|
| 1 | +import type { ReactNode } from "react"; |
| 2 | +import Image from "next/image"; |
| 3 | +import { Badge } from "@/components/ui/badge"; |
| 4 | +import { Button } from "@/components/ui/button"; |
| 5 | +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; |
| 6 | +import { FetchUser } from "@/actions/fetchUser"; |
| 7 | +import Link from "next/link"; |
| 8 | +import { ArrowLeftIcon } from "@phosphor-icons/react/dist/ssr"; |
| 9 | +import SignOut from "@/components/ui/signout"; |
| 10 | +import { SelectTheme } from "@/components/ui/theme-toggler"; |
| 11 | +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; |
| 12 | +import { Account } from "@/components/subscription/account"; |
| 13 | +import { Customisation } from "@/components/subscription/customisation"; |
| 14 | +import { Profile } from "@/components/subscription/profile/profile"; |
| 15 | +import Models from "@/components/subscription/model"; |
| 16 | +import APIKeysPage from "@/components/subscription/api-key"; |
| 17 | +import { AttachmentsPage } from "@/components/subscription/attachments"; |
| 18 | +import { ContactUsPage } from "@/components/subscription/contact-us"; |
| 19 | +import { History } from "@/components/subscription/history"; |
| 20 | + |
| 21 | +export default async function SubscriptionPage() { |
| 22 | + const user = await FetchUser(); |
| 23 | + console.log(user); |
| 24 | + return ( |
| 25 | + <div className="bg-background text-foreground min-h-screen w-full border"> |
| 26 | + <div className="mx-auto w-full max-w-6xl p-8"> |
| 27 | + <div> |
| 28 | + <div className="mb-6 flex items-center justify-between text-2xl font-bold"> |
| 29 | + <Button asChild variant="ghost" className="font-semibold"> |
| 30 | + <Link className="flex items-center gap-2" href="/"> |
| 31 | + <ArrowLeftIcon className="size-4" /> |
| 32 | + Back to chat |
| 33 | + </Link> |
| 34 | + </Button> |
| 35 | + <div className="flex items-center gap-3"> |
| 36 | + <SelectTheme /> |
| 37 | + <SignOut /> |
| 38 | + </div> |
| 39 | + </div> |
| 40 | + </div> |
| 41 | + <div className="grid grid-cols-1 gap-14 lg:grid-cols-3"> |
| 42 | + {/* Left Column - Profile and Shortcuts */} |
| 43 | + <div className="hidden space-y-8 lg:col-span-1 lg:block"> |
| 44 | + {/* Profile Section */} |
| 45 | + <Profile image={user?.image as string} /> |
| 46 | + |
| 47 | + {/* Message Usage */} |
| 48 | + <div className="bg-accent space-y-4 rounded-xl p-4 dark:bg-black"> |
| 49 | + <div className="flex items-center justify-between"> |
| 50 | + <span className="text-foreground font-medium"> |
| 51 | + Message Usage |
| 52 | + </span> |
| 53 | + <span className="text-muted-foreground text-sm"> |
| 54 | + Resets today at 5:30 AM |
| 55 | + </span> |
| 56 | + </div> |
| 57 | + |
| 58 | + <div className="space-y-2"> |
| 59 | + <div className="flex items-center justify-between"> |
| 60 | + <span className="text-foreground">Standard</span> |
| 61 | + <span className="text-foreground font-mono">0/20</span> |
| 62 | + </div> |
| 63 | + <div className="bg-muted h-2 w-full rounded-full"> |
| 64 | + <div |
| 65 | + className="bg-primary h-2 rounded-full" |
| 66 | + style={{ width: "0%" }} |
| 67 | + ></div> |
| 68 | + </div> |
| 69 | + <p className="text-muted-foreground text-sm"> |
| 70 | + 20 messages remaining |
| 71 | + </p> |
| 72 | + </div> |
| 73 | + </div> |
| 74 | + </div> |
| 75 | + |
| 76 | + {/* Right Column - Tabs Section */} |
| 77 | + <div className="lg:col-span-2"> |
| 78 | + <Tabs defaultValue="account" className="max-w-full overflow-x-auto"> |
| 79 | + <div className="no-scrollbar overflow-x-auto"> |
| 80 | + <TabsList className="h-[34px] rounded-lg"> |
| 81 | + <TabsTrigger className="rounded-md text-xs" value="account"> |
| 82 | + Account |
| 83 | + </TabsTrigger> |
| 84 | + <TabsTrigger |
| 85 | + className="rounded-lg text-xs" |
| 86 | + value="customisation" |
| 87 | + > |
| 88 | + Customisation |
| 89 | + </TabsTrigger> |
| 90 | + <TabsTrigger className="rounded-lg text-xs" value="history"> |
| 91 | + History & Sync |
| 92 | + </TabsTrigger> |
| 93 | + <TabsTrigger className="rounded-lg text-xs" value="models"> |
| 94 | + Models |
| 95 | + </TabsTrigger> |
| 96 | + <TabsTrigger className="rounded-lg text-xs" value="api-keys"> |
| 97 | + API Keys |
| 98 | + </TabsTrigger> |
| 99 | + <TabsTrigger |
| 100 | + className="rounded-lg text-xs" |
| 101 | + value="attachments" |
| 102 | + > |
| 103 | + Attachments |
| 104 | + </TabsTrigger> |
| 105 | + <TabsTrigger className="rounded-lg text-xs" value="contact"> |
| 106 | + Contact |
| 107 | + </TabsTrigger> |
| 108 | + </TabsList> |
| 109 | + </div> |
| 110 | + <TabsContent value="account" className="mt-6"> |
| 111 | + <Account /> |
| 112 | + </TabsContent> |
| 113 | + <TabsContent value="customisation"> |
| 114 | + <Customisation /> |
| 115 | + </TabsContent> |
| 116 | + <TabsContent value="history"> |
| 117 | + <History /> |
| 118 | + </TabsContent> |
| 119 | + <TabsContent value="models"> |
| 120 | + <Models /> |
| 121 | + </TabsContent> |
| 122 | + <TabsContent value="api-keys"> |
| 123 | + <APIKeysPage /> |
| 124 | + </TabsContent> |
| 125 | + <TabsContent value="attachments"> |
| 126 | + <AttachmentsPage /> |
| 127 | + </TabsContent> |
| 128 | + <TabsContent value="contact"> |
| 129 | + <ContactUsPage /> |
| 130 | + </TabsContent> |
| 131 | + </Tabs> |
| 132 | + </div> |
| 133 | + </div> |
| 134 | + </div> |
| 135 | + </div> |
| 136 | + ); |
| 137 | +} |
0 commit comments