@funhub/platform 0.2.35 → 0.2.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/biz/business/image-text-recommend/client.mjs +1 -1
- package/dist/components/biz/business/search-history/client.mjs +1 -1
- package/dist/components/biz/business/search-input/client.mjs +1 -1
- package/dist/components/common/media-preview/index.mjs +1 -1
- package/dist/components/pages/login/login-client.mjs +1 -1
- package/dist/components/pages/login/register.mjs +1 -1
- package/dist/components/pages/login/verify.mjs +1 -1
- package/dist/components/pages/search-result/page-client.mjs +1 -1
- package/dist/components/pages/search-result/search-tab.mjs +1 -1
- package/dist/components/pages/search-result/top-header.mjs +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button.d.mts +2 -2
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{formatCompactCount as e}from"../../../../utils/common.mjs";import t from"../../../../utils/get-res-url.mjs";import{pContentBatchGetVideoDetail as n,pContentGetNewstVideoList as r,pContentGetPopularVideoList as i}from"../../../../service/generated/client.mjs";import{pContentBatchGetVideoDetailKey as a,pContentGetNewstVideoListKey as o,pContentGetPopularVideoListKey as s}from"../../../../service/generated/tanstack.mjs";import{Image as c}from"../../../ui/image.mjs";import{Box as l}from"../../../ui/box.mjs";import{Text as u}from"../../../ui/text.mjs";import{IMAGE_TEXT_RECOMMEND_FIXED_BATCH_SIZE as d,buildImageTextRecommendRemoteMap as f,getImageTextRecommendFixedIds as ee,resolveImageTextRecommendVideoId as te}from"../../../../hooks/image-text-recommend.mjs";import{useRequest as p}from"../../../../hooks/query/use-query.mjs";import{normalizeHomeRecommendSmartLayout as ne}from"../home-recommend/shared/home-recommend-smart-layout.mjs";import re from"../../../../assets/images/frame.mjs";import ie from"../../../../assets/images/subscript.mjs";import{buildImageTextSmartListBody as m,resolveImageTextSmartListKind as ae}from"./shared/query.mjs";import{useCallback as h,useEffect as g,useMemo as _,useRef as oe,useState as v}from"react";import{Fragment as se,jsx as y,jsxs as b}from"react/jsx-runtime";import{useTranslations as ce}from"next-intl";import le from"next/link";const x=[];function S(e){return typeof e==`string`?e:e.src}function ue(e,n){if(!e||!e.trim())return S(n);if(e.startsWith(`http`)||e.startsWith(`//`)||e.startsWith(`data:`))return e;let r=t();return r?`${r}${e.startsWith(`/`)?e:`/${e}`}`:e}function C(e){if(e==null)return``;let t=e;return t.img_y||t.media?.img_y||``}function w(e){return e==null?``:e.name||``}function T(e,t=!1){let n=e,r=t?n.type:n.content_type;return typeof r==`number`?r:n.is_more_link===!0||Number(n.episode_cnt||n.episode_count||n.episodes?.length||n.links?.length||0)>1?2:1}function E(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function D(e,t){let n=e,r=n?.links?.length??0;if(!Number.isFinite(r)||r<=0)return``;let i=n.update_status;return t(r,i===0||i===`0`)}function de(e,t,n){return e?T(e,n)===2&&t?D(e,t):E(Number(e.duration??e.detail?.duration??0)):``}function fe(e,t){if(!(e??``).trim())return``;let n=encodeURIComponent((t??``).trim()||``);return`/video/${e.trim()}/${n}/episode/1`}function pe(t,n){if(!t)return``;let r=t,i=n?Number(r.static?.browse_count??0):Number(r.browse_count??0);return!Number.isFinite(i)||i<=0?``:e(i)}function me(){let e=new Date,t=new Date(e);return t.setHours(24,0,0,0),t.getTime()-e.getTime()}function O(e){let{title:t,items:T=x,commonPlayCount:E,commonEpisodes:D,layout:O,mode:k=`renderer`}=e,A=ce(`components.biz.business.imageTextRecommend`),j=k===`renderer`,M=k===`editor`,[N,P]=v({}),[F,I]=v([]),[L,R]=v(0),[z,B]=v(void 0),V=oe(null),H=_(()=>ne(O),[O]),U=H?.enabled===!0,W=_(()=>ae(H?.sortRule),[H?.sortRule]),G=T?.length??0,K=_(()=>ee(T,U),[U,T]),q=_(()=>K.slice(0,d),[K]),J=_(()=>{if(H?.enabled)return m(H,{targetCount:G})},[H,G]),{data:Y}=p(_(()=>!J||!U?[`image-text-recommend`,`smart-idle`]:W===`newest`?o(J):s(J),[J,U,W]),async()=>!J||!U?{data:{videos:[],cursor:``}}:W===`newest`?r(J):i(J),{enabled:j&&!M&&U&&T.length>0&&!!J,staleTime:1/0}),{data:X}=p(a({ids:q}),()=>n({ids:q}),{enabled:j&&!M&&!U&&q.length>0,staleTime:1/0}),Z=_(()=>U&&G>d?Math.ceil(G/d):K.length>0?Math.ceil(K.length/d):0,[U,G,K.length]),Q=h((e,t)=>A(t?`updatedTo`:`allEpisodes`,{count:e}),[A]),he=h(async(e,t)=>{if(e.length===0)return;let r=f((await n({ids:e})).data?.videos??[]);P(e=>t?{...e,...r}:r)},[]);g(()=>{if(M)return;if(U){let e=Y?.data?.videos??[];G>d?(I(e.slice(0,d)),B(Y?.data?.cursor),R(e.length>0?1:0)):(I(e.slice(0,G)),R(0)),P({});return}if(q.length===0){P({}),I([]),R(0),B(void 0);return}let e=X?.data?.videos??[];P(f(e)),I([]),B(void 0),R(e.length>0?1:0)},[M,U,Y,X,q,G]),g(()=>{if(M||Z<1||L<1||L>=Z)return;let e=V.current;if(!e)return;let t=new IntersectionObserver(e=>{let[t]=e;if(!t?.isIntersecting)return;let n=L;if(U&&H){let e=m(H,{targetCount:G,cursor:z,pageSize:d});(W===`newest`?r:i)(e).then(e=>{let t=e.data?.videos??[];I(e=>[...e,...t.slice(0,d)]),B(e.data?.cursor),R(n+1)}).catch(()=>{})}else{let e=n*d,t=K.slice(e,e+d);t.length>0&&(he(t,!0),R(n+1))}},{root:null,rootMargin:`0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[M,U,H,W,K,L,Z,G,z,he]),g(()=>{if(M||!U||!H||G<=0)return;let e=H,t,n=!1;function a(){t=window.setTimeout(()=>{let t=m(e,{targetCount:G,pageSize:Math.max(20,G*10)});(W===`newest`?r:i)(t).then(e=>{n||I((e.data?.videos??[]).slice(0,G))}).catch(()=>{n||I([])}).finally(()=>{n||a()})},me())}return a(),()=>{n=!0,t!==void 0&&window.clearTimeout(t)}},[M,U,H,W,G]);let $=_(()=>!T||T.length===0?x:M?T:U&&G>d?T.slice(0,F.length):T,[T,M,U,G,F.length]),ge=_(()=>$.length?$.map((e,t)=>{let n=String(e?.contentId??``).trim(),r=U?F[t]:n?N[n]:void 0,i=U?r?w(r):(e?.title??``).trim():(e?.title??``).trim()||(r?w(r):``),a=(e?.cover??``).trim(),o=U?C(r)||a:a||(e?.useVideoPoster?C(r):``),s=U&&String(r?.description??r?.content_description??``).trim()||(e?.contentDescription??``).trim(),c=de(r,Q,U),l=pe(r,U);return{...e,contentId:n||(r?te(r):``),title:i,cover:o,contentDescription:s,episodeOrDurationText:c,playCountText:l}}):x,[Q,U,$,N,F]);if(!T||T.length===0)return null;let _e=L>=1&&L<Z?U?F.length-2:L*d-2:-1;return b(l,{className:M?`bg-bg1 no-vw-x-16 py-
|
|
2
|
+
"use client";import{formatCompactCount as e}from"../../../../utils/common.mjs";import t from"../../../../utils/get-res-url.mjs";import{pContentBatchGetVideoDetail as n,pContentGetNewstVideoList as r,pContentGetPopularVideoList as i}from"../../../../service/generated/client.mjs";import{pContentBatchGetVideoDetailKey as a,pContentGetNewstVideoListKey as o,pContentGetPopularVideoListKey as s}from"../../../../service/generated/tanstack.mjs";import{Image as c}from"../../../ui/image.mjs";import{Box as l}from"../../../ui/box.mjs";import{Text as u}from"../../../ui/text.mjs";import{IMAGE_TEXT_RECOMMEND_FIXED_BATCH_SIZE as d,buildImageTextRecommendRemoteMap as f,getImageTextRecommendFixedIds as ee,resolveImageTextRecommendVideoId as te}from"../../../../hooks/image-text-recommend.mjs";import{useRequest as p}from"../../../../hooks/query/use-query.mjs";import{normalizeHomeRecommendSmartLayout as ne}from"../home-recommend/shared/home-recommend-smart-layout.mjs";import re from"../../../../assets/images/frame.mjs";import ie from"../../../../assets/images/subscript.mjs";import{buildImageTextSmartListBody as m,resolveImageTextSmartListKind as ae}from"./shared/query.mjs";import{useCallback as h,useEffect as g,useMemo as _,useRef as oe,useState as v}from"react";import{Fragment as se,jsx as y,jsxs as b}from"react/jsx-runtime";import{useTranslations as ce}from"next-intl";import le from"next/link";const x=[];function S(e){return typeof e==`string`?e:e.src}function ue(e,n){if(!e||!e.trim())return S(n);if(e.startsWith(`http`)||e.startsWith(`//`)||e.startsWith(`data:`))return e;let r=t();return r?`${r}${e.startsWith(`/`)?e:`/${e}`}`:e}function C(e){if(e==null)return``;let t=e;return t.img_y||t.media?.img_y||``}function w(e){return e==null?``:e.name||``}function T(e,t=!1){let n=e,r=t?n.type:n.content_type;return typeof r==`number`?r:n.is_more_link===!0||Number(n.episode_cnt||n.episode_count||n.episodes?.length||n.links?.length||0)>1?2:1}function E(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function D(e,t){let n=e,r=n?.links?.length??0;if(!Number.isFinite(r)||r<=0)return``;let i=n.update_status;return t(r,i===0||i===`0`)}function de(e,t,n){return e?T(e,n)===2&&t?D(e,t):E(Number(e.duration??e.detail?.duration??0)):``}function fe(e,t){if(!(e??``).trim())return``;let n=encodeURIComponent((t??``).trim()||``);return`/video/${e.trim()}/${n}/episode/1`}function pe(t,n){if(!t)return``;let r=t,i=n?Number(r.static?.browse_count??0):Number(r.browse_count??0);return!Number.isFinite(i)||i<=0?``:e(i)}function me(){let e=new Date,t=new Date(e);return t.setHours(24,0,0,0),t.getTime()-e.getTime()}function O(e){let{title:t,items:T=x,commonPlayCount:E,commonEpisodes:D,layout:O,mode:k=`renderer`}=e,A=ce(`components.biz.business.imageTextRecommend`),j=k===`renderer`,M=k===`editor`,[N,P]=v({}),[F,I]=v([]),[L,R]=v(0),[z,B]=v(void 0),V=oe(null),H=_(()=>ne(O),[O]),U=H?.enabled===!0,W=_(()=>ae(H?.sortRule),[H?.sortRule]),G=T?.length??0,K=_(()=>ee(T,U),[U,T]),q=_(()=>K.slice(0,d),[K]),J=_(()=>{if(H?.enabled)return m(H,{targetCount:G})},[H,G]),{data:Y}=p(_(()=>!J||!U?[`image-text-recommend`,`smart-idle`]:W===`newest`?o(J):s(J),[J,U,W]),async()=>!J||!U?{data:{videos:[],cursor:``}}:W===`newest`?r(J):i(J),{enabled:j&&!M&&U&&T.length>0&&!!J,staleTime:1/0}),{data:X}=p(a({ids:q}),()=>n({ids:q}),{enabled:j&&!M&&!U&&q.length>0,staleTime:1/0}),Z=_(()=>U&&G>d?Math.ceil(G/d):K.length>0?Math.ceil(K.length/d):0,[U,G,K.length]),Q=h((e,t)=>A(t?`updatedTo`:`allEpisodes`,{count:e}),[A]),he=h(async(e,t)=>{if(e.length===0)return;let r=f((await n({ids:e})).data?.videos??[]);P(e=>t?{...e,...r}:r)},[]);g(()=>{if(M)return;if(U){let e=Y?.data?.videos??[];G>d?(I(e.slice(0,d)),B(Y?.data?.cursor),R(e.length>0?1:0)):(I(e.slice(0,G)),R(0)),P({});return}if(q.length===0){P({}),I([]),R(0),B(void 0);return}let e=X?.data?.videos??[];P(f(e)),I([]),B(void 0),R(e.length>0?1:0)},[M,U,Y,X,q,G]),g(()=>{if(M||Z<1||L<1||L>=Z)return;let e=V.current;if(!e)return;let t=new IntersectionObserver(e=>{let[t]=e;if(!t?.isIntersecting)return;let n=L;if(U&&H){let e=m(H,{targetCount:G,cursor:z,pageSize:d});(W===`newest`?r:i)(e).then(e=>{let t=e.data?.videos??[];I(e=>[...e,...t.slice(0,d)]),B(e.data?.cursor),R(n+1)}).catch(()=>{})}else{let e=n*d,t=K.slice(e,e+d);t.length>0&&(he(t,!0),R(n+1))}},{root:null,rootMargin:`0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[M,U,H,W,K,L,Z,G,z,he]),g(()=>{if(M||!U||!H||G<=0)return;let e=H,t,n=!1;function a(){t=window.setTimeout(()=>{let t=m(e,{targetCount:G,pageSize:Math.max(20,G*10)});(W===`newest`?r:i)(t).then(e=>{n||I((e.data?.videos??[]).slice(0,G))}).catch(()=>{n||I([])}).finally(()=>{n||a()})},me())}return a(),()=>{n=!0,t!==void 0&&window.clearTimeout(t)}},[M,U,H,W,G]);let $=_(()=>!T||T.length===0?x:M?T:U&&G>d?T.slice(0,F.length):T,[T,M,U,G,F.length]),ge=_(()=>$.length?$.map((e,t)=>{let n=String(e?.contentId??``).trim(),r=U?F[t]:n?N[n]:void 0,i=U?r?w(r):(e?.title??``).trim():(e?.title??``).trim()||(r?w(r):``),a=(e?.cover??``).trim(),o=U?C(r)||a:a||(e?.useVideoPoster?C(r):``),s=U&&String(r?.description??r?.content_description??``).trim()||(e?.contentDescription??``).trim(),c=de(r,Q,U),l=pe(r,U);return{...e,contentId:n||(r?te(r):``),title:i,cover:o,contentDescription:s,episodeOrDurationText:c,playCountText:l}}):x,[Q,U,$,N,F]);if(!T||T.length===0)return null;let _e=L>=1&&L<Z?U?F.length-2:L*d-2:-1;return b(l,{className:M?`bg-bg1 no-vw-x-16 py-[16px] pointer-events-none`:`bg-bg1 no-vw-x-16 py-[16px]`,children:[t&&y(l,{className:`mb-3 flex items-center justify-between`,children:y(u,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:t})}),y(l,{className:`flex overflow-x-auto pb-2 scrollbar-hide space-x-2`,children:ge.map((e,t)=>{let n=E||(e.showPlayCount??!1),r=(e.playCountText??``).trim(),i=r!==``,a=D||(e.showEpisodes??!1),o=(e.episodeOrDurationText??``).trim(),s=a&&o!==``,d=k===`renderer`?fe(e.contentId??``,e.title??``):``,f=b(se,{children:[b(l,{className:`relative rounded-lg overflow-hidden bg-bg2 w-[116px] h-[134px]`,children:[M||e.cover?y(c,{src:ue(e.cover,re),alt:e.title??``,fill:!0,className:`object-cover`}):y(l,{className:`w-full h-full flex items-center justify-center`,children:y(u,{className:`text-text3 text-xs`,children:A(`noCover`)})}),!U&&(e.badge??``).trim()?y(l,{className:`absolute top-0 right-0 w-8 h-8`,children:y(c,{src:(e.badge??``).trim()||S(ie),alt:``,fill:!0,sizes:`32px`,className:`object-contain object-right-top`,unoptimized:!0})}):null,b(l,{className:`absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pb-1 pt-3 px-1 flex justify-between items-center gap-1`,children:[y(l,{className:`flex items-center min-w-0 shrink`,children:n&&i?b(l,{className:`flex items-center gap-1 rounded bg-overlay px-1 py-0`,children:[y(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`10`,viewBox:`0 0 12 10`,fill:`none`,className:`shrink-0`,"aria-hidden":!0,children:y(`path`,{d:`M7.56 5.18437L5.013 6.56737C4.893 6.63337 4.761 6.66937 4.638 6.66937C4.269 6.66937 4.002 6.38737 4.002 5.99737V3.28237C4.002 2.89237 4.269 2.61037 4.638 2.61037C4.764 2.61037 4.893 2.64637 5.013 2.70937L7.572 4.09237C7.803 4.21837 7.938 4.41637 7.938 4.63237C7.938 4.85137 7.8 5.05537 7.56 5.18437ZM9.807 9.27637L2.133 8.52937C0.954 8.52937 0 7.57537 0 6.39637V2.79937C0 1.62037 0.954 0.666368 2.133 0.666368L9.81 0.000367165C10.989 0.000367165 11.943 0.954367 11.943 2.13337V7.14337C11.9422 7.70935 11.7168 8.25188 11.3163 8.65181C10.9158 9.05174 10.373 9.27637 9.807 9.27637ZM10.875 2.13337C10.875 1.99351 10.8475 1.85502 10.7939 1.72581C10.7404 1.5966 10.662 1.47919 10.5631 1.3803C10.4642 1.2814 10.3468 1.20296 10.2176 1.14944C10.0883 1.09591 9.94986 1.06837 9.81 1.06837L2.133 1.73437C1.99314 1.73437 1.85465 1.76191 1.72544 1.81544C1.59623 1.86896 1.47883 1.9474 1.37993 2.0463C1.28104 2.14519 1.20259 2.2626 1.14907 2.39181C1.09555 2.52102 1.068 2.65951 1.068 2.79937V6.39637C1.068 6.67882 1.1802 6.94971 1.37993 7.14944C1.57966 7.34916 1.85054 7.46137 2.133 7.46137L9.807 8.20837C9.94686 8.20837 10.0853 8.18082 10.2146 8.1273C10.3438 8.07378 10.4612 7.99533 10.5601 7.89644C10.659 7.79754 10.7374 7.68014 10.7909 7.55093C10.8445 7.42171 10.872 7.28323 10.872 7.14337V2.13337H10.875Z`,fill:`white`})}),y(u,{className:`text-white text-[12px] leading-[20px]`,children:r})]}):null}),y(l,{className:`flex items-center shrink-0`,children:s?y(u,{className:`text-white text-[12px] leading-[20px]`,children:o}):null})]})]}),y(l,{className:`mt-2 py-2`,children:y(u,{className:`text-[16px] text-text1 font-bold leading-[24px] line-clamp-1`,children:e.title})})]});return y(l,{ref:t===_e?V:void 0,className:`flex-shrink-0 w-[116px]`,children:d?y(le,{href:d,className:`block`,children:f}):f},t)})})]})}export{O as ImageTextRecommendClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import e from"../../../../utils/event-bus.mjs";import{useUserStore as t}from"../../../../store/modules/user-store.mjs";import{trackKeywordClick as n}from"../../../../utils/tracking.mjs";import{useRouter as r}from"../../../../utils/use-compatible-router.mjs";import{Box as i}from"../../../ui/box.mjs";import{Text as a}from"../../../ui/text.mjs";import{eventKey as o}from"../../../../constants/event-key.mjs";import{useSearchHistory as s}from"../../../../hooks/use-search-history.mjs";import{DeleteConfirmDialog as c}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{DeleteIcon as l}from"../../../common/icons/delete.mjs";import{usePathname as u,useSearchParams as d}from"next/navigation";import{useLayoutEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";function v(e,t){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function y(y){let{title:b,rows:x=2,clearText:S,confirmDescription:C,onHistoryClick:w,mode:T=`renderer`}=y,E=T===`editor`,D=b??`搜索历史`,O=S??`清空`,k=C??`确定要清除所有搜索历史吗?`,A=p(()=>[`海市蜃楼`,`迷雾追凶`,`夜行者`,`狂飙`,`三大队`,`破冰行动`],[]),[j,M]=h(!1),[N,P]=h(null),F=m(null),I=m([]),L=m(null),R=r(),z=u(),B=d(),{userInfo:V}=t(),{history:H,addHistory:U,clearHistory:W}=s({storageKey:V?.user_id||`guest`}),G=()=>{W(),M(!1),e.emit(o.SEARCH_HISTORY_UPDATE)},K=p(()=>(H.length?H:T===`editor`?A:[]).slice(0,x*10),[H,T,A,x]);if(f(()=>{if(K.length===0){P(null);return}let e=F.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=[];I.current.slice(0,K.length).forEach(e=>{if(!e)return;let r=e.getBoundingClientRect(),i=Math.round(r.top-t.top),a=Math.round(r.bottom-t.top),o=n.find(e=>Math.abs(e.top-i)<=1);if(o){o.bottom=Math.max(o.bottom,a);return}n.push({top:i,bottom:a})}),n.sort((e,t)=>e.top-t.top);let r=n.slice(0,x).reduce((e,t)=>Math.max(e,t.bottom),0);P(e=>e===r?e:r)},n=()=>{L.current!=null&&cancelAnimationFrame(L.current),L.current=requestAnimationFrame(()=>{L.current=null,t()})};if(n(),typeof ResizeObserver>`u`)return()=>{L.current!=null&&(cancelAnimationFrame(L.current),L.current=null)};let r=new ResizeObserver(()=>{n()});return r.observe(e),I.current.slice(0,K.length).forEach(e=>{e&&r.observe(e)}),()=>{r.disconnect(),L.current!=null&&(cancelAnimationFrame(L.current),L.current=null)}},[K,x]),K.length===0)return null;let q=(e,t)=>{if(n({keyword:e,click_item_id:``,click_item_type_key:``,click_item_type_name:``,click_position:t,search_trace_id:``}),U(e),w){w(e);return}let r=new URLSearchParams(B.toString());r.set(`q`,e);let i=z.includes(`/search-result`)?z:`/search-result`;R.push(`${i}?${r.toString()}`)};return _(i,{className:E?`mt-[24px] no-vw-x-16 py-[16px]`:`mt-[24px] no-vw-x-16 py-0`,children:[_(i,{className:`mb-[15px] flex items-center justify-between`,children:[g(a,{className:`font-['PingFang_SC'] text-[16px] font-medium not-italic leading-normal text-white`,children:D}),g(`button`,{type:`button`,"aria-label":O,className:`flex h-[24px] w-[24px] shrink-0 items-center justify-center text-white/50`,onClick:()=>M(!0),children:g(l,{className:`h-[24px] w-[24px]`})})]}),g(i,{ref:F,className:`flex flex-wrap content-start items-center gap-[6px] overflow-hidden`,style:N?{maxHeight:`${N}px`}:void 0,children:K.map((e,t)=>g(i,{ref:e=>{I.current[t]=e},className:`flex min-w-[56px] cursor-pointer items-center justify-center rounded-full px-[8px] py-[4px] ${E?`bg-[#1F1F1F]/10`:`bg-white/20`}`,onClick:()=>q(e,t),children:g(a,{className:`max-w-full whitespace-nowrap font-['PingFang_SC'] text-[14px] font-normal not-italic leading-[20px] text-white`,children:v(e,8)})},t))}),g(c,{open:j,onOpenChange:M,onConfirm:G,title:``,description:k})]})}export{y as SearchHistoryClient};
|
|
2
|
+
"use client";import e from"../../../../utils/event-bus.mjs";import{useUserStore as t}from"../../../../store/modules/user-store.mjs";import{trackKeywordClick as n}from"../../../../utils/tracking.mjs";import{useRouter as r}from"../../../../utils/use-compatible-router.mjs";import{Box as i}from"../../../ui/box.mjs";import{Text as a}from"../../../ui/text.mjs";import{eventKey as o}from"../../../../constants/event-key.mjs";import{useSearchHistory as s}from"../../../../hooks/use-search-history.mjs";import{DeleteConfirmDialog as c}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{DeleteIcon as l}from"../../../common/icons/delete.mjs";import{usePathname as u,useSearchParams as d}from"next/navigation";import{useLayoutEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";function v(e,t){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function y(y){let{title:b,rows:x=2,clearText:S,confirmDescription:C,onHistoryClick:w,mode:T=`renderer`}=y,E=T===`editor`,D=b??`搜索历史`,O=S??`清空`,k=C??`确定要清除所有搜索历史吗?`,A=p(()=>[`海市蜃楼`,`迷雾追凶`,`夜行者`,`狂飙`,`三大队`,`破冰行动`],[]),[j,M]=h(!1),[N,P]=h(null),F=m(null),I=m([]),L=m(null),R=r(),z=u(),B=d(),{userInfo:V}=t(),{history:H,addHistory:U,clearHistory:W}=s({storageKey:V?.user_id||`guest`}),G=()=>{W(),M(!1),e.emit(o.SEARCH_HISTORY_UPDATE)},K=p(()=>(H.length?H:T===`editor`?A:[]).slice(0,x*10),[H,T,A,x]);if(f(()=>{if(K.length===0){P(null);return}let e=F.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=[];I.current.slice(0,K.length).forEach(e=>{if(!e)return;let r=e.getBoundingClientRect(),i=Math.round(r.top-t.top),a=Math.round(r.bottom-t.top),o=n.find(e=>Math.abs(e.top-i)<=1);if(o){o.bottom=Math.max(o.bottom,a);return}n.push({top:i,bottom:a})}),n.sort((e,t)=>e.top-t.top);let r=n.slice(0,x).reduce((e,t)=>Math.max(e,t.bottom),0);P(e=>e===r?e:r)},n=()=>{L.current!=null&&cancelAnimationFrame(L.current),L.current=requestAnimationFrame(()=>{L.current=null,t()})};if(n(),typeof ResizeObserver>`u`)return()=>{L.current!=null&&(cancelAnimationFrame(L.current),L.current=null)};let r=new ResizeObserver(()=>{n()});return r.observe(e),I.current.slice(0,K.length).forEach(e=>{e&&r.observe(e)}),()=>{r.disconnect(),L.current!=null&&(cancelAnimationFrame(L.current),L.current=null)}},[K,x]),K.length===0)return null;let q=(e,t)=>{if(n({keyword:e,click_item_id:``,click_item_type_key:``,click_item_type_name:``,click_position:t,search_trace_id:``}),U(e),w){w(e);return}let r=new URLSearchParams(B.toString());r.set(`q`,e);let i=z.includes(`/search-result`)?z:`/search-result`;R.push(`${i}?${r.toString()}`)};return _(i,{className:E?`mt-[24px] no-vw-x-16 py-[16px]`:`mt-[24px] no-vw-x-16 py-0 pb-[16px]`,children:[_(i,{className:`mb-[15px] flex items-center justify-between`,children:[g(a,{className:`font-['PingFang_SC'] text-[16px] font-medium not-italic leading-normal text-white`,children:D}),g(`button`,{type:`button`,"aria-label":O,className:`flex h-[24px] w-[24px] shrink-0 items-center justify-center text-white/50`,onClick:()=>M(!0),children:g(l,{className:`h-[24px] w-[24px]`})})]}),g(i,{ref:F,className:`flex flex-wrap content-start items-center gap-[6px] overflow-hidden`,style:N?{maxHeight:`${N}px`}:void 0,children:K.map((e,t)=>g(i,{ref:e=>{I.current[t]=e},className:`flex min-w-[56px] cursor-pointer items-center justify-center rounded-full px-[8px] py-[4px] ${E?`bg-[#1F1F1F]/10`:`bg-white/20`}`,onClick:()=>q(e,t),children:g(a,{className:`max-w-full whitespace-nowrap font-['PingFang_SC'] text-[14px] font-normal not-italic leading-[20px] text-white`,children:v(e,8)})},t))}),g(c,{open:j,onOpenChange:M,onConfirm:G,title:``,description:k})]})}export{y as SearchHistoryClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useRouter as e}from"../../../../utils/use-compatible-router.mjs";import{Box as t}from"../../../ui/box.mjs";import{Input as n}from"../../../ui/input.mjs";import{LeftArrowIcon as r}from"../../../common/icons/left-arrow.mjs";import i from"../../../../assets/icons/search.mjs";import a from"../../../../assets/icons/clear.mjs";import{usePathname as o,useSearchParams as s}from"next/navigation";import{useCallback as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";function f(e){if(!e||typeof e!=`string`)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.map(e=>e==null?``:String(e).trim()).filter(Boolean):[]}catch{return[]}}function p(p){let{placeholder:m,defaultPlaceholder:h,searchLabel:g,storageKey:_=`guest`,onSearch:v,mode:y=`renderer`}=p,b=m||(h??`请输入搜索内容`),x=g??`搜索`,S=y===`editor`,[C,w]=l(``),T=e(),E=o(),D=s(),O=`search_history_${_}`,k=c(e=>{if(S)return;let t=e.trim();if(t){try{let e=[t,...f(localStorage.getItem(O)).filter(e=>e!==t)].slice(0,20);localStorage.setItem(O,JSON.stringify(e))}catch(e){console.error(`Failed to save search history`,e)}if(v)v(t);else{let e=new URLSearchParams(D.toString());e.set(`q`,t);let n=E.includes(`/search-result`)?E:`/search-result`;T.push(`${n}?${e.toString()}`)}}},[O,S,v,E,T,D]),A=()=>{S||T.back()};return d(t,{className:`flex h-[66px] w-full items-center gap-[8px] no-vw-x-16 py-[16px]${S?` pointer-events-none`:``}`,children:[u(`button`,{type:`button`,"aria-label":`返回`,className:`flex size-[24px] shrink-0 items-center justify-center text-white active:opacity-70`,onClick:A,children:u(r,{className:`h-[16px] w-[16px]`})}),
|
|
2
|
+
"use client";import{useRouter as e}from"../../../../utils/use-compatible-router.mjs";import{Box as t}from"../../../ui/box.mjs";import{Input as n}from"../../../ui/input.mjs";import{LeftArrowIcon as r}from"../../../common/icons/left-arrow.mjs";import i from"../../../../assets/icons/search.mjs";import a from"../../../../assets/icons/clear.mjs";import{usePathname as o,useSearchParams as s}from"next/navigation";import{useCallback as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";function f(e){if(!e||typeof e!=`string`)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.map(e=>e==null?``:String(e).trim()).filter(Boolean):[]}catch{return[]}}function p(p){let{placeholder:m,defaultPlaceholder:h,searchLabel:g,storageKey:_=`guest`,onSearch:v,mode:y=`renderer`}=p,b=m||(h??`请输入搜索内容`),x=g??`搜索`,S=y===`editor`,[C,w]=l(``),T=e(),E=o(),D=s(),O=`search_history_${_}`,k=c(e=>{if(S)return;let t=e.trim();if(t){try{let e=[t,...f(localStorage.getItem(O)).filter(e=>e!==t)].slice(0,20);localStorage.setItem(O,JSON.stringify(e))}catch(e){console.error(`Failed to save search history`,e)}if(v)v(t);else{let e=new URLSearchParams(D.toString());e.set(`q`,t);let n=E.includes(`/search-result`)?E:`/search-result`;T.push(`${n}?${e.toString()}`)}}},[O,S,v,E,T,D]),A=()=>{S||T.back()};return d(t,{className:`flex h-[66px] w-full items-center gap-[8px] no-vw-x-16 py-[16px]${S?` pointer-events-none`:``}`,children:[u(`button`,{type:`button`,"aria-label":`返回`,className:`flex size-[24px] shrink-0 items-center justify-center text-white active:opacity-70`,onClick:A,children:u(r,{className:`h-[16px] w-[16px]`})}),u(t,{className:`flex h-[34px] min-w-0 flex-1 items-stretch overflow-hidden rounded-full p-[1px]`,style:{background:`linear-gradient(90deg, rgba(230,42,255,0.9) 0%, rgba(239,255,69,0.5) 25%, rgba(233,69,255,0.8) 50%, rgba(233,69,255,0.9) 100%)`},children:d(t,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 items-center overflow-hidden rounded-full bg-black backdrop-blur-[2px]`,children:[d(t,{className:`relative flex h-full min-w-0 flex-1 items-center pl-[12px] pr-[10px]`,children:[u(`span`,{className:`pointer-events-none absolute inset-y-0 left-[12px] flex items-center justify-center`,children:u(i,{className:`h-[14px] w-[14px] text-white/60`})}),u(n,{className:`!h-[20px] !w-full !rounded-none !border-0 !bg-transparent !px-0 !pl-[22px] !pr-[18px] !py-0 !text-[14px] !leading-[20px] !text-white !caret-white placeholder:!text-white/90 focus-visible:!ring-0`,placeholder:b,value:C,maxLength:128,onChange:e=>w(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),k(C))}}),C&&u(`span`,{className:`absolute inset-y-0 right-0 flex items-center justify-center`,children:u(a,{className:`h-[15px] w-[15px] shrink-0 cursor-pointer text-white/50 active:opacity-70`,onClick:()=>w(``)})})]}),u(`button`,{type:`button`,className:`mx-[2px] flex h-[30px] w-[56px] shrink-0 items-center justify-center rounded-[100px] bg-[linear-gradient(90deg,#9756E3_0%,#6C43EE_100%)] text-[14px] leading-[20px] text-white active:opacity-90`,onClick:()=>k(C),children:x})]})})]})}export{p as SearchInputClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../utils/cn.mjs";import{Image as t}from"../../ui/image.mjs";import{Carousel as n,CarouselContent as r,CarouselItem as i,CarouselNext as a,CarouselPrevious as o}from"../../ui/carousel.mjs";import{Dialog as s,DialogContent as c}from"../../ui/dialog.mjs";import{CloseIcon as l}from"../../../assets/icons/close-icon.mjs";import{useMediaPreviewStore as u}from"../../../store/modules/media-preview-store.mjs";import{VideoPlay as d}from"./video-play.mjs";import{useEffect as f,useRef as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";function _(){let{openWithMediaList:e,close:t,setOpen:n}=u();function r(t,n=0){e(t,n)}return{open:r,close:t,setOpen:n}}function v(_){let{className:v}=_,{isOpen:y,setOpen:b,close:x,mediaList:S,startIndex:C,setStartIndex:w}=u(),[T,E]=m(null),[D,O]=m(null),[k,A]=m(0),j=p(!1);if(f(()=>{y||!S.length||x()},[x,y,S.length]),f(()=>{y&&!j.current&&(O(C),A(e=>e+1)),!y&&j.current&&O(null),j.current=y},[y,S.length,C]),f(()=>{if(!y||!T||!S.length)return;let e=Math.min(Math.max(C,0),Math.max(S.length-1,0));T.selectedScrollSnap()!==e&&T.scrollTo(e,!0)},[T,y,C,S.length]),f(()=>{if(!T||!S.length||!y)return;function e(){T&&w(T.selectedScrollSnap())}return T.on(`select`,e),T.on(`reInit`,e),()=>{T.off(`select`,e),T.off(`reInit`,e)}},[T,y,w,S.length]),!S.length&&!y)return null;function M(e){if(e){b(!0);return}x()}function N(){x()}function P(e){e.stopPropagation()}return h(s,{open:y,onOpenChange:M,children:g(c,{showCloseButton:!1,className:e(`border-none z-[10000] flex h-screen w-screen max-w-none items-center justify-center rounded-none bg-black text-white`,v),onClick:P,children:[g(`div`,{className:`absolute left-0 right-0 w-full flex justify-between items-center top-[calc(env(safe-
|
|
2
|
+
"use client";import{cn as e}from"../../../utils/cn.mjs";import{Image as t}from"../../ui/image.mjs";import{Carousel as n,CarouselContent as r,CarouselItem as i,CarouselNext as a,CarouselPrevious as o}from"../../ui/carousel.mjs";import{Dialog as s,DialogContent as c}from"../../ui/dialog.mjs";import{CloseIcon as l}from"../../../assets/icons/close-icon.mjs";import{useMediaPreviewStore as u}from"../../../store/modules/media-preview-store.mjs";import{VideoPlay as d}from"./video-play.mjs";import{useEffect as f,useRef as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";function _(){let{openWithMediaList:e,close:t,setOpen:n}=u();function r(t,n=0){e(t,n)}return{open:r,close:t,setOpen:n}}function v(_){let{className:v}=_,{isOpen:y,setOpen:b,close:x,mediaList:S,startIndex:C,setStartIndex:w}=u(),[T,E]=m(null),[D,O]=m(null),[k,A]=m(0),j=p(!1);if(f(()=>{y||!S.length||x()},[x,y,S.length]),f(()=>{y&&!j.current&&(O(C),A(e=>e+1)),!y&&j.current&&O(null),j.current=y},[y,S.length,C]),f(()=>{if(!y||!T||!S.length)return;let e=Math.min(Math.max(C,0),Math.max(S.length-1,0));T.selectedScrollSnap()!==e&&T.scrollTo(e,!0)},[T,y,C,S.length]),f(()=>{if(!T||!S.length||!y)return;function e(){T&&w(T.selectedScrollSnap())}return T.on(`select`,e),T.on(`reInit`,e),()=>{T.off(`select`,e),T.off(`reInit`,e)}},[T,y,w,S.length]),!S.length&&!y)return null;function M(e){if(e){b(!0);return}x()}function N(){x()}function P(e){e.stopPropagation()}return h(s,{open:y,onOpenChange:M,children:g(c,{showCloseButton:!1,className:e(`border-none z-[10000] flex h-screen w-screen max-w-none items-center justify-center rounded-none bg-black text-white`,v),onClick:P,children:[g(`div`,{className:`absolute left-0 right-0 w-full flex justify-between items-center top-[calc(env(--safe-top-offset)+60px)] z-[999] rounded-full bg-black/60 px-3 py-1 text-xs text-white`,children:[h(`div`,{className:`text-white`,children:`${C+1}/${S.length}`}),h(l,{className:`h-[12px] w-[12px] text-white`,onClick:N})]}),g(n,{className:e(`w-full`),opts:{loop:!1,startIndex:C},setApi:E,children:[h(r,{className:`will-change-transform`,children:S.map((n,r)=>h(i,{className:`will-change-transform`,children:h(`div`,{className:`relative h-[70vh] w-full overflow-hidden rounded-lg will-change-transform transform-gpu`,children:n.type===`video`?h(d,{url:n.src,cover:n.cover,isActive:r===C,autoPlayMuted:n.autoPlayMuted,previewAutoPlay:y&&D===r,previewAutoPlaySeed:k},`${n.src}-${r}`):h(t,{src:n.src,alt:`预览`,fill:!0,className:e(`object-contain will-change-transform`)})})},`${n.src}-${r}`))}),h(o,{}),h(a,{})]})]})})}export{v as MediaPreview,_ as useMediaPreview};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{ensureGuestIdentity as e}from"../../../store/modules/user-store.mjs";import{Button as t}from"../../ui/button.mjs";import{Box as n}from"../../ui/box.mjs";import{Checkbox as r}from"../../ui/checkbox.mjs";import{Input as i}from"../../ui/input.mjs";import{Text as a}from"../../ui/text.mjs";import{CloseIcon as o}from"../../../assets/icons/close-icon.mjs";import{EyeIcon as s}from"../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as c}from"../../../assets/icons/eye-off-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{authGradientTextStyle as u,authPanelBackgroundStyle as d}from"./auth-page-styles.mjs";import{trackLoginPageClick as f}from"./tracking.mjs";import{useCallback as p,useMemo as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{useTranslations as v}from"next-intl";function y(y){let b=v(`components.pages.login`),{onClose:x,onForgotPassword:S,onRegister:C,onSubmit:w,errorText:T}=y,[E,D]=h(``),[O,k]=h(``),[A,j]=h(!1),[M,N]=h(!1),[P,F]=h(!1),[I,L]=h(null),R=m(()=>E.trim().length>0&&O.length>0&&P&&!M,[E,O,P,M]),z=p(()=>{e(!0),C?.()},[C]);async function B(){if(R)try{N(!0),await w?.({email:E.trim(),password:O})}finally{N(!1)}}return _(n,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,style:d,children:[_(n,{className:`relative z-[1] mx-auto flex min-h-screen w-full max-w-[390px] flex-col justify-between px-[32px] pt-[calc(env(safe-
|
|
2
|
+
"use client";import{ensureGuestIdentity as e}from"../../../store/modules/user-store.mjs";import{Button as t}from"../../ui/button.mjs";import{Box as n}from"../../ui/box.mjs";import{Checkbox as r}from"../../ui/checkbox.mjs";import{Input as i}from"../../ui/input.mjs";import{Text as a}from"../../ui/text.mjs";import{CloseIcon as o}from"../../../assets/icons/close-icon.mjs";import{EyeIcon as s}from"../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as c}from"../../../assets/icons/eye-off-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{authGradientTextStyle as u,authPanelBackgroundStyle as d}from"./auth-page-styles.mjs";import{trackLoginPageClick as f}from"./tracking.mjs";import{useCallback as p,useMemo as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{useTranslations as v}from"next-intl";function y(y){let b=v(`components.pages.login`),{onClose:x,onForgotPassword:S,onRegister:C,onSubmit:w,errorText:T}=y,[E,D]=h(``),[O,k]=h(``),[A,j]=h(!1),[M,N]=h(!1),[P,F]=h(!1),[I,L]=h(null),R=m(()=>E.trim().length>0&&O.length>0&&P&&!M,[E,O,P,M]),z=p(()=>{e(!0),C?.()},[C]);async function B(){if(R)try{N(!0),await w?.({email:E.trim(),password:O})}finally{N(!1)}}return _(n,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,style:d,children:[_(n,{className:`relative z-[1] mx-auto flex min-h-screen w-full max-w-[390px] flex-col justify-between px-[32px] pt-[calc(env(--safe-top-offset)+152px)] pb-[calc(env(safe-area-inset-bottom)+40px)]`,children:[g(t,{type:`button`,variant:`ghost`,onClick:x,"aria-label":b(`loginClient.close`),className:`absolute top-[calc(env(--safe-top-offset)+12px)] right-[24px] h-[32px] w-[32px] rounded-full border border-white/10 bg-white/5 !p-0 text-text2 backdrop-blur-[12px] hover:!bg-white/10 hover:text-text1`,children:g(o,{className:`h-[16px] w-[16px]`,"aria-hidden":`true`,focusable:`false`})}),_(n,{className:`flex w-full flex-col`,children:[g(a,{className:`text-[28px] leading-[32px] font-medium text-[#E6E6E6]`,children:b(`loginClient.title`)}),g(a,{className:`mt-[16px] text-[14px] leading-[24px] text-[#E6E6E6]`,children:b(`loginClient.subtitle`)}),_(`form`,{className:`mt-[48px]`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),B()},children:[g(n,{className:`flex h-[48px] items-center rounded-[8px] bg-white/10 px-[22px]`,children:g(i,{placeholder:b(`loginClient.emailPlaceholder`),type:`email`,name:`funhub-login-email`,value:E,onChange:e=>D(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`!h-auto !rounded-none !bg-transparent !px-0 !py-0 !text-[14px] !leading-[20px] !text-text2 placeholder:!text-white/60`})}),_(n,{className:`mt-[24px] flex h-[48px] items-center justify-between rounded-[8px] bg-white/10 px-[16px]`,children:[g(i,{placeholder:b(`loginClient.passwordPlaceholder`),type:A?`text`:`password`,name:`funhub-login-password`,value:O,onChange:e=>k(e.target.value),autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`flex-1 !h-auto !rounded-none !bg-transparent !px-0 !py-0 !text-[14px] !leading-[20px] !text-text2 placeholder:!text-white/60`}),g(t,{type:`button`,variant:`ghost`,className:`ml-[12px] h-[24px] w-[24px] cursor-pointer select-none !p-0 text-white/50 hover:text-white/80`,"aria-label":b(A?`loginClient.hidePassword`:`loginClient.showPassword`),onClick:()=>j(e=>!e),children:g(A?s:c,{className:`h-[20px] w-[20px]`,"aria-hidden":`true`,focusable:`false`})})]}),!!T&&g(n,{className:`mt-[8px] text-[12px] leading-[16px] text-theme5`,children:T})]}),_(n,{className:`mt-[16px] flex items-center justify-between text-[14px] leading-[24px] text-[#9DA3AC]`,children:[_(a,{as:`span`,className:`whitespace-nowrap`,children:[b(`loginClient.noAccount`),g(t,{type:`button`,variant:`link`,onClick:z,className:`inline h-auto !p-0 text-[14px] font-normal leading-[24px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,children:b(`loginClient.registerLink`)})]}),g(t,{type:`button`,variant:`link`,onClick:S,className:`inline h-auto !p-0 text-[14px] font-normal leading-[24px] text-[#9DA3AC] !no-underline hover:text-text1 hover:!no-underline`,children:b(`loginClient.forgotPassword`)})]})]}),_(n,{className:`flex w-full flex-col`,children:[_(n,{className:`flex items-center`,children:[g(r,{checked:P,onCheckedChange:e=>F(e===!0),"aria-label":b(`loginClient.agreeToTerms`),className:`mt-px size-[16px] border-white/60 bg-transparent data-[checked]:border-theme5 data-[checked]:bg-theme5 data-[checked]:text-white`}),_(a,{as:`span`,className:`ml-[8px] text-[12px] leading-[16px] text-[#9DA3AC]`,children:[b(`loginClient.agreeToTermsPrefix`),_(t,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>L(`terms`),children:[`《`,b(`loginClient.userAgreement`),`》`]}),b(`loginClient.and`),_(t,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>L(`privacy`),children:[`《`,b(`loginClient.privacyPolicy`),`》`]})]})]}),g(t,{type:`button`,"data-skip-dialog-track":`true`,onClick:e=>{f(e,`login_submit`),B()},disabled:!R,className:`mt-[16px] h-[48px] w-full !rounded-[8px] !border-0 !px-0 !py-0 text-[16px] font-normal leading-[24px] text-white disabled:opacity-100 active:opacity-90 ${R?``:`!text-white/60`}`,style:{background:R?`var(--gradient-action-button)`:`linear-gradient(90deg, rgba(151, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`},children:b(M?`loginClient.loggingIn`:`loginClient.login`)})]})]}),g(l,{type:I,onClose:()=>L(null)})]})}export{y as LoginClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{isValidEmail as e}from"../../../utils/email-validator.mjs";import{pUserSendEmailCode as t}from"../../../service/generated/client.mjs";import{Button as n}from"../../ui/button.mjs";import{Box as r}from"../../ui/box.mjs";import{Checkbox as i}from"../../ui/checkbox.mjs";import{Input as a}from"../../ui/input.mjs";import{Text as o}from"../../ui/text.mjs";import{useLoginModalStore as s}from"../../../store/modules/login-modal-store.mjs";import{LeftArrowIcon as c}from"../../../assets/icons/left-arrow-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{authGradientTextStyle as u,authPanelBackgroundStyle as d}from"./auth-page-styles.mjs";import{trackLoginPageClick as f}from"./tracking.mjs";import{useMemo as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useTranslations as _}from"next-intl";function v(v){let y=_(`components.pages.login`),{onClose:b,onLogin:x,onVerify:S}=v,{setVerifyStep:C}=s(),[w,T]=m(``),[E,D]=m(!1),[O,k]=m(``),[A,j]=m(!1),[M,N]=m(null),P=p(()=>w.trim().length>0&&A&&!E,[w,A,E]);function F(e){T(e),O&&k(``)}async function I(){if(P)try{D(!0),k(``);let n=w.trim();if(!e(n)){k(y(`register.invalidEmail`));return}await t({email:n}),C(`register-verify`),S?.(n)}catch(e){k(e.message??y(`register.sendFailed`))}finally{D(!1)}}return g(r,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,style:d,children:[g(r,{className:`relative z-[1] mx-auto flex min-h-screen w-full max-w-[390px] flex-col justify-between px-[32px] pt-[calc(env(safe-
|
|
2
|
+
"use client";import{isValidEmail as e}from"../../../utils/email-validator.mjs";import{pUserSendEmailCode as t}from"../../../service/generated/client.mjs";import{Button as n}from"../../ui/button.mjs";import{Box as r}from"../../ui/box.mjs";import{Checkbox as i}from"../../ui/checkbox.mjs";import{Input as a}from"../../ui/input.mjs";import{Text as o}from"../../ui/text.mjs";import{useLoginModalStore as s}from"../../../store/modules/login-modal-store.mjs";import{LeftArrowIcon as c}from"../../../assets/icons/left-arrow-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{authGradientTextStyle as u,authPanelBackgroundStyle as d}from"./auth-page-styles.mjs";import{trackLoginPageClick as f}from"./tracking.mjs";import{useMemo as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useTranslations as _}from"next-intl";function v(v){let y=_(`components.pages.login`),{onClose:b,onLogin:x,onVerify:S}=v,{setVerifyStep:C}=s(),[w,T]=m(``),[E,D]=m(!1),[O,k]=m(``),[A,j]=m(!1),[M,N]=m(null),P=p(()=>w.trim().length>0&&A&&!E,[w,A,E]);function F(e){T(e),O&&k(``)}async function I(){if(P)try{D(!0),k(``);let n=w.trim();if(!e(n)){k(y(`register.invalidEmail`));return}await t({email:n}),C(`register-verify`),S?.(n)}catch(e){k(e.message??y(`register.sendFailed`))}finally{D(!1)}}return g(r,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,style:d,children:[g(r,{className:`relative z-[1] mx-auto flex min-h-screen w-full max-w-[390px] flex-col justify-between px-[32px] pt-[calc(env(--safe-top-offset)+152px)] pb-[calc(env(safe-area-inset-bottom)+40px)]`,children:[h(n,{type:`button`,variant:`ghost`,onClick:b,"aria-label":y(`register.back`),className:`absolute top-[calc(env(--safe-top-offset)+12px)] left-[24px] h-[32px] w-[32px] rounded-full border border-white/10 bg-white/5 !p-0 text-text2 backdrop-blur-[12px] hover:!bg-white/10 hover:text-text1`,children:h(c,{className:`h-[16px] w-[16px]`,"aria-hidden":`true`,focusable:`false`})}),g(r,{className:`flex w-full flex-col`,children:[h(o,{className:`text-[28px] leading-[32px] font-medium text-[#E6E6E6]`,children:y(`loginClient.title`)}),h(o,{className:`mt-[16px] text-[14px] leading-[24px] text-[#E6E6E6]`,children:y(`loginClient.subtitle`)}),h(`form`,{className:`mt-[48px]`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),I()},children:h(r,{className:`flex h-[48px] items-center rounded-[8px] bg-white/10 px-[22px]`,children:h(a,{placeholder:y(`register.emailPlaceholder`),type:`email`,name:`funhub-register-email`,value:w,onChange:e=>F(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`!h-auto !rounded-none !bg-transparent !px-0 !py-0 !text-[14px] !leading-[20px] !text-text2 placeholder:!text-white/60`})})}),!!O&&h(r,{className:`mt-[8px] min-h-[16px] text-[12px] leading-[16px] text-theme5`,children:O}),h(r,{className:`mt-[16px] flex items-center justify-between text-[14px] leading-[24px] text-[#9DA3AC]`,children:g(o,{as:`span`,className:`whitespace-nowrap`,children:[y(`register.hasAccount`),h(n,{type:`button`,variant:`link`,onClick:x,className:`inline h-auto !p-0 text-[14px] font-normal leading-[24px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,children:y(`register.loginLink`)})]})})]}),g(r,{className:`flex w-full flex-col`,children:[g(r,{className:`flex items-center`,children:[h(i,{checked:A,onCheckedChange:e=>j(e===!0),"aria-label":y(`loginClient.agreeToTerms`),className:`mt-px size-[16px] border-white/60 bg-transparent data-[checked]:border-theme5 data-[checked]:bg-theme5 data-[checked]:text-white`}),g(o,{as:`span`,className:`ml-[8px] text-[12px] leading-[16px] text-[#9DA3AC]`,children:[y(`loginClient.agreeToTermsPrefix`),g(n,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>N(`terms`),children:[`《`,y(`loginClient.userAgreement`),`》`]}),y(`loginClient.and`),g(n,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>N(`privacy`),children:[`《`,y(`loginClient.privacyPolicy`),`》`]})]})]}),h(n,{type:`button`,"data-skip-dialog-track":`true`,onClick:e=>{f(e,`register_submit`),I()},disabled:!P,className:`mt-[16px] h-[48px] w-full !rounded-[8px] !border-0 !px-0 !py-0 text-[16px] font-normal leading-[24px] text-white disabled:opacity-100 active:opacity-90 ${P?``:`!text-white/60`}`,style:{background:P?`var(--gradient-action-button)`:`linear-gradient(90deg, rgba(151, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`},children:y(E?`register.sending`:`register.getCode`)})]})]}),h(l,{type:M,onClose:()=>N(null)})]})}export{v as Register};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{getCookie as e}from"../../../utils/common.mjs";import{cn as t}from"../../../utils/cn.mjs";import{pUserSendEmailCode as n,pUserSendResetPasswordEmailCode as r,pUserVerifyForgetEmailCode as i,pUserVerifyResetPasswordEmailCode as a}from"../../../service/generated/client.mjs";import{pUserRegisterByVerifyEmailCodeCompat as o}from"../../../service/register-by-verify-email-code.mjs";import{Button as s}from"../../ui/button.mjs";import{Box as c}from"../../ui/box.mjs";import{Text as l}from"../../ui/text.mjs";import{useLoginModalStore as u}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as d}from"../../../hooks/query/use-query.mjs";import{useSetAuthFields as f,useUserId as p}from"../../../hooks/use-auth.mjs";import{LeftArrowIcon as m}from"../../../assets/icons/left-arrow-icon.mjs";import{authPanelBackgroundStyle as h}from"./auth-page-styles.mjs";import{toast as g}from"sonner";import{useCallback as _,useEffect as v,useMemo as y,useRef as b,useState as x}from"react";import{jsx as S,jsxs as C}from"react/jsx-runtime";import{useTranslations as w}from"next-intl";function T(e){let[t,n]=e.split(`@`);return!t||!n?e:`${t.slice(0,3)}***${t.length>3?t.slice(-1):``}@${n}`}function E(E){let D=w(`components.pages.login`),{email:O,onClose:k,onPassword:A}=E,{verifyStep:j,resolveLogin:M}=u(),[N,P]=x([,,,,,,].fill(``)),[F,I]=x(0),[L,R]=x(!1),[z,B]=x(60),[V,H]=x(!1),[U,W]=x(``),G=b(null),K=p(),q=f(),J=d(),Y=y(()=>T(O),[O]),X=_(async()=>{if(j===`reset-password`)return await a({user_id:K,email_code:N.join(``)});if(j===`forgot-password`)return await i({email:O,email_code:N.join(``)});if(j===`register-verify`){let t=await e(`guestUserId`);return await o({email:O,email_code:N.join(``),user_id:t})}throw Error(D(`verify.invalidCode`))},[j,N,K,O,D]),Z=y(()=>N.every(e=>e!==``)&&!L,[N,L]);v(()=>{if(z<=0)return;let e=setInterval(()=>{B(e=>e-1)},1e3);return()=>clearInterval(e)},[z]),v(()=>{G.current?.focus()},[]);let Q=_(e=>{let t=e.target.value.replace(/\D/g,``);if(t.length===0)return;let n=[...N],r=t.split(``),i=F;for(let e of r)i<6&&(n[i]=e,i++);P(n),I(Math.min(i,5)),W(``)},[N,F]),$=_(e=>{if(e.key===`Backspace`){e.preventDefault();let t=[...N];N[F]?t[F]=``:F>0&&(t[F-1]=``,I(F-1)),P(t),W(``)}else e.key===`ArrowLeft`&&F>0?I(F-1):e.key===`ArrowRight`&&F<5&&I(F+1)},[N,F]),ee=_(e=>{I(e),G.current?.focus()},[]);async function te(){if(!(z>0||V))try{H(!0),j===`reset-password`?await r({user_id:K}):await n({email:O}),B(60),W(``)}finally{H(!1)}}async function ne(){if(Z)try{R(!0);let e=await X();if(j===`register-verify`){let t=e?.data;if(t?.user_id){q({token:t.token??``,expireTime:t.expire_time??0,userId:t.user_id}),g.success(D(`index.loginSuccess`)),J([`user-profile`,`mine`]),M(!0);return}}A?.(O)}catch(e){W(e.message??D(`verify.invalidCode`))}finally{R(!1)}}return S(c,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,style:h,children:C(c,{className:`relative z-[1] mx-auto min-h-screen w-full max-w-[390px] px-[32px] pt-[calc(env(safe-
|
|
2
|
+
"use client";import{getCookie as e}from"../../../utils/common.mjs";import{cn as t}from"../../../utils/cn.mjs";import{pUserSendEmailCode as n,pUserSendResetPasswordEmailCode as r,pUserVerifyForgetEmailCode as i,pUserVerifyResetPasswordEmailCode as a}from"../../../service/generated/client.mjs";import{pUserRegisterByVerifyEmailCodeCompat as o}from"../../../service/register-by-verify-email-code.mjs";import{Button as s}from"../../ui/button.mjs";import{Box as c}from"../../ui/box.mjs";import{Text as l}from"../../ui/text.mjs";import{useLoginModalStore as u}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as d}from"../../../hooks/query/use-query.mjs";import{useSetAuthFields as f,useUserId as p}from"../../../hooks/use-auth.mjs";import{LeftArrowIcon as m}from"../../../assets/icons/left-arrow-icon.mjs";import{authPanelBackgroundStyle as h}from"./auth-page-styles.mjs";import{toast as g}from"sonner";import{useCallback as _,useEffect as v,useMemo as y,useRef as b,useState as x}from"react";import{jsx as S,jsxs as C}from"react/jsx-runtime";import{useTranslations as w}from"next-intl";function T(e){let[t,n]=e.split(`@`);return!t||!n?e:`${t.slice(0,3)}***${t.length>3?t.slice(-1):``}@${n}`}function E(E){let D=w(`components.pages.login`),{email:O,onClose:k,onPassword:A}=E,{verifyStep:j,resolveLogin:M}=u(),[N,P]=x([,,,,,,].fill(``)),[F,I]=x(0),[L,R]=x(!1),[z,B]=x(60),[V,H]=x(!1),[U,W]=x(``),G=b(null),K=p(),q=f(),J=d(),Y=y(()=>T(O),[O]),X=_(async()=>{if(j===`reset-password`)return await a({user_id:K,email_code:N.join(``)});if(j===`forgot-password`)return await i({email:O,email_code:N.join(``)});if(j===`register-verify`){let t=await e(`guestUserId`);return await o({email:O,email_code:N.join(``),user_id:t})}throw Error(D(`verify.invalidCode`))},[j,N,K,O,D]),Z=y(()=>N.every(e=>e!==``)&&!L,[N,L]);v(()=>{if(z<=0)return;let e=setInterval(()=>{B(e=>e-1)},1e3);return()=>clearInterval(e)},[z]),v(()=>{G.current?.focus()},[]);let Q=_(e=>{let t=e.target.value.replace(/\D/g,``);if(t.length===0)return;let n=[...N],r=t.split(``),i=F;for(let e of r)i<6&&(n[i]=e,i++);P(n),I(Math.min(i,5)),W(``)},[N,F]),$=_(e=>{if(e.key===`Backspace`){e.preventDefault();let t=[...N];N[F]?t[F]=``:F>0&&(t[F-1]=``,I(F-1)),P(t),W(``)}else e.key===`ArrowLeft`&&F>0?I(F-1):e.key===`ArrowRight`&&F<5&&I(F+1)},[N,F]),ee=_(e=>{I(e),G.current?.focus()},[]);async function te(){if(!(z>0||V))try{H(!0),j===`reset-password`?await r({user_id:K}):await n({email:O}),B(60),W(``)}finally{H(!1)}}async function ne(){if(Z)try{R(!0);let e=await X();if(j===`register-verify`){let t=e?.data;if(t?.user_id){q({token:t.token??``,expireTime:t.expire_time??0,userId:t.user_id}),g.success(D(`index.loginSuccess`)),J([`user-profile`,`mine`]),M(!0);return}}A?.(O)}catch(e){W(e.message??D(`verify.invalidCode`))}finally{R(!1)}}return S(c,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,style:h,children:C(c,{className:`relative z-[1] mx-auto min-h-screen w-full max-w-[390px] px-[32px] pt-[calc(env(--safe-top-offset)+136px)] pb-[calc(env(safe-area-inset-bottom)+40px)]`,children:[S(s,{type:`button`,variant:`ghost`,onClick:k,"aria-label":D(`verify.back`),className:`absolute top-[calc(env(--safe-top-offset)+12px)] left-[16px] h-[32px] w-[32px] rounded-full border border-white/10 bg-white/5 !p-0 text-text2 backdrop-blur-[12px] hover:!bg-white/10 hover:text-text1`,children:S(m,{className:`h-[16px] w-[16px]`,"aria-hidden":`true`,focusable:`false`})}),C(c,{className:`w-full`,children:[S(c,{children:S(l,{className:`text-[28px] leading-[32px] font-medium text-text1`,children:D(`verify.title`)})}),C(c,{className:`mt-[6px]`,children:[S(l,{className:`ml-[4px] text-[14px] leading-[28px] text-white/60`,children:D(`verify.sentTo`)}),S(l,{className:`mt-[6px] text-[14px] leading-[28px] text-white/60`,children:Y})]}),C(`form`,{className:`mt-[44px]`,onSubmit:e=>{e.preventDefault(),ne()},children:[C(c,{className:`relative h-[50px]`,children:[S(`input`,{ref:G,type:`text`,inputMode:`numeric`,pattern:`[0-9]*`,value:``,onChange:Q,onKeyDown:$,className:`absolute inset-0 opacity-0 pointer-events-none h-full w-full border-none bg-transparent text-base outline-none`,autoComplete:`one-time-code`}),S(c,{className:`flex w-full items-center justify-between`,children:N.map((e,n)=>S(c,{onClick:()=>ee(n),className:t(`flex h-[50px] w-[50px] cursor-pointer items-center justify-center rounded-[8px] bg-white/10 transition-all duration-200`,U?`border-[0.5px] border-[var(--color-verification-error)]`:n===F?`ring-1 ring-white/25 bg-white/[0.14]`:``),children:S(l,{className:t(`select-none text-[28px] leading-none font-medium`,U?`text-[var(--color-verification-error)]`:`text-text1`),children:e})},n))})]}),!!U&&S(c,{className:`mt-[8px] text-[14px] leading-[24px] text-[var(--color-verification-error)]`,children:U}),S(s,{type:`submit`,disabled:!Z,className:`mt-[44px] h-[48px] w-full !rounded-[8px] !border-0 !px-0 !py-0 text-[16px] font-normal leading-[24px] text-white disabled:opacity-100 active:opacity-90 ${Z?``:`!text-white/60`}`,style:{background:Z?`var(--gradient-action-button)`:`linear-gradient(90deg, rgba(151, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`},children:D(L?`verify.verifying`:`verify.nextStep`)}),S(s,{type:`button`,variant:`ghost`,onClick:te,disabled:z>0||V,className:`mt-[16px] flex w-full items-center justify-center bg-transparent !p-0 text-[15px] leading-[24px] text-[#9DA3AC] hover:bg-transparent hover:text-text1 disabled:cursor-not-allowed disabled:opacity-100`,children:z>0?D(`verify.resendCountdown`,{seconds:z}):D(`verify.resend`)})]})]})]})})}export{E as Verify};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{updateUrlParams as e}from"../../../utils/common.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{useRouter as r}from"../../../utils/use-compatible-router.mjs";import{Box as i}from"../../ui/box.mjs";import{eventKey as a}from"../../../constants/event-key.mjs";import{useSearchHistory as o}from"../../../hooks/use-search-history.mjs";import{trackSearchResultPageView as s}from"./tracking.mjs";import{SEARCH_RESULT_SORT_OPTIONS as c}from"./shared.mjs";import l from"./search-user.mjs";import u from"./search-video-info.mjs";import d from"./search-all.mjs";import{SearchTab as f}from"./search-tab.mjs";import p from"./top-header.mjs";import{useSearchParams as m}from"next/navigation";import{useEffect as h,useMemo as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{useTranslations as b}from"next-intl";const x=[{labelKey:`tabs.all`,value:`all`},{labelKey:`tabs.video`,value:`video`},{labelKey:`tabs.user`,value:`user`}];function S(){r();let S=b(`components.pages.search.pageClient`),{userInfo:C}=n(),w=C?.user_id||`guest`,T=m().get(`q`)?.toString()||``,[E,D]=_(T),[O,k]=_(0);h(()=>{D(T),k(e=>e+1)},[T]);let[A,j]=_(x[0].value),[M,N]=_(c[0].value),[P,F]=_(0),{addHistory:I}=o({storageKey:w}),L=g(()=>x.map(e=>({value:e.value,label:S(e.labelKey)})),[S]),R=g(()=>E.trim()!==``,[E]);return h(()=>(t.on(a.EXCHANGE_SEARCH_TYPE,j),()=>{t.off(a.EXCHANGE_SEARCH_TYPE,j)}),[j]),h(()=>{E.trim()&&s(A,E)},[A,E]),y(i,{className:`flex h-dvh w-full flex-col`,children:[v(i,{className:`shrink-0`,children:v(p,{setSearchInputVal:t=>{t!==E&&(D(t),e({q:t}))},initInputVal:T,initInputVersion:O,addSearchHistory:I})}),v(i,{className:`
|
|
2
|
+
"use client";import{updateUrlParams as e}from"../../../utils/common.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{useRouter as r}from"../../../utils/use-compatible-router.mjs";import{Box as i}from"../../ui/box.mjs";import{eventKey as a}from"../../../constants/event-key.mjs";import{useSearchHistory as o}from"../../../hooks/use-search-history.mjs";import{trackSearchResultPageView as s}from"./tracking.mjs";import{SEARCH_RESULT_SORT_OPTIONS as c}from"./shared.mjs";import l from"./search-user.mjs";import u from"./search-video-info.mjs";import d from"./search-all.mjs";import{SearchTab as f}from"./search-tab.mjs";import p from"./top-header.mjs";import{useSearchParams as m}from"next/navigation";import{useEffect as h,useMemo as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{useTranslations as b}from"next-intl";const x=[{labelKey:`tabs.all`,value:`all`},{labelKey:`tabs.video`,value:`video`},{labelKey:`tabs.user`,value:`user`}];function S(){r();let S=b(`components.pages.search.pageClient`),{userInfo:C}=n(),w=C?.user_id||`guest`,T=m().get(`q`)?.toString()||``,[E,D]=_(T),[O,k]=_(0);h(()=>{D(T),k(e=>e+1)},[T]);let[A,j]=_(x[0].value),[M,N]=_(c[0].value),[P,F]=_(0),{addHistory:I}=o({storageKey:w}),L=g(()=>x.map(e=>({value:e.value,label:S(e.labelKey)})),[S]),R=g(()=>E.trim()!==``,[E]);return h(()=>(t.on(a.EXCHANGE_SEARCH_TYPE,j),()=>{t.off(a.EXCHANGE_SEARCH_TYPE,j)}),[j]),h(()=>{E.trim()&&s(A,E)},[A,E]),y(i,{className:`flex h-dvh w-full flex-col`,children:[v(i,{className:`shrink-0`,children:v(p,{setSearchInputVal:t=>{t!==E&&(D(t),e({q:t}))},initInputVal:T,initInputVersion:O,addSearchHistory:I})}),v(i,{className:`min-h-0 flex-1 overflow-hidden rounded-t-[16px]`,children:R&&y(i,{className:`flex h-full flex-col bg-[linear-gradient(180deg,rgba(6,3,21,0.9)_0%,rgba(6,3,21,0)_100%)] backdrop-blur-[2px]`,children:[v(f,{searchType:A,tabList:L,onChange:e=>{j(e)},sort:M,onSortChange:e=>{N(e),F(e=>e+1)}}),y(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-[24px]`,children:[A===`user`&&v(l,{inputVal:E,sort:M,refreshVersion:P}),A===`all`&&v(d,{searchInputVal:E,sort:M,refreshVersion:P}),A===`video`&&v(u,{inputVal:E,sort:M,refreshVersion:P})]})]})})]})}export{S as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Box as e}from"../../ui/box.mjs";import{Popover as t,PopoverContent as n,PopoverTrigger as r}from"../../ui/popover.mjs";import{SEARCH_RESULT_SORT_OPTIONS as i}from"./shared.mjs";import{memo as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";function l({className:e}){return c(`svg`,{viewBox:`0 0 22 15`,fill:`currentColor`,"aria-hidden":!0,className:e,children:[s(`rect`,{x:`0`,y:`0`,width:`13.5`,height:`2`,rx:`1`}),s(`rect`,{x:`0`,y:`6.5`,width:`13.5`,height:`2`,rx:`1`}),s(`rect`,{x:`0`,y:`13`,width:`13.5`,height:`2`,rx:`1`}),s(`path`,{d:`M15 1C15 0.447715 15.4477 0 16 0C16.5523 0 17 0.447715 17 1V11.2969L18.2412 9.84961C18.6006 9.43028 19.2311 9.38179 19.6504 9.74121C20.0697 10.1006 20.1182 10.7311 19.7588 11.1504L16.7588 14.6504C16.4865 14.9681 16.0458 15.0826 15.6533 14.9375C15.2608 14.7923 15 14.4185 15 14V1Z`})]})}const u=a(({searchType:a,onChange:u,tabList:d,sort:f,onSortChange:p})=>{let[m,h]=o(!1);return s(e,{as:`nav`,className:`safe-top-offset sticky z-40 no-vw-x-16 pb-[16px] pt-[
|
|
2
|
+
"use client";import{Box as e}from"../../ui/box.mjs";import{Popover as t,PopoverContent as n,PopoverTrigger as r}from"../../ui/popover.mjs";import{SEARCH_RESULT_SORT_OPTIONS as i}from"./shared.mjs";import{memo as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";function l({className:e}){return c(`svg`,{viewBox:`0 0 22 15`,fill:`currentColor`,"aria-hidden":!0,className:e,children:[s(`rect`,{x:`0`,y:`0`,width:`13.5`,height:`2`,rx:`1`}),s(`rect`,{x:`0`,y:`6.5`,width:`13.5`,height:`2`,rx:`1`}),s(`rect`,{x:`0`,y:`13`,width:`13.5`,height:`2`,rx:`1`}),s(`path`,{d:`M15 1C15 0.447715 15.4477 0 16 0C16.5523 0 17 0.447715 17 1V11.2969L18.2412 9.84961C18.6006 9.43028 19.2311 9.38179 19.6504 9.74121C20.0697 10.1006 20.1182 10.7311 19.7588 11.1504L16.7588 14.6504C16.4865 14.9681 16.0458 15.0826 15.6533 14.9375C15.2608 14.7923 15 14.4185 15 14V1Z`})]})}const u=a(({searchType:a,onChange:u,tabList:d,sort:f,onSortChange:p})=>{let[m,h]=o(!1);return s(e,{as:`nav`,className:`safe-top-offset sticky z-40 no-vw-x-16 pb-[16px] pt-[24px]`,children:c(e,{className:`flex h-[24px] items-center justify-between`,children:[s(e,{className:`flex items-center gap-[10px]`,children:d.map(e=>s(`button`,{type:`button`,className:`text-[16px] leading-[24px] transition-colors ${a===e.value?`font-medium text-white`:`font-normal text-white/80`}`,onClick:()=>{a!==e.value&&u(e.value)},children:e.label},e.value))}),c(t,{open:m,onOpenChange:h,children:[s(r,{"aria-label":`排序筛选`,className:`flex size-[24px] items-center justify-center`,children:s(l,{className:`h-[15px] w-[20px] text-white/40`})}),s(n,{side:`bottom`,align:`end`,sideOffset:8,className:`w-[132px] border border-white/10 bg-[#10071E]/95 p-[8px] backdrop-blur-[18px]`,children:s(e,{className:`flex flex-col gap-[4px]`,children:i.map(e=>s(`button`,{type:`button`,className:`rounded-[8px] px-[12px] py-[8px] text-left text-[14px] leading-[20px] ${e.value===f?`bg-white/10 text-white`:`text-white/70`}`,onClick:()=>{p(e.value),h(!1)},children:e.label},e.value))})})]})]})})});u.displayName=`SearchTab`;export{u as SearchTab};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useRouter as e}from"../../../utils/use-compatible-router.mjs";import{Input as t}from"../../ui/input.mjs";import{toast as n}from"../../../ui.mjs";import{useKeepAliveEffect as r,useKeepAliveState as i}from"../../common/keep-scroll-position/index.mjs";import{LeftArrowIcon as a}from"../../common/icons/left-arrow.mjs";import{useSearchParams as o}from"next/navigation";import{memo as s,useCallback as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";const f=s(({setSearchInputVal:s,initInputVal:f,initInputVersion:p,addSearchHistory:m})=>{let h=d(`components.pages.search`),g=e(),[_,v]=i(`search-input-val`,``),y=o().get(`q`),b=e=>{v(e.target.value)},x=c(e=>{s(e),m(e)},[m,s]);r(()=>{f&&(v(f),x(f))},[x,f,p,v],`search-init-input-effect`),r(()=>{y&&(v(y),x(y))},[x,v,y],`search-url-params-effect`);function S(){if(n.dismiss(),window.location.search.split(`from_code=`)[1]){g.push(`/`);return}g.back()}return l(`div`,{className:`app-top-nav w-full`,children:u(`header`,{className:`flex h-[60px] items-center gap-[8px] no-vw-x-16 pb-[10px] pt-[16px]`,children:[l(`button`,{type:`button`,"aria-label":`返回`,className:`flex size-[24px] shrink-0 items-center justify-center text-white`,onClick:S,children:l(a,{className:`h-[16px] w-[16px]`})}),l(`div`,{className:`relative h-[34px] min-w-0 flex-1`,children:
|
|
2
|
+
"use client";import{useRouter as e}from"../../../utils/use-compatible-router.mjs";import{Input as t}from"../../ui/input.mjs";import{toast as n}from"../../../ui.mjs";import{useKeepAliveEffect as r,useKeepAliveState as i}from"../../common/keep-scroll-position/index.mjs";import{LeftArrowIcon as a}from"../../common/icons/left-arrow.mjs";import{useSearchParams as o}from"next/navigation";import{memo as s,useCallback as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";const f=s(({setSearchInputVal:s,initInputVal:f,initInputVersion:p,addSearchHistory:m})=>{let h=d(`components.pages.search`),g=e(),[_,v]=i(`search-input-val`,``),y=o().get(`q`),b=e=>{v(e.target.value)},x=c(e=>{s(e),m(e)},[m,s]);r(()=>{f&&(v(f),x(f))},[x,f,p,v],`search-init-input-effect`),r(()=>{y&&(v(y),x(y))},[x,v,y],`search-url-params-effect`);function S(){if(n.dismiss(),window.location.search.split(`from_code=`)[1]){g.push(`/`);return}g.back()}return l(`div`,{className:`app-top-nav w-full`,children:u(`header`,{className:`flex h-[60px] items-center gap-[8px] no-vw-x-16 pb-[10px] pt-[16px]`,children:[l(`button`,{type:`button`,"aria-label":`返回`,className:`flex size-[24px] shrink-0 items-center justify-center text-white`,onClick:S,children:l(a,{className:`h-[16px] w-[16px]`})}),l(`div`,{className:`relative h-[34px] min-w-0 flex-1`,children:l(`div`,{className:`flex h-full min-w-0 flex-1 items-stretch overflow-hidden rounded-[100px] p-[1px]`,style:{background:`linear-gradient(90deg, rgba(230,42,255,0.9) 0%, rgba(239,255,69,0.5) 25%, rgba(233,69,255,0.8) 50%, rgba(233,69,255,0.9) 100%)`},children:u(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 items-center overflow-hidden rounded-[100px] bg-black backdrop-blur-[2px]`,children:[l(`div`,{className:`flex h-full min-w-0 flex-1 items-center pl-[20px] pr-[8px]`,children:l(t,{placeholder:h(`topHeader.placeholder`),maxLength:20,value:_,className:`!h-[24px] !w-full !rounded-none !border-0 !bg-transparent !px-0 !py-0 !text-[14px] !leading-[24px] !text-white/90 placeholder:!text-white/90`,onChange:b,onKeyDown:e=>{if(e.key===`Enter`){if(e.preventDefault(),!_.trim())return;x(_.trim())}}})}),l(`button`,{type:`button`,className:`mx-[2px] flex h-[30px] w-[56px] shrink-0 items-center justify-center rounded-[100px] bg-[linear-gradient(90deg,#9756E3_0%,#6C43EE_100%)] text-[14px] leading-[20px] text-white`,onClick:()=>{_.trim()&&x(_.trim())},children:h(`topHeader.search`)})]})})})]})})});f.displayName=`SearchTopHeader`;export{f as default};
|
|
@@ -6,7 +6,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
6
6
|
//#region components/ui/badge.d.ts
|
|
7
7
|
/** badgeVariants 工具定义。 */
|
|
8
8
|
declare const badgeVariants: (props?: ({
|
|
9
|
-
variant?: "link" | "default" | "
|
|
9
|
+
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
/** Badge 组件。 */
|
|
12
12
|
declare function Badge({
|
|
@@ -7,8 +7,8 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
7
7
|
//#region components/ui/button.d.ts
|
|
8
8
|
/** buttonVariants 工具定义。 */
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
|
-
variant?: "link" | "default" | "
|
|
11
|
-
size?: "default" | "
|
|
10
|
+
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
11
|
+
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
13
13
|
/** Button 组件属性。 */
|
|
14
14
|
type ButtonProps = Button.Props & VariantProps<typeof buttonVariants> & {
|