@funhub/platform 0.1.76 → 0.1.78

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.
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{Box as t}from"../../../../ui/box.mjs";import{Text as n}from"../../../../ui/text.mjs";import{useLoginModalStore as r}from"../../../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as i}from"../../../../../hooks/query/use-query.mjs";import{debounceFun as a}from"../../../../../utils/tools.mjs";import o from"../../../../common/interaction-animations.module.mjs";import s from"../../../../common/collection-popup/index.mjs";import{useContentOperate as c}from"../../../../../hooks/use-content-operate.mjs";import l from"../../../../../assets/icons/detail/check-ok.mjs";import u from"../../../../../assets/icons/detail/collect_nor.mjs";import d from"../../../../../assets/icons/detail/collect_sel.mjs";import f from"../../../../../assets/icons/detail/give_like.mjs";import p from"../../../../../assets/icons/detail/give_like_sel.mjs";import m from"../../../../../assets/icons/detail/share.mjs";import{useCallback as h,useMemo as g,useRef as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{toast as x}from"sonner";import{useTranslations as S}from"next-intl";function C({mode:C=`renderer`,information:E,onUpdate:D}){let O=C===`editor`||!E?.id||E.id.startsWith(`preview-`),k=S(`components.biz.business.detail`),[A,j]=v(!1),[M,N]=v(!1),P=_(0),F=e(e=>e.userId),I=e(e=>e.isLogin),L=i(),R=h(()=>{F&&(L([`user-profile`,`mine`,F,`user-like-video`]),L([`user-profile`,`mine`,F,`user-like-post`]),L([`user-profile`,`mine`,F,`user-collect-video`,F]),L([`user-profile`,`mine`,F,`user-collect-post`,F]))},[L,F]),{likeAnimation:z,handleLikeOperate:B,handleDefaultCollectionOperate:V,handleShareOperate:H}=c({id:E.id,isLike:E.like||!1,isDislike:E.dislike||!1,isCollect:E.collect||!1,likeCnt:T(E.static?.like_cnt),dislikeCnt:T(E.static?.dislike_cnt),contentType:E.content_type,prefetchDefaultCollection:!O,animationClasses:{like:o.likeShakeAnimation,dislike:o.dislikeShakeAnimation}}),U=h(e=>{D?.({...e})},[D]),W=h(async()=>{if(A)return;if(!I){r.getState().open();return}let e=Date.now();if(e-P.current<300)return;P.current=e,j(!0);let t=E.like||!1,n=E.dislike||!1,i=T(E.static?.like_cnt),a=T(E.static?.dislike_cnt),o=!t,s=Math.max(0,i+(o?1:-1)),c=o?!1:n,l=o&&n?Math.max(0,a-1):a;U({like:o,dislike:c,static:{...E.static,like_cnt:s,dislike_cnt:l}});try{let e=await B();if(!e){U({like:t,dislike:n,static:{...E.static,like_cnt:i,dislike_cnt:a}});return}U({like:e.isLike,dislike:e.isDislike??c,static:{...E.static,like_cnt:e.likeCnt,dislike_cnt:e.dislikeCnt??l}}),R(),window.sensors?.track?.(`detail_like_click`,{object_id:E.id,action:e.isLike?`点赞`:`取消点赞`,like_count:e.likeCnt})}catch(e){console.error(`点赞操作失败:`,e),x.error(k(`detailOperate.operateFailed`))}finally{j(!1)}},[B,E,R,A,I,k,U]),G=g(()=>E.id,[E.id]),K=h(()=>{H(({isCollect:e})=>{U({collect:e})},G)},[H,G,U]);async function q(e){return await new Promise(e=>setTimeout(e,300)),e}let J=h(()=>{s.show({mode:`select`,onCollect:async e=>{try{await q({contentId:E.id,collectionId:e}),U({collect:!0}),R(),x.success(k(`detailOperate.modifyCollectionSuccess`))}catch(e){console.error(`修改收藏夹失败:`,e),x.error(k(`detailOperate.collectFailed`))}}})},[E.id,R,k,U]),Y=h(e=>{let t=e||k(`detailOperate.defaultCollection`);x.custom(e=>b(`div`,{className:`flex items-center justify-between gap-[16px] px-[16px] py-[12px] rounded-[12px] bg-black text-white shadow-lg min-w-[280px]`,children:[b(`div`,{className:`flex items-center gap-[10px]`,children:[y(`div`,{className:`w-[24px] h-[24px] rounded-full bg-white flex items-center justify-center`,children:y(l,{className:`w-[14px] h-[14px]`})}),b(`div`,{className:`flex items-center gap-[6px]`,children:[y(`span`,{className:`text-[14px] leading-[20px]`,children:k(`detailOperate.collectAdded`)}),y(`span`,{className:`text-[14px] leading-[20px] font-semibold`,children:t})]})]}),y(`button`,{type:`button`,className:`text-[14px] text-theme5 font-semibold`,onClick:()=>{x.dismiss(e),J()},children:k(`detailOperate.modifyCollection`)})]}))},[J,k]),X=h(async()=>{if(M)return;if(!I){r.getState().open();return}let e=E.collect||!1;N(!0),window.sensors?.track?.(`detail_fav_click`,{object_id:E.id,action:e?`取消收藏`:`收藏`});try{let t=await V({currentCollect:e,onUpdate:({isCollect:e})=>{U({collect:e})}});if(!t?.success){x.error(t?.message||k(`detailOperate.collectFailed`));return}R(),window.sensors?.track?.(`detail_fav_click`,{object_id:E.id,action:t.isCollect?`收藏`:`取消收藏`}),!e&&t.isCollect&&Y(t.collectionTitle),e&&t.isCollect===!1&&x.success(k(`detailOperate.uncollectSuccess`))}catch(e){console.error(`收藏操作失败:`,e),x.error(e?.message||k(`detailOperate.collectFailed`))}finally{N(!1)}},[V,E.collect,E.id,R,M,I,Y,k,U]),Z=g(()=>a(X,300),[X]);return b(t,{className:`w-full h-[42px] mt-[16px] flex items-center justify-between ${O?`pointer-events-none`:``}`,children:[b(t,{className:`w-[25%] h-full flex flex-col items-center justify-center ${A?`opacity-50 cursor-not-allowed`:`cursor-pointer`}`,onClick:W,children:[E.like?y(p,{className:`w-[20px] h-[20px] ${z.animationClass}`}):y(f,{className:`w-[20px] h-[20px] text-text2`}),y(n,{className:`text-[12px] text-text2 leading-[20px]`,children:E.static?E.static.like_cnt===0?k(`detailOperate.like`):w(E.static?.like_cnt):k(`detailOperate.like`)})]}),b(t,{className:`w-[25%] h-full flex flex-col items-center justify-center ${M?`opacity-50 cursor-not-allowed`:`cursor-pointer`}`,onClick:Z,children:[E.collect?y(d,{className:`w-[20px] h-[20px]`}):y(u,{className:`w-[20px] h-[20px] text-text2`}),y(n,{className:`text-[12px] text-text2 leading-[20px]`,children:k(`detailOperate.collection`)})]}),b(t,{className:`w-[25%] h-full flex flex-col items-center justify-center cursor-pointer`,onClick:K,children:[y(m,{className:`w-[20px] h-[20px] text-text2`}),y(n,{className:`text-[12px] text-text2 leading-[20px]`,children:k(`detailOperate.share`)})]})]})}function w(e){let t=Number(e||0);return Number.isNaN(t)||t<=0?`0`:t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function T(e){if(e==null)return 0;if(typeof e==`number`)return e;let t=Number(e);return Number.isNaN(t)?0:t}export{C as DetailOperate};
2
+ "use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pCommunityMoveCollectionContent as t}from"../../../../../service/generated/client.mjs";import{Box as n}from"../../../../ui/box.mjs";import{Text as r}from"../../../../ui/text.mjs";import{useLoginModalStore as i}from"../../../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as a}from"../../../../../hooks/query/use-query.mjs";import{debounceFun as o}from"../../../../../utils/tools.mjs";import s from"../../../../common/interaction-animations.module.mjs";import c from"../../../../common/collection-popup/index.mjs";import{useContentOperate as l}from"../../../../../hooks/use-content-operate.mjs";import u from"../../../../../assets/icons/detail/check-ok.mjs";import d from"../../../../../assets/icons/detail/collect_nor.mjs";import f from"../../../../../assets/icons/detail/collect_sel.mjs";import p from"../../../../../assets/icons/detail/give_like.mjs";import m from"../../../../../assets/icons/detail/give_like_sel.mjs";import h from"../../../../../assets/icons/detail/share.mjs";import{useCallback as g,useMemo as _,useRef as v,useState as y}from"react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{toast as S}from"sonner";import{useTranslations as C}from"next-intl";function w({mode:w=`renderer`,information:D,onUpdate:O}){let k=w===`editor`||!D?.id||D.id.startsWith(`preview-`),A=C(`components.biz.business.detail`),[j,M]=y(!1),[N,P]=y(!1),F=v(0),I=e(e=>e.userId),L=e(e=>e.isLogin),R=a(),z=g(()=>{I&&(R([`user-profile`,`mine`,I,`user-like-video`]),R([`user-profile`,`mine`,I,`user-like-post`]),R([`user-profile`,`mine`,I,`user-collect-video`,I]),R([`user-profile`,`mine`,I,`user-collect-post`,I]))},[R,I]),{likeAnimation:B,handleLikeOperate:V,handleDefaultCollectionOperate:H,handleShareOperate:U}=l({id:D.id,isLike:D.like||!1,isDislike:D.dislike||!1,isCollect:D.collect||!1,likeCnt:E(D.static?.like_cnt),dislikeCnt:E(D.static?.dislike_cnt),contentType:D.content_type,prefetchDefaultCollection:!k,animationClasses:{like:s.likeShakeAnimation,dislike:s.dislikeShakeAnimation}}),W=g(e=>{O?.({...e})},[O]),G=g(async()=>{if(j)return;if(!L){i.getState().open();return}let e=Date.now();if(e-F.current<300)return;F.current=e,M(!0);let t=D.like||!1,n=D.dislike||!1,r=E(D.static?.like_cnt),a=E(D.static?.dislike_cnt),o=!t,s=Math.max(0,r+(o?1:-1)),c=o?!1:n,l=o&&n?Math.max(0,a-1):a;W({like:o,dislike:c,static:{...D.static,like_cnt:s,dislike_cnt:l}});try{let e=await V();if(!e){W({like:t,dislike:n,static:{...D.static,like_cnt:r,dislike_cnt:a}});return}W({like:e.isLike,dislike:e.isDislike??c,static:{...D.static,like_cnt:e.likeCnt,dislike_cnt:e.dislikeCnt??l}}),z(),window.sensors?.track?.(`detail_like_click`,{object_id:D.id,action:e.isLike?`点赞`:`取消点赞`,like_count:e.likeCnt})}catch(e){console.error(`点赞操作失败:`,e),S.error(A(`detailOperate.operateFailed`))}finally{M(!1)}},[V,D,z,j,L,A,W]),K=_(()=>D.id,[D.id]),q=g(()=>{U(({isCollect:e})=>{W({collect:e})},K)},[U,K,W]),J=g(()=>{c.show({mode:`select`,onCollect:async e=>{try{let n=await t({new_collection_id:e,content_id:D.id});if(n.code!==0)throw Error(n.message||A(`detailOperate.collectFailed`));W({collect:!0}),z(),S.success(A(`detailOperate.modifyCollectionSuccess`))}catch(e){console.error(`修改收藏夹失败:`,e),S.error(A(`detailOperate.collectFailed`))}}})},[D.id,z,A,W]),Y=g(e=>{let t=e||A(`detailOperate.defaultCollection`);S.custom(e=>x(`div`,{className:`flex items-center justify-between gap-[16px] px-[16px] py-[12px] rounded-[12px] bg-black text-white shadow-lg min-w-[280px]`,children:[x(`div`,{className:`flex items-center gap-[10px]`,children:[b(`div`,{className:`w-[24px] h-[24px] rounded-full bg-white flex items-center justify-center`,children:b(u,{className:`w-[14px] h-[14px]`})}),x(`div`,{className:`flex items-center gap-[6px]`,children:[b(`span`,{className:`text-[14px] leading-[20px]`,children:A(`detailOperate.collectAdded`)}),b(`span`,{className:`text-[14px] leading-[20px] font-semibold`,children:t})]})]}),b(`button`,{type:`button`,className:`text-[14px] text-theme5 font-semibold`,onClick:()=>{S.dismiss(e),J()},children:A(`detailOperate.modifyCollection`)})]}))},[J,A]),X=g(async()=>{if(N)return;if(!L){i.getState().open();return}let e=D.collect||!1;P(!0),window.sensors?.track?.(`detail_fav_click`,{object_id:D.id,action:e?`取消收藏`:`收藏`});try{let t=await H({currentCollect:e,onUpdate:({isCollect:e})=>{W({collect:e})}});if(!t?.success){S.error(t?.message||A(`detailOperate.collectFailed`));return}z(),window.sensors?.track?.(`detail_fav_click`,{object_id:D.id,action:t.isCollect?`收藏`:`取消收藏`}),!e&&t.isCollect&&Y(t.collectionTitle),e&&t.isCollect===!1&&S.success(A(`detailOperate.uncollectSuccess`))}catch(e){console.error(`收藏操作失败:`,e),S.error(e?.message||A(`detailOperate.collectFailed`))}finally{P(!1)}},[H,D.collect,D.id,z,N,L,Y,A,W]),Z=_(()=>o(X,300),[X]);return x(n,{className:`w-full h-[42px] mt-[16px] flex items-center justify-between ${k?`pointer-events-none`:``}`,children:[x(n,{className:`w-[25%] h-full flex flex-col items-center justify-center ${j?`opacity-50 cursor-not-allowed`:`cursor-pointer`}`,onClick:G,children:[D.like?b(m,{className:`w-[20px] h-[20px] ${B.animationClass}`}):b(p,{className:`w-[20px] h-[20px] text-text2`}),b(r,{className:`text-[12px] text-text2 leading-[20px]`,children:D.static?D.static.like_cnt===0?A(`detailOperate.like`):T(D.static?.like_cnt):A(`detailOperate.like`)})]}),x(n,{className:`w-[25%] h-full flex flex-col items-center justify-center ${N?`opacity-50 cursor-not-allowed`:`cursor-pointer`}`,onClick:Z,children:[D.collect?b(f,{className:`w-[20px] h-[20px]`}):b(d,{className:`w-[20px] h-[20px] text-text2`}),b(r,{className:`text-[12px] text-text2 leading-[20px]`,children:A(`detailOperate.collection`)})]}),x(n,{className:`w-[25%] h-full flex flex-col items-center justify-center cursor-pointer`,onClick:q,children:[b(h,{className:`w-[20px] h-[20px] text-text2`}),b(r,{className:`text-[12px] text-text2 leading-[20px]`,children:A(`detailOperate.share`)})]})]})}function T(e){let t=Number(e||0);return Number.isNaN(t)||t<=0?`0`:t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function E(e){if(e==null)return 0;if(typeof e==`number`)return e;let t=Number(e);return Number.isNaN(t)?0:t}export{w as DetailOperate};
@@ -8,7 +8,7 @@ type TabBarProps = TabBarInspectorProps & {
8
8
  items?: Array<Record<string, unknown>>;
9
9
  };
