From 49cf9a385ffe0df086a5d42096c76d8d7c09dd12 Mon Sep 17 00:00:00 2001 From: slava <75099655+SlavaKuntsov@users.noreply.github.com> Date: Thu, 22 Oct 2026 18:53:39 +0300 Subject: [PATCH] Revert "feat(frontend): redesign interface and add dark theme" --- docs/spec.md | 3 - frontend/package-lock.json | 11 -- frontend/package.json | 3 +- frontend/src/app/globals.css | 110 +----------- frontend/src/app/layout.tsx | 29 +-- frontend/src/app/login/page.tsx | 69 ++------ frontend/src/app/page.tsx | 98 +++------- frontend/src/app/register/page.tsx | 70 ++------ frontend/src/app/upload/page.tsx | 135 +++----------- frontend/src/app/watch/[id]/page.tsx | 206 ++++++++-------------- frontend/src/components/Header.tsx | 71 ++------ frontend/src/components/ScrollToTop.tsx | 37 ---- frontend/src/components/StatusBadge.tsx | 30 ---- frontend/src/components/ThemeProvider.tsx | 15 -- frontend/src/components/ThemeToggle.tsx | 54 ------ frontend/src/components/VideoCard.tsx | 91 ++++------ frontend/src/components/VideoPlayer.tsx | 73 ++++---- frontend/src/lib/format.ts | 15 -- frontend/tailwind.config.ts | 36 +--- 19 files changed, 233 insertions(+), 923 deletions(-) delete mode 100644 frontend/src/components/ScrollToTop.tsx delete mode 100644 frontend/src/components/StatusBadge.tsx delete mode 100644 frontend/src/components/ThemeProvider.tsx delete mode 100644 frontend/src/components/ThemeToggle.tsx delete mode 100644 frontend/src/lib/format.ts diff --git a/docs/spec.md b/docs/spec.md index baaf240..fcc55fa 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -175,9 +175,6 @@ Refer to `.env.example` for all variables. Key ones: - State management: Next Context or Zustand (no Redux unless necessary). - hls.js integration as per official docs. - Keep components small and reusable. -- Styling: Tailwind with **semantic tokens** defined in `src/app/globals.css` and wired in `tailwind.config.ts` (`bg-surface`, `text-content`, `border-line`, `accent`…). Don't hardcode raw palette colors in components — use token utilities so both themes stay consistent. -- Dark theme: `next-themes` (`attribute="class"` on ``), system preference by default, manual toggle in `src/components/ThemeToggle.tsx`. `color-scheme` flips per theme, so native controls follow. -- Shared UI primitives live in the component layer (`.surface`, `.btn`, `.input`, `.chip`, `.label`); reuse them instead of re-styling per page. --- diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 202243c..ce52067 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -10,7 +10,6 @@ "dependencies": { "hls.js": "^1.5.7", "next": "14.2.5", - "next-themes": "^0.4.6", "react": "18.3.1", "react-dom": "18.3.1", "zustand": "^4.5.2" @@ -4138,16 +4137,6 @@ } } }, - "node_modules/next-themes": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.4.6.tgz", - "integrity": "sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA==", - "license": "MIT", - "peerDependencies": { - "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" - } - }, "node_modules/next/node_modules/postcss": { "version": "8.4.31", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", diff --git a/frontend/package.json b/frontend/package.json index c296774..78f0254 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,11 +12,10 @@ "format:check": "prettier --check ." }, "dependencies": { - "hls.js": "^1.5.7", "next": "14.2.5", - "next-themes": "^0.4.6", "react": "18.3.1", "react-dom": "18.3.1", + "hls.js": "^1.5.7", "zustand": "^4.5.2" }, "devDependencies": { diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index 64403b6..a9a33d7 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -2,117 +2,9 @@ @tailwind components; @tailwind utilities; -/* --------------------------------------------------------------------------- - Design tokens — RGB channels so Tailwind opacity modifiers work. - Light is the default; `.dark` (set by next-themes on ) flips every - value, so a single class like `bg-surface` is correct in both themes. ---------------------------------------------------------------------------- */ :root { color-scheme: light; - - --bg: 247 247 248; - --surface: 255 255 255; - --surface-muted: 244 244 245; - --surface-hover: 244 244 245; - --fg: 24 24 27; - --fg-muted: 82 82 91; - --fg-subtle: 161 161 170; - --border: 228 228 231; - --accent: 239 68 68; - --accent-hover: 220 38 38; - --accent-text: 220 38 38; - --accent-soft: 254 226 226; - --accent-fg: 255 255 255; - - --shadow-surface: 0 0 0 1px rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.06), - 0 4px 12px -2px rgb(0 0 0 / 0.06); - --shadow-surface-hover: 0 0 0 1px rgb(0 0 0 / 0.07), 0 2px 4px -1px rgb(0 0 0 / 0.08), - 0 12px 28px -8px rgb(0 0 0 / 0.14); -} - -.dark { - color-scheme: dark; - - --bg: 9 9 11; - --surface: 24 24 27; - --surface-muted: 39 39 42; - --surface-hover: 45 45 50; - --fg: 244 244 245; - --fg-muted: 161 161 170; - --fg-subtle: 113 113 122; - --border: 42 42 46; - --accent: 239 68 68; - --accent-hover: 248 113 113; - --accent-text: 248 113 113; - --accent-soft: 69 26 28; - --accent-fg: 255 255 255; - - --shadow-surface: 0 0 0 1px rgb(255 255 255 / 0.06); - --shadow-surface-hover: 0 0 0 1px rgb(255 255 255 / 0.1), 0 12px 28px -8px rgb(0 0 0 / 0.6); -} - -@layer base { - h1, - h2, - h3 { - text-wrap: balance; - } - p { - text-wrap: pretty; - } - /* Nice focus default for anything not using a component class. */ - :focus-visible { - outline: 2px solid rgb(var(--accent) / 0.6); - outline-offset: 2px; - } } - -@layer components { - /* Elevated surface with a hairline ring baked into the shadow. */ - .surface { - @apply rounded-2xl bg-surface shadow-surface transition-shadow duration-200; - } - .surface-hover:hover { - @apply shadow-surface-hover; - } - - .label { - @apply mb-1.5 block text-sm font-medium text-content; - } - - .input { - @apply w-full rounded-lg border border-line bg-surface px-3 py-2 text-sm text-content - placeholder:text-content-subtle transition-colors - focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/25; - } - - .chip { - @apply inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-xs font-medium text-content-muted; - } - - /* One button base; variants set the colour. Press feedback is 0.96 (skill). */ - .btn { - @apply inline-flex select-none items-center justify-center gap-2 whitespace-nowrap rounded-lg px-3.5 py-2 - text-sm font-medium transition-[background-color,border-color,color,box-shadow,transform] - duration-150 ease-out active:scale-[0.96] - focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/45 - focus-visible:ring-offset-2 focus-visible:ring-offset-bg - disabled:pointer-events-none disabled:opacity-50; - } - .btn-primary { - @apply bg-accent text-accent-fg shadow-[0_1px_2px_rgb(0_0_0/0.15)] hover:bg-accent-hover; - } - .btn-secondary { - @apply bg-surface text-content shadow-surface hover:shadow-surface-hover; - } - .btn-ghost { - @apply text-content-muted hover:bg-surface-muted hover:text-content; - } - .btn-danger { - @apply bg-red-600 text-white hover:bg-red-700; - } -} - body { - @apply bg-bg text-content antialiased; + @apply bg-zinc-50 text-zinc-900 antialiased; } diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index 0a20712..8b27114 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -1,16 +1,7 @@ import Header from "@/components/Header"; -import ScrollToTop from "@/components/ScrollToTop"; -import ThemeProvider from "@/components/ThemeProvider"; import type { Metadata } from "next"; -import { Inter } from "next/font/google"; import "./globals.css"; -const inter = Inter({ - subsets: ["latin", "cyrillic"], - display: "swap", - variable: "--font-inter", -}); - export const metadata: Metadata = { title: "Flowix — Video Streaming", description: "Open-source adaptive HLS platform", @@ -18,19 +9,13 @@ export const metadata: Metadata = { export default function RootLayout({ children }: { children: React.ReactNode }) { return ( - - - - -
-
{children}
-
-
- Flowix — open-source adaptive HLS platform - gateway :8080 · nginx-vod :8081 -
-
- + + +
+
{children}
+
+ Flowix — open-source HLS • gateway :8080 +
); diff --git a/frontend/src/app/login/page.tsx b/frontend/src/app/login/page.tsx index 96b54a5..708d7a4 100644 --- a/frontend/src/app/login/page.tsx +++ b/frontend/src/app/login/page.tsx @@ -10,7 +10,6 @@ export default function LoginPage() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [localError, setLocalError] = useState(null); - const message = localError || error; const onSubmit = async (e: React.FormEvent) => { e.preventDefault(); @@ -24,61 +23,19 @@ export default function LoginPage() { }; return ( -
-
-

Welcome back

-

Sign in to upload and manage your videos.

- -
-
- - setEmail(e.target.value)} - placeholder="you@example.com" - type="email" - autoComplete="email" - required - className="input" - /> -
-
- - setPassword(e.target.value)} - placeholder="••••••••" - type="password" - autoComplete="current-password" - required - className="input" - /> -
- - {message && ( -
- {message} -
- )} - - -
- -

