From a707424fa2f1da65af3e66b0851c8b790841a45d Mon Sep 17 00:00:00 2001 From: shadcn Date: Mon, 20 Oct 2025 20:39:01 +0400 Subject: [PATCH] fix: front page blocks --- .../(root)/components/appearance-settings.tsx | 80 ++++++------------- apps/v4/app/(app)/(root)/components/index.tsx | 2 +- .../(app)/(root)/components/spinner-badge.tsx | 2 +- apps/v4/components/theme-customizer.tsx | 5 +- apps/v4/components/theme-selector.tsx | 8 +- apps/v4/lib/themes.ts | 36 ++------- 6 files changed, 35 insertions(+), 98 deletions(-) diff --git a/apps/v4/app/(app)/(root)/components/appearance-settings.tsx b/apps/v4/app/(app)/(root)/components/appearance-settings.tsx index 6a54f1c3ca..ea0df5091a 100644 --- a/apps/v4/app/(app)/(root)/components/appearance-settings.tsx +++ b/apps/v4/app/(app)/(root)/components/appearance-settings.tsx @@ -1,9 +1,8 @@ "use client" +import * as React from "react" import { IconMinus, IconPlus } from "@tabler/icons-react" -import { CheckIcon } from "lucide-react" -import { useThemeConfig } from "@/components/active-theme" import { Button } from "@/registry/new-york-v4/ui/button" import { ButtonGroup } from "@/registry/new-york-v4/ui/button-group" import { @@ -18,34 +17,31 @@ import { FieldTitle, } from "@/registry/new-york-v4/ui/field" import { Input } from "@/registry/new-york-v4/ui/input" -import { Label } from "@/registry/new-york-v4/ui/label" import { RadioGroup, RadioGroupItem, } from "@/registry/new-york-v4/ui/radio-group" import { Switch } from "@/registry/new-york-v4/ui/switch" -const accents = [ - { - name: "Blue", - value: "blue", - }, - { - name: "Amber", - value: "amber", - }, - { - name: "Green", - value: "green", - }, - { - name: "Rose", - value: "rose", - }, -] - export function AppearanceSettings() { - const { activeTheme, setActiveTheme } = useThemeConfig() + const [gpuCount, setGpuCount] = React.useState(8) + + const handleGpuAdjustment = React.useCallback((adjustment: number) => { + setGpuCount((prevCount) => + Math.max(1, Math.min(99, prevCount + adjustment)) + ) + }, []) + + const handleGpuInputChange = React.useCallback( + (e: React.ChangeEvent) => { + const value = parseInt(e.target.value, 10) + if (!isNaN(value) && value >= 1 && value <= 99) { + setGpuCount(value) + } + }, + [] + ) + return (
@@ -90,37 +86,6 @@ export function AppearanceSettings() {
- - - Accent - Select the accent color. - -
- - {accents.map((accent) => ( - - ))} - -
-
- Number of GPUs @@ -129,7 +94,8 @@ export function AppearanceSettings() { handleGpuAdjustment(-1)} + disabled={gpuCount <= 1} > @@ -147,6 +115,8 @@ export function AppearanceSettings() { size="icon-sm" type="button" aria-label="Increment" + onClick={() => handleGpuAdjustment(1)} + disabled={gpuCount >= 99} > diff --git a/apps/v4/app/(app)/(root)/components/index.tsx b/apps/v4/app/(app)/(root)/components/index.tsx index 9485c4d590..6439367be6 100644 --- a/apps/v4/app/(app)/(root)/components/index.tsx +++ b/apps/v4/app/(app)/(root)/components/index.tsx @@ -33,7 +33,7 @@ export function RootComponents() {
- Appearance Settings + Appearance Settings
diff --git a/apps/v4/app/(app)/(root)/components/spinner-badge.tsx b/apps/v4/app/(app)/(root)/components/spinner-badge.tsx index 8ba5773864..b6116547b9 100644 --- a/apps/v4/app/(app)/(root)/components/spinner-badge.tsx +++ b/apps/v4/app/(app)/(root)/components/spinner-badge.tsx @@ -3,7 +3,7 @@ import { Spinner } from "@/registry/new-york-v4/ui/spinner" export function SpinnerBadge() { return ( -
+
Syncing diff --git a/apps/v4/components/theme-customizer.tsx b/apps/v4/components/theme-customizer.tsx index ed3cdaee25..574a441fee 100644 --- a/apps/v4/components/theme-customizer.tsx +++ b/apps/v4/components/theme-customizer.tsx @@ -4,6 +4,7 @@ import * as React from "react" import template from "lodash/template" import { CheckIcon, ClipboardIcon } from "lucide-react" +import { THEMES } from "@/lib/themes" import { cn } from "@/lib/utils" import { useThemeConfig } from "@/components/active-theme" import { copyToClipboardWithMeta } from "@/components/copy-button" @@ -52,10 +53,6 @@ interface BaseColorOKLCH { dark: Record } -const THEMES = baseColors.filter( - (theme) => !["slate", "stone", "gray", "zinc"].includes(theme.name) -) - export function ThemeCustomizer({ className }: React.ComponentProps<"div">) { const { activeTheme = "neutral", setActiveTheme } = useThemeConfig() diff --git a/apps/v4/components/theme-selector.tsx b/apps/v4/components/theme-selector.tsx index 9bfdb083eb..79b030a43e 100644 --- a/apps/v4/components/theme-selector.tsx +++ b/apps/v4/components/theme-selector.tsx @@ -1,5 +1,6 @@ "use client" +import { THEMES } from "@/lib/themes" import { cn } from "@/lib/utils" import { useThemeConfig } from "@/components/active-theme" import { Label } from "@/registry/new-york-v4/ui/label" @@ -10,14 +11,9 @@ import { SelectTrigger, SelectValue, } from "@/registry/new-york-v4/ui/select" -import { baseColors } from "@/registry/registry-base-colors" import { CopyCodeButton } from "./theme-customizer" -const COLOR_THEMES = baseColors.filter( - (theme) => !["slate", "stone", "gray", "zinc"].includes(theme.name) -) - export function ThemeSelector({ className }: React.ComponentProps<"div">) { const { activeTheme, setActiveTheme } = useThemeConfig() @@ -36,7 +32,7 @@ export function ThemeSelector({ className }: React.ComponentProps<"div">) { - {COLOR_THEMES.map((theme) => ( + {THEMES.map((theme) => ( !["slate", "stone", "gray", "zinc"].includes(theme.name) +)