PageSourceSearch

https://www.willfitness.id/assets/CheckInCreativeTab-DQEFHzvt.js

js willfitness.id collected 2026-09-24 13:52:21 UTC 8,312 bytes, 1 lines download raw bytes

1import{r as l,j as e,A as p,m as c,d as G,s as $}from"./index-NPOBYjPA.js";import{G as q,C,g as z}from"./CreativeThumbnail-CGVVn8Go.js";import{B as j}from"./button-CTBRpJXq.js";import{C as A,b as E,c as V,a as P}from"./card-BojpQPBq.js";import{B as y}from"./badge-BohgQhcB.js";import{I as U}from"./input-gNqZb-zD.js";import{S as v}from"./spinner-B5mlNFnX.js";import{L as W}from"./list-D6Swzm7b.js";import{S as H}from"./search-C8LAV-JM.js";import{D as _}from"./download-Dv_9d2AN.js";import{I as K}from"./image-DzJyvD8e.js";import{V as O}from"./video-Ckug8lCs.js";import{F as Q}from"./file-text-DjiCt1cM.js";import"./index-QSG77vld.js";import"./ios-spinner-DlCtEzKX.js";const J=a=>{const s=Number(a||0);if(!Number.isFinite(s)||s<=0)return null;if(s<1024)return`${s} B`;const n=s/1024;if(n<1024)return`${n.toFixed(1)} KB`;const d=n/1024;return d<1024?`${d.toFixed(1)} MB`:`${(d/1024).toFixed(1)} GB`},S=a=>{const s=String(a||"").toLowerCase();return s.startsWith("image/")?"image":s.startsWith("video/")?"video":s==="application/pdf"?"pdf":"file"},I=a=>a==="image"?"Gambar":a==="video"?"Video":a==="pdf"?"PDF":"File",B=a=>a==="image"?K:a==="video"?O:Q,M=(a,s)=>{const n=String(a||"").trim();if(n){if(s&&!s.closed){try{s.opener=null}catch{}try{s.location.href=n;return}catch{}}window.location.href=n}};function me({shouldReduceMotion:a}){const[s,n]=l.useState([]),[d,f]=l.useState(!1),[w,h]=l.useState(null),[m,N]=l.useState(null),[b,F]=l.useState(""),[x,D]=l.useState("list"),L=async()=>{f(!0),h(null);try{const{data:t,error:i}=await $.from("creative_assets").select("id,sent_at,description,file_name,content_type,size_bytes").eq("status","sent").order("sent_at",{ascending:!1}).limit(50);if(i)throw i;n(t||[])}catch(t){h((t==null?void 0:t.message)||"Gagal memuat Creative."),n([])}finally{f(!1)}};l.useEffect(()=>{L()},[]);const g=l.useMemo(()=>{const t=String(b||"").trim().toLowerCase();return t?s.filter(i=>`${i.file_name} ${i.description}`.toLowerCase().includes(t)):s},[s,b]),k=async t=>{N(t);const i=window.open("about:blank","_blank");try{const r=await z(t,"original");M(r,i)}catch(r){h((r==null?void 0:r.message)||"Gagal membuka file."),i&&!i.closed&&i.close()}finally{N(null)}};return e.jsx("div",{className:G("p-4 space-y-4",a?"":"animate-in fade-in duration-300"),children:e.jsxs(A,{className:"rounded-[28px] border border-slate-100 bg-white dark:bg-slate-950 shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-blue-50/60 via-white to-white dark:from-blue-500/10 dark:via-slate-950 dark:to-slate-950"}),e.jsxs(E,{className:"relative p-5 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-row items-center justify-between gap-3",children:[e.jsx(V,{className:"text-sm font-black tracking-tight text-slate-900 dark:text-white flex items-center gap-2",children:"Creative"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(j,{type:"button",variant:"outline",className:"h-9 w-9 rounded-2xl p-0",onClick:()=>D(t=>t==="list"?"grid":"list"),children:e.jsx(p,{initial:!1,mode:"wait",children:e.jsx(c.span,{initial:{opacity:0,rotate:-18,scale:.92},animate:{opacity:1,rotate:0,scale:1},exit:{opacity:0,rotate:18,scale:.92},transition:a?{duration:0}:{duration:.18,ease:[.2,.8,.2,1]},className:"inline-flex",children:x==="list"?e.jsx(q,{className:"h-4 w-4"}):e.jsx(W,{className:"h-4 w-4"})},x)})})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(H,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(U,{value:b,onChange:t=>F(t.target.value),className:"h-11 rounded-2xl pl-10 border-slate-200 bg-white/80 dark:bg-slate-950/70",placeholder:"Cari file…"})]})]})]}),e.jsx(P,{className:"p-5 pt-0",children:d?e.jsx("div",{className:"py-10 flex items-center justify-center text-slate-400",children:e.jsx(v,{className:"h-5 w-5"})}):w?e.jsx("div",{className:"py-6 text-center text-xs text-rose-600",children:w}):g.length===0?e.jsx("div",{className:"py-10 text-center text-sm text-slate-500",children:"Belum ada file Creative untuk kamu."}):e.jsx(p,{initial:!1,mode:"wait",children:e.jsx(c.div,{initial:{opacity:0,y:10,filter:"blur(4px)"}
1,animate:{opacity:1,y:0,filter:"blur(0px)"},exit:{opacity:0,y:-10,filter:"blur(4px)"},transition:a?{duration:0}:{duration:.22,ease:[.2,.8,.2,1]},children:x==="grid"?e.jsx(c.div,{layout:!0,className:"grid grid-cols-2 gap-3",children:e.jsx(p,{initial:!1,children:g.map(t=>{const i=S(t.content_type),r=B(i),u=t.sent_at?new Date(String(t.sent_at)):null,o=u?Date.now()-u.getTime()<48*60*60*1e3:!1;return e.jsxs(c.div,{layout:!0,initial:{opacity:0,y:10,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-10,scale:.98},transition:a?{duration:0}:{duration:.18,ease:[.2,.8,.2,1]},className:"rounded-3xl border border-slate-200/70 bg-white dark:bg-slate-950 p-2.5 hover:border-slate-300 hover:bg-slate-50/40 transition-colors",children:[e.jsxs("div",{className:"relative",children:[i==="image"?e.jsx(C,{assetId:t.id,contentType:t.content_type,className:"w-full aspect-square rounded-[20px]"}):e.jsx("div",{className:"w-full aspect-square rounded-[20px] bg-slate-50 dark:bg-slate-900 border border-slate-200/70 dark:border-slate-800 flex items-center justify-center text-slate-700 dark:text-slate-200",children:e.jsx(r,{className:"h-6 w-6"})}),o?e.jsx("div",{className:"absolute top-2 left-2",children:e.jsx(y,{variant:"outline",className:"h-6 rounded-full text-[9px] font-black uppercase tracking-widest border-blue-200 text-blue-700 bg-blue-50",children:"Baru"})}):null]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:I(i)}),e.jsx("div",{className:"mt-0.5 text-sm font-semibold text-slate-900 dark:text-white truncate",children:t.file_name})]}),e.jsx(j,{type:"button",variant:"outline",className:"h-9 w-9 rounded-2xl p-0",onClick:()=>void k(t.id),disabled:m===t.id,children:m===t.id?e.jsx(v,{className:"h-4 w-4"}):e.jsx(_,{className:"h-4 w-4"})})]})]},t.id)})})}):e.jsx(c.div,{layout:!0,className:"space-y-2",children:e.jsx(p,{initial:!1,children:g.map(t=>{const i=J(t.size_bytes),r=S(t.content_type),u=B(r),o=t.sent_at?new Date(String(t.sent_at)):null,T=o?Date.now()-o.getTime()<48*60*60*1e3:!1;return e.jsx(c.div,{layout:!0,initial:{opacity:0,y:10,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-10,scale:.99},transition:a?{duration:0}:{duration:.18,ease:[.2,.8,.2,1]},className:"rounded-3xl border border-slate-200/70 bg-white dark:bg-slate-950 p-3 hover:border-slate-300 hover:bg-slate-50/40 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"shrink-0",children:r==="image"?e.jsx(C,{assetId:t.id,contentType:t.content_type,className:"h-12 w-12"}):e.jsx("div",{className:"h-12 w-12 rounded-2xl bg-slate-50 dark:bg-slate-900 border border-slate-100 dark:border-slate-800 flex items-center justify-center text-slate-700 dark:text-slate-200",children:e.jsx(u,{className:"h-5 w-5"})})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(y,{variant:"outline",className:"h-6 text-[9px] font-black uppercase tracking-widest border-slate-200 text-slate-600 bg-slate-50",children:I(r)}),T?e.jsx(y,{variant:"outline",className:"h-6 text-[9px] font-black uppercase tracking-widest border-blue-200 text-blue-700 bg-blue-50",children:"Baru"}):null,i?e.jsx("span",{className:"text-[10px] text-slate-400 font-medium",children:i}):null,o?e.jsx("span",{className:"text-[10px] text-slate-400 font-medium",children:o.toLocaleString("id-ID",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}):null]}),e.jsx("div",{className:"mt-1 text-sm font-semibold text-slate-900 dark:text-white truncate",children:t.file_name}),e.jsx("div",{className:"mt-1 text-[10px] text-slate-500 truncate",children:t.description})]}),e.jsx(j,{type:"button",variant:"outline",className:"h-10 w-10 rounded-2xl p-0",onClick:()=>void k(t.id),disabled:m===t.id,children:m===t.id?e.jsx(v,{className:"h-4 w-4"}):e.jsx(_,{className:"h-4 w-4"})})]})},t.id)})})})},x)})})]})})}export{me as CheckInCreativeTab};

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.