From 8669bf69ecf683eacbbdee055753e2b435f32466 Mon Sep 17 00:00:00 2001 From: oyi77 Date: Sun, 17 May 2026 05:33:27 +0700 Subject: [PATCH 1/7] feat(ui): add InfoTooltip and PresetSlider shared components --- src/shared/components/InfoTooltip.tsx | 34 ++++++++++++++ src/shared/components/PresetSlider.tsx | 64 ++++++++++++++++++++++++++ src/shared/components/index.tsx | 2 + 3 files changed, 100 insertions(+) create mode 100644 src/shared/components/InfoTooltip.tsx create mode 100644 src/shared/components/PresetSlider.tsx diff --git a/src/shared/components/InfoTooltip.tsx b/src/shared/components/InfoTooltip.tsx new file mode 100644 index 0000000000..9f62de5b16 --- /dev/null +++ b/src/shared/components/InfoTooltip.tsx @@ -0,0 +1,34 @@ +"use client"; + +import { cn } from "@/shared/utils/cn"; + +interface InfoTooltipProps { + text: string; + className?: string; +} + +export default function InfoTooltip({ text, className }: InfoTooltipProps) { + return ( + + + info + + + {text} + + + ); +} diff --git a/src/shared/components/PresetSlider.tsx b/src/shared/components/PresetSlider.tsx new file mode 100644 index 0000000000..17ffe35471 --- /dev/null +++ b/src/shared/components/PresetSlider.tsx @@ -0,0 +1,64 @@ +"use client"; + +import { cn } from "@/shared/utils/cn"; + +interface PresetSliderProps { + value: number; + onChange: (value: number) => void; + presets: { label: string; value: number }[]; + min?: number; + max?: number; + step?: number; + className?: string; +} + +export default function PresetSlider({ + value, + onChange, + presets, + min = 0, + max = 100, + step = 1, + className, +}: PresetSliderProps) { + return ( +
+
+ {presets.map((preset) => ( + + ))} +
+ onChange(Number(e.target.value))} + className={cn( + "w-full h-1.5 rounded-full appearance-none cursor-pointer", + "bg-black/10 dark:bg-white/10", + "accent-primary" + )} + /> +
+ {min} + {value} + {max} +
+
+ ); +} diff --git a/src/shared/components/index.tsx b/src/shared/components/index.tsx index 1039804883..e1a90df42a 100644 --- a/src/shared/components/index.tsx +++ b/src/shared/components/index.tsx @@ -33,6 +33,8 @@ export { default as NotificationToast } from "./NotificationToast"; export { default as FilterBar } from "./FilterBar"; export { default as ColumnToggle } from "./ColumnToggle"; export { default as DataTable } from "./DataTable"; +export { default as InfoTooltip } from "./InfoTooltip"; +export { default as PresetSlider } from "./PresetSlider"; // Layouts export * from "./layouts"; From 801f3c9c223e4a61a4187fecdb3da4135ba38f69 Mon Sep 17 00:00:00 2001 From: oyi77 Date: Sun, 17 May 2026 05:35:41 +0700 Subject: [PATCH 2/7] feat(ui): add simple/advanced mode switch to Caveman page Simple mode shows stats, language packs, and output mode only. Advanced mode reveals the full CompressionSettingsTab with all engine internals, thresholds, and tool strategies. --- .../caveman/CavemanContextPageClient.tsx | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/app/(dashboard)/dashboard/context/caveman/CavemanContextPageClient.tsx b/src/app/(dashboard)/dashboard/context/caveman/CavemanContextPageClient.tsx index e879548954..7847079b17 100644 --- a/src/app/(dashboard)/dashboard/context/caveman/CavemanContextPageClient.tsx +++ b/src/app/(dashboard)/dashboard/context/caveman/CavemanContextPageClient.tsx @@ -2,6 +2,7 @@ import { useEffect, useMemo, useState } from "react"; import { useTranslations } from "next-intl"; +import { SegmentedControl } from "@/shared/components"; import CompressionSettingsTab from "@/app/(dashboard)/dashboard/settings/components/CompressionSettingsTab"; type AnalyticsSummary = { @@ -44,6 +45,7 @@ export default function CavemanContextPageClient() { const [settings, setSettings] = useState(null); const [languagePacks, setLanguagePacks] = useState([]); const [saving, setSaving] = useState(false); + const [viewMode, setViewMode] = useState<"simple" | "advanced">("simple"); const refreshSettings = () => { fetch("/api/context/caveman/config") @@ -118,12 +120,22 @@ export default function CavemanContextPageClient() { return (
-
- compress -
-

{t("title")}

-

{t("description")}

+
+
+ compress +
+

{t("title")}

+

{t("description")}

+
+ setViewMode(v as "simple" | "advanced")} + options={[ + { value: "simple", label: t("simpleMode") || "Simple" }, + { value: "advanced", label: t("advancedMode") || "Advanced" }, + ]} + />
@@ -256,7 +268,7 @@ export default function CavemanContextPageClient() {
- + {viewMode === "advanced" && } ); } From 3757e6dc3002c2067c38f18f2c1d6889029ad880 Mon Sep 17 00:00:00 2001 From: oyi77 Date: Sun, 17 May 2026 05:38:04 +0700 Subject: [PATCH 3/7] feat(ui): add simple/advanced mode switch to RTK page Simple mode shows stats, config, and collapsible filter catalog. Advanced mode adds filter testing with raw JSON preview. --- .../context/rtk/RtkContextPageClient.tsx | 162 ++++++++++-------- 1 file changed, 93 insertions(+), 69 deletions(-) diff --git a/src/app/(dashboard)/dashboard/context/rtk/RtkContextPageClient.tsx b/src/app/(dashboard)/dashboard/context/rtk/RtkContextPageClient.tsx index e42b098115..8ae6106560 100644 --- a/src/app/(dashboard)/dashboard/context/rtk/RtkContextPageClient.tsx +++ b/src/app/(dashboard)/dashboard/context/rtk/RtkContextPageClient.tsx @@ -2,6 +2,7 @@ import { useEffect, useMemo, useState } from "react"; import { useTranslations } from "next-intl"; +import { SegmentedControl, Collapsible } from "@/shared/components"; type RtkFilter = { id: string; @@ -66,6 +67,7 @@ export default function RtkContextPageClient() { const [sample, setSample] = useState(SAMPLE_OUTPUT); const [preview, setPreview] = useState(null); const [saving, setSaving] = useState(false); + const [viewMode, setViewMode] = useState<"simple" | "advanced">("simple"); useEffect(() => { fetch("/api/context/rtk/filters") @@ -140,12 +142,22 @@ export default function RtkContextPageClient() { return (
-
- filter_alt -
-

{t("title")}

-

{t("description")}

+
+
+ filter_alt +
+

{t("title")}

+

{t("description")}

+
+ setViewMode(v as "simple" | "advanced")} + options={[ + { value: "simple", label: t("simpleMode") || "Simple" }, + { value: "advanced", label: t("advancedMode") || "Advanced" }, + ]} + />
@@ -278,72 +290,84 @@ export default function RtkContextPageClient() { )} -
-
-
-

{t("filterTesting")}

- -
-