- No account?{" "} - - Register - -

-
+
+

Login

+
+ setEmail(e.target.value)} placeholder="Email" type="email" required className="w-full rounded border px-3 py-2 text-sm" /> + setPassword(e.target.value)} placeholder="Password" type="password" required className="w-full rounded border px-3 py-2 text-sm" /> + {(localError || error) &&
{localError || error}
} + +
+

+ No account? Register +

); } diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index c26ddab..f950fb4 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -1,99 +1,43 @@ "use client"; -import Link from "next/link"; import VideoCard from "@/components/VideoCard"; import { listVideos, type Video } from "@/lib/api"; -import { useCallback, useEffect, useState } from "react"; - -function SkeletonCard() { - return ( -
-
-
-
-
-
-
-
- ); -} - -function PlayGlyph({ className = "" }: { className?: string }) { - return ( - - - - ); -} +import { useEffect, useState } from "react"; export default function HomePage() { const [videos, setVideos] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); - const load = useCallback(() => { - setLoading(true); - setError(null); + useEffect(() => { listVideos(24, 0) .then((res) => setVideos(res.data)) .catch((e) => setError((e as Error).message)) .finally(() => setLoading(false)); }, []); - useEffect(() => { - load(); - }, [load]); + if (loading) return
Loading videos…
; + if (error) return
Failed to load: {error}
; - return ( -
-
-
-

Latest videos

-

- {loading ? "Loading the library…" : `${videos.length} video${videos.length === 1 ? "" : "s"} · adaptive HLS`} -

-
- + if (videos.length === 0) { + return ( +
+

No videos yet

+

Upload your first video to get started.

+ Upload video - +
+ ); + } - {loading ? ( -
- {Array.from({ length: 6 }).map((_, i) => ( - - ))} -
- ) : error ? ( -
-
- - - -
-

Couldn't load videos

-

{error}

- -
- ) : videos.length === 0 ? ( -
-
- -
-

No videos yet

-

Upload your first video to get started.

- - Upload video - -
- ) : ( -
- {videos.map((v) => ( - setVideos((prev) => prev.filter((x) => x.id !== id))} /> - ))} -
- )} + return ( +
+

Latest videos

+
+ {videos.map((v) => ( + setVideos((prev) => prev.filter((x) => x.id !== id))} /> + ))} +
); } diff --git a/frontend/src/app/register/page.tsx b/frontend/src/app/register/page.tsx index aceda08..a047763 100644 --- a/frontend/src/app/register/page.tsx +++ b/frontend/src/app/register/page.tsx @@ -10,7 +10,6 @@ export default function RegisterPage() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [localError, setLocalError] = useState(null); - const message = localError || error; const onSubmit = async (e: React.FormEvent) => { e.preventDefault(); @@ -24,62 +23,19 @@ export default function RegisterPage() { }; return ( -
-
-

Create account

-

Start uploading and streaming in a minute.

- -
-
- - setEmail(e.target.value)} - placeholder="you@example.com" - type="email" - autoComplete="email" - required - className="input" - /> -
-
- - setPassword(e.target.value)} - placeholder="At least 8 characters" - type="password" - autoComplete="new-password" - required - minLength={8} - className="input" - /> -
- - {message && ( -
- {message} -
- )} - - -
- -

