Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

Settings page with appearance settings

Khuram Niazab954389d547
diff --git a/src/app/dashboard/settings/page.tsx b/src/app/dashboard/settings/page.tsx
index 6d44287..6e30f36 100644
--- a/src/app/dashboard/settings/page.tsx
+++ b/src/app/dashboard/settings/page.tsx
@@ -1,7 +1,23 @@
+import DisplaySettings from "@/components/DisplaySettings";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import React from "react";
function Settings() {
- return <div>Settings Page</div>;
+ return (
+ <div className="flex flex-col col-span-3">
+ <h3 className="text-2xl font-semibold leading-none tracking-tight mb-4">
+ Settings
+ </h3>
+ <Tabs defaultValue="display">
+ <TabsList>
+ <TabsTrigger value="display">Display</TabsTrigger>
+ </TabsList>
+ <TabsContent value="display">
+ <DisplaySettings />
+ </TabsContent>
+ </Tabs>
+ </div>
+ );
}
export default Settings;
diff --git a/src/components/AddCompany.tsx b/src/components/AddCompany.tsx
index 0d5649d..78847e0 100644
--- a/src/components/AddCompany.tsx
+++ b/src/components/AddCompany.tsx
@@ -18,7 +18,6 @@ import { zodResolver } from "@hookform/resolvers/zod";
import {
Form,
FormControl,
- FormDescription,
FormField,
FormItem,
FormLabel,
diff --git a/src/components/DisplaySettings.tsx b/src/components/DisplaySettings.tsx
new file mode 100644
index 0000000..930b8d6
--- /dev/null
+++ b/src/components/DisplaySettings.tsx
@@ -0,0 +1,175 @@
+"use client";
+import { z } from "zod";
+import { Card, CardContent, CardHeader, CardTitle } from "./ui/card";
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "./ui/form";
+import { RadioGroup, RadioGroupItem } from "./ui/radio-group";
+import { useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { toast } from "./ui/use-toast";
+import { Button } from "./ui/button";
+import { useTheme } from "next-themes";
+
+const appearanceFormSchema = z.object({
+ theme: z.enum(["light", "dark", "system"], {
+ required_error: "Please select a theme.",
+ }),
+});
+
+type AppearanceFormValues = z.infer<typeof appearanceFormSchema>;
+
+// This can come from your database or API.
+const defaultValues: Partial<AppearanceFormValues> = {
+ theme: "system",
+};
+
+function DisplaySettings() {
+ const { setTheme, systemTheme } = useTheme();
+ const form = useForm<AppearanceFormValues>({
+ resolver: zodResolver(appearanceFormSchema),
+ defaultValues,
+ });
+
+ function onSubmit(data: AppearanceFormValues) {
+ setTheme(data.theme);
+ toast({
+ variant: "success",
+ title: `Your selected theme has been saved.`,
+ });
+ }
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>Appearance</CardTitle>
+ <CardContent>
+ <div className="mt-4">
+ <Form {...form}>
+ <form
+ onSubmit={form.handleSubmit(onSubmit)}
+ className="space-y-8"
+ >
+ <FormField
+ control={form.control}
+ name="theme"
+ render={({ field }) => (
+ <FormItem className="space-y-1">
+ <FormLabel>Theme</FormLabel>
+ <FormDescription>
+ Select the theme for the app.
+ </FormDescription>
+ <FormMessage />
+ <RadioGroup
+ onValueChange={field.onChange}
+ defaultValue={field.value}
+ className="grid max-w-lg md:grid-cols-3 gap-8 pt-2"
+ >
+ <FormItem>
+ <FormLabel className="[&:has([data-state=checked])>div]:border-primary">
+ <FormControl>
+ <RadioGroupItem
+ value="light"
+ className="sr-only"
+ />
+ </FormControl>
+ <LightThemeElement />
+ <span className="block w-full p-2 text-center font-normal">
+ Light
+ </span>
+ </FormLabel>
+ </FormItem>
+ <FormItem>
+ <FormLabel className="[&:has([data-state=checked])>div]:border-primary">
+ <FormControl>
+ <RadioGroupItem
+ value="dark"
+ className="sr-only"
+ />
+ </FormControl>
+ <DarkThemeElement />
+ <span className="block w-full p-2 text-center font-normal">
+ Dark
+ </span>
+ </FormLabel>
+ </FormItem>
+ <FormItem>
+ <FormLabel className="[&:has([data-state=checked])>div]:border-primary">
+ <FormControl>
+ <RadioGroupItem
+ value="system"
+ className="sr-only"
+ />
+ </FormControl>
+ {systemTheme === "dark" ? (
+ <DarkThemeElement />
+ ) : (
+ <LightThemeElement />
+ )}
+ <span className="block w-full p-2 text-center font-normal">
+ System
+ </span>
+ </FormLabel>
+ </FormItem>
+ </RadioGroup>
+ </FormItem>
+ )}
+ />
+
+ <Button type="submit">Update preferences</Button>
+ </form>
+ </Form>
+ </div>
+ </CardContent>
+ </CardHeader>
+ </Card>
+ );
+}
+
+export default DisplaySettings;
+
+function LightThemeElement() {
+ return (
+ <div className="cursor-pointer items-center rounded-md border-2 border-muted p-1 hover:border-accent">
+ <div className="space-y-2 rounded-sm bg-[#ecedef] p-2">
+ <div className="space-y-2 rounded-md bg-white p-2 shadow-sm">
+ <div className="h-2 w-[80px] rounded-lg bg-[#ecedef]" />
+ <div className="h-2 w-[100px] rounded-lg bg-[#ecedef]" />
+ </div>
+ <div className="flex items-center space-x-2 rounded-md bg-white p-2 shadow-sm">
+ <div className="h-4 w-4 rounded-full bg-[#ecedef]" />
+ <div className="h-2 w-[100px] rounded-lg bg-[#ecedef]" />
+ </div>
+ <div className="flex items-center space-x-2 rounded-md bg-white p-2 shadow-sm">
+ <div className="h-4 w-4 rounded-full bg-[#ecedef]" />
+ <div className="h-2 w-[100px] rounded-lg bg-[#ecedef]" />
+ </div>
+ </div>
+ </div>
+ );
+}
+function DarkThemeElement() {
+ return (
+ <div className="cursor-pointer items-center rounded-md border-2 border-muted bg-popover p-1 hover:bg-accent hover:text-accent-foreground">
+ <div className="space-y-2 rounded-sm bg-slate-950 p-2">
+ <div className="space-y-2 rounded-md bg-slate-800 p-2 shadow-sm">
+ <div className="h-2 w-[80px] rounded-lg bg-slate-400" />
+ <div className="h-2 w-[100px] rounded-lg bg-slate-400" />
+ </div>
+ <div className="flex items-center space-x-2 rounded-md bg-slate-800 p-2 shadow-sm">
+ <div className="h-4 w-4 rounded-full bg-slate-400" />
+ <div className="h-2 w-[100px] rounded-lg bg-slate-400" />
+ </div>
+ <div className="flex items-center space-x-2 rounded-md bg-slate-800 p-2 shadow-sm">
+ <div className="h-4 w-4 rounded-full bg-slate-400" />
+ <div className="h-2 w-[100px] rounded-lg bg-slate-400" />
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 61554c4..294709e 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -1,6 +1,12 @@
import Link from "next/link";
-import { PanelLeft, Briefcase, Search, PowerIcon } from "lucide-react";
-import { Input } from "./ui/input";
+import {
+ PanelLeft,
+ Briefcase,
+ Search,
+ PowerIcon,
+ Settings,
+ Info,
+} from "lucide-react";
import { Button } from "./ui/button";
import {
@@ -22,6 +28,7 @@ import { SIDEBAR_LINKS } from "@/lib/constants";
import { signOut } from "@/auth";
import UserAvatar from "./UserAvatar";
import { getCurrentUser } from "@/utils/user.utils";
+import { redirect } from "next/navigation";
async function Header() {
// const session = await auth();
@@ -64,13 +71,13 @@ async function Header() {
</Sheet>
<h1 className="font-semibold">JobSync - Job Search Assistant</h1>
<div className="relative ml-auto flex-1 md:grow-0">
- <Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
+ {/* <Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
<Input
id="search"
type="search"
placeholder="Search..."
className="w-full rounded-lg bg-background pl-8 md:w-[200px] lg:w-[336px]"
- />
+ /> */}
</div>
<DropdownMenu>
@@ -80,8 +87,14 @@ async function Header() {
<DropdownMenuContent align="end">
<DropdownMenuLabel>My Account</DropdownMenuLabel>
<DropdownMenuSeparator />
- <DropdownMenuItem>Settings</DropdownMenuItem>
- <DropdownMenuItem>Support</DropdownMenuItem>
+ <DropdownMenuItem>
+ <Settings className="w-5 mr-2" />
+ <Link href="/dashboard/settings">Settings</Link>
+ </DropdownMenuItem>
+ <DropdownMenuItem>
+ <Info className="w-5 mr-2" />
+ Support
+ </DropdownMenuItem>
<DropdownMenuSeparator />
<form
action={async () => {
@@ -98,7 +111,7 @@ async function Header() {
</form>
</DropdownMenuContent>
</DropdownMenu>
- <ModeToggle />
+ {/* <ModeToggle /> */}
</header>
);
}