mirror of
https://github.com/hex248/sprint.git
synced 2026-02-09 02:33:02 +00:00
moved ThemeToggle to account settings
This commit is contained in:
@@ -12,6 +12,8 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@
|
|||||||
import { UploadAvatar } from "@/components/upload-avatar";
|
import { UploadAvatar } from "@/components/upload-avatar";
|
||||||
import { useUpdateUser } from "@/lib/query/hooks";
|
import { useUpdateUser } from "@/lib/query/hooks";
|
||||||
import { parseError } from "@/lib/server";
|
import { parseError } from "@/lib/server";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
import ThemeToggle from "./theme-toggle";
|
||||||
|
|
||||||
function AccountDialog({ trigger }: { trigger?: ReactNode }) {
|
function AccountDialog({ trigger }: { trigger?: ReactNode }) {
|
||||||
const { user: currentUser, setUser } = useAuthenticatedSession();
|
const { user: currentUser, setUser } = useAuthenticatedSession();
|
||||||
@@ -82,7 +84,7 @@ function AccountDialog({ trigger }: { trigger?: ReactNode }) {
|
|||||||
)}
|
)}
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
|
|
||||||
<DialogContent className="sm:max-w-sm">
|
<DialogContent className={cn("sm:max-w-sm", error !== "" && "border border-destructive")}>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Account</DialogTitle>
|
<DialogTitle>Account</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -122,7 +124,12 @@ function AccountDialog({ trigger }: { trigger?: ReactNode }) {
|
|||||||
/>
|
/>
|
||||||
<Label className="text-lg -mt-2">Preferences</Label>
|
<Label className="text-lg -mt-2">Preferences</Label>
|
||||||
|
|
||||||
<div className="flex flex-col gap-1 w-min">
|
<div className="flex gap-8 justify w-full">
|
||||||
|
<div className="flex flex-col items-start gap-1">
|
||||||
|
<Label className="text-sm">Light/Dark Mode</Label>
|
||||||
|
<ThemeToggle withText />
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col items-start gap-1">
|
||||||
<Label className="text-sm">Icon Style</Label>
|
<Label className="text-sm">Icon Style</Label>
|
||||||
<Select
|
<Select
|
||||||
value={iconPreference}
|
value={iconPreference}
|
||||||
@@ -153,10 +160,11 @@ function AccountDialog({ trigger }: { trigger?: ReactNode }) {
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{error !== "" && <Label className="text-destructive text-sm">{error}</Label>}
|
{error !== "" && <Label className="text-destructive text-sm">{error}</Label>}
|
||||||
|
|
||||||
<div className="flex justify-end">
|
<div className="flex justify-end mt-4">
|
||||||
<Button variant={"outline"} type={"submit"} className="px-12">
|
<Button variant={"outline"} type={"submit"} className="px-12">
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Icon from "@/components/ui/icon";
|
|||||||
import { IconButton } from "@/components/ui/icon-button";
|
import { IconButton } from "@/components/ui/icon-button";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
function ThemeToggle({ className }: { className?: string }) {
|
function ThemeToggle({ withText, className }: { withText?: boolean; className?: string }) {
|
||||||
const { theme, setTheme } = useTheme();
|
const { theme, setTheme } = useTheme();
|
||||||
const resolvedTheme =
|
const resolvedTheme =
|
||||||
theme === "system"
|
theme === "system"
|
||||||
@@ -14,6 +14,7 @@ function ThemeToggle({ className }: { className?: string }) {
|
|||||||
const isDark = resolvedTheme === "dark";
|
const isDark = resolvedTheme === "dark";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<div className={cn("flex items-center gap-2", className)}>
|
||||||
<IconButton
|
<IconButton
|
||||||
size="md"
|
size="md"
|
||||||
className={cn("hover:text-muted-foreground", className)}
|
className={cn("hover:text-muted-foreground", className)}
|
||||||
@@ -22,6 +23,8 @@ function ThemeToggle({ className }: { className?: string }) {
|
|||||||
>
|
>
|
||||||
{isDark ? <Icon icon="sun" className="size-5" /> : <Icon icon="moon" className="size-5" />}
|
{isDark ? <Icon icon="sun" className="size-5" /> : <Icon icon="moon" className="size-5" />}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
{withText && (isDark ? "Dark Mode" : "Light Mode")}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import { useSelection } from "@/components/selection-provider";
|
|||||||
import { ServerConfigurationDialog } from "@/components/server-configuration-dialog";
|
import { ServerConfigurationDialog } from "@/components/server-configuration-dialog";
|
||||||
import { useAuthenticatedSession } from "@/components/session-provider";
|
import { useAuthenticatedSession } from "@/components/session-provider";
|
||||||
import SmallUserDisplay from "@/components/small-user-display";
|
import SmallUserDisplay from "@/components/small-user-display";
|
||||||
import ThemeToggle from "@/components/theme-toggle";
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
@@ -217,7 +216,6 @@ export default function App() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={`flex gap-${BREATHING_ROOM} items-center`}>
|
<div className={`flex gap-${BREATHING_ROOM} items-center`}>
|
||||||
<ThemeToggle />
|
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger className="text-sm">
|
<DropdownMenuTrigger className="text-sm">
|
||||||
<SmallUserDisplay user={user} />
|
<SmallUserDisplay user={user} />
|
||||||
|
|||||||
Reference in New Issue
Block a user