Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

feat: update `/settings` for early access (#892)

Eric Lee9ee244749a73
diff --git a/apps/web/src/app/[locale]/[username]/_components/dashboard/index.tsx b/apps/web/src/app/[locale]/[username]/_components/dashboard/index.tsx
index b436c8c5..2b569345 100644
--- a/apps/web/src/app/[locale]/[username]/_components/dashboard/index.tsx
+++ b/apps/web/src/app/[locale]/[username]/_components/dashboard/index.tsx
@@ -44,7 +44,7 @@ export async function Dashboard({ user }: Props) {
return (
<div className="container">
- {/* // TODO: GFI: make each page a subroute, put settings into this same layout */}
+ {/* // TODO: GFI: make each page a subroute, put settings & profile into same layout */}
<Tabs className="flex flex-col gap-8 py-8 md:flex-row" defaultValue="overview">
<VerticalTabsList>
<div className="flex flex-col items-center gap-10 md:items-start">
diff --git a/apps/web/src/app/[locale]/settings/_components/appearance.tsx b/apps/web/src/app/[locale]/settings/_components/appearance.tsx
deleted file mode 100644
index 31f5c233..00000000
--- a/apps/web/src/app/[locale]/settings/_components/appearance.tsx
+++ /dev/null
@@ -1,134 +0,0 @@
-'use client';
-
-import { zodResolver } from '@hookform/resolvers/zod';
-import { Button } from '@repo/ui/components/button';
-import {
- Form,
- FormControl,
- FormDescription,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
-} from '@repo/ui/components/form';
-import { RadioGroup, RadioGroupItem } from '@repo/ui/components/radio-group';
-import { Separator } from '@repo/ui/components/separator';
-import { useToast } from '@repo/ui/components/use-toast';
-import { useForm } from 'react-hook-form';
-import { appearanceFormSchema } from './schema';
-import type { z } from 'zod';
-
-export function Appearances() {
- return (
- <div className="max-w-lg space-y-6 p-8">
- <div className="mb-4">
- <h3 className="text-lg font-medium">Appearances</h3>
- <p className="text-muted-foreground mb-4 text-sm">
- Configure how you receive notifications.
- </p>
- <Separator />
- </div>
- <AppearanceForm />
- </div>
- );
-}
-
-type AppearanceFormValues = z.infer<typeof appearanceFormSchema>;
-
-// This can come from your database or API.
-const defaultValues: Partial<AppearanceFormValues> = {
- theme: 'light',
-};
-
-export function AppearanceForm() {
- const { toast } = useToast();
- const form = useForm<AppearanceFormValues>({
- resolver: zodResolver(appearanceFormSchema),
- defaultValues,
- });
-
- function onSubmit(data: AppearanceFormValues) {
- toast({
- title: 'You submitted the following values:',
- description: (
- <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
- <code className="text-white">{JSON.stringify(data, null, 2)}</code>
- </pre>
- ),
- });
- }
-
- return (
- <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 dashboard.</FormDescription>
- <FormMessage />
- <RadioGroup
- onValueChange={(e: 'dark' | 'light') => field.onChange(e)}
- defaultValue={field.value}
- className="grid max-w-md grid-cols-2 gap-8 pt-2"
- >
- <FormItem>
- <FormLabel className="[&:has([data-state=checked])>div]:border-primary">
- <FormControl>
- <RadioGroupItem value="light" className="sr-only" />
- </FormControl>
- <div className="border-muted hover:border-accent items-center rounded-md border-2 p-1">
- <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>
- <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>
- <div className="border-muted bg-popover hover:bg-accent hover:text-accent-foreground items-center rounded-md border-2 p-1">
- <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>
- <span className="block w-full p-2 text-center font-normal">Dark</span>
- </FormLabel>
- </FormItem>
- </RadioGroup>
- </FormItem>
- )}
- />
-
- <Button type="submit">Update preferences</Button>
- </form>
- </Form>
- );
-}
diff --git a/apps/web/src/app/[locale]/settings/_components/profile.tsx b/apps/web/src/app/[locale]/settings/_components/edit-profile-tab.tsx
similarity index 58%
rename from apps/web/src/app/[locale]/settings/_components/profile.tsx
rename to apps/web/src/app/[locale]/settings/_components/edit-profile-tab.tsx
index 89411606..a6d90dbb 100644
--- a/apps/web/src/app/[locale]/settings/_components/profile.tsx
+++ b/apps/web/src/app/[locale]/settings/_components/edit-profile-tab.tsx
@@ -1,31 +1,17 @@
'use client';
import { zodResolver } from '@hookform/resolvers/zod';
+import { useFieldArray, useForm } from 'react-hook-form';
+
import type { User } from '@repo/db/types';
import { Button } from '@repo/ui/components/button';
-import {
- Form,
- FormControl,
- FormDescription,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
-} from '@repo/ui/components/form';
+import { Form, FormField, FormItem, FormLabel, FormMessage } from '@repo/ui/components/form';
import { Input } from '@repo/ui/components/input';
import { MagicIcon } from '@repo/ui/components/magic-icon';
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from '@repo/ui/components/select';
-import { Separator } from '@repo/ui/components/separator';
import { useToast } from '@repo/ui/components/use-toast';
-import Link from 'next/link';
-import { useFieldArray, useForm } from 'react-hook-form';
+
import { RichMarkdownEditor } from '~/components/rich-markdown-editor';
+
import { updateProfile } from './settings.action';
import { profileSchema, type ProfileSchema } from './schema';
@@ -35,14 +21,7 @@ interface Props {
export function ProfileSettings({ user }: Props) {
return (
- <div className="space-y-8 p-8">
- <div className="mb-4">
- <h3 className="text-lg font-medium">Profile</h3>
- <p className="text-muted-foreground mb-4 text-sm">
- This is how others will see you on the site.
- </p>
- <Separator />
- </div>
+ <div>
<ProfileForm user={user} />
</div>
);
@@ -67,9 +46,7 @@ function ProfileForm({ user }: Props) {
mode: 'onChange',
defaultValues: {
bio: user.bio,
- email: user.email!,
userLinks,
- username: user.name,
},
});
@@ -102,48 +79,6 @@ function ProfileForm({ user }: Props) {
return (
<Form {...form}>
<form onSubmit={(e) => form.handleSubmit(onSubmit)(e)} className="space-y-8">
- <FormField
- control={form.control}
- name="username"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Username</FormLabel>
- <FormControl>
- <Input disabled placeholder="shadcn" {...field} />
- </FormControl>
- <FormDescription>
- This is your public display name. It can be your real name or a pseudonym. You can
- only change this once every 30 days.
- </FormDescription>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="email"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Email</FormLabel>
- <Select onValueChange={field.onChange} defaultValue={field.value}>
- <FormControl>
- <SelectTrigger>
- <SelectValue placeholder="Select a verified email to display" />
- </SelectTrigger>
- </FormControl>
- <SelectContent>
- <SelectItem value={user.email!}>{user.email}</SelectItem>
- </SelectContent>
- </Select>
- <FormDescription>
- You can manage verified email addresses in your{' '}
- <Link href="/examples/forms">email settings</Link>.
- </FormDescription>
- <FormMessage />
- </FormItem>
- )}
- />
-
<FormField
control={form.control}
name="bio"
@@ -156,7 +91,7 @@ function ProfileForm({ user }: Props) {
)}
/>
<div className="flex flex-col items-start space-y-3 pt-8">
- <h4 className="text-sm font-medium">Social accounts</h4>
+ <h4 className="text-sm font-medium">Social Links</h4>
{fields.map((val, i) => {
return (
<FormItem className="mb-3" key={`url-link-${i}`}>
diff --git a/apps/web/src/app/[locale]/settings/_components/notifications.tsx b/apps/web/src/app/[locale]/settings/_components/notifications.tsx
deleted file mode 100644
index c5cc39ab..00000000
--- a/apps/web/src/app/[locale]/settings/_components/notifications.tsx
+++ /dev/null
@@ -1,222 +0,0 @@
-'use client';
-
-import { zodResolver } from '@hookform/resolvers/zod';
-import type { User } from '@repo/db/types';
-import { Separator } from '@repo/ui/components/separator';
-import { Checkbox } from '@repo/ui/components/checkbox';
-import { Switch } from '@repo/ui/components/switch';
-import {
- Form,
- FormControl,
- FormDescription,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
-} from '@repo/ui/components/form';
-import { RadioGroup, RadioGroupItem } from '@repo/ui/components/radio-group';
-import { Button } from '@repo/ui/components/button';
-import { useToast } from '@repo/ui/components/use-toast';
-import Link from 'next/link';
-import { useForm } from 'react-hook-form';
-import { z } from 'zod';
-
-interface Props {
- user: User & { userLinks: { id: string | null; url: string }[] };
-}
-
-export function Notifications({ user }: Props) {
- return (
- <div className="max-w-lg space-y-6 p-8">
- <div className="mb-4">
- <h3 className="text-lg font-medium">Notifications</h3>
- <p className="text-muted-foreground mb-4 text-sm">
- Configure how you receive notifications.
- </p>
- <Separator />
- </div>
- <NotificationsForm />
- </div>
- );
-}
-
-const notificationsFormSchema = z.object({
- type: z.enum(['all', 'mentions', 'none'], {
- required_error: 'You need to select a notification type.',
- }),
- mobile: z.boolean().default(false).optional(),
- communication_emails: z.boolean().default(false).optional(),
- social_emails: z.boolean().default(false).optional(),
- marketing_emails: z.boolean().default(false).optional(),
- security_emails: z.boolean(),
-});
-
-type NotificationsFormValues = z.infer<typeof notificationsFormSchema>;
-
-// This can come from your database or API.
-const defaultValues: Partial<NotificationsFormValues> = {
- communication_emails: false,
- marketing_emails: false,
- social_emails: true,
- security_emails: true,
-};
-
-export function NotificationsForm() {
- const { toast } = useToast();
- const form = useForm<NotificationsFormValues>({
- resolver: zodResolver(notificationsFormSchema),
- defaultValues,
- });
-
- async function onSubmit(data: NotificationsFormValues) {
- toast({
- title: 'You submitted the following values:',
- description: (
- <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
- <code className="text-white">{JSON.stringify(data, null, 2)}</code>
- </pre>
- ),
- });
- }
-
- return (
- <Form {...form}>
- <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
- <FormField
- control={form.control}
- name="type"
- render={({ field }) => (
- <FormItem className="space-y-3">
- <FormLabel>Notify me about...</FormLabel>
- <FormControl>
- <RadioGroup
- onValueChange={(e: 'all' | 'mentions' | 'none') => field.onChange(e)}
- defaultValue={field.value}
- className="flex flex-col space-y-1"
- >
- <FormItem className="flex items-center space-x-3 space-y-0">
- <FormControl>
- <RadioGroupItem value="all" />
- </FormControl>
- <FormLabel className="font-normal">All new messages</FormLabel>
- </FormItem>
- <FormItem className="flex items-center space-x-3 space-y-0">
- <FormControl>
- <RadioGroupItem value="mentions" />
- </FormControl>
- <FormLabel className="font-normal">Direct messages and mentions</FormLabel>
- </FormItem>
- <FormItem className="flex items-center space-x-3 space-y-0">
- <FormControl>
- <RadioGroupItem value="none" />
- </FormControl>
- <FormLabel className="font-normal">Nothing</FormLabel>
- </FormItem>
- </RadioGroup>
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <div>
- <h3 className="mb-4 text-lg font-medium">Email Notifications</h3>
- <div className="space-y-4">
- <FormField
- control={form.control}
- name="communication_emails"
- render={({ field }) => (
- <FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">
- <div className="space-y-0.5">
- <FormLabel className="text-base">Communication emails</FormLabel>
- <FormDescription>Receive emails about your account activity.</FormDescription>
- </div>
- <FormControl>
- <Switch checked={field.value} onCheckedChange={field.onChange} />
- </FormControl>
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="marketing_emails"
- render={({ field }) => (
- <FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">
- <div className="space-y-0.5">
- <FormLabel className="text-base">Marketing emails</FormLabel>
- <FormDescription>
- Receive emails about new products, features, and more.
- </FormDescription>
- </div>
- <FormControl>
- <Switch checked={field.value} onCheckedChange={field.onChange} />
- </FormControl>
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="social_emails"
- render={({ field }) => (
- <FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">
- <div className="space-y-0.5">
- <FormLabel className="text-base">Social emails</FormLabel>
- <FormDescription>
- Receive emails for friend requests, follows, and more.
- </FormDescription>
- </div>
- <FormControl>
- <Switch checked={field.value} onCheckedChange={field.onChange} />
- </FormControl>
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="security_emails"
- render={({ field }) => (
- <FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">
- <div className="space-y-0.5">
- <FormLabel className="text-base">Security emails</FormLabel>
- <FormDescription>
- Receive emails about your account activity and security.
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- disabled
- aria-readonly
- />
- </FormControl>
- </FormItem>
- )}
- />
- </div>
- </div>
- <FormField
- control={form.control}
- name="mobile"
- render={({ field }) => (
- <FormItem className="flex flex-row items-start space-x-3 space-y-0">
- <FormControl>
- <Checkbox
- checked={field.value}
- onCheckedChange={(e: boolean) => field.onChange(e)}
- />
- </FormControl>
- <div className="space-y-1 leading-none">
- <FormLabel>Use different settings for my mobile devices</FormLabel>
- <FormDescription>
- You can manage your mobile notifications in the{' '}
- <Link href="/examples/forms">mobile settings</Link> page.
- </FormDescription>
- </div>
- </FormItem>
- )}
- />
- <Button type="submit">Update notifications</Button>
- </form>
- </Form>
- );
-}
diff --git a/apps/web/src/app/[locale]/settings/_components/schema.ts b/apps/web/src/app/[locale]/settings/_components/schema.ts
index 422d19b2..a06535d7 100644
--- a/apps/web/src/app/[locale]/settings/_components/schema.ts
+++ b/apps/web/src/app/[locale]/settings/_components/schema.ts
@@ -14,19 +14,6 @@ export const appearanceFormSchema = z.object({
export type ApperenceFormSchema = z.infer<typeof appearanceFormSchema>;
export const profileSchema = z.object({
- username: z
- .string()
- .min(2, {
- message: 'Username must be at least 2 characters.',
- })
- .max(30, {
- message: 'Username must not be longer than 30 characters.',
- }),
- email: z
- .string({
- required_error: 'Please select an email to display.',
- })
- .email(),
bio: createNoProfanitySchemaWithValidate((str) => str.max(256)),
userLinks: z.array(
z.object({
diff --git a/apps/web/src/app/[locale]/settings/_components/settings.tsx b/apps/web/src/app/[locale]/settings/_components/settings.tsx
index f16bc728..7486bf3d 100644
--- a/apps/web/src/app/[locale]/settings/_components/settings.tsx
+++ b/apps/web/src/app/[locale]/settings/_components/settings.tsx
@@ -1,5 +1,7 @@
'use client';
+import Link from 'next/link';
+
import type { User } from '@repo/db/types';
import {
Tabs,
@@ -7,128 +9,86 @@ import {
VerticalTabsList,
VerticalTabsTrigger,
} from '@repo/ui/components/tabs';
-import { Card } from '@repo/ui/components/card';
-import { BellRing, Brush, Settings2, Shapes } from '@repo/ui/icons';
-import Link from 'next/link';
-import { getRelativeTime } from '~/utils/relativeTime';
-import { ProfileSettings } from './profile';
-import { Notifications } from './notifications';
-import { Appearances } from './appearance';
-import { usePathname } from 'next/navigation';
-import UserHeader from '../../[username]/_components/dashboard/user-header';
+import { Settings2, User as UserIcon } from '@repo/ui/icons';
import { MagicIcon } from '@repo/ui/components/magic-icon';
+import { Card, CardContent, CardHeader, CardTitle } from '@repo/ui/components/card';
+
+import { getRelativeTime } from '~/utils/relativeTime';
+import UserHeader from '~/app/[locale]/[username]/_components/dashboard/user-header';
import { stripProtocolAndWWW } from '~/utils/stringUtils';
+import { ProfileSettings } from './edit-profile-tab';
+
interface Props {
user: User & { userLinks: { id: string | null; url: string }[] };
}
-export const links = [
- {
- icon: Settings2,
- name: 'Profile',
- link: '/settings',
- disabled: false,
- },
- {
- icon: Brush,
- name: 'Appearance',
- link: '/settings/appearance',
- disabled: false,
- },
- {
- icon: Shapes,
- name: 'Connections',
- link: '/settings/connections',
- disabled: true,
- },
- {
- icon: BellRing,
- name: 'Notifications',
- link: '/settings/notifications',
- disabled: true,
- },
-];
+export const Settings = async ({ user }: Props) => {
+ const filteredProfileLinks =
+ user.userLinks.length > 0 ? user.userLinks.filter((item) => item.url !== '') : [];
-export const Settings = ({ user }: Props) => {
- const path = usePathname();
- let selectedTabValue: string;
- if (path === '/settings') {
- selectedTabValue = 'profile';
- } else if (path === '/settings/connections') {
- selectedTabValue = 'connections';
- } else if (path === '/settings/notifications') {
- selectedTabValue = 'notifications';
- } else if (path === '/settings/appearance') {
- selectedTabValue = 'appearance';
- } else {
- // TODO: 404
- selectedTabValue = 'profile';
- }
return (
<div className="container">
- <Tabs className="flex flex-col gap-8 py-8 md:flex-row" defaultValue={selectedTabValue}>
+ {/* // TODO: GFI: make each page a subroute, put settings & profile into the same layout */}
+ <Tabs className="flex flex-col gap-8 py-8 md:flex-row" defaultValue="settings">
<VerticalTabsList>
- <div className="mb-2 flex flex-col items-center md:items-start">
+ <div className="flex flex-col items-center gap-10 md:items-start">
<div
- className="mb-10 h-32 w-32 rounded-3xl bg-cover bg-center bg-no-repeat md:h-64 md:w-64"
+ className="h-32 w-32 rounded-3xl bg-cover bg-center bg-no-repeat md:h-64 md:w-64"
style={{ backgroundImage: `url(${user.image ?? '/avatar.jpeg'})` }}
/>
- <UserHeader user={user} isOwnProfile />
- <p
- className="text-sm italic tracking-tight text-neutral-500"
- title={`Joined ${user.createdAt.toString()}`}
- >
- Joined {getRelativeTime(user.createdAt)}
- </p>
- <div className="mb-4 mt-2 w-full text-center text-sm md:w-64 md:text-start">
- {user.bio}
+ <div className="flex flex-col items-center gap-2 md:w-full md:items-start">
+ <UserHeader user={user} isOwnProfile />
+ <span
+ className="text-muted-foreground text-sm italic tracking-tight"
+ title={`Joined ${user.createdAt.toString()}`}
+ >
+ Joined {getRelativeTime(user.createdAt)}
+ </span>
</div>
- {user.userLinks.length > 0 && (
- <div className="flex flex-col gap-2">
- {user.userLinks
- .filter((item) => item.url !== '')
- .map((link) => (
- <div className="flex items-center gap-2" key={link.id}>
- <MagicIcon url={link.url} />
- <a
- className="text-xs text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400"
- href={link.url}
- rel="noopener noreferrer"
- target="_blank"
- >
- {stripProtocolAndWWW(link.url)}
- </a>
- </div>
- ))}
+ {Boolean(filteredProfileLinks.length > 0) && (
+ <div className="flex w-full flex-col items-center gap-2 md:items-start">
+ {filteredProfileLinks.map((link) => (
+ <div className="flex items-center gap-2" key={link.id}>
+ <MagicIcon url={link.url} />
+ <a
+ className="text-xs text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400"
+ href={link.url}
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ {stripProtocolAndWWW(link.url)}
+ </a>
+ </div>
+ ))}
</div>
)}
- </div>
- <div className="flex gap-4 pr-6 md:flex-col">
- {links.map(({ icon: Icon, name, link, disabled }) => {
- const Comp = disabled ? 'div' : Link;
- return (
- <Comp href={link} key={name} className="w-full">
- <VerticalTabsTrigger
- className="flex w-full items-center justify-center gap-3 px-2 md:justify-normal md:px-3"
- value={name.toLowerCase()}
- key={name}
- disabled={disabled}
- >
- <Icon className="h-4 w-4" />
- <span className="hidden md:block">{name}</span>
- </VerticalTabsTrigger>
- </Comp>
- );
- })}
+ <div className="flex gap-4 md:w-full md:flex-col">
+ <VerticalTabsTrigger
+ className="flex items-center justify-center gap-3 px-2 md:justify-normal md:px-3"
+ value="settings"
+ >
+ <Settings2 className="h-4 w-4" />
+ <span className="hidden md:block">Settings</span>
+ </VerticalTabsTrigger>
+ <Link
+ href="/settings"
+ className="border-border dark:border-ring data-[state=active]:bg-border ring-offset-background focus-visible:ring-ring data-[state=active]:text-foreground flex items-center justify-center gap-3 whitespace-nowrap rounded-xl border px-1.5 py-1.5 text-sm font-medium transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm md:justify-normal md:px-3"
+ >
+ <UserIcon className="h-4 w-4" />
+ <span className="hidden md:block">Back to Profile</span>
+ </Link>
+ </div>
</div>
</VerticalTabsList>
- <VerticalTabsContent className="shrink grow space-y-4" value={selectedTabValue}>
- <Card className="col-span-4 min-h-[calc(100vh_-_56px_-_6rem)]">
- {selectedTabValue === 'profile' && <ProfileSettings user={user} />}
- {selectedTabValue === 'connections' && <div>Connections</div>}
- {selectedTabValue === 'notifications' && <Notifications user={user} />}
- {selectedTabValue === 'appearance' && <Appearances />}
+ <VerticalTabsContent className="shrink grow space-y-4" value="settings">
+ <Card className="col-span-4 md:min-h-[calc(100vh_-_56px_-_6rem)]">
+ <CardHeader>
+ <CardTitle>Settings</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <ProfileSettings user={user} />
+ </CardContent>
</Card>
</VerticalTabsContent>
</Tabs>
diff --git a/apps/web/src/app/[locale]/settings/appearance/error.tsx b/apps/web/src/app/[locale]/settings/appearance/error.tsx
deleted file mode 100644
index d42f3afb..00000000
--- a/apps/web/src/app/[locale]/settings/appearance/error.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-'use client';
-function ErrorBounds() {
- return (
- <div>
- <h1>404</h1>
- <p>Page not found</p>
- </div>
- );
-}
-
-export default ErrorBounds;
diff --git a/apps/web/src/app/[locale]/settings/appearance/page.tsx b/apps/web/src/app/[locale]/settings/appearance/page.tsx
deleted file mode 100644
index 5dbff5ec..00000000
--- a/apps/web/src/app/[locale]/settings/appearance/page.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { getServerAuthSession } from '@repo/auth/server';
-import { prisma } from '@repo/db';
-import { Settings } from '../_components/settings';
-
-export default async function SettingsPage() {
- const session = await getServerAuthSession();
-
- if (!session?.user || !session.user.name) {
- return null;
- }
-
- const profileData = await prisma.user.findFirstOrThrow({
- where: {
- id: session.user.id,
- },
- include: {
- userLinks: true,
- },
- orderBy: {
- updatedAt: 'asc',
- },
- });
-
- // NOTE: make the user links have 4 at all times
- const userLinks = (profileData.userLinks = [
- ...profileData.userLinks,
- ...Array(4 - profileData.userLinks.length).fill({
- id: null,
- url: '',
- }),
- ])
- // NOTE: sort the user links so empty strings are at the bottom
- .sort((a, b) => b.url.localeCompare(a.url));
-
- return (
- <>
- <Settings user={profileData} />
- </>
- );
-}
diff --git a/apps/web/src/app/[locale]/settings/notifications/error.tsx b/apps/web/src/app/[locale]/settings/notifications/error.tsx
deleted file mode 100644
index d42f3afb..00000000
--- a/apps/web/src/app/[locale]/settings/notifications/error.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-'use client';
-function ErrorBounds() {
- return (
- <div>
- <h1>404</h1>
- <p>Page not found</p>
- </div>
- );
-}
-
-export default ErrorBounds;
diff --git a/apps/web/src/app/[locale]/settings/notifications/page.tsx b/apps/web/src/app/[locale]/settings/notifications/page.tsx
deleted file mode 100644
index 5dbff5ec..00000000
--- a/apps/web/src/app/[locale]/settings/notifications/page.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { getServerAuthSession } from '@repo/auth/server';
-import { prisma } from '@repo/db';
-import { Settings } from '../_components/settings';
-
-export default async function SettingsPage() {
- const session = await getServerAuthSession();
-
- if (!session?.user || !session.user.name) {
- return null;
- }
-
- const profileData = await prisma.user.findFirstOrThrow({
- where: {
- id: session.user.id,
- },
- include: {
- userLinks: true,
- },
- orderBy: {
- updatedAt: 'asc',
- },
- });
-
- // NOTE: make the user links have 4 at all times
- const userLinks = (profileData.userLinks = [
- ...profileData.userLinks,
- ...Array(4 - profileData.userLinks.length).fill({
- id: null,
- url: '',
- }),
- ])
- // NOTE: sort the user links so empty strings are at the bottom
- .sort((a, b) => b.url.localeCompare(a.url));
-
- return (
- <>
- <Settings user={profileData} />
- </>
- );
-}