10
10
  /**
11
- * TabBar 物料组件 - 客户端交互部分
11
+ * TabBar 物料组件 - 客户端交互部分(支持 icon+文案 / 仅 icon 两种形式)
12
12
  */
13
13
  declare function TabBarClient(props: TabBarProps): react_jsx_runtime0.JSX.Element | null;
14
14
  //#endregion
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import{useMemo as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{usePathname as o,useRouter as s}from"next/navigation";const c=[];function l(l){let{items:u=c,mode:d=`renderer`}=l,f=s(),p=o(),m=r(()=>{if(d===`editor`)return 0;let e=u.findIndex(e=>!!(e.domainId===`home`&&p===`/`||e.domainId===`mine`&&p.includes(`/mine`)));return e>=0?e:0},[u,p,d]),h=e=>{if(d!==`editor`)if(e.configType===1)switch(e.functionPageType){case`搜索`:f.push(`/search`);break;case`个人中心`:f.push(`/user/mine`);break;case`内容列表`:f.push(`/video-list?tags=${e.tags}&title=${e.title}`);break;default:f.push(`/`)}else{let t=(e.domainId??``).toString().trim();f.push(t?`/domain/${t}`:`/`)}};if(!u||u.length===0)return null;let g=u.some(e=>e.label!=null&&String(e.label).trim()!==``);return i(t,{className:`fixed bottom-0 left-0 right-0 z-50 safe-area-bottom bg-bg1 border-t border-line1 backdrop-blur-[2px] py-3 shadow-[0px_-4px_10px_0px_rgba(0,0,0,0.02)]`,children:i(t,{className:`flex w-full items-center`,children:u.map((r,o)=>{let s=m===o,c=r.icon;return s&&r.activeIcon&&(c=r.activeIcon),a(t,{className:`flex min-w-0 flex-1 cursor-pointer flex-col items-center justify-center ${g?`gap-1`:``}`,onClick:()=>h(r),children:[i(t,{className:`relative size-[22px] shrink-0`,children:c?i(e,{src:c,alt:typeof r.label==`string`?r.label:``,fill:!0,className:`object-contain`}):i(t,{className:`size-full rounded-sm ${s?`bg-theme5`:`bg-text3`}`})}),g&&i(n,{className:`truncate text-center text-[10px] leading-[10px] font-medium min-w-0 max-w-full px-0.5 ${s?`text-theme5`:`text-text2`}`,children:r.label??``})]},o)})})})}export{l as TabBarClient};
2
+ "use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import{useMemo as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{usePathname as o,useRouter as s}from"next/navigation";const c=[];function l(e,t){return e.domainId===`home`&&t===`/`||e.domainId===`mine`&&t.includes(`/mine`)}function u(e){if(e.configType===1)switch(e.functionPageType){case`搜索`:return`/search`;case`个人中心`:return`/user/mine`;case`内容列表`:return`/video-list?tags=${e.tags}&title=${e.title}`;default:return`/`}let t=(e.domainId??``).toString().trim();return t?`/domain/category/${t}`:`/`}function d(d){let{items:f=c,mode:p=`renderer`}=d,m=s(),h=o(),g=r(()=>{if(p===`editor`)return 0;let e=(f??[]).findIndex(e=>l(e,h));return e>=0?e:0},[f,h,p]),_=r(()=>(f??[]).some(e=>e.label!=null&&String(e.label).trim()!==``),[f]);if(!f?.length)return null;let v=e=>{p!==`editor`&&m.push(u(e))},y=`flex min-w-0 flex-1 cursor-pointer flex-col items-center justify-center ${_?`gap-1`:``}`;return i(t,{className:`fixed bottom-0 left-0 right-0 z-50 safe-area-bottom bg-bg1 border-t border-line1 backdrop-blur-[2px] py-3 shadow-[0px_-4px_10px_0px_rgba(0,0,0,0.02)]`,children:i(t,{className:`flex w-full items-center`,children:f.map((r,o)=>{let s=g===o,c=s&&r.activeIcon?r.activeIcon:r.icon,l=typeof r.label==`string`?r.label:String(r.label??``);return a(t,{className:y,onClick:()=>v(r),children:[i(t,{className:`relative size-[22px] shrink-0`,children:c?i(e,{src:c,alt:l,fill:!0,className:`object-contain`}):i(t,{className:`size-full rounded-sm ${s?`bg-theme5`:`bg-text3`}`})}),_&&i(n,{className:`truncate text-center text-[10px] leading-[10px] font-medium min-w-0 max-w-full px-0.5 ${s?`text-theme5`:`text-text2`}`,children:l})]},o)})})})}export{d as TabBarClient};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Box as e}from"../../ui/box.mjs";import{Sheet as t,SheetContent as n,SheetHeader as r,SheetTitle as i}from"../../ui/sheet.mjs";import{Switch as a}from"../../ui/switch.mjs";import{Text as o}from"../../ui/text.mjs";import{useKeepAliveState as s}from"../keep-scroll-position/index.mjs";import c from"../../../assets/icons/close.mjs";import l from"../../../assets/icons/common/right_arrow.mjs";import u from"../../ui/popup.mjs";import{useCardDecoration as d}from"../../../hooks/use-card-decoration.mjs";import{useCallback as f,useEffect as p,useMemo as m,useRef as h,useState as g}from"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{toast as b}from"sonner";import{useTranslations as x}from"next-intl";function S(e,t,n){return(e||[]).map((e,r)=>{let i=Number.parseInt(e?.id||``,10),a=Number.isNaN(i)?r+1:i,o=e?.id||``,s=Number.isNaN(i)&&o||n(a);return{id:e?.id||`${t}-${a}`,series_num:a,title:s}})}function C(e,t,n){return(e||[]).map((e,r)=>{let i=Number(e?.id),a=Number.isNaN(i)?r+1:i,o=n(a);return{id:e?.id||`${t}-${a}`,series_num:a,title:o}})}function w(e,t,n){return e<=0?n(`singleContent`):n(t===`1`?`completedSeriesTotal`:`ongoingSeriesTotal`,{total:e})}function T(e){return e.mode===`detail`?v(D,{information:e.information,series_num:e.series_num,onEpisodeChange:e.onEpisodeChange}):v(E,{open:e.open,variant:e.variant,title:e.title,updateStatus:e.updateStatus,summaryText:e.summaryText,seriesList:e.seriesList,activeEpisodeId:e.activeEpisodeId,showEpisodeTitle:e.showEpisodeTitle,onToggleTitle:e.onToggleTitle,onClose:e.onClose,onSelectEpisode:e.onSelectEpisode,popupBodyStyle:e.popupBodyStyle})}function E({open:s,variant:l,title:d,updateStatus:f,summaryText:_,seriesList:b,activeEpisodeId:C,showEpisodeTitle:T=!1,onToggleTitle:E,onClose:D,onSelectEpisode:O,popupBodyStyle:k}){let A=x(`components.common.seriesEpisodes`),j=!!E,M=j&&T,N=h(null),P=h(null),F=m(()=>S(b,`episode`,e=>A(`episodeLabel`,{episode:e})),[b,A]),I=m(()=>{if(F.length===0)return[];let e=[];return F.forEach((t,n)=>{let r=Math.floor(n/50);e[r]||(e[r]=[]),e[r].push(t)}),e},[F]),L=m(()=>{if(!C)return 0;let e=F.findIndex(e=>e.id===C);return e<0?0:Math.floor(e/50)},[C,F]),[R,z]=g(L);p(()=>{z(L)},[L]);let B=m(()=>typeof _==`string`&&_.trim()?_:w(F.length,f,A),[F.length,_,A,f]),V=d||A(`selectorTitle`);function H(){let e=N.current;if(e){P.current&&=(window.cancelAnimationFrame(P.current),null),e.scrollTop=0;try{e.scrollTo({top:0,left:0,behavior:`auto`})}catch{}P.current=window.requestAnimationFrame(()=>{P.current=null;let e=N.current;e&&(e.scrollTop=0)})}}p(()=>{s&&H()},[s,T,R]);function U(e){E&&(E(e),H())}function W(e){O?.(e.id,e.series_num),D()}let G=M?2:5,K=I.length>1?v(`div`,{className:`w-full flex gap-[8px] overflow-x-auto`,children:I.map((e,t)=>{if(e.length===0)return null;let n=t===R,r=t*50+1,i=Math.min((t+1)*50,F.length);return y(`div`,{className:`shrink-0 px-[16px] py-[6px] rounded-[16px] text-[14px] transition-colors cursor-pointer relative overflow-hidden ${n?`text-theme5 bg-bg2`:`text-text2 bg-bg2`}`,onClick:()=>{z(t),H()},children:[r,`-`,i,n&&v(`div`,{className:`absolute w-full h-full top-0 left-0 opacity-20 bg-theme5`})]},`series-group-${t}`)})}):null,q=y(`div`,{className:`pb-[8px] flex justify-between`,children:[v(`span`,{className:`text-[16px] text-text1`,children:B}),j&&y(`div`,{className:`flex items-center gap-[4px]`,children:[v(a,{size:`sm`,className:`data-checked:bg-theme5 h-[20px] w-[33px]`,checked:T,onCheckedChange:e=>{U(!!e)}}),v(`button`,{type:`button`,className:`text-[16px] text-text1`,onClick:()=>{U(!T)},children:A(`episodeTitle`)})]})]}),J=v(`div`,{className:`grid w-full gap-2 ${G===2?`grid-cols-2`:`grid-cols-5`}`,children:(I[R]||[]).map((e,t)=>{let n=!!(C&&e.id===C);return v(`button`,{type:`button`,"data-episode-id":e.id,onClick:()=>{W(e)},className:`flex items-center justify-center w-full h-[60px] rounded-[8px] border border-line1 border-solid text-[16px] cursor-pointer select-none transition-colors relative overflow-hidden ${n?`font-bold text-theme5 bg-line1`:`text-text1`} ${M?`h-[72px] px-[10px] text-[14px]`:``} ${t%G===0?``:`border-l-0`}`,children:M?v(`span`,{className:`leading-[22px] line-clamp-2`,children:e.title}):e.series_num},e.id)})});return l===`sheet`?v(t,{open:s,onOpenChange:e=>!e&&D(),children:y(n,{side:`bottom`,showCloseButton:!0,className:`min-h-[50vh] max-h-[70vh] bg-bg1 text-text1 rounded-t-2xl border-t border-white/10`,children:[v(r,{className:`pt-3 pb-0`,children:v(i,{className:`flex items-center justify-between text-lg text-text1`,children:V})}),y(`div`,{className:`px-4 pb-2 flex flex-col gap-3`,children:[K,q]}),v(`div`,{ref:N,className:`flex-1 h-0 pt-[4px] pb-[12px] overflow-y-auto px-4`,children:J})]})}):v(u,{open:s,onOpenChange:e=>{e||D()},showCloseButton:!1,className:`border-0 bg-transparent p-0`,children:y(e,{className:`w-full flex flex-col bg-bg1 px-[12px] text-text1`,style:{minHeight:`60vh`,...k},children:[y(e,{className:`flex justify-between items-center h-[48px]`,children:[v(o,{className:`text-[16px] font-bold text-text1`,children:V}),v(e,{className:`pl-[12px] h-full flex items-center`,onClick:D,children:v(c,{className:`w-[14px] h-[14px] text-text1 cursor-pointer`})})]}),y(e,{className:`flex-1 h-0 w-full pb-[12px] flex flex-col gap-3`,children:[K,q,v(e,{ref:N,className:`flex-1 h-0 pt-[4px] pb-[12px] overflow-y-auto`,children:J})]})]})})}function D({information:t,series_num:n,onEpisodeChange:r}){let i=x(`components.common`),{getTitleText:a}=d(),[c,u]=s(`detail-series-popup-${t.id}`,!1),[S,w]=s(`detail-series-title-toggle-${t.id}`,!1),T=m(()=>C((t.links||[]).map(e=>({id:e.id,name:e.name})),t.id||`episode`,e=>i(`seriesEpisodes.episodeLabel`,{episode:e})),[t.id,t.links,i]),D=t.update_status===`1`?i(`seriesEpisodes.completedSeriesTotal`,{total:t.links.length}):i(`seriesEpisodes.ongoingSeriesUpdatedTo`,{total:t.links.length}),O=m(()=>t.links[n-1]?.id||t.links[0]?.id||``,[t.links,n]);function k(e){if(typeof window>`u`)return;let{search:t,hash:n}=window.location;window.history.replaceState(window.history.state,``,`${e}${t}${n}`)}let A=h(null),j=f(e=>{let t=A.current?.querySelector(`[data-content-id="${e}"]`);t&&A.current&&A.current.scrollTo({left:t.offsetLeft-10,behavior:`smooth`})},[]);p(()=>{j(O)},[O,j]);let M=f(e=>{if(e!==n){if(!t.links[e-1]){b.error(i(`seriesEpisodes.episodeNotFound`));return}try{r(e);let n=a(t)||t.name||``,i=encodeURIComponent(n);k(`/video/${t.id}/${i}/episode/${e}`)}catch(e){console.error(`切换剧集失败`,e),b.error(i(`seriesEpisodes.episodeSwitchFailed`))}}},[a,t,r,n,i]),N=f(e=>{setTimeout(()=>{j(e)},200)},[j]),[P,F]=g(`auto`),I=f(()=>{if(typeof window>`u`)return;let e=document.getElementById(`selectPopupPosition`),t=window.visualViewport?.height||window.innerHeight;if(e){let n=Math.max(0,t-e.offsetTop);n>0&&F(`${n}px`)}},[]);return p(()=>{if(!c)return;I();let e=()=>{I()};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[I,c]),T.length===0?null:y(_,{children:[y(e,{className:`w-full mt-[16px] flex flex-col items-end mb-[4px]`,children:[y(e,{className:`w-fit flex items-center px-[12px] h-[28px]`,onClick:()=>u(!0),children:[v(o,{className:`text-[14px] text-text2 leading-[20px]`,children:D}),v(l,{className:`w-[11px] h-[18px] ml-[4px] text-text2`})]}),v(`div`,{ref:A,className:`w-full mt-[12px] overflow-x-auto px-[12px] flex gap-x-[8px] ${S?`h-[76px]`:`h-[60px]`}`,children:T.map((e,t)=>v(`div`,{"data-content-id":e.id,className:`shrink-0 h-[full] px-[18px] rounded-[6px] border border-line1 flex items-center ${S?`w-[162px]`:`w-[60px] !px-[0] justify-center`} ${e.id===O?`!border-theme5 bg-line1`:``}`,onClick:()=>M(t+1),children:v(o,{className:`text-[16px] text-text1 leading-[22px] line-clamp-2 ${e.id===O?`font-bold !text-theme5`:``}`,children:S?e.title:e.series_num})},e.id))})]}),v(E,{title:i(`seriesEpisodes.selectorTitle`),variant:`popup`,open:c,updateStatus:t.update_status,summaryText:D,seriesList:(t.links||[]).map(e=>({id:e.id,name:e.name})),activeEpisodeId:O,showEpisodeTitle:S,onToggleTitle:e=>{w(e),N(O)},onClose:()=>u(!1),onSelectEpisode:(e,t)=>{u(!1),M(t),j(e)},popupBodyStyle:{height:P}})]})}export{T as SeriesEpisodes};
2
+ "use client";import{Box as e}from"../../ui/box.mjs";import{Sheet as t,SheetContent as n,SheetHeader as r,SheetTitle as i}from"../../ui/sheet.mjs";import{Switch as a}from"../../ui/switch.mjs";import{Text as o}from"../../ui/text.mjs";import{useKeepAliveState as s}from"../keep-scroll-position/index.mjs";import c from"../../../assets/icons/close.mjs";import l from"../../../assets/icons/common/right_arrow.mjs";import u from"../../ui/popup.mjs";import{useCardDecoration as d}from"../../../hooks/use-card-decoration.mjs";import{useCallback as f,useEffect as p,useMemo as m,useRef as h,useState as g}from"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{toast as b}from"sonner";import{useTranslations as x}from"next-intl";function S(e,t,n){return(e||[]).map((e,r)=>{let i=Number.parseInt(e?.id||``,10),a=Number.isNaN(i)?r+1:i,o=e?.id||``,s=Number.isNaN(i)&&o||n(a);return{id:e?.id||`${t}-${a}`,series_num:a,title:s}})}function C(e,t,n){return(e||[]).map((e,r)=>{let i=Number(e?.id),a=Number.isNaN(i)?r+1:i,o=n(a);return{id:e?.id||`${t}-${a}`,series_num:a,title:o}})}function w(e,t,n){return e<=0?n(`singleContent`):n(t===`1`?`completedSeriesTotal`:`ongoingSeriesTotal`,{total:e})}function T(e){return e.mode===`detail`?v(D,{information:e.information,series_num:e.series_num,onEpisodeChange:e.onEpisodeChange}):v(E,{open:e.open,variant:e.variant,title:e.title,updateStatus:e.updateStatus,summaryText:e.summaryText,seriesList:e.seriesList,activeEpisodeId:e.activeEpisodeId,showEpisodeTitle:e.showEpisodeTitle,onToggleTitle:e.onToggleTitle,onClose:e.onClose,onSelectEpisode:e.onSelectEpisode,popupBodyStyle:e.popupBodyStyle})}function E({open:s,variant:l,title:d,updateStatus:f,summaryText:_,seriesList:b,activeEpisodeId:C,showEpisodeTitle:T=!1,onToggleTitle:E,onClose:D,onSelectEpisode:O,popupBodyStyle:k}){let A=x(`components.common.seriesEpisodes`),j=!!E,M=j&&T,N=h(null),P=h(null),F=m(()=>S(b,`episode`,e=>A(`episodeLabel`,{episode:e})),[b,A]),I=m(()=>{if(F.length===0)return[];let e=[];return F.forEach((t,n)=>{let r=Math.floor(n/50);e[r]||(e[r]=[]),e[r].push(t)}),e},[F]),L=m(()=>{if(!C)return 0;let e=F.findIndex(e=>e.id===C);return e<0?0:Math.floor(e/50)},[C,F]),[R,z]=g(L);p(()=>{z(L)},[L]);let B=m(()=>typeof _==`string`&&_.trim()?_:w(F.length,f,A),[F.length,_,A,f]),V=d||A(`selectorTitle`);function H(){let e=N.current;if(e){P.current&&=(window.cancelAnimationFrame(P.current),null),e.scrollTop=0;try{e.scrollTo({top:0,left:0,behavior:`auto`})}catch{}P.current=window.requestAnimationFrame(()=>{P.current=null;let e=N.current;e&&(e.scrollTop=0)})}}p(()=>{s&&H()},[s,T,R]);function U(e){E&&(E(e),H())}function W(e){O?.(e.id,e.series_num),D()}let G=M?2:5,K=I.length>1?v(`div`,{className:`shrink-0 w-full flex gap-[8px] overflow-x-auto`,children:I.map((e,t)=>{if(e.length===0)return null;let n=t===R,r=t*50+1,i=Math.min((t+1)*50,F.length);return y(`div`,{className:`shrink-0 px-[16px] py-[6px] rounded-[16px] text-[14px] transition-colors cursor-pointer relative overflow-hidden ${n?`text-theme5 bg-bg2`:`text-text2 bg-bg2`}`,onClick:()=>{z(t),H()},children:[r,`-`,i,n&&v(`div`,{className:`absolute w-full h-full top-0 left-0 opacity-20 bg-theme5`})]},`series-group-${t}`)})}):null,q=y(`div`,{className:`pb-[8px] flex justify-between`,children:[v(`span`,{className:`text-[16px] text-text1`,children:B}),j&&y(`div`,{className:`flex items-center gap-[4px]`,children:[v(a,{size:`sm`,className:`data-checked:bg-theme5 h-[20px] w-[33px]`,checked:T,onCheckedChange:e=>{U(!!e)}}),v(`button`,{type:`button`,className:`text-[16px] text-text1`,onClick:()=>{U(!T)},children:A(`episodeTitle`)})]})]}),J=v(`div`,{className:`grid w-full gap-2 ${G===2?`grid-cols-2`:`grid-cols-5`}`,children:(I[R]||[]).map((e,t)=>{let n=!!(C&&e.id===C);return v(`button`,{type:`button`,"data-episode-id":e.id,onClick:()=>{W(e)},className:`flex items-center justify-center w-full h-[60px] rounded-[8px] border border-line1 border-solid text-[16px] cursor-pointer select-none transition-colors relative overflow-hidden ${n?`font-bold text-theme5 bg-line1`:`text-text1`} ${M?`h-[72px] px-[10px] text-[14px]`:``} ${t%G===0?``:`border-l-0`}`,children:M?v(`span`,{className:`leading-[22px] line-clamp-2`,children:e.title}):e.series_num},e.id)})});return l===`sheet`?v(t,{open:s,onOpenChange:e=>!e&&D(),children:y(n,{side:`bottom`,showCloseButton:!0,className:`min-h-[50vh] max-h-[70vh] bg-bg1 text-text1 rounded-t-2xl border-t border-white/10`,children:[v(r,{className:`pt-3 pb-0`,children:v(i,{className:`flex items-center justify-between text-lg text-text1`,children:V})}),y(`div`,{className:`px-4 pb-2 flex flex-col gap-3`,children:[K,q]}),v(`div`,{ref:N,className:`flex-1 h-0 pt-[4px] pb-[12px] overflow-y-auto px-4`,children:J})]})}):v(u,{open:s,onOpenChange:e=>{e||D()},showCloseButton:!1,className:`border-0 bg-transparent p-0`,children:y(e,{className:`w-full flex flex-col bg-bg1 px-[12px] text-text1`,style:{height:`70vh`,...k,maxHeight:`70vh`},children:[y(e,{className:`shrink-0 flex justify-between items-center h-[48px]`,children:[v(o,{className:`text-[16px] font-bold text-text1`,children:V}),v(e,{className:`pl-[12px] h-full flex items-center`,onClick:D,children:v(c,{className:`w-[14px] h-[14px] text-text1 cursor-pointer`})})]}),y(e,{className:`flex-1 h-0 w-full pb-[12px] flex flex-col gap-3`,children:[K,q,v(e,{ref:N,className:`flex-1 h-0 pt-[4px] pb-[12px] overflow-y-auto`,children:J})]})]})})}function D({information:t,series_num:n,onEpisodeChange:r}){let i=x(`components.common`),{getTitleText:a}=d(),[c,u]=s(`detail-series-popup-${t.id}`,!1),[S,w]=s(`detail-series-title-toggle-${t.id}`,!1),T=m(()=>C((t.links||[]).map(e=>({id:e.id,name:e.name})),t.id||`episode`,e=>i(`seriesEpisodes.episodeLabel`,{episode:e})),[t.id,t.links,i]),D=t.update_status===`1`?i(`seriesEpisodes.completedSeriesTotal`,{total:t.links.length}):i(`seriesEpisodes.ongoingSeriesUpdatedTo`,{total:t.links.length}),O=m(()=>t.links[n-1]?.id||t.links[0]?.id||``,[t.links,n]);function k(e){if(typeof window>`u`)return;let{search:t,hash:n}=window.location;window.history.replaceState(window.history.state,``,`${e}${t}${n}`)}let A=h(null),j=f(e=>{let t=A.current?.querySelector(`[data-content-id="${e}"]`);t&&A.current&&A.current.scrollTo({left:t.offsetLeft-10,behavior:`smooth`})},[]);p(()=>{j(O)},[O,j]);let M=f(e=>{if(e!==n){if(!t.links[e-1]){b.error(i(`seriesEpisodes.episodeNotFound`));return}try{r(e);let n=a(t)||t.name||``,i=encodeURIComponent(n);k(`/video/${t.id}/${i}/episode/${e}`)}catch(e){console.error(`切换剧集失败`,e),b.error(i(`seriesEpisodes.episodeSwitchFailed`))}}},[a,t,r,n,i]),N=f(e=>{setTimeout(()=>{j(e)},200)},[j]),[P,F]=g(`70vh`),I=f(()=>{if(typeof window>`u`)return;let e=document.getElementById(`selectPopupPosition`),t=window.visualViewport?.height||window.innerHeight;if(!e){F(`70vh`);return}let n=Math.max(0,t-e.offsetTop);if(n<=0){F(`70vh`);return}F(`${n}px`)},[]);return p(()=>{if(!c)return;I();let e=()=>{I()};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[I,c]),T.length===0?null:y(_,{children:[y(e,{className:`w-full mt-[16px] flex flex-col items-end mb-[4px]`,children:[y(e,{className:`w-fit flex items-center px-[12px] h-[28px]`,onClick:()=>u(!0),children:[v(o,{className:`text-[14px] text-text2 leading-[20px]`,children:D}),v(l,{className:`w-[11px] h-[18px] ml-[4px] text-text2`})]}),v(`div`,{ref:A,className:`w-full mt-[12px] overflow-x-auto px-[12px] flex gap-x-[8px] ${S?`h-[76px]`:`h-[60px]`}`,children:T.map((e,t)=>v(`div`,{"data-content-id":e.id,className:`shrink-0 h-[full] px-[18px] rounded-[6px] border border-line1 flex items-center ${S?`w-[162px]`:`w-[60px] !px-[0] justify-center`} ${e.id===O?`!border-theme5 bg-line1`:``}`,onClick:()=>M(t+1),children:v(o,{className:`text-[16px] text-text1 leading-[22px] line-clamp-2 ${e.id===O?`font-bold !text-theme5`:``}`,children:S?e.title:e.series_num})},e.id))})]}),v(E,{title:i(`seriesEpisodes.selectorTitle`),variant:`popup`,open:c,updateStatus:t.update_status,summaryText:D,seriesList:(t.links||[]).map(e=>({id:e.id,name:e.name})),activeEpisodeId:O,showEpisodeTitle:S,onToggleTitle:e=>{w(e),N(O)},onClose:()=>u(!1),onSelectEpisode:(e,t)=>{u(!1),M(t),j(e)},popupBodyStyle:{height:P}})]})}export{T as SeriesEpisodes};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,gUserViewUserInfo as r,pCommunityDeleteCollection as i,pCommunityRemoveContentFromCollection as a,pCommunitySubscribeCollection as o,pInteractionBatchDeleteCollects as s}from"../../../service/generated/client.mjs";import{Box as c}from"../../ui/box.mjs";import{Checkbox as ee}from"../../ui/checkbox.mjs";import{Drawer as te,DrawerContent as ne,DrawerDescription as re,DrawerTitle as ie}from"../../ui/drawer.mjs";import{List as ae}from"../../ui/list.mjs";import{Text as l}from"../../ui/text.mjs";import{useLoginModalStore as oe}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as se,useMutation as u,useRequest as d,useUpdateRequest as ce}from"../../../hooks/query/use-query.mjs";import{ShareDrawer as le}from"../../common/share-popup/share-drawer.mjs";import{SharePlatformEnum as f}from"../../../types/share.mjs";import p from"../../../utils/share-manager.mjs";import{HeaderNav as m}from"../../common/header-nav/client.mjs";import{MoreIcon as h}from"../../common/icons/more.mjs";import{CollectionDetailCard as g}from"./_components/collection-detail-card.mjs";import{useMemo as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{toast as x}from"sonner";import{useTranslations as ue}from"next-intl";import{useRouter as S,useSearchParams as de}from"next/navigation";function C(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function w(e){let t=e.detail.info?.video_duration;if(typeof t==`number`&&Number.isFinite(t)&&t>0)return Math.floor(t);let n=e.medias?.find(e=>{let t=e?.video_duration;return typeof t==`number`&&Number.isFinite(t)&&t>0})?.video_duration;return typeof n==`number`&&Number.isFinite(n)&&n>0?Math.floor(n):0}function T(e){let t=e.detail.info?.play_count;if(typeof t==`number`&&Number.isFinite(t))return Math.max(0,Math.floor(t));let n=e.detail.view_count;return typeof n==`number`&&Number.isFinite(n)?Math.max(0,Math.floor(n)):0}function fe(e){let t=e.detail,n=t.info,r=String(n?.cover_image||t.cover_image||C(e)||``),i=String(n?.text||n?.title||t.title||t.content||``),a=t.author_score??0,o=Array.isArray(t.tags)?t.tags:[];return{id:e.content_id?String(e.content_id):String(e.id),title:i,type:typeof e.type==`number`?e.type:0,coverImage:r,score:a,collectedAt:t.create_time==null?void 0:String(t.create_time),tags:o,duration:w(e),viewCount:T(e),publishTime:String(t.create_time??t.update_time??``),is_more_link:n?.is_more_link??!1,authorName:``}}function E({id:C}){let w=ue(`components.pages.collectionDetail`),T=S(),E=de(),{userId:D,isLogin:O}=t(),{open:k}=oe(),A=se();ce();let j=d([`collection-detail`,C],()=>n({collection_id:C})),M=j.data?.data?.data?.collection?.user_id,N=!!(M&&D&&String(M)===String(D)),P=d([`user-info`,M],()=>r({target_user_id:M,user_id:M})),[F,I]=v(!1),[L,R]=v(!1),[z,B]=v(!1),[V,H]=v(()=>new Set),[U,W]=v(null),G=j.data?.data?.data?.collection,K=G?.contents,q=_(()=>K?K.map(e=>({content_id:e.content_id,id:Number(e.content_id),detail:e,type:Number(e.source_type??0),medias:e.medias,cover_image:e.cover_image})):[],[K]).map(fe),J=_(()=>new Set(q.map(e=>e.id)),[q]),Y=J.size>0&&V.size===J.size;G?.cover_image,G?.content_count,G?.is_subscribe;let{mutateAsync:pe,isPending:me}=u(async e=>await o({collection_id:C,subscribe:e})),{mutateAsync:he,isPending:ge}=u(async e=>await a({collection_id:C,content_id:e})),{mutateAsync:_e,isPending:X}=u(async e=>await i({collection_id:e})),{mutateAsync:ve,isPending:Z}=u(async e=>await s({app_id:0,user_id:D,folder_id:C,content_type:1,content_ids:e})),Q=P.data?.data;Q?.avatar,Q?.nick_name;let ye=N&&G?.is_default===!1;function be(e){W({kind:`content`,id:e.id,type:e.type,title:e.title,isCollected:!0}),I(!0)}function xe(){if(N){R(!0);return}W({kind:`collection`,id:C}),I(!0)}function Se(){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}if(!N){x.error(w(`detail.operationFailed`));return}R(!1),H(new Set),B(!0)}function Ce(){H(new Set),B(!1)}function we(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function Te(){if(Y){H(new Set);return}H(new Set(J))}async function Ee(){if(!(V.size===0||Z)){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}try{let e=await ve(Array.from(V));if(e.code===0){x.success(w(`detail.uncollectSuccess`)),A([`collection-detail`,C]),A([`user-profile`,`mine`]),A([`user-profile`,`profile`,M]),H(new Set),B(!1);return}x.error(e.message||w(`detail.uncollectFailed`))}catch(e){console.error(`批量取消收藏失败`,e),x.error(w(`detail.operationFailed`))}}}function De(e){if(typeof window>`u`)return``;if(e.kind===`collection`)return`${window.location.origin}/collection/${e.id}`;let t=e.title?encodeURIComponent(e.title):`detail`,n=e.type===1?`/video/${e.id}/${t}`:`/post/${e.id}`;return`${window.location.origin}${n}`}function $(e){if(!U)return;let t=De(U);t&&p.showSharePopup({type:e,data:{id:U.id},copyUrl:t})}function Oe(){$(f.WECHAT)}function ke(){$(f.QQ)}function Ae(){$(f.WECHAT_MOMENTS)}function je(){if(!ge){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}!U||U.kind!==`content`||he(U.id).then(e=>{if(e.code===0){x.success(w(`detail.uncollectSuccess`)),A([`collection-detail`,C]),W(e=>e&&{...e,isCollected:!1});return}x.error(e.message||w(`detail.uncollectFailed`))}).catch(e=>{console.error(`取消收藏失败`,e),x.error(w(`detail.operationFailed`))})}}function Me(){let e=new URLSearchParams(E.toString());e.set(`id`,C),e.set(`type`,`edit`),T.push(`/collection/create?${e.toString()}`),R(!1),I(!1)}async function Ne(){if(!X){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}if(!ye){x.error(w(`detail.defaultCollectionDeleteNotSupported`));return}try{let e=await _e(C);if(e.code===0){x.success(w(`detail.deleteSuccess`)),A([`collection-detail`,C]),A([`user-profile`,`mine`]),A([`user-profile`,`profile`,M]),R(!1),I(!1),T.back();return}x.error(e.message||w(`detail.deleteFailed`))}catch(e){console.error(`删除合集失败`,e),x.error(w(`detail.operationFailed`))}}}return b(c,{className:`flex flex-col bg-bg1 min-h-screen ${z?`pb-28`:`pb-6`}`,children:[y(m,{title:G?.title??``,rightChild:N?z?y(`button`,{type:`button`,onClick:Ce,className:`px-2 py-1 text-sm text-text1`,children:w(`detail.done`)}):y(`button`,{type:`button`,onClick:xe,className:`p-2`,children:y(h,{})}):void 0}),y(c,{className:`px-4 flex items-start gap-4`,children:b(c,{className:`flex-1 flex flex-col gap-2`,children:[y(c,{className:`flex items-center justify-between`,children:y(l,{className:`text-xl text-text1 font-medium line-clamp-2`,children:G?.title??w(`detail.defaultTitle`)})}),y(c,{className:`text-text2 text-sm`,children:G?.description})]})}),y(c,{className:`px-4 ${z?`pb-20`:``}`,children:y(ae,{loading:j.isLoading,hasMore:!1,emptyText:w(`detail.emptyContent`),className:`divide-y divide-text1/5`,children:q.map(e=>y(g,{...e,onOpenShare:be,isEditMode:z,isSelected:V.has(e.id),onToggleSelection:we},e.id))})}),z&&b(c,{style:{paddingBottom:`calc(12px + env(safe-area-inset-bottom, 0px))`},className:`fixed left-0 right-0 bottom-0 z-10 bg-bg1 border-t border-text1/10 px-4 pt-3 flex items-center justify-between`,children:[b(c,{className:`flex items-center gap-2`,children:[y(ee,{checked:Y,onCheckedChange:Te}),y(l,{className:`text-sm text-text1`,children:w(`detail.selectAll`)})]}),y(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:V.size>0?`default`:`outline`,disabled:V.size===0||Z,onClick:Ee,children:w(Z?`detail.deleting`:`detail.delete`)})]}),b(te,{open:L,onOpenChange:R,children:[y(ie,{className:`hidden`,children:w(`detail.collectionManageTitle`)}),y(re,{className:`hidden`,children:w(`detail.collectionManageTitle`)}),b(ne,{className:`z-[2000]`,children:[b(c,{className:`px-4 py-5`,children:[y(l,{className:`text-sm text-text1 text-center font-medium`,children:w(`detail.collectionManageTitle`)}),b(c,{className:`mt-4 border-t border-text1/10`,children:[y(`button`,{className:`w-full text-left py-4 border-b border-text1/10`,onClick:Me,children:y(l,{className:`text-text1`,children:w(`detail.editCollection`)})}),y(`button`,{className:`w-full text-left py-4 border-b border-text1/10`,onClick:Se,children:y(l,{className:`text-text1`,children:w(`detail.manageCollection`)})}),y(`button`,{className:`w-full text-left py-4 ${X?`opacity-60 cursor-not-allowed`:``}`,onClick:Ne,disabled:X,children:y(l,{className:`text-destructive`,children:w(X?`detail.deleting`:`detail.deleteCollection`)})})]})]}),y(e,{className:`w-full h-auto py-4 text-lg text-text1`,size:`lg`,onClick:()=>R(!1),variant:`secondary`,children:w(`detail.cancel`)})]})]}),y(le,{isShowCollect:U?.kind===`content`&&N&&O,isCollected:U?.isCollected,open:F,onOpenChange:I,onShareWeChat:Oe,onShareQQ:ke,onShareMoments:Ae,onUncollect:je})]})}export{E as CollectionDetail};
2
+ "use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,gUserViewUserInfo as r,pCommunityDeleteCollection as i,pCommunityRemoveContentFromCollection as a,pCommunitySubscribeCollection as o,pInteractionBatchDeleteCollects as s}from"../../../service/generated/client.mjs";import{Box as c}from"../../ui/box.mjs";import{Checkbox as ee}from"../../ui/checkbox.mjs";import{Drawer as te,DrawerContent as ne,DrawerDescription as re,DrawerTitle as ie}from"../../ui/drawer.mjs";import{List as ae}from"../../ui/list.mjs";import{Text as l}from"../../ui/text.mjs";import{useLoginModalStore as oe}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as se,useMutation as u,useRequest as d,useUpdateRequest as ce}from"../../../hooks/query/use-query.mjs";import{ShareDrawer as le}from"../../common/share-popup/share-drawer.mjs";import{SharePlatformEnum as f}from"../../../types/share.mjs";import p from"../../../utils/share-manager.mjs";import{HeaderNav as m}from"../../common/header-nav/client.mjs";import{MoreIcon as h}from"../../common/icons/more.mjs";import{CollectionDetailCard as g}from"./_components/collection-detail-card.mjs";import{useMemo as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{toast as x}from"sonner";import{useTranslations as ue}from"next-intl";import{useRouter as S,useSearchParams as de}from"next/navigation";function C(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function w(e){let t=e.detail.info?.video_duration;if(typeof t==`number`&&Number.isFinite(t)&&t>0)return Math.floor(t);let n=e.medias?.find(e=>{let t=e?.video_duration;return typeof t==`number`&&Number.isFinite(t)&&t>0})?.video_duration;return typeof n==`number`&&Number.isFinite(n)&&n>0?Math.floor(n):0}function T(e){let t=e.detail.info?.play_count;if(typeof t==`number`&&Number.isFinite(t))return Math.max(0,Math.floor(t));let n=e.detail.view_count;return typeof n==`number`&&Number.isFinite(n)?Math.max(0,Math.floor(n)):0}function fe(e){let t=e.detail,n=t.info,r=String(n?.cover_image||t.cover_image||C(e)||``),i=String(n?.text||n?.title||t.title||t.content||``),a=t.author_score??0,o=Array.isArray(t.tags)?t.tags:[];return{id:e.content_id?String(e.content_id):String(e.id),title:i,type:typeof e.type==`number`?e.type:0,coverImage:r,score:a,collectedAt:t.create_time==null?void 0:String(t.create_time),tags:o,duration:w(e),viewCount:T(e),publishTime:String(t.create_time??t.update_time??``),is_more_link:n?.is_more_link??!1,authorName:``}}function E({id:C}){let w=ue(`components.pages.collectionDetail`),T=S(),E=de(),{userId:D,isLogin:O}=t(),{open:k}=oe(),A=se();ce();let j=d([`collection-detail`,C],()=>n({collection_id:C})),M=j.data?.data?.data?.collection?.user_id,N=!!(M&&D&&String(M)===String(D)),P=d([`user-info`,M],()=>r({target_user_id:M,user_id:M})),[F,I]=v(!1),[L,R]=v(!1),[z,B]=v(!1),[V,H]=v(()=>new Set),[U,W]=v(null),G=j.data?.data?.data?.collection,K=G?.contents,q=_(()=>K?K.map(e=>({content_id:e.content_id,id:Number(e.content_id),detail:e,type:Number(e.source_type??0),medias:e.medias,cover_image:e.cover_image})):[],[K]).map(fe),J=_(()=>new Set(q.map(e=>e.id)),[q]),Y=J.size>0&&V.size===J.size;G?.cover_image,G?.content_count,G?.is_subscribe;let{mutateAsync:pe,isPending:me}=u(async e=>await o({collection_id:C,subscribe:e})),{mutateAsync:he,isPending:ge}=u(async e=>await a({collection_id:C,content_id:e})),{mutateAsync:_e,isPending:X}=u(async e=>await i({collection_id:e})),{mutateAsync:ve,isPending:Z}=u(async e=>await s({app_id:0,user_id:D,folder_id:C,content_type:1,content_ids:e})),Q=P.data?.data;Q?.avatar,Q?.nick_name;let ye=N&&G?.is_default===!1;function be(e){W({kind:`content`,id:e.id,type:e.type,title:e.title,isCollected:!0}),I(!0)}function xe(){if(N){R(!0);return}W({kind:`collection`,id:C}),I(!0)}function Se(){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}if(!N){x.error(w(`detail.operationFailed`));return}R(!1),H(new Set),B(!0)}function Ce(){H(new Set),B(!1)}function we(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function Te(){if(Y){H(new Set);return}H(new Set(J))}async function Ee(){if(!(V.size===0||Z)){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}try{let e=await ve(Array.from(V));if(e.code===0){x.success(w(`detail.uncollectSuccess`)),A([`collection-detail`,C]),A([`user-profile`,`mine`]),A([`user-profile`,`profile`,M]),H(new Set),B(!1);return}x.error(e.message||w(`detail.uncollectFailed`))}catch(e){console.error(`批量取消收藏失败`,e),x.error(w(`detail.operationFailed`))}}}function De(e){if(typeof window>`u`)return``;if(e.kind===`collection`)return`${window.location.origin}/collection/${e.id}`;let t=e.title?encodeURIComponent(e.title):`detail`,n=e.type===1?`/video/${e.id}/${t}`:`/post/${e.id}`;return`${window.location.origin}${n}`}function $(e){if(!U)return;let t=De(U);t&&p.showSharePopup({type:e,data:{id:U.id},copyUrl:t})}function Oe(){$(f.WECHAT)}function ke(){$(f.QQ)}function Ae(){$(f.WECHAT_MOMENTS)}function je(){if(!ge){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}!U||U.kind!==`content`||he(U.id).then(e=>{if(e.code===0){x.success(w(`detail.uncollectSuccess`)),A([`collection-detail`,C]),W(e=>e&&{...e,isCollected:!1});return}x.error(e.message||w(`detail.uncollectFailed`))}).catch(e=>{console.error(`取消收藏失败`,e),x.error(w(`detail.operationFailed`))})}}function Me(){let e=new URLSearchParams(E.toString());e.set(`id`,C),e.set(`type`,`edit`),T.push(`/collection/create?${e.toString()}`),R(!1),I(!1)}async function Ne(){if(!X){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}if(!ye){x.error(w(`detail.defaultCollectionDeleteNotSupported`));return}try{let e=await _e(C);if(e.code===0){x.success(w(`detail.deleteSuccess`)),A([`collection-detail`,C]),A([`user-profile`,`mine`]),A([`user-profile`,`profile`,M]),R(!1),I(!1),T.back();return}x.error(e.message||w(`detail.deleteFailed`))}catch(e){console.error(`删除合集失败`,e),x.error(w(`detail.operationFailed`))}}}return b(c,{className:`flex flex-col bg-bg1 min-h-screen ${z?`pb-28`:`pb-6`}`,children:[y(m,{title:G?.title??``,rightChild:N?z?y(`button`,{type:`button`,onClick:Ce,className:`px-2 py-1 text-sm text-text1`,children:w(`detail.done`)}):y(`button`,{type:`button`,onClick:xe,className:`p-2`,children:y(h,{})}):void 0}),y(c,{className:`px-4 flex items-start gap-4`,children:b(c,{className:`flex-1 flex flex-col gap-2`,children:[y(c,{className:`flex items-center justify-between`}),y(c,{className:`text-text2 text-sm`,children:G?.description})]})}),y(c,{className:`px-4 ${z?`pb-20`:``}`,children:y(ae,{loading:j.isLoading,hasMore:!1,emptyText:w(`detail.emptyContent`),className:`divide-y divide-text1/5`,children:q.map(e=>y(g,{...e,onOpenShare:be,isEditMode:z,isSelected:V.has(e.id),onToggleSelection:we},e.id))})}),z&&b(c,{style:{paddingBottom:`calc(12px + env(safe-area-inset-bottom, 0px))`},className:`fixed left-0 right-0 bottom-0 z-10 bg-bg1 border-t border-text1/10 px-4 pt-3 flex items-center justify-between`,children:[b(c,{className:`flex items-center gap-2`,children:[y(ee,{checked:Y,onCheckedChange:Te}),y(l,{className:`text-sm text-text1`,children:w(`detail.selectAll`)})]}),y(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:V.size>0?`default`:`outline`,disabled:V.size===0||Z,onClick:Ee,children:w(Z?`detail.deleting`:`detail.delete`)})]}),b(te,{open:L,onOpenChange:R,children:[y(ie,{className:`hidden`,children:w(`detail.collectionManageTitle`)}),y(re,{className:`hidden`,children:w(`detail.collectionManageTitle`)}),b(ne,{className:`z-[2000]`,children:[b(c,{className:`px-4 py-5`,children:[y(l,{className:`text-sm text-text1 text-center font-medium`,children:w(`detail.collectionManageTitle`)}),b(c,{className:`mt-4 border-t border-text1/10`,children:[y(`button`,{className:`w-full text-left py-4 border-b border-text1/10`,onClick:Me,children:y(l,{className:`text-text1`,children:w(`detail.editCollection`)})}),y(`button`,{className:`w-full text-left py-4 border-b border-text1/10`,onClick:Se,children:y(l,{className:`text-text1`,children:w(`detail.manageCollection`)})}),y(`button`,{className:`w-full text-left py-4 ${X?`opacity-60 cursor-not-allowed`:``}`,onClick:Ne,disabled:X,children:y(l,{className:`text-destructive`,children:w(X?`detail.deleting`:`detail.deleteCollection`)})})]})]}),y(e,{className:`w-full h-auto py-4 text-lg text-text1`,size:`lg`,onClick:()=>R(!1),variant:`secondary`,children:w(`detail.cancel`)})]})]}),y(le,{isShowCollect:U?.kind===`content`&&N&&O,isCollected:U?.isCollected,open:F,onOpenChange:I,onShareWeChat:Oe,onShareQQ:ke,onShareMoments:Ae,onUncollect:je})]})}export{E as CollectionDetail};
@@ -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?: "default" | "link" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
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?: "default" | "link" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
11
- size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
10
+ variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
11
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "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> & {
@@ -1,11 +1,11 @@
1
1
 
2
2
  import * as React from "react";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
- import NextImage from "next/image";
4
+ import Image from "next/image";
5
5
 
6
6
  //#region components/ui/image.d.ts
7
7
  /** BaseImageProps 属性定义。 */
8
- type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof NextImage>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
8
+ type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof Image>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
9
9
  type CommonImageProps = BaseImageProps & {
10
10
  /** 图片地址,支持普通 URL、默认资源路径和加密地址。 */src: string; /** 图片替代文本。 */
11
11
  alt?: string; /** 图片类名。 */
@@ -27,6 +27,6 @@ type ImagePropsWithSize = CommonImageProps & {
27
27
  /** ImageProps 属性定义。 */
28
28
  type ImageProps = ImagePropsWithFill | ImagePropsWithSize;
29
29
  /** 图片组件:支持 bnc 解密、默认资源域名拼接与错误占位。 */
30
- declare function Image(props: ImageProps): react_jsx_runtime0.JSX.Element;
30
+ declare function Image$1(props: ImageProps): react_jsx_runtime0.JSX.Element;
31
31
  //#endregion
32
- export { BaseImageProps, CommonImageProps, Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
32
+ export { BaseImageProps, CommonImageProps, Image$1 as Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funhub/platform",
3
3
  "type": "module",
4
- "version": "0.1.76",
4
+ "version": "0.1.78",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"