PageSourceSearch

https://www.ylive.ai/assets/Keluarga-bqM0RjM_.js

js ylive.ai collected 2026-10-05 13:44:31 UTC 8,452 bytes, 1 lines download raw bytes

1import{r as N,j as e,m as c}from"./vendor-motion-IPZE8IrO.js";import{e as A,u as C,t as i,c as t,B as n,i as G,b as L,C as o,I as k,L as v,U as h}from"./index-AEzrcV_C.js";import{H as P}from"./heart-aP6sTjLq.js";import{U as E}from"./user-plus-BVyNx2e3.js";import{C as K}from"./crown-Dx9drzfp.js";import{T as U}from"./trash-2-BXxk1pxB.js";import"./vendor-react-BN0qJr-I.js";import"./vendor-trpc-IjFHpi-5.js";function R(){const{isAuthenticated:d}=A(),[,p]=C(),[m,b]=N.useState(""),[l,j]=N.useState(""),r=i.useUtils(),{data:u,isLoading:y}=i.family.checkAccess.useQuery(void 0,{enabled:d}),{data:s,isLoading:w}=i.family.getMyGroup.useQuery(void 0,{enabled:d}),x=i.family.createGroup.useMutation({onSuccess:()=>{t.success("Grup keluarga berhasil dibuat!"),r.family.getMyGroup.invalidate(),b("")},onError:a=>t.error(a.message)}),g=i.family.inviteMember.useMutation({onSuccess:a=>{t.success(`Undangan berhasil dikirim ke ${l}`,{description:a.userFound?"Pengguna ditemukan di sistem":"Pengguna belum terdaftar, akan menerima undangan saat mendaftar"}),r.family.getMyGroup.invalidate(),j("")},onError:a=>t.error(a.message)}),M=i.family.removeMember.useMutation({onSuccess:()=>{t.success("Anggota berhasil dihapus"),r.family.getMyGroup.invalidate()},onError:a=>t.error(a.message)}),f=i.family.leaveGroup.useMutation({onSuccess:()=>{t.success("Anda telah keluar dari grup keluarga"),r.family.getMyGroup.invalidate(),r.family.checkAccess.invalidate()},onError:a=>t.error(a.message)});return d?e.jsxs("div",{className:"min-h-screen bg-background text-white",children:[e.jsx("header",{className:"sticky top-0 z-40 backdrop-blur-xl bg-background/80 border-b border-border",children:e.jsxs("div",{className:"container flex items-center h-14 gap-3",children:[e.jsx("button",{onClick:()=>p("/dashboard"),className:"text-muted-foreground hover:text-white transition-colors",children:e.jsx(L,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl",children:"👨‍👩‍👧‍👦"}),e.jsx("h1",{className:"font-semibold text-lg",children:"Keluarga"})]})]})}),e.jsxs("main",{className:"container py-6 space-y-6 max-w-3xl mx-auto",children:[!u?.hasAccess&&!y&&e.jsx(c.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"p-6 rounded-xl border border-pink-500/30 bg-gradient-to-br from-pink-500/10 to-rose-500/5",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-pink-500/20 flex items-center justify-center",children:e.jsx(P,{className:"w-6 h-6 text-pink-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-lg font-semibold text-white mb-1",children:"Paket Keluarga"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Belajar investasi syariah bersama keluarga. Hingga 4 anggota berbagi satu langganan premium."}),e.jsxs("ul",{className:"space-y-2 mb-4",children:[e.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(o,{className:"w-4 h-4 text-pink-400"}),"Hingga 4 anggota keluarga"]}),e.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(o,{className:"w-4 h-4 text-pink-400"}),"Semua fitur Pro untuk setiap anggota"]}),e.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(o,{className:"w-4 h-4 text-pink-400"}),"Hemat dibanding langganan individual"]}),e.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(o,{className:"w-4 h-4 text-pink-400"}),"Kelola anggota dengan mudah"]})]}),e.jsx(n,{onClick:()=>p("/subscription"),className:"bg-pink-600 hover:bg-pink-700",children:"Lihat Paket — Rp 149.000/bulan"})]})]})}),u?.hasAccess&&e.jsxs(e.Fragment,{children:[!s&&!w&&u.isOwner&&e.jsxs(c.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"p-6 rounded-xl border border-pink-500/20 bg-white/[0.02]",children:[e.jsx("h2",{className:"text-lg font-semibold mb-3",children:"Buat Grup Keluarga"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Beri nama grup keluarga Anda, lalu undang anggota keluarga."}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(k,{value:m,onChange:a=>b(a.target.value),placeholder:"Nama grup (contoh: Keluarga Budi)",className:"bg-white/5 border-border text-white flex-1"}),e.jsx(n,{onClick:()=>x.mutate({name:m}),disabled:!m||x.isPending,className:"bg-pink-600 hover:bg-pink-700",children:x.isPending?e.jsx(v,{className:"w-4 h-4 animate-spin"}):"Buat Grup"})]})]}),s&&e.jsxs(c.div,{initial:{opacity:0,y:10}
1,animate:{opacity:1,y:0},className:"space-y-6",children:[e.jsxs("div",{className:"p-6 rounded-xl border border-pink-500/20 bg-gradient-to-br from-pink-500/5 to-transparent",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-pink-500/20 flex items-center justify-center",children:e.jsx(h,{className:"w-5 h-5 text-pink-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold text-white",children:s.group?.name||"Grup Keluarga"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.role==="owner"?"Anda adalah pemilik":"Anda adalah anggota"})]})]}),e.jsxs("span",{className:"text-xs px-2 py-1 rounded-full bg-pink-500/10 text-pink-400 border border-pink-500/30",children:[s.members?.filter(a=>a.status==="active").length||0,"/",s.group?.maxMembers||4," anggota"]})]}),s.role==="owner"&&e.jsxs("div",{className:"flex gap-3 mt-4",children:[e.jsx(k,{value:l,onChange:a=>j(a.target.value),placeholder:"Email anggota keluarga",type:"email",className:"bg-white/5 border-border text-white flex-1"}),e.jsx(n,{onClick:()=>g.mutate({email:l}),disabled:!l||g.isPending,className:"bg-pink-600 hover:bg-pink-700",children:g.isPending?e.jsx(v,{className:"w-4 h-4 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"w-4 h-4 mr-1"}),"Undang"]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Anggota Keluarga"}),s.members&&s.members.length>0?s.members.map(a=>e.jsxs(c.div,{className:"p-4 rounded-xl border border-border bg-white/[0.02] flex items-center justify-between",initial:{opacity:0,y:5},animate:{opacity:1,y:0},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-9 h-9 rounded-full flex items-center justify-center ${a.role==="owner"?"bg-amber-500/20":"bg-pink-500/10"}`,children:a.role==="owner"?e.jsx(K,{className:"w-4 h-4 text-amber-400"}):e.jsx(h,{className:"w-4 h-4 text-pink-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-white",children:a.inviteEmail||"Anggota"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.status==="active"?"Aktif":a.status==="pending"?"Menunggu":"Dihapus"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${a.status==="active"?"bg-primary/10 text-primary":a.status==="pending"?"bg-amber-500/10 text-amber-400":"bg-red-500/10 text-red-400"}`,children:a.status==="active"?"✓ Aktif":a.status==="pending"?"⏳ Pending":"✗ Dihapus"}),s.role==="owner"&&a.status!=="removed"&&e.jsx("button",{onClick:()=>M.mutate({memberId:a.id}),className:"text-muted-foreground hover:text-red-400 transition-colors",title:"Hapus anggota",children:e.jsx(U,{className:"w-4 h-4"})})]})]},a.id)):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(h,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"Belum ada anggota"}),e.jsx("p",{className:"text-xs mt-1",children:"Undang anggota keluarga untuk mulai berbagi"})]})]}),s.role==="member"&&e.jsx(n,{variant:"outline",onClick:()=>f.mutate(),disabled:f.isPending,className:"border-red-500/30 text-red-400 hover:bg-red-500/10 w-full",children:"Keluar dari Grup"})]})]})]})]}):e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("h2",{className:"text-xl font-semibold text-white",children:"Login untuk mengakses Keluarga"}),e.jsx(n,{onClick:()=>window.location.href=G(window.location.pathname),className:"bg-pink-600 hover:bg-pink-700",children:"Login Sekarang"})]})})}export{R as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.