- Have account?{" "} - - Login - -

-
+
+

Create account

+
+ setEmail(e.target.value)} placeholder="Email" type="email" required className="w-full rounded border px-3 py-2 text-sm" /> + setPassword(e.target.value)} placeholder="Password (min 8)" type="password" required minLength={8} className="w-full rounded border px-3 py-2 text-sm" /> + {(localError || error) &&
{localError || error}
} + +
+

+ Have account? Login +

); } diff --git a/frontend/src/app/upload/page.tsx b/frontend/src/app/upload/page.tsx index 4042007..7cca3b7 100644 --- a/frontend/src/app/upload/page.tsx +++ b/frontend/src/app/upload/page.tsx @@ -1,7 +1,6 @@ "use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; -import Link from "next/link"; import { uploadVideo } from "@/lib/api"; import { useAuth } from "@/store/auth"; @@ -15,7 +14,6 @@ export default function UploadPage() { const [uploading, setUploading] = useState(false); const [error, setError] = useState(null); const [doneId, setDoneId] = useState(null); - const [dragOver, setDragOver] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); @@ -46,128 +44,49 @@ export default function UploadPage() { }; return ( -
-
-

Upload video

-

- Uploaded directly to object storage, then transcoded to 360p / 720p / 1080p. -

-
+
+

Upload video

+

MP4 up to 5GB via presigned direct to MinIO. Stored as raw, then transcoded to 3 renditions.

{!email && ( -
- - - - - You are not logged in.{" "} - - Login - {" "} - to upload. - +
+ You are not logged in. Login to upload.
)} -
+
- Video file - -
- -
- + setTitle(e.target.value)} - placeholder="My video" - className="input" + type="file" + accept="video/*" + onChange={(e) => setFile(e.target.files?.[0] ?? null)} + className="mt-1 block w-full rounded border p-2 text-sm" /> + {file &&

{file.name} — {(file.size / 1_000_000).toFixed(1)} MB

}
-
- -