From 40f698acb747e1a3c9b91da2a6b211955e4f05ff Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Mon, 16 Mar 2026 01:40:28 +0100 Subject: [PATCH] refactor: clean up styles and improve layout in dashboard and edit channel components - Removed unnecessary class names for buttons in ChannelCard and DashboardPage components. - Updated layout styles in RootLayout to apply dark mode by default. - Refactored edit-channel-sheet to streamline block editor and filter editor components. - Adjusted duration input fields to reflect minutes instead of seconds in AlgorithmicFilterEditor. - Enhanced the structure of the EditChannelSheet for better readability and maintainability. --- .../dashboard/components/channel-card.tsx | 2 - .../components/edit-channel-sheet.tsx | 919 +++++++++--------- k-tv-frontend/app/(main)/dashboard/page.tsx | 13 +- k-tv-frontend/app/layout.tsx | 2 +- 4 files changed, 465 insertions(+), 471 deletions(-) diff --git a/k-tv-frontend/app/(main)/dashboard/components/channel-card.tsx b/k-tv-frontend/app/(main)/dashboard/components/channel-card.tsx index a550a26..1b99564 100644 --- a/k-tv-frontend/app/(main)/dashboard/components/channel-card.tsx +++ b/k-tv-frontend/app/(main)/dashboard/components/channel-card.tsx @@ -168,7 +168,6 @@ export function ChannelCard({ size="icon-sm" onClick={onViewSchedule} title="View schedule" - className="border-zinc-700 text-zinc-400 hover:text-zinc-100" > @@ -176,7 +175,6 @@ export function ChannelCard({ size="icon-sm" asChild title="Watch on TV" - className="border-zinc-700 text-zinc-400 hover:text-zinc-100" > diff --git a/k-tv-frontend/app/(main)/dashboard/components/edit-channel-sheet.tsx b/k-tv-frontend/app/(main)/dashboard/components/edit-channel-sheet.tsx index 3ff0ab7..85d6083 100644 --- a/k-tv-frontend/app/(main)/dashboard/components/edit-channel-sheet.tsx +++ b/k-tv-frontend/app/(main)/dashboard/components/edit-channel-sheet.tsx @@ -2,11 +2,11 @@ import { useState, useEffect, useRef } from "react"; import { z } from "zod"; -import { Trash2, Plus, ChevronDown, ChevronUp } from "lucide-react"; +import { Trash2, Plus } from "lucide-react"; import { Sheet, SheetContent, SheetHeader, SheetTitle } from "@/components/ui/sheet"; import { Button } from "@/components/ui/button"; import { TagInput } from "./tag-input"; -import { BlockTimeline, BLOCK_COLORS, timeToMins, minsToTime } from "./block-timeline"; +import { BlockTimeline, BLOCK_COLORS, minsToTime } from "./block-timeline"; import { SeriesPicker } from "./series-picker"; import { FilterPreview } from "./filter-preview"; import { useCollections, useSeries, useGenres } from "@/hooks/use-library"; @@ -447,23 +447,23 @@ function AlgorithmicFilterEditor({ error={!!errors[`${pfx}.content.filter.decade`]} /> - + - setFilter({ min_duration_secs: v === "" ? null : (v as number) }) + setFilter({ min_duration_secs: v === "" ? null : (v as number) * 60 }) } - placeholder="1200" + placeholder="30" error={!!errors[`${pfx}.content.filter.min_duration_secs`]} /> - + - setFilter({ max_duration_secs: v === "" ? null : (v as number) }) + setFilter({ max_duration_secs: v === "" ? null : (v as number) * 60 }) } - placeholder="3600" + placeholder="120" error={!!errors[`${pfx}.content.filter.max_duration_secs`]} /> @@ -482,27 +482,12 @@ function AlgorithmicFilterEditor({ interface BlockEditorProps { block: ProgrammingBlock; index: number; - isSelected: boolean; - color: string; errors: FieldErrors; onChange: (block: ProgrammingBlock) => void; - onRemove: () => void; - onSelect: () => void; providers: ProviderInfo[]; } -function BlockEditor({ block, index, isSelected, color, errors, onChange, onRemove, onSelect, providers }: BlockEditorProps) { - const [expanded, setExpanded] = useState(isSelected); - const elRef = useRef(null); - - // Scroll into view when selected - useEffect(() => { - if (isSelected) { - setExpanded(true); - elRef.current?.scrollIntoView({ behavior: "smooth", block: "nearest" }); - } - }, [isSelected]); - +function BlockEditor({ block, index, errors, onChange, providers }: BlockEditorProps) { const setField = (key: K, value: ProgrammingBlock[K]) => onChange({ ...block, [key]: value }); @@ -535,169 +520,136 @@ function BlockEditor({ block, index, isSelected, color, errors, onChange, onRemo }; return ( -
-
-
- - +
+
+ + setField("name", v)} + placeholder="Evening Sitcoms" + error={!!errors[`${pfx}.name`]} + /> + + + setContentType(v as "algorithmic" | "manual")} + > + + + +
- {expanded && ( -
-
- - setField("name", v)} - placeholder="Evening Sitcoms" - error={!!errors[`${pfx}.name`]} - /> - - - setContentType(v as "algorithmic" | "manual")} - > - - - - -
+
+ + setField("start_time", e.target.value + ":00")} + className="w-full rounded-md border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-100 focus:border-zinc-500 focus:outline-none" + /> + + + setField("duration_mins", v === "" ? 60 : v)} + min={1} + error={!!errors[`${pfx}.duration_mins`]} + /> + +
-
- - setField("start_time", e.target.value + ":00")} - className="w-full rounded-md border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-100 focus:border-zinc-500 focus:outline-none" - /> - - - setField("duration_mins", v === "" ? 60 : v)} - min={1} - error={!!errors[`${pfx}.duration_mins`]} - /> - -
+ {content.type === "algorithmic" && ( + <> + - {content.type === "algorithmic" && ( - <> - - - {content.strategy === "sequential" && ( -
-

- Sequential options -

- - -
- )} - - )} - - {content.type === "manual" && ( + {content.strategy === "sequential" && (
-

Item IDs

-