PageSourceSearch

https://maasy.ai/assets/PortalProjects-j2nGLQHF.js

js maasy.ai collected 2026-09-24 13:54:50 UTC 6,479 bytes, 2 lines download raw bytes

1import{j as e,dp as h,a_ as $,aC as q,az as z,n as w,q as _,u as A,aq as L,dq as H,r as x,Q as F,aH as R,aI as U,p as V,V as G,B as y,dr as K,s as g}from"./index-CuMcGkrh.js";import{u as Q}from"./usePortalTasks-BPTYdbD7.js";import{P as J}from"./PortalRecentActivity-CGmE6WNl.js";import{I as O}from"./images-pOQOCZfC.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new a.Error().stack;n&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[n]="f40db314-4a94-4678-aa6e-362a07f211d4",a._sentryDebugIdIdentifier="sentry-dbid-f40db314-4a94-4678-aa6e-362a07f211d4")}catch{}})();const f=[{bg:"from-primary/15 to-primary/5",text:"text-primary",border:"border-l-primary"},{bg:"from-warning/15 to-warning/5",text:"text-warning",border:"border-l-warning"},{bg:"from-success/15 to-success/5",text:"text-success",border:"border-l-success"},{bg:"from-destructive/15 to-destructive/5",text:"text-destructive",border:"border-l-destructive"}];function W({totalProjects:a,pendingTasks:n,completedTasks:i,overdueTasks:m}){const d=[{label:"Mis Marcas",value:a,icon:h},{label:"Tareas Pendientes",value:n,icon:$},{label:"Completadas",value:i,icon:q},{label:"Vencidas",value:m,icon:z}];return e.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:d.map((r,u)=>e.jsx(w,{className:`border-l-4 ${f[u].border} hover:-translate-y-0.5 transition-all duration-200`,children:e.jsxs(_,{className:"flex items-center gap-4 p-5",children:[e.jsx("div",{className:`flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br ${f[u].bg} ${f[u].text}`,children:e.jsx(r.icon,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold tabular-nums",children:r.value}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r.label})]})]})},r.label))})}function X(){const a=new Date().getHours();return a<12?"Buenos días":a<19?"Buenas tardes":"Buenas noches"}function Y(){return new Date().toLocaleDateString("es-ES",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}function ae(){var b,N;const{session:a,profile:n}=A(),i=(b=a==null?void 0:a.user)==null?void 0:b.id,m=L(),{data:d}=H(),[r,u]=x.useState([]),[k,j]=x.useState(!0),[C,T]=x.useState({}),{tasks:p}=Q();x.useEffect(()=>{if(!i)return;(async()=>{const{data:t}=await g.from("project_access").select("project_id").eq("user_id",i);if(!(t!=null&&t.length)){j(!1);return}const o=t.map(l=>l.project_id),{data:S}=await g.from("projects").select("id, brand_name, industry").in("id",o);u(S||[]);const{data:v}=await g.from("team_tasks").select("id, project_id, status").in("project_id",o);if(v){const l={};v.forEach(c=>{c.project_id&&(l[c.project_id]||(l[c.project_id]={total:0,done:0}),l[c.project_id].total++,c.status==="completed"&&l[c.project_id].done++)}),T(l)}j(!1)})()},[i]);const P=((N=n==null?void 0:n.full_name)==null?void 0:N.split(" ")[0])||"Usuario",D=r.map(s=>s.id),I=p.filter(s=>s.status!=="completed"),B=p.filter(s=>s.status==="completed"),E=new Date,M=p.filter(s=>s.due_date&&new Date(s.due_date)<E&&s.status!=="completed");return k?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(F,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):r.length?e.jsxs("div",{className:"p-6 lg:p-8 space-y-6",children:[e.jsxs("header",{children:[e.jsxs("h1",{className:"text-2xl lg:text-3xl font-bold tracking-tight",children:[X(),", ",P," 👋"]}),e.jsx("p",{className:"text-muted-foreground mt-1 capitalize",children:Y()}),(d==null?void 0:d.welcome_message)&&e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:d.welcome_message})]}),e.jsx(W,{totalProjects:r.length,pendingTasks:I.length,completedTasks:B.length,overdueTasks:M.length}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-5",children:[e.jsx("div",{className:"lg:col-span-3 space-y-4",children:e.jsxs(w,{children:[e.jsx(R,{className:"pb-3",children:e.jsxs(U,{className:"text-lg flex items-center gap-2",children:[e.jsx(h,{className:"h-5 w-5 text-muted-foreground"}),"Mis Marcas (",r.length,")"]})}),e.jsx(_,{className:"space-y-3",children:r.map(s=>{const t=C[s.id];
1return e.jsxs("div",{className:"flex items-start gap-4 rounded-lg border p-4 transition-all duration-200 hover:shadow-premium-sm hover:border-border/80 group cursor-pointer",onClick:()=>m(`/portal/projects/${s.id}`),children:[e.jsx("div",{className:"flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-primary/15 to-accent/10 text-primary font-bold text-sm shadow-sm",children:s.brand_name.split(" ").map(o=>o[0]).join("").toUpperCase().slice(0,2)}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm hover:text-primary transition-colors",children:s.brand_name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.industry||"Marca"})]}),e.jsx(V,{variant:"secondary",children:"Activo"})]}),t&&t.total>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{value:t.done/t.total*100,className:"h-1 flex-1"}),e.jsxs("span",{className:"text-[10px] font-medium text-muted-foreground w-16 text-right tabular-nums",children:[t.done,"/",t.total," tareas"]})]}),t.total-t.done>0&&e.jsxs("span",{className:"text-xs text-warning",children:[t.total-t.done," pendientes"]})]}),e.jsxs("div",{className:"flex gap-1 pt-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsxs(y,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:o=>{o.stopPropagation(),m(`/portal/projects/${s.id}?tab=media`)},children:[e.jsx(O,{className:"mr-1 h-3 w-3"}),"Media"]}),e.jsxs(y,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:o=>{o.stopPropagation(),m(`/portal/projects/${s.id}?tab=tareas`)},children:[e.jsx(K,{className:"mr-1 h-3 w-3"}),"Tareas"]})]})]})]},s.id)})})]})}),e.jsx("div",{className:"lg:col-span-2 space-y-4",children:e.jsx(J,{projectIds:D})})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",children:[e.jsx(h,{className:"h-12 w-12"}),e.jsx("p",{className:"text-sm",children:"No tienes marcas asignadas aún."}),e.jsx("p",{className:"text-xs",children:"Contacta al equipo para obtener acceso."})]})}export{ae as default};
2//# sourceMappingURL=PortalProjects-j2nGLQHF.js.map

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.