mirror of
https://gitbruv.vercel.app/api/git/bruv/gitbruv.git
synced 2025-12-20 23:24:09 +01:00
wip
This commit is contained in:
parent
a63628e659
commit
dffc97239e
17 changed files with 1220 additions and 24 deletions
55
app/(main)/settings/account/page.tsx
Normal file
55
app/(main)/settings/account/page.tsx
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
import { redirect } from "next/navigation";
|
||||
import { getCurrentUser } from "@/actions/settings";
|
||||
import { EmailForm } from "@/components/settings/email-form";
|
||||
import { PasswordForm } from "@/components/settings/password-form";
|
||||
import { DeleteAccount } from "@/components/settings/delete-account";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
|
||||
export default async function AccountSettingsPage() {
|
||||
const user = await getCurrentUser();
|
||||
|
||||
if (!user) {
|
||||
redirect("/login");
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Email Address</CardTitle>
|
||||
<CardDescription>
|
||||
Change the email associated with your account
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<EmailForm currentEmail={user.email} />
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Password</CardTitle>
|
||||
<CardDescription>
|
||||
Update your password to keep your account secure
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<PasswordForm />
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="border-red-500/20">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-red-500">Danger Zone</CardTitle>
|
||||
<CardDescription>
|
||||
Irreversible actions that affect your account
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<DeleteAccount username={user.username} />
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
28
app/(main)/settings/layout.tsx
Normal file
28
app/(main)/settings/layout.tsx
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { redirect } from "next/navigation";
|
||||
import { getSession } from "@/lib/session";
|
||||
import { SettingsNav } from "@/components/settings/settings-nav";
|
||||
|
||||
export default async function SettingsLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const session = await getSession();
|
||||
|
||||
if (!session?.user) {
|
||||
redirect("/login");
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="container max-w-5xl py-8">
|
||||
<h1 className="text-2xl font-semibold mb-8">Settings</h1>
|
||||
<div className="flex gap-8">
|
||||
<aside className="w-48 shrink-0">
|
||||
<SettingsNav />
|
||||
</aside>
|
||||
<main className="flex-1 min-w-0">{children}</main>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
65
app/(main)/settings/page.tsx
Normal file
65
app/(main)/settings/page.tsx
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
import { redirect } from "next/navigation";
|
||||
import { getCurrentUser } from "@/actions/settings";
|
||||
import { ProfileForm } from "@/components/settings/profile-form";
|
||||
import { AvatarUpload } from "@/components/settings/avatar-upload";
|
||||
import { SocialLinksForm } from "@/components/settings/social-links-form";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
|
||||
export default async function SettingsPage() {
|
||||
const user = await getCurrentUser();
|
||||
|
||||
if (!user) {
|
||||
redirect("/login");
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Profile Picture</CardTitle>
|
||||
<CardDescription>
|
||||
Upload a picture to personalize your profile
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<AvatarUpload currentAvatar={user.avatarUrl} name={user.name} />
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Profile Information</CardTitle>
|
||||
<CardDescription>
|
||||
Update your profile details visible to other users
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ProfileForm
|
||||
user={{
|
||||
name: user.name,
|
||||
username: user.username,
|
||||
bio: user.bio,
|
||||
location: user.location,
|
||||
website: user.website,
|
||||
pronouns: user.pronouns,
|
||||
}}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Social Links</CardTitle>
|
||||
<CardDescription>
|
||||
Add links to your social profiles
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<SocialLinksForm socialLinks={user.socialLinks} />
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue