3 lines
5.5 KiB
JavaScript
3 lines
5.5 KiB
JavaScript
module.exports=[12576,(a,b,c)=>{"use strict";b.exports=a.r(81232).vendored["react-ssr"].ReactServerDOMTurbopackClient},98414,91969,a=>{"use strict";var b=a.i(6155),c=a.i(12348);function d({className:a,...d}){return(0,b.jsx)("textarea",{"data-slot":"textarea",className:(0,c.cn)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),...d})}a.s(["Textarea",()=>d],98414);let e=(0,a.i(37111).default)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);a.s(["ArrowLeft",()=>e],91969)},45522,a=>{"use strict";var b=a.i(6155),c=a.i(54297),d=a.i(14672),e=a.i(1845),f=a.i(74719),g=a.i(8895),h=a.i(59580),i=a.i(85801),j=a.i(98414),k=a.i(99766),l=a.i(24749),m=a.i(91969);let n=(0,a.i(37111).default)("TreePine",[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]]);var o=a.i(31483);function p(){let a=(0,d.useRouter)(),{data:p}=(0,e.useSession)(),[q,r]=(0,c.useState)(""),[s,t]=(0,c.useState)(""),[u,v]=(0,c.useState)(""),[w,x]=(0,c.useState)(!1),y=async a=>{if(a.preventDefault(),!q.trim())return void v("请输入家族树名称");v(""),x(!0);try{let a=await fetch("/api/trees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:q.trim(),description:s.trim()||void 0})}),b=await a.json();if(!a.ok)throw Error(b.error||"创建失败");window.location.href=`/?treeId=${b.tree.id}`}catch(a){v(a.message||"创建失败,请稍后重试")}finally{x(!1)}};return p?(0,b.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,b.jsx)(f.SiteHeader,{}),(0,b.jsx)("main",{className:"container mx-auto py-8 px-4 md:px-6 flex-1",children:(0,b.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,b.jsxs)("div",{className:"mb-6",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"sm",asChild:!0,className:"mb-4",children:(0,b.jsxs)(o.default,{href:"/",children:[(0,b.jsx)(m.ArrowLeft,{className:"h-4 w-4 mr-2"}),"返回首页"]})}),(0,b.jsx)("h1",{className:"text-3xl font-serif font-bold mb-2",children:"创建新家族树"}),(0,b.jsx)("p",{className:"text-muted-foreground",children:"开始记录您的家族历史和传承"})]}),(0,b.jsx)(k.Card,{children:(0,b.jsxs)("form",{onSubmit:y,children:[(0,b.jsx)(k.CardHeader,{children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-primary text-primary-foreground",children:(0,b.jsx)(n,{className:"h-6 w-6"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)(k.CardTitle,{children:"家族树信息"}),(0,b.jsx)(k.CardDescription,{children:"填写基本信息以创建您的家族树"})]})]})}),(0,b.jsxs)(k.CardContent,{className:"space-y-6",children:[u&&(0,b.jsx)(l.Alert,{variant:"destructive",children:(0,b.jsx)(l.AlertDescription,{children:u})}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)(i.Label,{htmlFor:"name",children:["家族树名称 ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(h.Input,{id:"name",placeholder:"例如:王氏家族、李氏宗谱",value:q,onChange:a=>r(a.target.value),maxLength:50,required:!0}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"建议使用姓氏+家族/宗谱等命名"})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(i.Label,{htmlFor:"description",children:"家族树描述(可选)"}),(0,b.jsx)(j.Textarea,{id:"description",placeholder:"简要描述您的家族历史、祖籍地等信息",value:s,onChange:a=>t(a.target.value),rows:4,maxLength:500}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[s.length,"/500 字"]})]}),(0,b.jsxs)("div",{className:"rounded-lg border bg-muted/50 p-4",children:[(0,b.jsx)("h3",{className:"font-medium mb-2",children:"💡 温馨提示"}),(0,b.jsxs)("ul",{className:"text-sm text-muted-foreground space-y-1",children:[(0,b.jsx)("li",{children:"• 创建后可以随时修改家族树信息"}),(0,b.jsx)("li",{children:"• 您可以邀请家族成员共同编辑"}),(0,b.jsx)("li",{children:"• 支持导入已有的家族数据"})]})]})]}),(0,b.jsxs)(k.CardFooter,{className:"flex gap-3",children:[(0,b.jsx)(g.Button,{type:"button",variant:"outline",onClick:()=>a.back(),disabled:w,className:"flex-1",children:"取消"}),(0,b.jsx)(g.Button,{type:"submit",disabled:w||!q.trim(),className:"flex-1",children:w?"创建中...":"创建家族树"})]})]})})]})})]}):(0,b.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,b.jsx)(f.SiteHeader,{}),(0,b.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,b.jsxs)(k.Card,{className:"w-full max-w-md mx-4",children:[(0,b.jsxs)(k.CardHeader,{children:[(0,b.jsx)(k.CardTitle,{children:"需要登录"}),(0,b.jsx)(k.CardDescription,{children:"请先登录后再创建家族树"})]}),(0,b.jsx)(k.CardFooter,{children:(0,b.jsx)(g.Button,{asChild:!0,className:"w-full",children:(0,b.jsx)(o.default,{href:"/auth/signin",children:"前往登录"})})})]})})]})}a.s(["default",()=>p],45522)}];
|
|
|
|
//# sourceMappingURL=Documents_go-new_chinese-family-tree_a3b74e4b._.js.map
|