mosaicmap/app/me/profile/page.tsx
2025-07-28 23:14:43 +08:00

150 lines
5.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use client"
import { useState } from "react"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Textarea } from "@/components/ui/textarea"
import { Badge } from "@/components/ui/badge"
import { Calendar } from "@/components/ui/calendar"
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
import { Camera, CalendarIcon, Save } from "lucide-react"
import { cn } from "@/lib/utils"
import { format } from "date-fns"
export default function Page() {
const [date, setDate] = useState<Date>()
const [profileData, setProfileData] = useState({
name: "张三",
email: "zhangsan@example.com",
phone: "+86 138 0013 8000",
bio: "这是我的个人简介,我是一名前端开发工程师,热爱技术和创新。",
location: "北京市朝阳区",
website: "https://zhangsan.dev",
company: "科技有限公司",
})
return (
<div className="space-y-6 p-4">
<div>
<h2 className="text-2xl font-bold tracking-tight"></h2>
<p className="text-muted-foreground"></p>
</div>
<Card>
<CardHeader>
<CardTitle></CardTitle>
<CardDescription></CardDescription>
</CardHeader>
<CardContent className="space-y-6">
<div className="flex items-center space-x-4">
<Avatar className="h-20 w-20">
<AvatarImage src="/placeholder.svg?height=80&width=80" />
<AvatarFallback></AvatarFallback>
</Avatar>
<div className="space-y-2">
<Button variant="outline" size="sm" className="gap-2 bg-transparent">
<Camera className="h-4 w-4" />
</Button>
<p className="text-sm text-muted-foreground">400x400px JPGPNG </p>
</div>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<div className="space-y-2">
<Label htmlFor="name"></Label>
<Input
id="name"
value={profileData.name}
onChange={(e) => setProfileData({ ...profileData, name: e.target.value })}
/>
</div>
<div className="space-y-2">
<Label htmlFor="email"></Label>
<div className="flex items-center space-x-2">
<Input
id="email"
type="email"
value={profileData.email}
onChange={(e) => setProfileData({ ...profileData, email: e.target.value })}
/>
<Badge variant="secondary"></Badge>
</div>
</div>
<div className="space-y-2">
<Label htmlFor="phone"></Label>
<Input
id="phone"
value={profileData.phone}
onChange={(e) => setProfileData({ ...profileData, phone: e.target.value })}
/>
</div>
<div className="space-y-2">
<Label htmlFor="company"></Label>
<Input
id="company"
value={profileData.company}
onChange={(e) => setProfileData({ ...profileData, company: e.target.value })}
/>
</div>
<div className="space-y-2">
<Label htmlFor="location"></Label>
<Input
id="location"
value={profileData.location}
onChange={(e) => setProfileData({ ...profileData, location: e.target.value })}
/>
</div>
<div className="space-y-2">
<Label htmlFor="website"></Label>
<Input
id="website"
value={profileData.website}
onChange={(e) => setProfileData({ ...profileData, website: e.target.value })}
/>
</div>
</div>
<div className="space-y-2">
<Label htmlFor="bio"></Label>
<Textarea
id="bio"
placeholder="介绍一下您自己..."
className="min-h-[100px]"
value={profileData.bio}
onChange={(e) => setProfileData({ ...profileData, bio: e.target.value })}
/>
<p className="text-sm text-muted-foreground">{profileData.bio.length}/500 </p>
</div>
<div className="space-y-2">
<Label></Label>
<Popover>
<PopoverTrigger asChild>
<Button
variant="outline"
className={cn("w-full justify-start text-left font-normal", !date && "text-muted-foreground")}
>
<CalendarIcon className="mr-2 h-4 w-4" />
{date ? format(date, "yyyy年MM月dd日") : "选择日期"}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0">
<Calendar mode="single" selected={date} onSelect={setDate} initialFocus />
</PopoverContent>
</Popover>
</div>
<Button className="gap-2">
<Save className="h-4 w-4" />
</Button>
</CardContent>
</Card>
</div>
)
}