Files
humicletter/_next/static/chunks/app/homepage/page-905f9e40506126d1.js
T
2026-06-09 16:51:15 +07:00

1 line
7.8 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[539],{1259:(e,t,s)=>{"use strict";s.d(t,{default:()=>m});var r=s(5155),a=s(2115),l=s(6868),c=s(6046),o=s(1466),n=s(5236),i=s(7401);let d=(0,i.A)("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]),u=(0,i.A)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);function m(){let[e,t]=(0,a.useState)(0),[s,i]=(0,a.useState)(0),{username:m}=(0,l.A)(),[h,x]=(0,a.useState)(!1),[p,g]=(0,a.useState)(!1),[f,b]=(0,a.useState)(!1),v=(0,c.useRouter)();return(0,a.useEffect)(()=>{(async()=>{try{let e=localStorage.getItem("authToken"),s=await fetch("https://cetaksuratkp-api.humicprototyping.com/api/letter",{headers:{Authorization:"Bearer ".concat(e),Accept:"application/json"}}),r=await s.json(),a=r.data;if(Array.isArray(a)){let e=a.filter(e=>"1"===e.is_acceptance).length,s=a.filter(e=>"1"===e.is_completion).length;console.log("Acceptance count:",e),console.log("Completion count:",s),t(e),i(s),console.log(a.map(e=>({id:e.id,is_acceptance:e.is_acceptance,is_completion:e.is_completion})))}else console.error("Unexpected response format",a),console.log("API Response",r)}catch(e){console.error("Failed to fetch letter data:",e)}})()},[]),(0,a.useEffect)(()=>{let e=e=>{let t=e.target;t.closest("#letter-dropdown")||t.closest("#letter-button")||b(!1),t.closest("#profile-dropdown")||t.closest("#profile-button")||g(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]),(0,r.jsxs)("div",{className:"min-h-screen bg-gray-100",children:[(0,r.jsxs)("nav",{className:"bg-white shadow-md px-10 py-4 flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-8",children:[(0,r.jsx)("img",{src:"/logo-humic-text.png",alt:"HUMIC Engineering",className:"h-12 mr-3"}),(0,r.jsxs)("div",{className:"flex space-x-8",children:[(0,r.jsx)("a",{href:"#",className:"text-[#B4262A] font-semibold border-b-2 border-[#B4262A]",children:"Home"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("button",{id:"letter-button",onClick:()=>b(!f),className:"text-gray-700 hover:text-[#B4262A] font-medium cursor-pointer transition duration-300",children:"Letter"}),f&&(0,r.jsxs)("div",{id:"letter-dropdown",className:"absolute mt-2 bg-white shadow-md rounded-md w-48 z-50",children:[(0,r.jsx)("button",{onClick:()=>v.push("/letter/acceptanceletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Acceptance Letter"}),(0,r.jsx)("button",{onClick:()=>v.push("/letter/completionletter"),className:"block w-full text-left px-4 py-2 hover:bg-gray-100",children:"Completion Letter"})]})]})]})]}),(0,r.jsxs)("div",{className:"relative z-50",children:[(0,r.jsx)("button",{id:"profile-button",onClick:()=>g(!p),className:"text-gray-700 hover:text-black cursor-pointer",children:(0,r.jsx)(o.A,{})}),p&&(0,r.jsxs)("div",{id:"profile-dropdown",className:"absolute right-0 mt-2 w-48 bg-white shadow-md rounded-lg",children:[(0,r.jsx)("div",{className:"p-4 bg-gray-100 text-black text-center",children:(0,r.jsx)("p",{className:"font-semibold",children:m||"Guest"})}),(0,r.jsxs)("button",{onClick:async()=>{x(!0),await new Promise(e=>setTimeout(e,1e3)),x(!1),v.push("/login")},disabled:h,className:"w-full flex items-center justify-center px-4 py-2 text-sm text-black hover:bg-gray-200",children:[h?(0,r.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2 text-black",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})]}):(0,r.jsx)(n.A,{className:"mr-2",size:18}),h?"Logging out...":"Log Out"]})]})]})]}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("img",{src:"/assets/background.jpg",className:"w-full h-[320px] object-cover z-0",alt:"Background"}),(0,r.jsx)("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-white text-center",children:(0,r.jsxs)("h1",{className:"text-5xl font-bold drop-shadow-lg",children:["Welcome",m?", ".concat(m):"","!"]})})]}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-6 p-10",children:[(0,r.jsxs)("div",{className:"bg-white shadow-md rounded-lg p-6 col-span-2",children:[(0,r.jsx)("h2",{className:"text-xl font-bold text-black mb-3",children:"Letter Maker"}),(0,r.jsx)("p",{className:"text-gray-600 text-sm leading-relaxed",children:"This platform allows interns at HUMIC Engineering to easily create and manage their internship documents, including acceptance and completion letters, in a fast, accurate, and secure way."})]}),(0,r.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,r.jsxs)("div",{className:"bg-white p-4 rounded-lg shadow-md text-center",children:[(0,r.jsx)(d,{className:"text-yellow-500 text-4xl mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-lg font-bold text-black",children:e}),(0,r.jsx)("p",{className:"text-gray-600 text-sm",children:"Acceptance letter"})]}),(0,r.jsxs)("div",{className:"bg-white p-4 rounded-lg shadow-md text-center",children:[(0,r.jsx)(u,{className:"text-green-500 text-4xl mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-lg font-bold text-black",children:s}),(0,r.jsx)("p",{className:"text-gray-600 text-sm",children:"Completion letter"})]})]})]})]})}},1466:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(7401).A)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},5236:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(7401).A)("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]])},6046:(e,t,s)=>{"use strict";var r=s(6658);s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},6868:(e,t,s)=>{"use strict";s.d(t,{A:()=>o,AuthProvider:()=>c});var r=s(5155),a=s(2115);let l=(0,a.createContext)(void 0);function c(e){let{children:t}=e,[s,c]=(0,a.useState)("");return(0,a.useEffect)(()=>{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);(null==t?void 0:t.name)&&c(t.name)}},[]),(0,r.jsx)(l.Provider,{value:{username:s,setUsername:c,logout:()=>{localStorage.removeItem("authToken"),localStorage.removeItem("user"),c("")}},children:t})}function o(){let e=(0,a.useContext)(l);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}},7401:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(2115);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l=function(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.filter((e,t,s)=>!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim()};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:s="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:n,className:i="",children:d,iconNode:u,...m}=e;return(0,r.createElement)("svg",{ref:t,...c,width:a,height:a,stroke:s,strokeWidth:n?24*Number(o)/Number(a):o,className:l("lucide",i),...m},[...u.map(e=>{let[t,s]=e;return(0,r.createElement)(t,s)}),...Array.isArray(d)?d:[d]])}),n=(e,t)=>{let s=(0,r.forwardRef)((s,c)=>{let{className:n,...i}=s;return(0,r.createElement)(o,{ref:c,iconNode:t,className:l("lucide-".concat(a(e)),n),...i})});return s.displayName="".concat(e),s}},8288:(e,t,s)=>{Promise.resolve().then(s.bind(s,1259))}},e=>{var t=t=>e(e.s=t);e.O(0,[441,587,358],()=>t(8288)),_N_E=e.O()}]);