mirror of
https://github.com/hex248/sprint.git
synced 2026-02-07 18:23:03 +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 { useUpdateUser } from "@/lib/query/hooks";
|
||||
import { parseError } from "@/lib/server";
|
||||
import { cn } from "@/lib/utils";
|
||||
import ThemeToggle from "./theme-toggle";
|
||||
|
||||
function AccountDialog({ trigger }: { trigger?: ReactNode }) {
|
||||
const { user: currentUser, setUser } = useAuthenticatedSession();
|
||||
@@ -82,7 +84,7 @@ function AccountDialog({ trigger }: { trigger?: ReactNode }) {
|
||||
)}
|
||||
</DialogTrigger>
|
||||
|
||||
<DialogContent className="sm:max-w-sm">
|
||||
<DialogContent className={cn("sm:max-w-sm", error !== "" && "border border-destructive")}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Account</DialogTitle>
|
||||
</DialogHeader>
|
||||
@@ -122,7 +124,12 @@ function AccountDialog({ trigger }: { trigger?: ReactNode }) {
|
||||
/>
|
||||
<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>
|
||||
<Select
|
||||
value={iconPreference}
|
||||
@@ -153,10 +160,11 @@ function AccountDialog({ trigger }: { trigger?: ReactNode }) {
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{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">
|
||||
Save
|
||||
</Button>
|
||||
|
||||
@@ -3,7 +3,7 @@ import Icon from "@/components/ui/icon";
|
||||
import { IconButton } from "@/components/ui/icon-button";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function ThemeToggle({ className }: { className?: string }) {
|
||||
function ThemeToggle({ withText, className }: { withText?: boolean; className?: string }) {
|
||||
const { theme, setTheme } = useTheme();
|
||||
const resolvedTheme =
|
||||
theme === "system"
|
||||
@@ -14,6 +14,7 @@ function ThemeToggle({ className }: { className?: string }) {
|
||||
const isDark = resolvedTheme === "dark";
|
||||
|
||||
return (
|
||||
<div className={cn("flex items-center gap-2", className)}>
|
||||
<IconButton
|
||||
size="md"
|
||||
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" />}
|
||||
</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 { useAuthenticatedSession } from "@/components/session-provider";
|
||||
import SmallUserDisplay from "@/components/small-user-display";
|
||||
import ThemeToggle from "@/components/theme-toggle";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
@@ -217,7 +216,6 @@ export default function App() {
|
||||
)}
|
||||
</div>
|
||||
<div className={`flex gap-${BREATHING_ROOM} items-center`}>
|
||||
<ThemeToggle />
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger className="text-sm">
|
||||
<SmallUserDisplay user={user} />
|
||||
|
||||
Reference in New Issue
Block a user