@funhub/platform 0.2.1 → 0.2.2
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/detail/shared/editor-preview.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-recommend/client.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-recommend/material.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/empty-state.mjs +2 -0
- package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +1 -1
- package/dist/components/biz/business/ranking-recommend/client.d.mts +2 -0
- package/dist/components/biz/business/ranking-recommend/client.mjs +2 -2
- package/dist/components/biz/business/ranking-recommend/material.d.mts +12 -0
- package/dist/components/biz/business/ranking-recommend/schema.d.mts +12 -0
- package/dist/components/biz/business/ranking-recommend/schema.mjs +1 -1
- package/dist/components/biz/business/ranking-recommend/server.mjs +1 -1
- package/dist/components/biz/business/ranking-recommend/shared/query.mjs +2 -0
- package/dist/components/biz/business/ranking-recommend/shared.mjs +1 -1
- package/dist/components/biz/business/search-history/client.mjs +1 -1
- package/dist/components/common/list/collection-list/collection-list-item.d.mts +2 -0
- package/dist/components/common/list/collection-list/collection-list-item.mjs +1 -1
- package/dist/components/pages/settings/_components/reset-password-drawer.mjs +3 -3
- package/dist/components/pages/video-list/video-list-recommend-item.mjs +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button.d.mts +2 -2
- package/dist/components/ui/empty.d.mts +1 -1
- package/dist/components/ui/item.d.mts +1 -1
- package/dist/service/generated/client.d.mts +10 -2
- package/dist/service/generated/client.mjs +1 -1
- package/dist/service/generated/tanstack.d.mts +12 -2
- package/dist/service/generated/tanstack.mjs +1 -1
- package/dist/service.d.mts +3 -3
- package/dist/service.mjs +1 -1
- package/dist/types.d.mts +226 -3
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
const e=`/static/components-thumb/video_player.png`,t=[{id:`tag-1`,name:`标签`,group:`类型`},{id:`tag-2`,name:`标签`,group:`类型`},{id:`tag-3`,name:`标签`,group:`类型`}],n=Array.from({length:6}).map((e,t)=>({id:`episode-${t+1}`,name:`第${t+1}集`,preview_m3u8_url:``,m3u8_url:``})),r={id:`preview-detail`,mid:`preview-detail`,name:`电影名称电影名称电影名称电影名称电影名称`,img_x:e,img_y:e,preview_images:[e],description:`简介文案,简介文案简介文案简介文案简介文案简介文案简介文案简介文案简介文案简介文案简介文案简介文案简介文案简介文案。`,score:`9.6`,is_more_link:`y`,update_status:`1`,tags:t,links:n,content_type:0,play_count:123,episode_cnt:n.length,like:!1,dislike:!1,collect:!1,static:{like_cnt:0,dislike_cnt:0}};function i(e=6){let t=Math.max(1,Math.floor(e));return Array.from({length:t}).map((e,t)=>({...r,id:`preview-recommend-${t+1}`,name:`猜你喜欢 ${t+1}`,play_count:8e3+t*873}))}export{i as buildEditorPreviewRecommendList,r as editorPreviewInformation};
|
|
2
|
+
const e=`/static/components-thumb/video_player.png`,t=[{id:`tag-1`,name:`标签`,group:`类型`},{id:`tag-2`,name:`标签`,group:`类型`},{id:`tag-3`,name:`标签`,group:`类型`}],n=Array.from({length:6}).map((e,t)=>({id:`episode-${t+1}`,name:`第${t+1}集`,preview_m3u8_url:``,m3u8_url:``})),r={id:`preview-detail`,mid:`preview-detail`,name:`电影名称电影名称电影名称电影名称电影名称`,img_x:e,img_y:e,preview_images:[e],description:`简介文案,简介文案简介文案简介文案简介文案简介文案简介文案简介文案简介文案简介文案简介文案简介文案简介文案简介文案。`,score:`9.6`,is_more_link:`y`,update_status:`1`,tags:t,links:n,content_type:0,play_count:123,episode_cnt:n.length,like:!1,dislike:!1,collect:!1,static:{like_cnt:0,dislike_cnt:0}};function i(e=6){let t=Math.max(1,Math.floor(e));return Array.from({length:t}).map((e,t)=>({...r,id:`preview-recommend-${t+1}`,name:`猜你喜欢 ${t+1}`,play_count:8e3+t*873,img_type:t%3==1?`long`:`short`}))}export{i as buildEditorPreviewRecommendList,r as editorPreviewInformation};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Box as e}from"../../../../ui/box.mjs";import
|
|
2
|
+
"use client";import{Box as e}from"../../../../ui/box.mjs";import t from"../../../../ui/loading.mjs";import{WaterfallRecommend as n}from"../../../../common/list/waterfall-recommend/waterfall-recommend.mjs";import{useVideoDetailRecommendData as r}from"./shared.mjs";import{useCallback as i,useMemo as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";function c(e){let t=[],n=[],r=0,i=0;return e.forEach(e=>{let a=(e.cardKind===`short`?120:218)+16;r<=i?(t.push(e),r+=a):(n.push(e),i+=a)}),{left:t,right:n}}function l(l){let{uiItems:u,shouldShowLoading:d,isPreview:f,resolvedModuleTitle:p,triggerIndex:m,triggerMarker:h}=r(l),g=a(()=>u.map((e,t)=>({key:e.info.id?`detail-recommend-${e.info.id}-${t}`:`detail-recommend-${t}`,sourceIndex:e.sourceIndex,href:e.detailPath||`#`,cardKind:e.cardKind,coverUrl:e.coverUrl,title:e.title,metaPrimaryText:e.showEpisode?e.videoInfoText:``,heatText:e.showPlayCount?e.playCountText:``,score:e.score})),[u]),_=a(()=>c(g),[g]),v=!!p,y=i(({item:e})=>{if(!(e.sourceIndex!==m||!h))return e=>{e&&e.setAttribute(`data-detail-recommend-trigger`,h)}},[m,h]);return g.length?s(e,{className:f?`mt-[16px] w-full pointer-events-none`:`mt-[16px] w-full`,children:[o(n,{title:p,columns:_,sectionClassName:`w-full`,headerClassName:v?`mb-[8px] flex items-center justify-between px-[12px]`:`hidden`,titleClassName:`flex-1 min-w-0 text-[18px] leading-[26px] font-bold line-clamp-1 text-text1`,containerClassName:`relative flex w-full gap-[15px] px-[12px]`,getItemRef:y}),d&&o(e,{className:`w-full flex justify-center py-[12px]`,children:o(t,{size:`medium`,showLabel:!1,className:`text-theme5`})})]}):null}export{l as VideoDetailRecommendClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{defineMaterial as e}from"../../../../../utils/schema/material.mjs";import{VideoDetailRecommendClient as t}from"./client.mjs";import{videoDetailRecommendInspectorPropsSchema as n}from"./schema.mjs";import{VideoDetailRecommend as r}from"./server.mjs";const i=e({type:`video-detail-recommend`,name:`详情页-推荐模块`,icon:`/static/components-thumb/
|
|
2
|
+
import{defineMaterial as e}from"../../../../../utils/schema/material.mjs";import{VideoDetailRecommendClient as t}from"./client.mjs";import{videoDetailRecommendInspectorPropsSchema as n}from"./schema.mjs";import{VideoDetailRecommend as r}from"./server.mjs";const i=e({type:`video-detail-recommend`,name:`详情页-推荐模块`,icon:`/static/components-thumb/grid_waterfall_two_column.png`,category:`详情页`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as videoDetailRecommendMaterial};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{cn as e}from"../../../../../utils/cn.mjs";import{Box as t}from"../../../../ui/box.mjs";import{Text as n}from"../../../../ui/text.mjs";import{jsx as r,jsxs as i}from"react/jsx-runtime";function a(a){let{text:o,className:s}=a;return i(t,{className:e(`flex min-h-[360px] w-full flex-col items-center pt-[132px]`,s),children:[i(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`68`,height:`58`,viewBox:`0 0 68 58`,fill:`none`,className:`h-[58px] w-[68px]`,children:[r(`rect`,{x:`0.5`,y:`0.5`,width:`67`,height:`57`,rx:`7.5`,fill:`#1B1829`,stroke:`#322F3E`}),r(`path`,{d:`M27.1175 33.8211L27.118 23.9652C27.1182 21.7159 29.502 20.2667 31.4989 21.3021L40.5835 26.0125C42.6976 27.1086 42.7531 30.1126 40.681 31.2861L31.5959 36.4317C29.596 37.5644 27.1173 36.1195 27.1175 33.8211Z`,fill:`#54525E`})]}),r(n,{className:`mt-[16px] text-center text-[15px] leading-[normal] text-[#54525E]`,children:o})]})}export{a as ProfileMainEmptyState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../../../../../utils/cn.mjs";import{Button as t}from"../../../../../../ui/button.mjs";import{useUserStore as n}from"../../../../../../../store/modules/user-store.mjs";import{gCommunityGetSubscribedCollections as r,gCommunityGetUserCollections as i,gInteractionListCollects as ee,pInteractionBatchDeleteCollects as te,pInteractionBatchDeleteFolders as ne}from"../../../../../../../service/generated/client.mjs";import{Box as a}from"../../../../../../ui/box.mjs";import{Checkbox as re}from"../../../../../../ui/checkbox.mjs";import{Text as o}from"../../../../../../ui/text.mjs";import{Tabs as ie,TabsList as ae,TabsTrigger as oe}from"../../../../../../ui/tabs.mjs";import{useMutation as s,usePaginated as c,useUpdateRequest as se}from"../../../../../../../hooks/query/use-query.mjs";import{CreateCollectionSheet as ce}from"../../../../../../common/collection-popup/create-collection-sheet.mjs";import{DeleteConfirmDialog as le}from"../../../../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{CollectionList as ue}from"../../../../../../common/list/collection-list/collection-list.mjs";import{PostList as de}from"../../../../../../common/list/post-list/post-list.mjs";import{CollectVideoWaterfall as fe}from"./video-waterfall.mjs";import{useEffect as l,useMemo as u,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{toast as m}from"sonner";import{useTranslations as h}from"next-intl";import g from"dayjs";import{parseAsString as pe,useQueryState as me}from"nuqs";const he={video:1,post:2};function ge(e,t){if(!e)return e;let n=0,r=e.pages.map(e=>({page:e,filteredList:(e.data?.list??S).filter(e=>{let r=e?.id??``,i=t.has(r);return i&&(n+=1),!i})}));return{...e,pages:r.map(({page:e,filteredList:t})=>{if(!e.data)return e;let r=typeof e.data.total==`number`?Math.max(0,e.data.total-n):e.data.total;return{...e,data:{...e.data,list:t,total:r}}})}}function _(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 _e(e,t){let n=t[e.content_id||``]?.create_time,r=_(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:g(n).toDate().getTime()}}function v(e){return e.tags?.find(e=>e?.name?.trim())?.name?.trim()||String(e.cat_name||``).trim()||``}function y(e){let t=String(e.img_type||``).trim().toLowerCase();return t===`short`?e.img_y||e.img_x||``:t===`long`?e.img_x||e.img_y||``:e.img_y||e.img_x||``}function ve(e,t){let n=t[e.id||``]?.create_time;return{is_more_link:e.is_more_link,id:e.id||``,title:e.name||``,coverImage:y(e),duration:Number(e.duration??e.detail?.duration??0),authorName:e.up_user||e.source_username||``,viewCount:e.play_count??0,publishTime:g(n).toDate().getTime(),imgType:e.img_type||e.media?.img_type||``,score:e.score??e.detail?.score,metaPrimaryText:v(e)}}function b(e){let t=_(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function x(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function ye(e){let t=e.contents??[],n=(Array.isArray(t)?t:[]).slice(0,3).map(b),r=e.content_count??n.length;return{id:e.collection_id||``,title:e.title||``,contentCount:r,contents:r===0?x(e.collection_id||`collection`):n}}const S=[],be=[`video`,`post`,`collection`],xe=[`created`,`subscribed`];function Se({className:t}){return f(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,className:e(`text-[var(--color-text-secondary)] opacity-60`,t),children:f(`path`,{d:`M7.33398 7.3335V4.66683H8.66732V7.3335H11.334V8.66683H8.66732V11.3335H7.33398V8.66683H4.66732V7.3335H7.33398ZM8.00065 14.6668C4.31875 14.6668 1.33398 11.682 1.33398 8.00016C1.33398 4.31826 4.31875 1.3335 8.00065 1.3335C11.6825 1.3335 14.6673 4.31826 14.6673 8.00016C14.6673 11.682 11.6825 14.6668 8.00065 14.6668ZM8.00065 13.3335C10.9462 13.3335 13.334 10.9457 13.334 8.00016C13.334 5.05464 10.9462 2.66683 8.00065 2.66683C5.05513 2.66683 2.66732 5.05464 2.66732 8.00016C2.66732 10.9457 5.05513 13.3335 8.00065 13.3335Z`,fill:`currentColor`})})}function Ce({className:t}){return f(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,className:e(`text-[var(--color-text-secondary)] opacity-60`,t),children:f(`g`,{children:f(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.7666 2.12385C10.9828 1.94731 11.3023 1.95935 11.5039 2.16096L13.8389 4.49592C13.942 4.5991 13.9999 4.73966 14 4.88557C14 5.03152 13.942 5.17199 13.8389 5.27522L11.5078 7.6053C11.5063 7.60688 11.5055 7.60959 11.5039 7.61116C11.5023 7.61279 11.4997 7.61345 11.498 7.61506L5.27539 13.8387C5.17216 13.9418 5.03168 13.9998 4.88574 13.9998H2.55078C2.24679 13.9998 2.00001 13.753 2 13.449V11.1141C2 10.9681 2.05794 10.8277 2.16113 10.7244L10.7246 2.16096L10.7666 2.12385ZM3.10059 11.3416V12.8992H4.6582L10.335 7.22151L8.77734 5.66389L3.10059 11.3416ZM9.55664 4.88459L11.1143 6.44221L12.6709 4.88557L11.1133 3.32893L9.55664 4.88459Z`,fill:`currentColor`})})})}const we=`flex items-center gap-[2px] text-[14px] leading-6 text-[var(--color-text-secondary)]`;function Te(){return e(`!flex !items-center !flex-none !h-6 !w-auto !rounded-[4px] !bg-[var(--color-surface-chip-gray20)] !text-[12px] !font-normal !leading-[14px] !text-text1 hover:!text-text1`,`data-[active]:!text-text1 data-[state=active]:!text-text1`,`data-[active]:!bg-[image:var(--gradient-action-button)]`,`data-[state=active]:!bg-[image:var(--gradient-action-button)]`)}function C({mode:e=`renderer`,userId:g,showCreateAction:_=!1,queryKeyPrefix:v,isMine:y=!1}){let b=h(),x=h(`components.pages.collectionDetail`),C=h(`components.pages.profile.components.tabs`),w=e===`renderer`,T=v??[],[E,D]=me(`collectTab`,pe.withDefault(`video`)),[O,k]=me(`collectCollectionTab`,pe.withDefault(`created`)),A=u(()=>be.includes(E)?E:`video`,[E]),j=u(()=>xe.includes(O)?O:`created`,[O]),[M,N]=d(!1),[P,F]=d(!1),[Ee,I]=d(!1),[De,L]=d(!1),[Oe,ke]=d(!1),[R,z]=d(()=>new Set),[B,V]=d(()=>new Set),{userId:Ae,userInfo:je}=n(),H=g||Ae||je?.userId||``,Me=se();async function Ne(e,t){if(!H)return{data:{list:[],total:0}};let n=await ee({user_id:H,folder_id:``,content_type:t,page:e,page_size:10}),r=n.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},i=t===he.video?(n.data?.video_infos??[]).map(e=>ve(e,r)):(n.data?.post_infos??[]).map(e=>_e(e,r));return{data:{list:i,total:n.data?.total??i.length}}}let U=c({key:[...T,`user-collect-video`,H],initialPageParam:1,async queryFn(e){return Ne(e,he.video)},options:{staleTime:0,enabled:w},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),W=c({key:[...T,`user-collect-post`,H],initialPageParam:1,options:{staleTime:0,enabled:w},async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}});async function Pe(e){if(!H)return{data:{list:[],total:0}};let t=await i({page:e,user_id:g,page_size:10}),n=t.data?.data?.collections??[];return{data:{list:n.map(ye),total:t.data?.data?.total??n.length}}}async function Fe(e){if(!H)return{data:{list:[],total:0}};let t=(await r({page:e,user_id:g,page_size:10})).data?.data,n=t?.collections??[];return{data:{list:n.map(ye),total:t?.total??n.length}}}let G=c({key:[...T,`user-collection-created`,H],initialPageParam:1,options:{staleTime:0,enabled:w},async queryFn(e){return Pe(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),K=c({key:[...T,`user-collection-subscribed`,H],initialPageParam:1,options:{staleTime:0,enabled:w},async queryFn(e){return Fe(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),Ie=u(()=>U.data?.pages.flatMap(e=>e.data?.list??S)??S,[U.data]),Le=u(()=>W.data?.pages.flatMap(e=>e.data?.list??S)??S,[W.data]),Re=u(()=>G.data?.pages.flatMap(e=>e.data?.list??S)??S,[G.data]),ze=u(()=>K.data?.pages.flatMap(e=>e.data?.list??S)??S,[K.data]),Be=A===`video`?Ie:A===`post`?Le:S,q=new Set(Be.map(e=>e.id)),J=A===`video`?U:W,Y=j===`created`?G:K,Ve=j===`created`?Re:ze,X=new Set(Ve.map(e=>e.id)),He=X.size>0&&B.size===X.size,Ue=A===`video`,We=_&&j===`created`,Ge=[...T,`user-collect-video`,H],Ke=[...T,`user-collect-post`,H],{mutateAsync:qe,isPending:Z}=s(async e=>await te({app_id:0,user_id:H,folder_id:``,content_type:Ue?1:2,content_ids:e})),{mutateAsync:Je,isPending:Q}=s(async e=>await ne({app_id:0,user_id:H,folder_ids:e,delete_content:!0})),Ye=()=>{N(!M),z(new Set)};function Xe(){We&&(F(e=>!e),V(new Set))}l(()=>{if(z(new Set),A===`collection`){N(!1),I(!1);return}N(!1),V(new Set),F(!1),L(!1)},[A]),l(()=>{V(new Set),F(!1),L(!1)},[j]),l(()=>{E!==A&&D(A)},[A,E,D]),l(()=>{O!==j&&k(j)},[j,O,k]);let Ze=e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Qe=()=>{R.size===q.size&&q.size>0?z(new Set):z(new Set(q))};function $e(e){V(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function et(){if(He){V(new Set);return}V(new Set(X))}function tt(){R.size===0||Z||I(!0)}function nt(){Z||I(!1)}function rt(){Q||L(!1)}async function it(){if(!(R.size===0||Z)){if(!H){m.error(C(`collectTab.pleaseLogin`));return}try{let e=Array.from(R),t=await qe(e);if(t.code===0){m.success(C(`collectTab.uncollectedSuccess`));let t=new Set(e);Me(Ue?Ge:Ke,e=>ge(e,t)),I(!1),z(new Set),N(!1)}else m.error(t.message||C(`collectTab.uncollectFailed`))}catch(e){console.error(`取消收藏失败`,e),m.error(C(`collectTab.operationFailed`))}}}function at(){B.size===0||Q||L(!0)}async function ot(){if(!(B.size===0||Q)){if(!H){m.error(C(`collectTab.pleaseLogin`));return}try{let e=await Je(Array.from(B));if(e.code===0){m.success(x(`detail.deleteSuccess`)),await Y.refetch(),L(!1),V(new Set),F(!1);return}m.error(e.message||x(`detail.deleteFailed`))}catch(e){console.error(`删除收藏夹失败`,e),m.error(x(`detail.deleteFailed`))}}}let $=async()=>{if(w){if(A===`collection`){await Y.fetchNextPage();return}await J.fetchNextPage()}};return p(a,{children:[p(a,{className:`flex items-center justify-between`,children:[f(ie,{value:A,onValueChange:e=>{D(e)},children:p(ae,{variant:`tag`,className:`!h-6 !gap-4 !p-0`,children:[f(oe,{value:`video`,className:Te(),children:C(`collectTab.video`)}),f(oe,{value:`collection`,className:Te(),children:C(`collectTab.collections`)})]})}),A===`collection`?_&&p(a,{className:`flex items-center gap-3`,children:[p(`button`,{type:`button`,className:we,onClick:()=>ke(!0),children:[f(Se,{}),f(o,{className:`text-[14px] leading-6 text-[var(--color-text-secondary)]`,children:b(`components.pages.collectionCreate.form.create`)})]}),We&&p(`button`,{type:`button`,className:we,onClick:Xe,children:[!P&&f(Ce,{}),f(o,{className:`text-[14px] leading-6 text-[var(--color-text-secondary)]`,children:C(P?`collectTab.cancel`:`collectTab.edit`)})]})]}):A===`post`&&y&&p(t,{variant:`ghost`,size:`sm`,className:`h-6 gap-[2px] px-0 text-[14px] leading-6 text-[var(--color-text-secondary)] hover:bg-transparent hover:text-[var(--color-text-secondary)]`,onClick:Ye,children:[M?null:f(Ce,{}),f(o,{className:`text-[14px] leading-6 text-[var(--color-text-secondary)]`,children:C(M?`collectTab.cancel`:`collectTab.edit`)})]})]}),f(a,{className:`pt-4`,children:A===`video`?f(fe,{list:Ie,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,emptyText:C(`collectTab.emptyContent`)}):A===`post`?f(de,{list:Le,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,emptyText:C(`collectTab.emptyContent`),isEditMode:M,selectedIds:R,onToggleSelection:Ze}):f(ue,{list:Ve,loading:Y.isFetching,hasMore:Y.hasNextPage??!1,loadMore:$,emptyText:C(`collectTab.emptyContent`),isEditMode:P,selectedIds:B,onToggleSelection:$e})}),M&&A!==`collection`&&p(a,{className:`fixed left-0 z-10 flex w-full items-center justify-between bg-bg1 px-3 py-2 bottom-[var(--tab-bar-occupied-height)]`,children:[p(a,{className:`flex items-center gap-2`,children:[f(re,{checked:R.size===q.size&&q.size>0,onCheckedChange:Qe}),f(o,{className:`text-sm text-text1`,children:C(`collectTab.selectAll`)})]}),f(t,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:R.size>0?`default`:`outline`,disabled:R.size===0||Z,onClick:tt,children:C(Z?`collectTab.processing`:`collectTab.delete`)})]}),P&&p(a,{className:`fixed bottom-0 left-0 right-0 z-[60] h-[98px] bg-[var(--color-overlay-panel-fade-start90)] backdrop-blur-[50px]`,children:[p(a,{className:`flex items-center gap-[2px] px-4 pt-2`,children:[f(`button`,{type:`button`,className:`flex h-12 w-[178px] items-center justify-center rounded-[100px] text-[16px] leading-6 text-[var(--color-text-primary)]`,onClick:et,children:C(He?`collectTab.cancelSelectAll`:`collectTab.selectAll`)}),f(`button`,{type:`button`,className:`flex h-12 w-[178px] items-center justify-center rounded-[100px] bg-[var(--color-surface-white10)] text-[16px] leading-6 text-[var(--color-border-required)] disabled:opacity-40`,disabled:B.size===0||Q,onClick:at,children:C(Q?`collectTab.processing`:`collectTab.delete`)})]}),f(a,{className:`pointer-events-none absolute bottom-2 left-1/2 h-[5px] w-[134px] -translate-x-1/2 rounded-[100px] bg-[var(--color-neutral-black)]`})]}),f(le,{open:Ee,onOpenChange:I,onCancel:nt,onConfirm:it,title:``,description:C(`collectTab.deleteConfirmDescription`),confirmText:C(`collectTab.delete`),cancelText:C(`collectTab.cancel`),isConfirming:Z}),f(le,{open:De,onOpenChange:L,onCancel:rt,onConfirm:ot,title:x(`detail.deleteCollection`),isConfirming:Q}),f(ce,{visible:Oe,onClose:()=>ke(!1),onCreated:()=>{G.refetch()}})]})}export{C as CollectTab};
|
|
2
|
+
"use client";import{cn as e}from"../../../../../../../utils/cn.mjs";import{Button as t}from"../../../../../../ui/button.mjs";import{useUserStore as n}from"../../../../../../../store/modules/user-store.mjs";import{gCommunityGetSubscribedCollections as r,gCommunityGetUserCollections as i,gInteractionListCollects as ee,pCommunityBatchDeleteCollection as te,pInteractionBatchDeleteCollects as ne}from"../../../../../../../service/generated/client.mjs";import{Box as a}from"../../../../../../ui/box.mjs";import{Checkbox as re}from"../../../../../../ui/checkbox.mjs";import{Text as o}from"../../../../../../ui/text.mjs";import{Tabs as ie,TabsList as ae,TabsTrigger as oe}from"../../../../../../ui/tabs.mjs";import{useMutation as se,usePaginated as s,useUpdateRequest as ce}from"../../../../../../../hooks/query/use-query.mjs";import{CreateCollectionSheet as le}from"../../../../../../common/collection-popup/create-collection-sheet.mjs";import{DeleteConfirmDialog as ue}from"../../../../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{CollectionList as de}from"../../../../../../common/list/collection-list/collection-list.mjs";import{PostList as fe}from"../../../../../../common/list/post-list/post-list.mjs";import{ProfileMainEmptyState as c}from"../../empty-state.mjs";import{CollectVideoWaterfall as pe}from"./video-waterfall.mjs";import{useEffect as l,useMemo as u,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{toast as m}from"sonner";import{useTranslations as h}from"next-intl";import g from"dayjs";import{parseAsString as me,useQueryState as he}from"nuqs";const ge={video:1,post:2};function _e(e,t){if(!e)return e;let n=0,r=e.pages.map(e=>({page:e,filteredList:(e.data?.list??y).filter(e=>{let r=e?.id??``,i=t.has(r);return i&&(n+=1),!i})}));return{...e,pages:r.map(({page:e,filteredList:t})=>{if(!e.data)return e;let r=typeof e.data.total==`number`?Math.max(0,e.data.total-n):e.data.total;return{...e,data:{...e.data,list:t,total:r}}})}}function _(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 ve(e,t){let n=t[e.content_id||``]?.create_time,r=_(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:g(n).toDate().getTime()}}function ye(e){return e.tags?.find(e=>e?.name?.trim())?.name?.trim()||String(e.cat_name||``).trim()||``}function be(e){let t=String(e.img_type||``).trim().toLowerCase();return t===`short`?e.img_y||e.img_x||``:t===`long`?e.img_x||e.img_y||``:e.img_y||e.img_x||``}function xe(e,t){let n=t[e.id||``]?.create_time;return{is_more_link:e.is_more_link,id:e.id||``,title:e.name||``,coverImage:be(e),duration:Number(e.duration??e.detail?.duration??0),authorName:e.up_user||e.source_username||``,viewCount:e.play_count??0,publishTime:g(n).toDate().getTime(),imgType:e.img_type||e.media?.img_type||``,score:e.score??e.detail?.score,metaPrimaryText:ye(e)}}function Se(e){let t=_(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function v(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function Ce(e){let t=e.contents??[],n=(Array.isArray(t)?t:[]).slice(0,3).map(Se),r=e.content_count??n.length;return{id:e.collection_id||``,title:e.title||``,contentCount:r,isDefaultCollection:!!e.is_default,contents:r===0?v(e.collection_id||`collection`):n}}const y=[],we=[`video`,`post`,`collection`],Te=[`created`,`subscribed`];function Ee({className:t}){return f(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,className:e(`text-[var(--color-text-secondary)] opacity-60`,t),children:f(`path`,{d:`M7.33398 7.3335V4.66683H8.66732V7.3335H11.334V8.66683H8.66732V11.3335H7.33398V8.66683H4.66732V7.3335H7.33398ZM8.00065 14.6668C4.31875 14.6668 1.33398 11.682 1.33398 8.00016C1.33398 4.31826 4.31875 1.3335 8.00065 1.3335C11.6825 1.3335 14.6673 4.31826 14.6673 8.00016C14.6673 11.682 11.6825 14.6668 8.00065 14.6668ZM8.00065 13.3335C10.9462 13.3335 13.334 10.9457 13.334 8.00016C13.334 5.05464 10.9462 2.66683 8.00065 2.66683C5.05513 2.66683 2.66732 5.05464 2.66732 8.00016C2.66732 10.9457 5.05513 13.3335 8.00065 13.3335Z`,fill:`currentColor`})})}function De({className:t}){return f(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,className:e(`text-[var(--color-text-secondary)] opacity-60`,t),children:f(`g`,{children:f(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.7666 2.12385C10.9828 1.94731 11.3023 1.95935 11.5039 2.16096L13.8389 4.49592C13.942 4.5991 13.9999 4.73966 14 4.88557C14 5.03152 13.942 5.17199 13.8389 5.27522L11.5078 7.6053C11.5063 7.60688 11.5055 7.60959 11.5039 7.61116C11.5023 7.61279 11.4997 7.61345 11.498 7.61506L5.27539 13.8387C5.17216 13.9418 5.03168 13.9998 4.88574 13.9998H2.55078C2.24679 13.9998 2.00001 13.753 2 13.449V11.1141C2 10.9681 2.05794 10.8277 2.16113 10.7244L10.7246 2.16096L10.7666 2.12385ZM3.10059 11.3416V12.8992H4.6582L10.335 7.22151L8.77734 5.66389L3.10059 11.3416ZM9.55664 4.88459L11.1143 6.44221L12.6709 4.88557L11.1133 3.32893L9.55664 4.88459Z`,fill:`currentColor`})})})}const Oe=`flex items-center gap-[2px] text-[14px] leading-6 text-[var(--color-text-secondary)]`;function ke(){return e(`!flex !items-center !flex-none !h-6 !w-auto !rounded-[4px] !bg-[var(--color-surface-chip-gray20)] !text-[12px] !font-normal !leading-[14px] !text-text1 hover:!text-text1`,`data-[active]:!text-text1 data-[state=active]:!text-text1`,`data-[active]:!bg-[image:var(--gradient-action-button)]`,`data-[state=active]:!bg-[image:var(--gradient-action-button)]`)}function b({mode:e=`renderer`,userId:g,showCreateAction:_=!1,queryKeyPrefix:ye,isMine:be=!1}){let Se=h(),v=h(`components.pages.collectionDetail`),b=h(`components.pages.profile.components.tabs`),x=e===`renderer`,S=ye??[],[C,w]=he(`collectTab`,me.withDefault(`video`)),[T,Ae]=he(`collectCollectionTab`,me.withDefault(`created`)),E=u(()=>we.includes(C)?C:`video`,[C]),D=u(()=>Te.includes(T)?T:`created`,[T]),[O,k]=d(!1),[A,j]=d(!1),[je,M]=d(!1),[Me,N]=d(!1),[Ne,Pe]=d(!1),[P,F]=d(()=>new Set),[I,L]=d(()=>new Set),{userId:Fe,userInfo:Ie}=n(),R=g||Fe||Ie?.userId||``,Le=ce();async function Re(e,t){if(!R)return{data:{list:[],total:0}};let n=await ee({user_id:R,folder_id:``,content_type:t,page:e,page_size:10}),r=n.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},i=t===ge.video?(n.data?.video_infos??[]).map(e=>xe(e,r)):(n.data?.post_infos??[]).map(e=>ve(e,r));return{data:{list:i,total:n.data?.total??i.length}}}let z=s({key:[...S,`user-collect-video`,R],initialPageParam:1,async queryFn(e){return Re(e,ge.video)},options:{staleTime:0,enabled:x},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),B=s({key:[...S,`user-collect-post`,R],initialPageParam:1,options:{staleTime:0,enabled:x},async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}});async function ze(e){if(!R)return{data:{list:[],total:0}};let t=await i({page:e,user_id:g,page_size:10}),n=t.data?.data?.collections??[];return{data:{list:n.map(Ce),total:t.data?.data?.total??n.length}}}async function Be(e){if(!R)return{data:{list:[],total:0}};let t=(await r({page:e,user_id:g,page_size:10})).data?.data,n=t?.collections??[];return{data:{list:n.map(Ce),total:t?.total??n.length}}}let V=s({key:[...S,`user-collection-created`,R],initialPageParam:1,options:{staleTime:0,enabled:x},async queryFn(e){return ze(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),H=s({key:[...S,`user-collection-subscribed`,R],initialPageParam:1,options:{staleTime:0,enabled:x},async queryFn(e){return Be(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),U=u(()=>z.data?.pages.flatMap(e=>e.data?.list??y)??y,[z.data]),W=u(()=>B.data?.pages.flatMap(e=>e.data?.list??y)??y,[B.data]),Ve=u(()=>V.data?.pages.flatMap(e=>e.data?.list??y)??y,[V.data]),He=u(()=>H.data?.pages.flatMap(e=>e.data?.list??y)??y,[H.data]),Ue=E===`video`?U:E===`post`?W:y,G=new Set(Ue.map(e=>e.id)),K=E===`video`?z:B,q=D===`created`?V:H,J=D===`created`?Ve:He,Y=E===`video`?U.length===0&&!K.isFetching:E===`post`?W.length===0&&!K.isFetching:J.length===0&&!q.isFetching,X=u(()=>new Set(J.filter(e=>!e.isDefaultCollection).map(e=>e.id)),[J]),We=X.size>0&&[...X].every(e=>I.has(e)),Ge=E===`video`,Ke=_&&D===`created`,qe=[...S,`user-collect-video`,R],Je=[...S,`user-collect-post`,R],{mutateAsync:Ye,isPending:Z}=se(async e=>await ne({app_id:0,user_id:R,folder_id:``,content_type:Ge?1:2,content_ids:e})),{mutateAsync:Xe,isPending:Q}=se(async e=>await te({collection_ids:e})),Ze=()=>{k(!O),F(new Set)};function Qe(){Ke&&(j(e=>!e),L(new Set))}l(()=>{if(F(new Set),E===`collection`){k(!1),M(!1);return}k(!1),L(new Set),j(!1),N(!1)},[E]),l(()=>{L(new Set),j(!1),N(!1)},[D]),l(()=>{C!==E&&w(E)},[E,C,w]),l(()=>{T!==D&&Ae(D)},[D,T,Ae]);let $e=e=>{F(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},et=()=>{P.size===G.size&&G.size>0?F(new Set):F(new Set(G))};function tt(e){if(J.find(t=>t.id===e)?.isDefaultCollection){m.error(v(`detail.defaultCollectionDeleteNotSupported`));return}L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function nt(){if(We){L(new Set);return}L(new Set(X))}function rt(){P.size===0||Z||M(!0)}function it(){Z||M(!1)}function at(){Q||N(!1)}async function ot(){if(!(P.size===0||Z)){if(!R){m.error(b(`collectTab.pleaseLogin`));return}try{let e=Array.from(P),t=await Ye(e);if(t.code===0){m.success(b(`collectTab.uncollectedSuccess`));let t=new Set(e);Le(Ge?qe:Je,e=>_e(e,t)),M(!1),F(new Set),k(!1)}else m.error(t.message||b(`collectTab.uncollectFailed`))}catch(e){console.error(`取消收藏失败`,e),m.error(b(`collectTab.operationFailed`))}}}function st(){I.size===0||Q||N(!0)}async function ct(){if(!(I.size===0||Q)){if(!R){m.error(b(`collectTab.pleaseLogin`));return}try{let e=await Xe(Array.from(I));if(e.code===0){m.success(v(`detail.deleteSuccess`)),await q.refetch(),N(!1),L(new Set),j(!1);return}m.error(e.message||v(`detail.deleteFailed`))}catch(e){console.error(`删除收藏夹失败`,e),m.error(v(`detail.deleteFailed`))}}}let $=async()=>{if(x){if(E===`collection`){await q.fetchNextPage();return}await K.fetchNextPage()}};return p(a,{children:[p(a,{className:`flex items-center justify-between`,children:[f(ie,{value:E,onValueChange:e=>{w(e)},children:p(ae,{variant:`tag`,className:`!h-6 !gap-4 !p-0`,children:[f(oe,{value:`video`,className:ke(),children:b(`collectTab.video`)}),f(oe,{value:`collection`,className:ke(),children:b(`collectTab.collections`)})]})}),E===`collection`?_&&p(a,{className:`flex items-center gap-3`,children:[p(`button`,{type:`button`,className:Oe,onClick:()=>Pe(!0),children:[f(Ee,{}),f(o,{className:`text-[14px] leading-6 text-[var(--color-text-secondary)]`,children:Se(`components.pages.collectionCreate.form.create`)})]}),Ke&&p(`button`,{type:`button`,className:Oe,onClick:Qe,children:[!A&&f(De,{}),f(o,{className:`text-[14px] leading-6 text-[var(--color-text-secondary)]`,children:b(A?`collectTab.cancel`:`collectTab.edit`)})]})]}):E===`post`&&be&&p(t,{variant:`ghost`,size:`sm`,className:`h-6 gap-[2px] px-0 text-[14px] leading-6 text-[var(--color-text-secondary)] hover:bg-transparent hover:text-[var(--color-text-secondary)]`,onClick:Ze,children:[O?null:f(De,{}),f(o,{className:`text-[14px] leading-6 text-[var(--color-text-secondary)]`,children:b(O?`collectTab.cancel`:`collectTab.edit`)})]})]}),f(a,{className:`pt-4`,children:E===`video`?Y?f(c,{text:b(`collectTab.emptyContent`)}):f(pe,{list:U,loading:K.isFetching,hasMore:K.hasNextPage??!1,loadMore:$,emptyText:b(`collectTab.emptyContent`)}):E===`post`?Y?f(c,{text:b(`collectTab.emptyContent`)}):f(fe,{list:W,loading:K.isFetching,hasMore:K.hasNextPage??!1,loadMore:$,emptyText:b(`collectTab.emptyContent`),isEditMode:O,selectedIds:P,onToggleSelection:$e}):Y?f(c,{text:b(`collectTab.emptyContent`)}):f(de,{list:J,loading:q.isFetching,hasMore:q.hasNextPage??!1,loadMore:$,emptyText:b(`collectTab.emptyContent`),isEditMode:A,selectedIds:I,onToggleSelection:tt})}),O&&E!==`collection`&&p(a,{className:`fixed left-0 z-10 flex w-full items-center justify-between bg-bg1 px-3 py-2 bottom-[var(--tab-bar-occupied-height)]`,children:[p(a,{className:`flex items-center gap-2`,children:[f(re,{checked:P.size===G.size&&G.size>0,onCheckedChange:et}),f(o,{className:`text-sm text-text1`,children:b(`collectTab.selectAll`)})]}),f(t,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:P.size>0?`default`:`outline`,disabled:P.size===0||Z,onClick:rt,children:b(Z?`collectTab.processing`:`collectTab.delete`)})]}),A&&p(a,{className:`fixed bottom-0 left-0 right-0 z-[60] h-[98px] bg-[var(--color-overlay-panel-fade-start90)] backdrop-blur-[50px]`,children:[p(a,{className:`flex items-center gap-[2px] px-4 pt-2`,children:[f(`button`,{type:`button`,className:`flex h-12 w-[178px] items-center justify-center rounded-[100px] text-[16px] leading-6 text-[var(--color-text-primary)]`,onClick:nt,children:b(We?`collectTab.cancelSelectAll`:`collectTab.selectAll`)}),f(`button`,{type:`button`,className:`flex h-12 w-[178px] items-center justify-center rounded-[100px] bg-[var(--color-surface-white10)] text-[16px] leading-6 text-[var(--color-border-required)] disabled:opacity-40`,disabled:I.size===0||Q,onClick:st,children:b(Q?`collectTab.processing`:`collectTab.delete`)})]}),f(a,{className:`pointer-events-none absolute bottom-2 left-1/2 h-[5px] w-[134px] -translate-x-1/2 rounded-[100px] bg-[var(--color-neutral-black)]`})]}),f(ue,{open:je,onOpenChange:M,onCancel:it,onConfirm:ot,title:``,description:b(`collectTab.deleteConfirmDescription`),confirmText:b(`collectTab.delete`),cancelText:b(`collectTab.cancel`),isConfirming:Z}),f(ue,{open:Me,onOpenChange:N,onCancel:at,onConfirm:ct,title:v(`detail.deleteCollection`),isConfirming:Q}),f(le,{visible:Ne,onClose:()=>Pe(!1),onCreated:()=>{V.refetch()}})]})}export{b as CollectTab};
|
|
@@ -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{pInteractionBatchClearBrowse as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as c}from"../../../../../../../hooks/query/use-query.mjs";import{PostList as l}from"../../../../../../common/list/post-list/post-list.mjs";import{
|
|
2
|
+
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionBatchClearBrowse as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as c}from"../../../../../../../hooks/query/use-query.mjs";import{PostList as l}from"../../../../../../common/list/post-list/post-list.mjs";import{ProfileMainEmptyState as u}from"../../empty-state.mjs";import{CollectVideoWaterfall as d}from"../collect-tab/video-waterfall.mjs";import{getHistoryData as ee,likeContentType as f}from"../../utils.mjs";import{useEffect as p,useMemo as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{toast as v}from"sonner";import{useTranslations as y}from"next-intl";import{parseAsString as b,useQueryState as x}from"nuqs";function S(e){let{detail:t}=e,{info:n,publish_time:r}=t;return{id:e.id,title:n.title||n.text||``,coverImage:n.cover_image_thumbnail||n.cover_image||n.cover_horizontal_image_thumbnail||void 0,publishTime:r}}function C(e){let{detail:t,content_play_progress:n}=e,{user_info:r,info:i,statics_cnt:a,publish_time:o,parent_content_info:s}=t,c=(Array.isArray(i?.tags)?i.tags:[]).map(e=>typeof e==`string`?e.trim():e&&typeof e==`object`&&`name`in e?String(e.name||``).trim():``).find(Boolean)||``,l=String(i?.img_type||``).trim().toLowerCase(),u=l===`long`||!l&&!!i?.cover_horizontal_image_thumbnail,d=u?i?.cover_horizontal_image_thumbnail||i?.img_x||i?.cover_image_thumbnail||i?.img_y||i?.cover_image||``:i?.cover_image_thumbnail||i?.img_y||i?.cover_horizontal_image_thumbnail||i?.img_x||i?.cover_image||``;return{is_more_link:i.is_more_link,id:e.id,title:i.title||i.text||i.name||``,coverImage:d,duration:Number(i.video_duration??0),progress:n?.percent??0,seriesNum:n?.series_num,authorName:r.name,viewCount:i?.play_count??a?.browse_cnt??0,publishTime:o,type:s?.type,imgType:l||(u?`long`:`short`),score:i?.score,metaPrimaryText:c}}function w(e,t,n){if(!e)return e;let r=0,i=e.pages.map(e=>({page:e,filteredList:(e.data?.list??[]).filter(e=>{let i=n(e)??``,a=t.has(i);return a&&(r+=1),!a})}));return{...e,pages:i.map(({page:e,filteredList:t})=>{if(!e.data)return e;let n=typeof e.data.total==`number`?Math.max(0,e.data.total-r):e.data.total;return{...e,data:{...e.data,list:t,total:n}}})}}const te=[`video`,`post`];function T({mode:T=`renderer`,targetUserId:E,queryKeyPrefix:D}){let O=y(`components.pages.profile.components.tabs`),k=T===`renderer`,A=D??[],[j,M]=x(`historyTab`,b.withDefault(`video`)),N=m(()=>te.includes(j)?j:`video`,[j]),[P,F]=h(!1),[I,L]=h(()=>new Set),R=t(e=>e.userId),z=c(),B=[...A,`user-history-video`],V=[...A,`user-history-post`],H=s({key:B,initialPageParam:1,async queryFn(e){return ee({targetUserId:E,page:e,contentType:f.video})},options:{staleTime:0,enabled:k},getNextPageParam(e,t){if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),U=s({key:V,initialPageParam:1,async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},options:{staleTime:0,enabled:k},getNextPageParam(e,t){if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),W=N===`video`?H:U,G=H.data?.pages.flatMap(e=>(e.data?.list??[]).map(C))??[],K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(S))??[],q=N===`video`?G:K,J=N===`video`?G.length===0&&!W.isFetching:K.length===0&&!W.isFetching,Y=new Set(q.map(e=>e.id)),X=N===`video`,{mutateAsync:Z,isPending:Q}=o(async e=>await n({app_id:0,user_id:R,content_type:e.contentType,content_ids:e.contentIds}));p(()=>{L(new Set)},[N]),p(()=>{j!==N&&M(N)},[N,j,M]);let ne=e=>{L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},re=()=>{I.size===Y.size&&Y.size>0?L(new Set):L(new Set(Y))},ie=async()=>{if(!(I.size===0||Q)){if(!R){v.error(O(`historyTab.pleaseLogin`));return}try{let e=Array.from(I),t=await Z({contentIds:e,contentType:X?1:2});if(t.code===0){v.success(O(`historyTab.historyDeletedSuccess`));let t=new Set(e);z(X?B:V,e=>w(e,t,e=>e.id)),L(new Set),F(!1)}else v.error(t.message||O(`historyTab.deleteFailed`))}catch(e){console.error(`删除浏览记录失败`,e),v.error(O(`historyTab.operationFailed`))}}},$=async()=>{k&&await W.fetchNextPage()};return _(r,{children:[g(r,{className:``,children:N===`video`?J?g(u,{text:O(`historyTab.emptyContent`)}):g(d,{list:G,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`historyTab.emptyContent`)}):J?g(u,{text:O(`historyTab.emptyContent`)}):g(l,{list:K,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`historyTab.emptyContent`),isEditMode:P,selectedIds:I,onToggleSelection:ne})}),P&&_(r,{className:`fixed left-0 z-10 flex w-full items-center justify-between bg-bg1 px-3 py-2 bottom-[var(--tab-bar-occupied-height)]`,children:[_(r,{className:`flex items-center gap-2`,children:[g(i,{checked:I.size===Y.size&&Y.size>0,onCheckedChange:re}),g(a,{className:`text-sm text-text1`,children:O(`historyTab.selectAll`)})]}),g(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:I.size>0?`default`:`outline`,disabled:I.size===0||Q,onClick:ie,children:O(Q?`historyTab.processing`:`historyTab.delete`)})]})]})}export{T as HistoryTab};
|
|
@@ -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{pInteractionUnifiedBatchLikeDislike as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as c}from"../../../../../../../hooks/query/use-query.mjs";import{PostList as l}from"../../../../../../common/list/post-list/post-list.mjs";import{
|
|
2
|
+
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionUnifiedBatchLikeDislike as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as c}from"../../../../../../../hooks/query/use-query.mjs";import{PostList as l}from"../../../../../../common/list/post-list/post-list.mjs";import{ProfileMainEmptyState as u}from"../../empty-state.mjs";import{CollectVideoWaterfall as d}from"../collect-tab/video-waterfall.mjs";import{getLikeData as ee,likeContentType as f}from"../../utils.mjs";import{useEffect as p,useMemo as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{toast as v}from"sonner";import{useTranslations as y}from"next-intl";import{parseAsString as b,useQueryState as x}from"nuqs";function S(e,t,n){if(!e)return e;let r=0,i=e.pages.map(e=>({page:e,filteredList:(e.data?.list??[]).filter(e=>{let i=n(e)??``,a=t.has(i);return a&&(r+=1),!a})}));return{...e,pages:i.map(({page:e,filteredList:t})=>{if(!e.data)return e;let n=typeof e.data.total==`number`?Math.max(0,e.data.total-r):e.data.total;return{...e,data:{...e.data,list:t,total:n}}})}}function te(e){let{detail:t}=e,{info:n,publish_time:r}=t;return{id:e.id,title:n?.name||n?.text||n?.content||``,coverImage:n?.cover_image_thumbnail||n?.cover_image||n?.cover_horizontal_image_thumbnail||``,publishTime:r??0}}function C(e){let{detail:t}=e,{user_info:n,info:r,statics_cnt:i,publish_time:a,parent_content_info:o}=t,s=(Array.isArray(r?.tags)?r.tags:[]).map(e=>typeof e==`string`?e.trim():e&&typeof e==`object`&&`name`in e?String(e.name||``).trim():``).find(Boolean)||``,c=String(r?.img_type||``).trim().toLowerCase(),l=c===`long`||!c&&!!r?.cover_horizontal_image_thumbnail,u=l?r?.cover_horizontal_image_thumbnail||r?.img_x||r?.cover_image_thumbnail||r?.img_y||r?.cover_image||``:r?.cover_image_thumbnail||r?.img_y||r?.cover_horizontal_image_thumbnail||r?.img_x||r?.cover_image||``;return{id:e.id,is_more_link:r?.is_more_link||!1,title:r?.name||r?.text||r?.content||``,coverImage:u,duration:Number(r?.video_duration??0),progress:e.content_play_progress?.percent??0,seriesNum:e.content_play_progress?.series_num,authorName:n?.name||``,viewCount:r?.play_count??i?.browse_cnt??0,publishTime:a??0,type:o?.type,imgType:c||(l?`long`:`short`),score:r?.score,metaPrimaryText:s}}const w=[`video`,`post`];function T({mode:T=`renderer`,targetUserId:E,queryKeyPrefix:D,isMine:ne=!1}){let O=y(`components.pages.profile.components.tabs`),k=T===`renderer`,A=D??[],[j,M]=x(`likeTab`,b.withDefault(`video`)),N=m(()=>w.includes(j)?j:`video`,[j]),[P,F]=h(!1),[I,L]=h(()=>new Set),R=t(e=>e.userId),z=c(),B=[...A,`user-like-video`],V=[...A,`user-like-post`],H=s({key:B,initialPageParam:1,async queryFn(e){return ee({targetUserId:E,page:e,contentType:f.video})},options:{staleTime:0,enabled:k},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),U=s({key:V,options:{staleTime:0,enabled:k},initialPageParam:1,async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),W=N===`video`?H:U,G=H.data?.pages.flatMap(e=>(e.data?.list??[]).map(C))??[],K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(te))??[],q=N===`video`?G:K,J=N===`video`?G.length===0&&!W.isFetching:K.length===0&&!W.isFetching,Y=new Set(q.map(e=>e.id)),X=N===`video`,{mutateAsync:Z,isPending:Q}=o(async e=>await n({app_id:0,user_id:R,action:`cancel_like`,content_ids:e,content_type:X?1:2}));p(()=>{L(new Set)},[N]),p(()=>{j!==N&&M(N)},[N,j,M]);let re=e=>{L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ie=()=>{I.size===Y.size&&Y.size>0?L(new Set):L(new Set(Y))},ae=async()=>{if(!(I.size===0||Q)){if(!R){v.error(O(`likeTab.pleaseLogin`));return}try{let e=Array.from(I),t=await Z(e);if(t.code===0){v.success(O(`likeTab.unlikedSuccess`));let t=new Set(e);z(X?B:V,e=>S(e,t,e=>e.id)),L(new Set),F(!1)}else v.error(t.message||O(`likeTab.unlikeFailed`))}catch(e){console.error(`取消点赞失败`,e),v.error(O(`likeTab.operationFailed`))}}},$=async()=>{k&&await W.fetchNextPage()};return _(r,{children:[g(r,{className:``,children:N===`video`?J?g(u,{text:O(`likeTab.emptyContent`)}):g(d,{list:G,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`likeTab.emptyContent`)}):J?g(u,{text:O(`likeTab.emptyContent`)}):g(l,{list:K,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`likeTab.emptyContent`),isEditMode:P,selectedIds:I,onToggleSelection:re})}),P&&_(r,{className:`fixed left-0 z-10 flex w-full items-center justify-between bg-bg1 px-3 py-2 bottom-[var(--tab-bar-occupied-height)]`,children:[_(r,{className:`flex items-center gap-2`,children:[g(i,{checked:I.size===Y.size&&Y.size>0,onCheckedChange:ie}),g(a,{className:`text-sm text-text1`,children:O(`likeTab.selectAll`)})]}),g(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:I.size>0?`default`:`outline`,disabled:I.size===0||Q,onClick:ae,children:O(Q?`likeTab.processing`:`likeTab.delete`)})]})]})}export{T as LikeTab};
|
|
@@ -9,6 +9,8 @@ type RankingRecommendProps = RankingRecommendInspectorProps & {
|
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* 推荐榜物料组件 - 客户端部分
|
|
12
|
+
* - 智能铺设开启:按标签调用热门列表接口,随机铺设推荐位
|
|
13
|
+
* - 智能铺设关闭:按配置的内容 ID 取数
|
|
12
14
|
*/
|
|
13
15
|
declare function RankingRecommendClient(props: RankingRecommendProps): react_jsx_runtime0.JSX.Element | null;
|
|
14
16
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{isClient as e}from"../../../../utils/common.mjs";import{pContentBatchGetVideoDetail as t}from"../../../../service/generated/client.mjs";import{Box as
|
|
2
|
+
"use client";import{isClient as e}from"../../../../utils/common.mjs";import{pContentBatchGetVideoDetail as t,pContentGetPopularVideoList as n}from"../../../../service/generated/client.mjs";import{pContentGetPopularVideoListKey as r}from"../../../../service/generated/tanstack.mjs";import{Box as i}from"../../../ui/box.mjs";import{Text as a}from"../../../ui/text.mjs";import o from"../../../ui/link.mjs";import{buildImageTextRecommendSmartPicked as s,getImageTextRecommendLayoutTags as c}from"../../../../hooks/image-text-recommend.mjs";import{useRequest as l}from"../../../../hooks/query/use-query.mjs";import u from"../../../../assets/icons/common/right_arrow_thin.mjs";import{buildRankingCardList as d,buildSmartRankingCardList as f,normalizeContentId as p,resolveCoverDisplaySrc as m,resolveOrderedContentIds as h}from"./shared.mjs";import{buildSmartPopularQuery as g,buildStableChosenTags as _}from"./shared/query.mjs";import{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";function w(e){let t=e===`nebula`?`
|
|
3
3
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 138" fill="none">
|
|
4
4
|
<defs>
|
|
5
5
|
<linearGradient id="bg" x1="10" y1="6" x2="84" y2="132" gradientUnits="userSpaceOnUse">
|
|
@@ -67,4 +67,4 @@
|
|
|
67
67
|
<path d="M19 31L31 20L49 23L42 39L24 40L19 31Z" fill="#F8FCFF" opacity="0.82"/>
|
|
68
68
|
<path d="M14 99C31 84 49 77 70 77" stroke="#FF6773" stroke-width="3" stroke-linecap="round" opacity="0.45"/>
|
|
69
69
|
</svg>
|
|
70
|
-
`;return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}const
|
|
70
|
+
`;return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}const T=w(`nebula`),E=w(`crimson`),D=T,O={padding:`0.5px`,background:`linear-gradient(180deg, rgba(230,42,255,0.9) 5%, rgba(239,255,69,0.5) 30%, rgba(233,69,255,0.8) 55%, rgba(233,69,255,0.9) 100%)`,WebkitMask:`linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`,WebkitMaskComposite:`xor`,maskComposite:`exclude`},k={background:`rgba(83, 83, 83, 0.2)`},A={backdropFilter:`blur(4px)`,WebkitBackdropFilter:`blur(4px)`,maskImage:`linear-gradient(180deg, transparent 58.3%, black 100%)`,WebkitMaskImage:`linear-gradient(180deg, transparent 58.3%, black 100%)`},j=[{contentId:`mock-1`,title:`东野圭吾作品:11字谜案`,cover:T,category:`烧脑悬疑`,heatText:`2242万热度`,score:8.9,statusText:`完结`,href:`#`},{contentId:`mock-2`,title:`东野圭吾作品:11字谜案`,cover:E,category:`烧脑悬疑`,heatText:`2242万热度`,score:8.9,statusText:`完结`,href:`#`}];function M(e){return Array.from({length:e},(e,t)=>({...j[t%j.length],contentId:`mock-${t+1}`}))}function N({filled:e,className:t=``}){return S(`svg`,{viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":!0,className:t,children:S(`path`,{d:`M7 0.5L8.76 4.94L13.5 5.39L9.91 8.57L10.94 13.2L7 10.77L3.06 13.2L4.09 8.57L0.5 5.39L5.24 4.94L7 0.5Z`,fill:e?`#FFC039`:`rgba(255,255,255,0.3)`})})}function P({score:e}){let t=Math.ceil(e/2);return C(i,{className:`flex items-center gap-[8px]`,children:[S(i,{className:`flex items-center gap-[4px]`,children:Array.from({length:5},(e,n)=>S(N,{filled:n<t,className:`size-[14px]`},n))}),S(a,{className:`font-['DIN'] text-[12px] font-bold leading-normal text-[#FFC039]`,children:e.toFixed(1)})]})}function F({item:e,isEditor:t}){let n=m(e.cover,D),r=C(i,{className:`relative h-[158px] w-full`,children:[C(i,{className:`absolute left-0 top-[28px] h-[130px] w-full overflow-hidden rounded-[8px]`,children:[S(i,{className:`absolute inset-0 rounded-[8px]`,style:k}),S(i,{className:`pointer-events-none absolute rounded-full`,style:{left:`34px`,top:`-238px`,width:`385.969px`,height:`385.969px`,background:`radial-gradient(25.17% 25.17% at 64.27% 57.53%, #4F8DFF 0%, rgba(255,255,255,0) 100%)`,mixBlendMode:`overlay`,filter:`blur(50px)`}}),S(i,{className:`pointer-events-none absolute rounded-full`,style:{left:`210px`,top:`-75px`,width:`189px`,height:`187px`,background:`radial-gradient(50.27% 50.39% at 65.31% 48.07%, #FF5DEF 0%, rgba(255,255,255,0) 100%)`,mixBlendMode:`overlay`,filter:`blur(50px)`}}),S(i,{className:`pointer-events-none absolute inset-0 rounded-[8px]`,style:O})]}),C(i,{className:`absolute left-[16px] top-0 z-10 h-[138px] w-[100px] overflow-hidden rounded-[4px]`,children:[S(`img`,{src:n,alt:e.title,className:`absolute inset-0 size-full object-cover`}),S(i,{className:`pointer-events-none absolute inset-0 rounded-[4px]`,style:{background:`linear-gradient(180deg, rgba(8, 2, 17, 0) 44.64%, rgba(8, 2, 17, 0.7) 82.7%)`}}),S(i,{className:`pointer-events-none absolute inset-0 rounded-[4px]`,style:A}),e.statusText&&S(i,{className:`absolute bottom-[9px] right-[8px] flex h-[18px] w-[32px] items-center justify-center rounded-[4px] bg-white/20 p-[2px]`,children:S(a,{className:`font-['PingFang_SC'] text-[12px] leading-[14px] text-white`,children:e.statusText})})]}),C(i,{className:`absolute left-[132px] top-[58px] z-10 flex w-[210px] items-start justify-between`,children:[C(i,{className:`flex h-[71px] w-[152px] flex-col justify-between`,children:[C(i,{className:`flex flex-col gap-[4px]`,children:[S(a,{className:`line-clamp-1 font-['PingFang_SC'] text-[14px] font-medium leading-[20px] text-white`,children:e.title}),C(i,{className:`flex items-center gap-[10px] font-['PingFang_SC'] text-[14px] leading-[20px] text-white/60`,children:[e.category&&S(a,{className:`shrink-0 whitespace-nowrap`,children:e.category}),e.heatText&&S(a,{className:`shrink-0 whitespace-nowrap`,children:e.heatText})]})]}),e.score>0&&S(P,{score:e.score})]}),S(i,{"aria-hidden":!0,className:`size-[22px] shrink-0 opacity-0`})]})]});return t||!e.href||e.href===`#`?r:S(o,{href:e.href,className:`block`,children:r})}function I(o){let{title:m,items:w,layout:T,prefetchItems:E,mode:D=`renderer`}=o,O=D===`editor`,k=D===`renderer`,A=(m??``).trim()||`推荐榜`,j=!!T?.enabled,N=y(()=>c(T),[T]),P=w?.length??2,I=y(()=>_(N,P),[N,P]),L=y(()=>g(I,P),[I,P]),{data:R}=l(r(L),()=>n(L),{enabled:k&&!O&&j,staleTime:1/0}),[z,B]=x([]);v(()=>{O||!j||B(f(s(R?.data?.videos??[],I,P)))},[O,j,R,I,P]);let V=y(()=>O||j?[]:h(w),[w,O,j]),H=y(()=>Array.from(new Set(V)),[V]),U=y(()=>V.join(`,`),[V]),W=y(()=>Array.isArray(E)?E.map(e=>p(e.contentId)).join(`,`):``,[E]),[G,K]=x(()=>E??[]),q=b(``);v(()=>{O||j||(K(E??[]),q.current=W&&W===U?U:``)},[O,j,U,W,E]),v(()=>{if(O||j||!e()||!U||q.current===U)return;q.current=U;let n=!1;async function r(){try{let e=await t({ids:H},{cache:`no-store`}),r=Array.isArray(e.data?.videos)?e.data.videos:[];if(n)return;K(d(r,w??[]))}catch(e){console.error(`推荐榜数据获取失败`,e)}}return r(),()=>{n=!0}},[O,j,V,U,H,w]);let J=j?z:G,Y=y(()=>O?M(w?.length??2):[],[O,w?.length]),X=O?Y:J;return!O&&X.length===0?null:C(i,{className:`mt-[24px] w-full px-[16px]${O?` pointer-events-none`:``}`,children:[C(i,{className:`flex items-center justify-between`,children:[S(a,{className:`font-['PingFang_SC'] text-[18px] font-medium leading-[24px] text-white/90`,style:O?{textShadow:`0 1px 4px rgba(0,0,0,0.45)`}:void 0,children:A}),S(i,{className:`flex shrink-0 items-center justify-end gap-[2px] opacity-50`,style:O?{filter:`drop-shadow(0 1px 3px rgba(0,0,0,0.45))`}:void 0,children:S(i,{className:`overflow-hidden`,children:S(u,{className:`size-[24px] text-white`})})})]}),S(i,{className:`mt-[16px] flex flex-col gap-[16px]`,children:X.map((e,t)=>S(F,{item:e,isEditor:O},`${e.contentId}-${t}`))})]})}export{I as RankingRecommendClient};
|
|
@@ -10,8 +10,20 @@ import * as zod_v4_core0 from "zod/v4/core";
|
|
|
10
10
|
//#region components/biz/business/ranking-recommend/material.d.ts
|
|
11
11
|
declare const rankingRecommendMaterial: DefineMaterialOption<typeof RankingRecommendServer, typeof RankingRecommendClient, zod.ZodObject<{
|
|
12
12
|
readonly title: zod.ZodString & SchemaHasDefaultValue;
|
|
13
|
+
readonly moduleCount: zod.ZodNumber & SchemaHasDefaultValue;
|
|
14
|
+
readonly layout: zod.ZodObject<{
|
|
15
|
+
readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
16
|
+
readonly tags: zod.ZodArray<zod.ZodString> & SchemaHasDefaultValue;
|
|
17
|
+
}, zod_v4_core0.$strip> | zod.ZodOptional<zod.ZodObject<{
|
|
18
|
+
readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
19
|
+
readonly tags: zod.ZodArray<zod.ZodString> & SchemaHasDefaultValue;
|
|
20
|
+
}, zod_v4_core0.$strip>>;
|
|
13
21
|
readonly items: zod.ZodArray<zod.ZodObject<{
|
|
14
22
|
id: zod.ZodString & SchemaHasDefaultValue;
|
|
23
|
+
contentName: zod.ZodString & SchemaHasDefaultValue;
|
|
24
|
+
title: zod.ZodString & SchemaHasDefaultValue;
|
|
25
|
+
cover: zod.ZodString & SchemaHasDefaultValue;
|
|
26
|
+
useVideoPoster: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
15
27
|
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
16
28
|
} & {
|
|
17
29
|
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
@@ -9,8 +9,20 @@ import { z } from "zod";
|
|
|
9
9
|
*/
|
|
10
10
|
declare const rankingRecommendInspectorPropsSchema: z.ZodObject<{
|
|
11
11
|
readonly title: z.ZodString & SchemaHasDefaultValue;
|
|
12
|
+
readonly moduleCount: z.ZodNumber & SchemaHasDefaultValue;
|
|
13
|
+
readonly layout: z.ZodObject<{
|
|
14
|
+
readonly enabled: z.ZodBoolean & SchemaHasDefaultValue;
|
|
15
|
+
readonly tags: z.ZodArray<z.ZodString> & SchemaHasDefaultValue;
|
|
16
|
+
}, z.core.$strip> | z.ZodOptional<z.ZodObject<{
|
|
17
|
+
readonly enabled: z.ZodBoolean & SchemaHasDefaultValue;
|
|
18
|
+
readonly tags: z.ZodArray<z.ZodString> & SchemaHasDefaultValue;
|
|
19
|
+
}, z.core.$strip>>;
|
|
12
20
|
readonly items: z.ZodArray<z.ZodObject<{
|
|
13
21
|
id: z.ZodString & SchemaHasDefaultValue;
|
|
22
|
+
contentName: z.ZodString & SchemaHasDefaultValue;
|
|
23
|
+
title: z.ZodString & SchemaHasDefaultValue;
|
|
24
|
+
cover: z.ZodString & SchemaHasDefaultValue;
|
|
25
|
+
useVideoPoster: z.ZodBoolean & SchemaHasDefaultValue;
|
|
14
26
|
}, z.core.$strip>> & SchemaHasDefaultValue;
|
|
15
27
|
} & {
|
|
16
28
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{defineComponentPropsSchema as e,getSchemaDefaultProps as t}from"../../../../utils/schema/schema.mjs";import{z as n}from"zod";const r=e(e=>({title:e.string(`推荐榜`,{label:`标题名称`,description:`支持输入,中/英/数/符,6个字符`}),items:e.array(n.object({id:e.string(``,{label:`内容ID`})}),{label:`推荐榜内容`,defaultValue:[{id:`22edc8693ebbdaf1
|
|
2
|
+
import{defineComponentPropsSchema as e,getSchemaDefaultProps as t}from"../../../../utils/schema/schema.mjs";import{z as n}from"zod";const r=e(e=>({title:e.string(`推荐榜`,{label:`标题名称`,description:`支持输入,中/英/数/符,6个字符`}),moduleCount:e.number(2,{label:`推荐模块数`}),layout:e.object({enabled:e.boolean(!1,{fieldType:`switch`,label:`智能铺设`}),tags:e.array(n.string(),{label:`取数范围标签`,defaultValue:[`电影`]})},{label:`智能铺设`,defaultValue:{enabled:!1,tags:[`电影`]}}),items:e.array(n.object({id:e.string(``,{label:`内容ID`}),contentName:e.string(``,{label:`内容名称`}),title:e.string(``,{label:`推荐位内容名称`}),cover:e.string(``,{label:`推荐位封面`}),useVideoPoster:e.boolean(!0,{fieldType:`switch`,label:`沿用视频海报`})}),{label:`推荐榜内容`,defaultValue:[{id:`22edc8693ebbdaf1`,contentName:``,title:``,cover:``,useVideoPoster:!0},{id:`22edc8693ebbdaf1`,contentName:``,title:``,cover:``,useVideoPoster:!0}]})}));t(r);export{r as rankingRecommendInspectorPropsSchema};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{pContentBatchGetVideoDetail as e}from"../../../../service/generated/client.mjs";import{buildRankingCardList as
|
|
2
|
+
import{pContentBatchGetVideoDetail as e,pContentGetPopularVideoList as t}from"../../../../service/generated/client.mjs";import{pContentGetPopularVideoListKey as n}from"../../../../service/generated/tanstack.mjs";import{getImageTextRecommendLayoutTags as r}from"../../../../hooks/image-text-recommend.mjs";import{HydrationBoundary as i}from"../../../../hooks/query/hydration-boundary.mjs";import{buildRankingCardList as a,resolveOrderedContentIds as o}from"./shared.mjs";import{buildSmartPopularQuery as s,buildStableChosenTags as c}from"./shared/query.mjs";import{RankingRecommendClient as l}from"./client.mjs";import{jsx as u}from"react/jsx-runtime";const d=[];async function f(f){let{mode:p=`renderer`,items:m=d,layout:h,...g}=f,_=!!h?.enabled,v=[],y=f.prefetchItems;if(p===`renderer`)try{if(_){let e=r(h),i=m?.length??2,a=s(c(e,i),i),o=await t(a);v.push({queryKey:n(a),queryFn:()=>Promise.resolve(o)})}else{let t=o(m),n=Array.from(new Set(t));if(n.length>0){let t=await e({ids:n},{cache:`no-store`});y=a(Array.isArray(t.data?.videos)?t.data.videos:[],m)}}}catch(e){console.warn(`[ranking-recommend] server prefetch failed:`,e)}return u(i,{prefetch:v,children:u(l,{...g,items:m,layout:h,mode:p,prefetchItems:y})})}export{f as RankingRecommendServer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
function e(e,t){let n=e.map(e=>String(e).trim()).filter(Boolean);if(!n.length||t<=0)return[];if(n.length>=t)return n.slice(0,t);let r=[...n];for(;r.length<t;)r.push(n[r.length%n.length]);return r}function t(e,t){return{page_size:Math.max(20,t*10),tags:e.length?Array.from(new Set(e)):void 0}}export{t as buildSmartPopularQuery,e as buildStableChosenTags};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import e from"../../../../utils/get-res-url.mjs";import{getPostDetailPagePath as t}from"../../../../utils/tools.mjs";function n(e){return typeof e==`string`?e.trim():String(e??``).trim()}function r(e){return Array.isArray(e)?e.map(e=>n(e?.id)).filter(Boolean):[]}function i(t,n=``){let r=typeof t==`string`?t.trim():``;if(!r)return n;if(r.startsWith(`http`)||r.startsWith(`//`)||r.startsWith(`data:`))return r;let i=e();return i?`${i}${r.startsWith(`/`)?r:`/${r}`}`:r}function a(e){return!e||!Number.isFinite(e)||e<=0?``:e>=1e4?`${(e/1e4).toFixed(e>=1e5?0:1).replace(/\.0$/,``)}万热度`:e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}K热度`:`${Math.floor(e)}热度`}function o(e){let t=n(e.update_status);return t===`1`?`完结`:t===`0`?`连载中`:``}function s(e){let r=n(e.id||e.mid||e.video_id),i=Number(e.play_count??e.browse_count??0)
|
|
2
|
+
import e from"../../../../utils/get-res-url.mjs";import{getPostDetailPagePath as t}from"../../../../utils/tools.mjs";function n(e){return typeof e==`string`?e.trim():String(e??``).trim()}function r(e){return Array.isArray(e)?e.map(e=>n(e?.id)).filter(Boolean):[]}function i(t,n=``){let r=typeof t==`string`?t.trim():``;if(!r)return n;if(r.startsWith(`http`)||r.startsWith(`//`)||r.startsWith(`data:`))return r;let i=e();return i?`${i}${r.startsWith(`/`)?r:`/${r}`}`:r}function a(e){return!e||!Number.isFinite(e)||e<=0?``:e>=1e4?`${(e/1e4).toFixed(e>=1e5?0:1).replace(/\.0$/,``)}万热度`:e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}K热度`:`${Math.floor(e)}热度`}function o(e){let t=n(e.update_status);return t===`1`?`完结`:t===`0`?`连载中`:``}function s(e){let t=Number(e);return!Number.isFinite(t)||t<=0?0:t>10&&t<=100?t/10:Math.min(t,10)}function c(e){let r=n(e.id||e.mid||e.video_id),i=Number(e.play_count??e.browse_count??0);return{contentId:r,title:n(e.name),cover:n(e.img_y||e.img_x),category:n(e.cat_name),heatText:a(i),score:s(e.score),statusText:o(e),href:r?t({id:r,contentType:0}):`#`}}function l(e,t){let r=new Map;return e.forEach(e=>{let t=n(e.id||e.mid||e.video_id);t&&r.set(t,e)}),t.map(e=>{let t=n(e.id),i=t?r.get(t):void 0;if(!i)return null;let a=c(i),o=(e.title??``).trim();o&&(a.title=o);let s=(e.cover??``).trim();return s&&e.useVideoPoster===!1&&(a.cover=s),a}).filter(e=>!!e)}function u(e){let r=n(e.id||e.mid),i=Number(e.static?.browse_cnt??0),o=n(e.update_status);return{contentId:r,title:n(e.name),cover:n(e.img_y||e.img_x),category:n(e.cat_name),heatText:a(i),score:s(e.score),statusText:o===`1`?`完结`:o===`0`?`连载中`:``,href:r?t({id:r,contentType:0}):`#`}}function d(e){return e.map(u)}export{l as buildRankingCardList,d as buildSmartRankingCardList,n as normalizeContentId,i as resolveCoverDisplaySrc,r as resolveOrderedContentIds};
|
|
@@ -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{useRouter as n}from"../../../../utils/use-compatible-router.mjs";import{Box as r}from"../../../ui/box.mjs";import{Text as i}from"../../../ui/text.mjs";import{eventKey as a}from"../../../../constants/event-key.mjs";import{useSearchHistory as o}from"../../../../hooks/use-search-history.mjs";import{DeleteConfirmDialog as s}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{DeleteIcon as c}from"../../../common/icons/delete.mjs";import{useLayoutEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{usePathname as h,useSearchParams as g}from"next/navigation";function _(e,t){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function v(v){let{title:y,rows:b=2,clearText:x,confirmDescription:S,onHistoryClick:C,mode:w=`renderer`}=v,T=w===`editor`,E=y??`搜索历史`,D=x??`清空`,O=S??`确定要清除所有搜索历史吗?`,k=u(()=>[`海市蜃楼`,`迷雾追凶`,`夜行者`,`狂飙`,`三大队`,`破冰行动`],[]),[A,j]=f(!1),[M,N]=f(null),P=d(null),F=d([]),I=d(null),L=n(),R=h(),z=g(),{userInfo:B}=t(),{history:V,addHistory:H,clearHistory:U}=o({storageKey:B?.user_id||`guest`}),W=()=>{U(),j(!1),e.emit(a.SEARCH_HISTORY_UPDATE)},G=u(()=>(V.length?V:w===`editor`?k:[]).slice(0,b*10),[V,w,k,b]);if(l(()=>{if(G.length===0){N(null);return}let e=P.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=[];F.current.slice(0,G.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,b).reduce((e,t)=>Math.max(e,t.bottom),0);N(e=>e===r?e:r)},n=()=>{I.current!=null&&cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>{I.current=null,t()})};if(n(),typeof ResizeObserver>`u`)return()=>{I.current!=null&&(cancelAnimationFrame(I.current),I.current=null)};let r=new ResizeObserver(()=>{n()});return r.observe(e),F.current.slice(0,G.length).forEach(e=>{e&&r.observe(e)}),()=>{r.disconnect(),I.current!=null&&(cancelAnimationFrame(I.current),I.current=null)}},[G,b]),G.length===0)return null;let K=e=>{if(H(e),C){C(e);return}let t=new URLSearchParams(z.toString());t.set(`q`,e);let n=R.includes(`/search-result`)?R:`/search-result`;L.push(`${n}?${t.toString()}`)};return m(r,{className:T?`mt-[24px] px-[16px] py-[16px]`:`mt-[24px] px-[16px] py-0`,children:[m(r,{className:`mb-[15px] flex items-center justify-between`,children:[p(i,{className:`font-['PingFang_SC'] text-[16px] font-medium not-italic leading-normal ${T?`text-[#1F1F1F]`:`text-white`}`,children:E}),p(`button`,{type:`button`,"aria-label":D,className:`flex h-[24px] w-[24px] shrink-0 items-center justify-center ${T?`text-[#1F1F1F]/50`:`text-white/50`}`,onClick:()=>j(!0),children:p(c,{className:`h-[24px] w-[24px]`})})]}),p(r,{ref:P,className:`flex flex-wrap content-
|
|
2
|
+
"use client";import e from"../../../../utils/event-bus.mjs";import{useUserStore as t}from"../../../../store/modules/user-store.mjs";import{useRouter as n}from"../../../../utils/use-compatible-router.mjs";import{Box as r}from"../../../ui/box.mjs";import{Text as i}from"../../../ui/text.mjs";import{eventKey as a}from"../../../../constants/event-key.mjs";import{useSearchHistory as o}from"../../../../hooks/use-search-history.mjs";import{DeleteConfirmDialog as s}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{DeleteIcon as c}from"../../../common/icons/delete.mjs";import{useLayoutEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{usePathname as h,useSearchParams as g}from"next/navigation";function _(e,t){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function v(v){let{title:y,rows:b=2,clearText:x,confirmDescription:S,onHistoryClick:C,mode:w=`renderer`}=v,T=w===`editor`,E=y??`搜索历史`,D=x??`清空`,O=S??`确定要清除所有搜索历史吗?`,k=u(()=>[`海市蜃楼`,`迷雾追凶`,`夜行者`,`狂飙`,`三大队`,`破冰行动`],[]),[A,j]=f(!1),[M,N]=f(null),P=d(null),F=d([]),I=d(null),L=n(),R=h(),z=g(),{userInfo:B}=t(),{history:V,addHistory:H,clearHistory:U}=o({storageKey:B?.user_id||`guest`}),W=()=>{U(),j(!1),e.emit(a.SEARCH_HISTORY_UPDATE)},G=u(()=>(V.length?V:w===`editor`?k:[]).slice(0,b*10),[V,w,k,b]);if(l(()=>{if(G.length===0){N(null);return}let e=P.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=[];F.current.slice(0,G.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,b).reduce((e,t)=>Math.max(e,t.bottom),0);N(e=>e===r?e:r)},n=()=>{I.current!=null&&cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>{I.current=null,t()})};if(n(),typeof ResizeObserver>`u`)return()=>{I.current!=null&&(cancelAnimationFrame(I.current),I.current=null)};let r=new ResizeObserver(()=>{n()});return r.observe(e),F.current.slice(0,G.length).forEach(e=>{e&&r.observe(e)}),()=>{r.disconnect(),I.current!=null&&(cancelAnimationFrame(I.current),I.current=null)}},[G,b]),G.length===0)return null;let K=e=>{if(H(e),C){C(e);return}let t=new URLSearchParams(z.toString());t.set(`q`,e);let n=R.includes(`/search-result`)?R:`/search-result`;L.push(`${n}?${t.toString()}`)};return m(r,{className:T?`mt-[24px] px-[16px] py-[16px]`:`mt-[24px] px-[16px] py-0`,children:[m(r,{className:`mb-[15px] flex items-center justify-between`,children:[p(i,{className:`font-['PingFang_SC'] text-[16px] font-medium not-italic leading-normal ${T?`text-[#1F1F1F]`:`text-white`}`,children:E}),p(`button`,{type:`button`,"aria-label":D,className:`flex h-[24px] w-[24px] shrink-0 items-center justify-center ${T?`text-[#1F1F1F]/50`:`text-white/50`}`,onClick:()=>j(!0),children:p(c,{className:`h-[24px] w-[24px]`})})]}),p(r,{ref:P,className:`flex flex-wrap content-start items-center gap-[6px] overflow-hidden`,style:M?{maxHeight:`${M}px`}:void 0,children:G.map((e,t)=>p(r,{ref:e=>{F.current[t]=e},className:`flex min-w-[56px] cursor-pointer items-center justify-center rounded-full px-[8px] py-[4px] ${T?`bg-[#1F1F1F]/10`:`bg-white/20`}`,onClick:()=>K(e),children:p(i,{className:`max-w-full whitespace-nowrap font-['PingFang_SC'] text-[14px] font-normal not-italic leading-[20px] ${T?`text-[#1F1F1F]`:`text-white`}`,children:_(e,8)})},t))}),p(s,{open:A,onOpenChange:j,onConfirm:W,title:``,description:O})]})}export{v as SearchHistoryClient};
|
|
@@ -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{RightArrowIcon as r}from"../../icons/right-arrow.mjs";import{CollectionSelectIcon as i,CollectionSelectedIcon as a}from"./collection-select-icon.mjs";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";import{useTranslations as l}from"next-intl";import u from"next/link";const d=[];function f({size:e=12}){return s(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`currentColor`,children:s(`path`,{d:`M8 5v14l11-7z`})})}function p(e){if(!e)return``;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`}function m(m){let h=l(`components.common.list.collectionList`),{id:g,title:_,contentCount:v,contents:y=d,
|
|
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{RightArrowIcon as r}from"../../icons/right-arrow.mjs";import{CollectionSelectIcon as i,CollectionSelectedIcon as a}from"./collection-select-icon.mjs";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";import{useTranslations as l}from"next-intl";import u from"next/link";const d=[];function f({size:e=12}){return s(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`currentColor`,children:s(`path`,{d:`M8 5v14l11-7z`})})}function p(e){if(!e)return``;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`}function m(m){let h=l(`components.common.list.collectionList`),{id:g,title:_,contentCount:v,contents:y=d,isDefaultCollection:b=!1,isEditMode:x=!1,isSelected:S=!1,onToggleSelection:C}=m,w=y.slice(0,3),T=!!b,E=x&&typeof C==`function`;function D(){C?.(g)}function O(r,i){if(r.isPlaceholder)return s(t,{className:`h-[130px] w-full rounded-[8px] bg-[var(--color-surface-white10)]`},r.id??`${_}-${i}`);let a=c(t,{className:`relative h-full w-full overflow-hidden rounded-[8px] bg-gray-100`,children:[s(e,{src:r.coverImage||`/empty/default-cover.png`,alt:r.title||_,fill:!0,className:`object-cover`}),r.isVideo&&c(o,{children:[s(t,{className:`absolute inset-0 flex items-center justify-center bg-black/20`,children:s(t,{className:`flex h-6 w-6 items-center justify-center rounded-full bg-[var(--color-text-white80)]`,children:s(f,{size:12})})}),r.isMovie&&s(t,{className:`absolute bottom-1 left-1 rounded-xs bg-[var(--color-surface-mask-black60)] px-1 text-[10px] text-text1`,children:h(`collectionListItem.movieLabel`)}),r.videoDuration&&s(t,{className:`absolute bottom-1 right-1 rounded-xs bg-[var(--color-surface-mask-black60)] px-1 text-[10px] text-text1`,children:p(r.videoDuration)})]}),s(t,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-[58px] rounded-b-[8px] bg-[image:var(--gradient-card-mask-strong)]`}),s(n,{className:`absolute bottom-3 left-2 right-2 line-clamp-2 text-[12px] leading-[16px] text-[var(--color-text-white80)]`,dangerouslySetInnerHTML:{__html:r.title||``}})]});return E?s(`button`,{type:`button`,className:`block h-[130px] w-[103px] shrink-0 overflow-hidden rounded-[8px] bg-[rgba(255,255,255,0.05)]`,onClick:D,"aria-pressed":S,children:a},r.id??`${_}-${i}`):s(u,{href:`/${r.contentType===1?`video`:`post`}/${r.id}`,className:`block h-[130px] w-full shrink-0 overflow-hidden rounded-[8px] bg-[rgba(255,255,255,0.05)]`,children:a},r.id??`${_}-${i}`)}return c(t,{className:`h-[200px] rounded-[8px] bg-[rgba(255,255,255,0.05)] p-4`,children:[c(t,{className:`mb-4 flex items-center justify-between gap-2`,children:[E?c(`button`,{type:`button`,className:`flex min-w-0 items-center gap-1${T?` opacity-50`:``}`,onClick:D,"aria-pressed":T?!1:S,"aria-disabled":T,children:[s(!T&&S?a:i,{}),s(n,{className:`line-clamp-1 text-[16px] font-normal leading-[22px] text-[var(--color-text-primary)]`,children:_})]}):s(n,{className:`line-clamp-1 text-[16px] font-normal leading-[22px] text-[var(--color-text-primary)]`,children:_}),E?c(t,{className:`flex shrink-0 items-center text-[var(--color-text-tertiary)]`,children:[c(n,{className:`text-[14px] leading-[20px] text-[var(--color-text-tertiary)]`,children:[v,h(`collectionListItem.contentCountSuffix`)]}),s(t,{className:`flex size-6 items-center justify-center`,children:s(r,{className:`h-4 w-4 text-[var(--color-text-tertiary)]`})})]}):c(u,{href:`/collection/${g}`,className:`flex shrink-0 items-center text-[var(--color-text-tertiary)]`,children:[c(n,{className:`text-[14px] leading-[20px] text-[var(--color-text-tertiary)]`,children:[v,h(`collectionListItem.contentCountSuffix`)]}),s(t,{className:`flex size-6 items-center justify-center`,children:s(r,{className:`h-4 w-4 text-[var(--color-text-tertiary)]`})})]})]}),s(t,{className:`grid h-[130px] w-full grid-cols-3 gap-2`,children:w.map(O)})]})}export{m as CollectionListItem};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{Button as e}from"../../../ui/button.mjs";import{hashPassword as t}from"../../../../utils/common.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserResetPassword as r,pUserSendResetPasswordEmailCode as i,pUserVerifyResetPasswordEmailCode as ee}from"../../../../service/generated/client.mjs";import{getPasswordValidationErrorText as a,validatePasswordPair as te}from"../../../../utils/password-validator.mjs";import{Box as o}from"../../../ui/box.mjs";import{Drawer as s,DrawerContent as ne,DrawerDescription as re,DrawerHeader as ie,DrawerTitle as c}from"../../../ui/drawer.mjs";import{Text as l}from"../../../ui/text.mjs";import u from"../../../ui/legacy/button.mjs";import{HeaderNav as ae}from"../../../common/header-nav/client.mjs";import{EyeIcon as d}from"../../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as f}from"../../../../assets/icons/eye-off-icon.mjs";import p from"../../../ui/legacy/input.mjs";import{useEffect as m,useMemo as h,useRef as g,useState as _}from"react";import{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){let[t,n]=e.split(`@`);return!t||!n?e:`${t.slice(0,3)}***${t.length>3?t.slice(-1):``}@${n}`}function C(C){let w=x(`components.pages.settings.components`),{open:oe,onOpenChange:T}=C,E=n(e=>e.userInfo),[D,O]=_([,,,,,,].fill(``)),[k,A]=_(0),j=g(null),M=D.includes(``),[N,P]=_(``),F=g(null),[se,I]=_(60),[L,R]=_(!1),z=h(()=>S(E?.email||``),[E?.email]);async function B(){if(L)return;let e=b.loading(w(`resetPasswordDrawer.sending`));try{let t=await i({user_id:E?.user_id});t.code===0?(b.success(w(`resetPasswordDrawer.codeSentSuccess`),{id:e}),R(!0),I(60),P(``)):b.error(t.message||w(`resetPasswordDrawer.sendFailed`),{id:e})}catch(t){console.error(t),b.error(w(`resetPasswordDrawer.sendFailed`),{id:e})}}function V(){W(e=>e===1?e:e+1)}async function H(){let e=b.loading(w(`resetPasswordDrawer.verifying`));try{P(``);let t=await ee({user_id:E?.user_id,email_code:D.join(``)});t.code===0?(b.success(w(`resetPasswordDrawer.verifySuccess`),{id:e}),V()):(P(t.message||w(`resetPasswordDrawer.verifyFailed`)),b.error(t.message||w(`resetPasswordDrawer.verifyFailed`),{id:e}))}catch(t){console.error(t),P(w(`resetPasswordDrawer.verifyFailed`)),b.error(w(`resetPasswordDrawer.verifyFailed`),{id:e})}}m(()=>{if(L)return F.current=setInterval(()=>{I(e=>e<=1?(F.current&&clearInterval(F.current),R(!1),60):e-1)},1e3),()=>{F.current&&clearInterval(F.current)}},[L]);let[U,W]=_(0);m(()=>{U===0&&j.current?.focus()},[U]);let[G,K]=_({password:``,confirmPassword:``}),[q,J]=_(!1),[Y,ce]=_(!1),[X,le]=_(!1),Z=h(()=>te(G.password,G.confirmPassword),[G.password,G.confirmPassword]),Q=h(()=>a(Z),[Z]),$=h(()=>q||G.password.length===0||G.confirmPassword.length===0||Z.type!==`none`,[q,G.password.length,G.confirmPassword.length,Z.type]);async function ue(){if($)return;let e=b.loading(w(`resetPasswordDrawer.submitting`));try{J(!0);let n=await r({user_id:E?.user_id,password:t(G.password)});n.code===0?(b.success(w(`resetPasswordDrawer.passwordResetSuccess`),{id:e}),K({password:``,confirmPassword:``}),O([,,,,,,].fill(``)),A(0),T(!1)):b.error(n.message||w(`resetPasswordDrawer.resetFailed`),{id:e})}catch(t){console.error(t),b.error(w(`resetPasswordDrawer.resetFailed`),{id:e})}finally{J(!1)}}function de(e){let t=e.target.value.replace(/\D/g,``);if(t.length===0)return;let n=[...D],r=t.split(``),i=k;for(let e of r){if(i>=6)break;n[i]=e,i+=1}O(n),A(Math.min(i,5)),N&&P(``)}function fe(e){if(e.key===`Backspace`){e.preventDefault();let t=[...D];t[k]?t[k]=``:k>0&&(t[k-1]=``,A(k-1)),O(t),N&&P(``);return}e.key===`ArrowLeft`&&k>0&&A(k-1),e.key===`ArrowRight`&&k<5&&A(k+1)}function pe(e){A(e),j.current?.focus()}let me=y(o,{className:`p-6 min-h-[calc(100vh-48px)] bg-[var(--color-surface-panel-dark)]`,children:[y(o,{className:`space-y-[12px]`,children:[v(l,{className:`text-[24px] leading-[32px] font-bold text-text1`,children:w(`resetPasswordDrawer.verifyTitle`)}),v(o,{className:`flex items-center justify-between gap-[8px]`,children:y(l,{className:`min-w-0 flex-1 truncate text-[12px] leading-[16px] text-text2`,children:[w(`resetPasswordDrawer.boundEmailNotice`),v(l,{className:`dark:text-white text-white`,children:z}),w(`resetPasswordDrawer.verifyHint`)]})})]}),y(o,{className:`mt-[28px]`,children:[y(o,{className:`relative`,children:[v(`input`,{ref:j,type:`text`,inputMode:`numeric`,pattern:`[0-9]*`,value:``,onChange:de,onKeyDown:fe,className:`absolute inset-0 h-full w-full opacity-0 pointer-events-none caret-transparent`,autoComplete:`one-time-code`}),v(o,{className:`flex justify-between gap-[10px]`,children:D.map((e,t)=>v(o,{onClick:()=>pe(t),className:`
|
|
3
3
|
h-[48px] flex-1 rounded-[6px] border-2 flex items-center justify-center cursor-pointer transition-all duration-200
|
|
4
|
-
${
|
|
5
|
-
`,children:
|
|
4
|
+
${N?`border-theme5 bg-line1`:t===k?`border-theme3 bg-theme3/10`:`border-transparent bg-line1`}
|
|
5
|
+
`,children:v(l,{className:`text-[24px] leading-none font-semibold text-text1 select-none`,children:e})},`${t}-${e||`empty`}`))})]}),v(o,{className:`min-h-[22px] pt-[8px]`,children:v(l,{className:`text-[12px] leading-[18px] text-theme5`,children:N})}),v(u,{type:`button`,onClick:H,disabled:M,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 ${M?`!text-white/60`:``}`,style:{background:M?`linear-gradient(90deg, rgba(151, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`:`var(--gradient-action-button)`},children:`提交`}),L?v(o,{className:`mt-[16px] w-full text-center text-[15px] leading-[24px] text-[#9DA3AC]`,children:w(`resetPasswordDrawer.resendCountdown`,{seconds:se})}):v(e,{variant:`link`,onClick:B,className:`mt-[16px] h-auto w-full justify-center !rounded-none bg-transparent !px-0 !py-0 text-[14px] leading-[24px] font-medium no-underline hover:no-underline`,style:{backgroundImage:`var(--gradient-action-button)`,backgroundClip:`text`,WebkitBackgroundClip:`text`,color:`transparent`},children:w(`resetPasswordDrawer.sendCode`)})]})]}),he=y(o,{className:`flex min-h-[calc(100vh-48px)] flex-col bg-[var(--color-surface-panel-dark)]`,children:[y(o,{className:`px-[32px] pt-[15px]`,children:[v(l,{className:`text-[16px] leading-[20px] text-text1`,children:w(`resetPasswordDrawer.setNewPasswordHint`)}),y(o,{className:`mt-[16px]`,children:[y(o,{className:`relative flex h-[48px] items-center rounded-[8px] border bg-white/10 px-[16px] ${Q?`border-theme5`:`border-transparent`}`,children:[v(p,{value:G.password,onChange:e=>K(t=>({...t,password:e})),placeholder:w(`resetPasswordDrawer.passwordPlaceholder`),type:Y?`text`:`password`,autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`rounded-none bg-transparent !px-0 !py-0 text-[14px] leading-[20px] text-text1 placeholder:text-white/60`}),v(`button`,{type:`button`,onClick:()=>ce(!Y),className:`absolute right-[16px] top-1/2 -translate-y-1/2 text-white/50 transition-colors hover:text-white/80`,children:v(Y?d:f,{className:`h-[24px] w-[24px]`})})]}),y(o,{className:`mt-[16px] relative flex h-[48px] items-center rounded-[8px] border bg-white/10 px-[16px] ${Z.type===`not-match`?`border-theme5`:`border-transparent`}`,children:[v(p,{value:G.confirmPassword,onChange:e=>K(t=>({...t,confirmPassword:e})),placeholder:w(`resetPasswordDrawer.confirmPasswordPlaceholder`),type:X?`text`:`password`,autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`rounded-none bg-transparent !px-0 !py-0 text-[14px] leading-[20px] text-text1 placeholder:text-white/60`}),v(`button`,{type:`button`,onClick:()=>le(!X),className:`absolute right-[16px] top-1/2 -translate-y-1/2 text-white/50 transition-colors hover:text-white/80`,children:v(X?d:f,{className:`h-[24px] w-[24px]`})})]}),Q?v(o,{className:`mt-[12px]`,children:v(l,{className:`text-[12px] leading-[16px] text-theme5`,children:Q})}):null]})]}),v(o,{className:`mt-auto bg-[rgba(5,1,15,0.9)] px-[16px] pt-[8px] pb-[calc(env(safe-area-inset-bottom)+8px)] backdrop-blur-[4px]`,children:v(u,{onClick:ue,disabled:$,className:`h-[48px] w-full rounded-[8px] bg-[linear-gradient(90deg,#A656E3_10%,#6C43EE_100%)] px-0 py-0 text-[16px] leading-[24px] font-normal text-white disabled:bg-[linear-gradient(90deg,rgba(166,86,227,0.45)_10%,rgba(108,67,238,0.45)_100%)] disabled:text-white/60 active:opacity-90`,children:w(q?`resetPasswordDrawer.submitting`:`resetPasswordDrawer.resetPassword`)})})]});return y(s,{open:oe,onOpenChange:T,direction:`right`,handleOnly:!0,children:[y(ie,{className:`hidden`,children:[v(c,{children:w(`resetPasswordDrawer.title`)}),v(re,{children:w(`resetPasswordDrawer.title`)})]}),y(ne,{className:`!w-full`,children:[v(ae,{className:`!bg-[var(--color-surface-panel-dark)] !border-transparent`,onBack:()=>T(!1)}),U===0&&me,U===1&&he]})]})}export{C as ResetPasswordDrawer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
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{memo as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import o from"next/link";function s(e){return e.img_x??e.img_y??``}function c(e){return e.img_y??e.img_x??``}function l(e){return!Number.isFinite(e)||e==null||e<=0?``:(e>10?e/10:e).toFixed(1)}function u(e){let t=[...Array.isArray(e.tags)?e.tags.map(e=>e?.name?.trim()??``):[],e.cat_name?.trim()??``,e.status_text?.trim()??``,e.language?.trim()??``];return Array.from(new Set(t.filter(Boolean))).slice(0,5)}function d(e){return e?.trim()||`暂无简介`}function f({item:r,href:f=``}){let p=r.name??r.id??`未命名视频`,m=s(r),h=c(r),g=l(r.score),_=u(r),v=d(r.description);return a(o,{href:f,className:`cursor-pointer rounded-[16px] border border-[#8d44ff]/60 bg-[rgba(255,255,255,0.1)] p-[16px] shadow-[0_20px_40px_rgba(0,0,0,0.18)] backdrop-blur-[12px]`,"aria-label":p,children:[i(t,{className:`relative aspect-[326/207] overflow-hidden rounded-[8px] bg-[linear-gradient(180deg,#2d1147_0%,#13031f_100%)]`,children:m?i(e,{src:m,alt:p,fill:!0,className:`object-cover`}):null}),a(t,{className:`mt-[16px] flex gap-[16px]`,children:[i(t,{className:`relative h-[88px] w-[64px] shrink-0 overflow-hidden rounded-[4px] border border-white/20 bg-white/5`,children:h?i(e,{src:h,alt:`${p} 海报`,fill:!0,className:`object-cover`}):null}),a(t,{className:`min-w-0 flex-1`,children:[a(t,{className:`flex items-start justify-between gap-[12px]`,children:[i(n,{as:`h3`,className:`min-w-0 flex-1 line-clamp-1 text-[18px] font-medium leading-[25px] text-white`,children:p}),g?i(n,{className:`shrink-0 text-[18px] font-semibold leading-[20px] text-[#ffc039] tabular-nums`,children:g}):null]}),_.length>0?i(t,{className:`mt-[8px] flex flex-wrap gap-[6px]`,children:_.map(e=>i(t,{className:`flex h-[18px] items-center justify-center rounded-[4px] bg-white/20 px-[4px] py-[2px]`,children:i(n,{className:`text-[12px] leading-[14px] text-white`,children:e})},e))}):null]})]}),i(n,{as:`p`,className:`mt-[12px] line-clamp-3 text-[14px] leading-[24px] text-white/[0.55]`,children:v})]})}const p=r(f);p.displayName=`VideoListRecommendItem`;export{p as VideoListRecommendItem};
|
|
@@ -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?: "
|
|
9
|
+
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | 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?: "
|
|
11
|
-
size?: "
|
|
10
|
+
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
11
|
+
size?: "icon" | "default" | "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> & {
|
|
@@ -34,7 +34,7 @@ type EmptyStateProps = React.ComponentProps<'div'> & {
|
|
|
34
34
|
};
|
|
35
35
|
/** emptyMediaVariants 工具定义。 */
|
|
36
36
|
declare const emptyMediaVariants: (props?: ({
|
|
37
|
-
variant?: "
|
|
37
|
+
variant?: "icon" | "default" | null | undefined;
|
|
38
38
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
39
39
|
/** EmptyMedia 组件。 */
|
|
40
40
|
declare function EmptyMedia({
|
|
@@ -82,7 +82,7 @@ declare function Item({
|
|
|
82
82
|
}: ItemProps): React.ReactElement;
|
|
83
83
|
/** itemMediaVariants 工具定义。 */
|
|
84
84
|
declare const itemMediaVariants: (props?: ({
|
|
85
|
-
variant?: "
|
|
85
|
+
variant?: "icon" | "default" | "image" | null | undefined;
|
|
86
86
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
87
87
|
/** ItemMedia 组件。 */
|
|
88
88
|
declare function ItemMedia({
|