@funhub/platform 0.1.105 → 0.1.107
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/detail-operate.mjs +1 -1
- package/dist/components/biz/business/detail/shared/runtime-context-provider.mjs +1 -1
- package/dist/components/biz/business/detail/shared/video-detail-server-data.mjs +1 -1
- package/dist/components/biz/business/search-history/client.mjs +1 -1
- package/dist/components/common/video-player/style.module.mjs +0 -2
- package/dist/components/pages/video-detail/page.mjs +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button-group.d.mts +1 -1
- package/dist/components/ui/button.d.mts +2 -2
- package/dist/components/ui/field.d.mts +1 -1
- package/dist/hooks/use-content-operate.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
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 l from"../../../../common/share-popup/share-popup.mjs";import{useContentOperate as u}from"../../../../../hooks/use-content-operate.mjs";import d from"../../../../../assets/icons/detail/check-ok.mjs";import f from"../../../../../assets/icons/detail/collect_nor.mjs";import p from"../../../../../assets/icons/detail/collect_sel.mjs";import ee from"../../../../../assets/icons/detail/give_like.mjs";import m from"../../../../../assets/icons/detail/give_like_sel.mjs";import te from"../../../../../assets/icons/detail/share.mjs";import{useCallback as h,useEffect 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";import{usePathname as w,useSearchParams as ne}from"next/navigation";function T({mode:T=`renderer`,information:O,onUpdate:k}){let A=T===`editor`||!O?.id||O.id.startsWith(`preview-`),j=`${w()}?${ne()?.toString()||``}`,M=v(j),N=C(`components.biz.business.detail`),[P,F]=y(!1),[I,L]=y(!1),R=v(0),z=e(e=>e.userId),B=e(e=>e.isLogin),V=a();g(()=>{M.current!==j&&(l.clear(),M.current=j)},[j]),g(()=>()=>{l.clear()},[]);let H=h(()=>{z&&(V([`user-profile`,`mine`,z,`user-like-video`]),V([`user-profile`,`mine`,z,`user-like-post`]),V([`user-profile`,`mine`,z,`user-collect-video`,z]),V([`user-profile`,`mine`,z,`user-collect-post`,z]))},[V,z]),{likeAnimation:U,handleLikeOperate:W,handleDefaultCollectionOperate:G,handleShareOperate:K}=u({id:O.id,isLike:O.like||!1,isDislike:O.dislike||!1,isCollect:O.collect||!1,likeCnt:D(O.static?.like_cnt),dislikeCnt:D(O.static?.dislike_cnt),contentType:
|
|
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 l from"../../../../common/share-popup/share-popup.mjs";import{useContentOperate as u}from"../../../../../hooks/use-content-operate.mjs";import d from"../../../../../assets/icons/detail/check-ok.mjs";import f from"../../../../../assets/icons/detail/collect_nor.mjs";import p from"../../../../../assets/icons/detail/collect_sel.mjs";import ee from"../../../../../assets/icons/detail/give_like.mjs";import m from"../../../../../assets/icons/detail/give_like_sel.mjs";import te from"../../../../../assets/icons/detail/share.mjs";import{useCallback as h,useEffect 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";import{usePathname as w,useSearchParams as ne}from"next/navigation";function T({mode:T=`renderer`,information:O,onUpdate:k}){let A=T===`editor`||!O?.id||O.id.startsWith(`preview-`),j=`${w()}?${ne()?.toString()||``}`,M=v(j),N=C(`components.biz.business.detail`),[P,F]=y(!1),[I,L]=y(!1),R=v(0),z=e(e=>e.userId),B=e(e=>e.isLogin),V=a();g(()=>{M.current!==j&&(l.clear(),M.current=j)},[j]),g(()=>()=>{l.clear()},[]);let H=h(()=>{z&&(V([`user-profile`,`mine`,z,`user-like-video`]),V([`user-profile`,`mine`,z,`user-like-post`]),V([`user-profile`,`mine`,z,`user-collect-video`,z]),V([`user-profile`,`mine`,z,`user-collect-post`,z]))},[V,z]),{likeAnimation:U,handleLikeOperate:W,handleDefaultCollectionOperate:G,handleShareOperate:K}=u({id:O.id,isLike:O.like||!1,isDislike:O.dislike||!1,isCollect:O.collect||!1,likeCnt:D(O.static?.like_cnt),dislikeCnt:D(O.static?.dislike_cnt),contentType:1,prefetchDefaultCollection:!A,animationClasses:{like:s.likeShakeAnimation,dislike:s.dislikeShakeAnimation}}),q=h(e=>{k?.({...e})},[k]),J=h(async()=>{if(P)return;if(!B){i.getState().open();return}let e=Date.now();if(e-R.current<300)return;R.current=e,F(!0);let t=O.like||!1,n=O.dislike||!1,r=D(O.static?.like_cnt),a=D(O.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;q({like:o,dislike:c,static:{...O.static,like_cnt:s,dislike_cnt:l}});try{let e=await W();if(!e){q({like:t,dislike:n,static:{...O.static,like_cnt:r,dislike_cnt:a}});return}q({like:e.isLike,dislike:e.isDislike??c,static:{...O.static,like_cnt:e.likeCnt,dislike_cnt:e.dislikeCnt??l}}),H(),window.sensors?.track?.(`detail_like_click`,{object_id:O.id,action:e.isLike?`点赞`:`取消点赞`,like_count:e.likeCnt})}catch(e){console.error(`点赞操作失败:`,e),S.error(N(`detailOperate.operateFailed`))}finally{F(!1)}},[W,O,H,P,B,N,q]),Y=_(()=>O.id,[O.id]),X=h(()=>{K(({isCollect:e})=>{q({collect:e})},Y)},[K,Y,q]),Z=h(()=>{c.show({mode:`select`,onCollect:async e=>{try{let n=await t({new_collection_id:e,content_id:O.id});if(n.code!==0)throw Error(n.message||N(`detailOperate.collectFailed`));q({collect:!0}),H(),S.success(N(`detailOperate.modifyCollectionSuccess`))}catch(e){console.error(`修改收藏夹失败:`,e),S.error(N(`detailOperate.collectFailed`))}}})},[O.id,H,N,q]),Q=h(e=>{let t=e||N(`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(d,{className:`w-[14px] h-[14px]`})}),x(`div`,{className:`flex items-center gap-[6px]`,children:[b(`span`,{className:`text-[14px] leading-[20px]`,children:N(`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),Z()},children:N(`detailOperate.modifyCollection`)})]}))},[Z,N]),$=h(async()=>{if(I)return;if(!B){i.getState().open();return}let e=O.collect||!1;L(!0),window.sensors?.track?.(`detail_fav_click`,{object_id:O.id,action:e?`取消收藏`:`收藏`});try{let t=await G({currentCollect:e,onUpdate:({isCollect:e})=>{q({collect:e})}});if(!t?.success){S.error(t?.message||N(`detailOperate.collectFailed`));return}H(),window.sensors?.track?.(`detail_fav_click`,{object_id:O.id,action:t.isCollect?`收藏`:`取消收藏`}),!e&&t.isCollect&&Q(t.collectionTitle),e&&t.isCollect===!1&&S.success(N(`detailOperate.uncollectSuccess`))}catch(e){console.error(`收藏操作失败:`,e),S.error(e?.message||N(`detailOperate.collectFailed`))}finally{L(!1)}},[G,O.collect,O.id,H,I,B,Q,N,q]),re=_(()=>o($,300),[$]);return x(n,{className:`w-full h-[42px] mt-[16px] flex items-center justify-between ${A?`pointer-events-none`:``}`,children:[x(n,{className:`w-[25%] h-full flex flex-col items-center justify-center ${P?`opacity-50 cursor-not-allowed`:`cursor-pointer`}`,onClick:J,children:[O.like?b(m,{className:`w-[20px] h-[20px] ${U.animationClass}`}):b(ee,{className:`w-[20px] h-[20px] text-text2`}),b(r,{className:`text-[12px] text-text2 leading-[20px]`,children:O.static?O.static.like_cnt===0?N(`detailOperate.like`):E(O.static?.like_cnt):N(`detailOperate.like`)})]}),x(n,{className:`w-[25%] h-full flex flex-col items-center justify-center ${I?`opacity-50 cursor-not-allowed`:`cursor-pointer`}`,onClick:re,children:[O.collect?b(p,{className:`w-[20px] h-[20px]`}):b(f,{className:`w-[20px] h-[20px] text-text2`}),b(r,{className:`text-[12px] text-text2 leading-[20px]`,children:N(`detailOperate.collection`)})]}),x(n,{className:`w-[25%] h-full flex flex-col items-center justify-center cursor-pointer`,onClick:X,children:[b(te,{className:`w-[20px] h-[20px] text-text2`}),b(r,{className:`text-[12px] text-text2 leading-[20px]`,children:N(`detailOperate.share`)})]})]})}function E(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 D(e){if(e==null)return 0;if(typeof e==`number`)return e;let t=Number(e);return Number.isNaN(t)?0:t}export{T as DetailOperate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{gContentGetVideoDetail as e}from"../../../../../service/generated/client.mjs";import{useRequest as t}from"../../../../../hooks/query/use-query.mjs";import{createContext as n,use as r,useCallback as i,useMemo as a}from"react";import{jsx as o}from"react/jsx-runtime";import{useParams as s,useRouter as c}from"next/navigation";const l=n(void 0);function u(e,t){if(!(!e&&!t))return{information:e?.information??t?.information,currentSeriesNum:e?.currentSeriesNum??t?.currentSeriesNum,onEpisodeChange:e?.onEpisodeChange??t?.onEpisodeChange,onUpdateInformation:e?.onUpdateInformation??t?.onUpdateInformation,detailId:e?.detailId??t?.detailId,episodeIndex:e?.episodeIndex??t?.episodeIndex,resumeProgressSeconds:e?.resumeProgressSeconds??t?.resumeProgressSeconds,isShow:e?.isShow??t?.isShow,isWebView:e?.isWebView??t?.isWebView,isInformationLoading:e?.isInformationLoading??t?.isInformationLoading,isInformationResolved:e?.isInformationResolved??t?.isInformationResolved}}function d({value:e,children:t}){let n=r(l);return o(l,{value:a(()=>u(n,e)??e,[n,e]),children:t})}function f(){let e=r(l),t=p({enabled:e===void 0||e.onEpisodeChange===void 0||e.detailId===void 0||e.currentSeriesNum===void 0||e.episodeIndex===void 0||e.isInformationLoading===void 0||e.isInformationResolved===void 0,shouldRequestInformation:!e?.information});return a(()=>{let n=u(e,t);return n&&(e&&t&&e.onEpisodeChange===void 0?{...n,currentSeriesNum:t.currentSeriesNum??n.currentSeriesNum,episodeIndex:t.episodeIndex??n.episodeIndex,onEpisodeChange:t.onEpisodeChange??n.onEpisodeChange}:n)},[e,t])}function p(n){let{enabled:r,shouldRequestInformation:o}=n,l=s(),u=c(),d=l.level,f=Array.isArray(d)?d:typeof d==`string`?[d]:[],p=f[0]||``,m=f.findIndex(e=>e===`episode`),h=m>=0?f[m+1]:f[2],g=Math.max(1,Number(h)||1),_=Math.max(0,g-1),v=f[1]||``,y=typeof window<`u`&&(window.isWebView===!0||window.isWebview===!0),{data:b,isPending:x,isFetching:S,isError:C,isSuccess:w}=t([`video-detail-material-fallback`,p],async()=>p?await e({id:p}):null,{enabled:r&&o&&!!p}),T=a(()=>{let e=b?.data?.video;if(!(!e||typeof e!=`object`))return{...e,content_type:
|
|
2
|
+
"use client";import{gContentGetVideoDetail as e}from"../../../../../service/generated/client.mjs";import{useRequest as t}from"../../../../../hooks/query/use-query.mjs";import{createContext as n,use as r,useCallback as i,useMemo as a}from"react";import{jsx as o}from"react/jsx-runtime";import{useParams as s,useRouter as c}from"next/navigation";const l=n(void 0);function u(e,t){if(!(!e&&!t))return{information:e?.information??t?.information,currentSeriesNum:e?.currentSeriesNum??t?.currentSeriesNum,onEpisodeChange:e?.onEpisodeChange??t?.onEpisodeChange,onUpdateInformation:e?.onUpdateInformation??t?.onUpdateInformation,detailId:e?.detailId??t?.detailId,episodeIndex:e?.episodeIndex??t?.episodeIndex,resumeProgressSeconds:e?.resumeProgressSeconds??t?.resumeProgressSeconds,isShow:e?.isShow??t?.isShow,isWebView:e?.isWebView??t?.isWebView,isInformationLoading:e?.isInformationLoading??t?.isInformationLoading,isInformationResolved:e?.isInformationResolved??t?.isInformationResolved}}function d({value:e,children:t}){let n=r(l);return o(l,{value:a(()=>u(n,e)??e,[n,e]),children:t})}function f(){let e=r(l),t=p({enabled:e===void 0||e.onEpisodeChange===void 0||e.detailId===void 0||e.currentSeriesNum===void 0||e.episodeIndex===void 0||e.isInformationLoading===void 0||e.isInformationResolved===void 0,shouldRequestInformation:!e?.information});return a(()=>{let n=u(e,t);return n&&(e&&t&&e.onEpisodeChange===void 0?{...n,currentSeriesNum:t.currentSeriesNum??n.currentSeriesNum,episodeIndex:t.episodeIndex??n.episodeIndex,onEpisodeChange:t.onEpisodeChange??n.onEpisodeChange}:n)},[e,t])}function p(n){let{enabled:r,shouldRequestInformation:o}=n,l=s(),u=c(),d=l.level,f=Array.isArray(d)?d:typeof d==`string`?[d]:[],p=f[0]||``,m=f.findIndex(e=>e===`episode`),h=m>=0?f[m+1]:f[2],g=Math.max(1,Number(h)||1),_=Math.max(0,g-1),v=f[1]||``,y=typeof window<`u`&&(window.isWebView===!0||window.isWebview===!0),{data:b,isPending:x,isFetching:S,isError:C,isSuccess:w}=t([`video-detail-material-fallback`,p],async()=>p?await e({id:p}):null,{enabled:r&&o&&!!p}),T=a(()=>{let e=b?.data?.video;if(!(!e||typeof e!=`object`))return{...e,content_type:1,episode_cnt:e.links?.length||0}},[b?.data?.video]),E=i(e=>{let t=Math.max(1,Math.floor(Number(e)||1));if(!p||typeof window>`u`)return;let n=`${y?`/webview`:`/video`}/${p}/${encodeURIComponent(v)}/episode/${t}`,{search:r,hash:i,pathname:a}=window.location,o=`${a}${r}${i}`,s=`${n}${r}${i}`;o!==s&&u.replace(s,{scroll:!1})},[p,y,v,u]);if(r)return{information:T,currentSeriesNum:g,onEpisodeChange:E,detailId:p,episodeIndex:_,resumeProgressSeconds:0,isShow:!0,isWebView:y,isInformationLoading:o?!!p&&!T&&(x||S):!1,isInformationResolved:!p||!!T||!o||C||w}}export{d as VideoDetailMaterialRuntimeProvider,f as useVideoDetailMaterialRuntimeContext};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{gContentGetVideoDetail as e}from"../../../../../service/generated/client.mjs";import{cache as t}from"react";function n(e){if(!e||typeof e!=`object`)return null;let t=e,n=Array.isArray(t.links)?t.links:[];return{...t,mid:String(t.mid||t.id||``),content_type:
|
|
2
|
+
import{gContentGetVideoDetail as e}from"../../../../../service/generated/client.mjs";import{cache as t}from"react";function n(e){if(!e||typeof e!=`object`)return null;let t=e,n=Array.isArray(t.links)?t.links:[];return{...t,mid:String(t.mid||t.id||``),content_type:1,episode_cnt:n.length}}const r=t(async t=>{let r=String(t||``).trim();if(!r)return null;try{return n((await e({id:r},{revalidate:86400,tags:[`video-detail:ssr:${r}`]})).data?.video)}catch(e){return console.error(`详情物料服务端获取视频详情失败`,e),null}});async function i(e){let t=String(e||``).trim();return t?await r(t):null}export{i as getVideoDetailServerInformation};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../ui/button.mjs";import t from"../../../../utils/event-bus.mjs";import{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import{DeleteConfirmDialog as a}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{useCallback as o,useEffect as s,useMemo as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{usePathname as f,useRouter as p,useSearchParams as m}from"next/navigation";function h(e,t){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function g(g){let{title:_,rows:v=1,clearText:y,confirmDescription:b,storageKey:x=`guest`,onHistoryClick:S,mode:C=`renderer`}=g,w=_??`搜索历史`,T=y??`清空`,E=b??`确定要清除所有搜索历史吗?`,D=c(()=>[`搜索历史1`,`搜索历史2`,`搜索历史3`],[]),[O,k]=l([]),[A,j]=l(!1),M=p(),N=f(),P=m(),F=`search_history_${x}`,I=o(()=>{let e=[];try{let t=localStorage.getItem(F);if(t)try{let n=JSON.parse(t);e=Array.isArray(n)?n:[]}catch{e=[]}k(e)}catch(e){console.error(`Failed to parse search history`,e),k([])}},[F]);s(()=>(I(),t.on(i.SEARCH_HISTORY_UPDATE,I),()=>t.off(i.SEARCH_HISTORY_UPDATE,I)),[I]);let L=()=>{k([]),localStorage.removeItem(F),j(!1),t.emit(i.SEARCH_HISTORY_UPDATE)},R=c(()=>(O.length?O:C===`editor`?D:[]).slice(0,v*10),[O,C,D,v]);if(R.length===0)return null;let z=e=>{if(S){S(e);return}let t=new URLSearchParams(P.toString());t.set(`q`,e);let n=N.includes(`/search-result`)?N:`/search-result`;M.push(`${n}?${t.toString()}`)};return d(n,{className:`px-4 py-2`,children:[d(n,{className:`flex justify-between items-center mb-2`,children:[u(r,{className:`text-[16px] font-bold text-text1`,children:w}),u(e,{variant:`ghost`,size:`sm`,className:`text-text3 text-[12px] p-0 h-auto`,onClick:()=>j(!0),children:T})]}),u(n,{className:`flex flex-wrap gap-2 overflow-hidden`,style:{maxHeight
|
|
2
|
+
"use client";import{Button as e}from"../../../ui/button.mjs";import t from"../../../../utils/event-bus.mjs";import{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import{DeleteConfirmDialog as a}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{useCallback as o,useEffect as s,useMemo as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{usePathname as f,useRouter as p,useSearchParams as m}from"next/navigation";function h(e,t){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function g(g){let{title:_,rows:v=1,clearText:y,confirmDescription:b,storageKey:x=`guest`,onHistoryClick:S,mode:C=`renderer`}=g,w=_??`搜索历史`,T=y??`清空`,E=b??`确定要清除所有搜索历史吗?`,D=c(()=>[`搜索历史1`,`搜索历史2`,`搜索历史3`],[]),[O,k]=l([]),[A,j]=l(!1),M=p(),N=f(),P=m(),F=`search_history_${x}`,I=o(()=>{let e=[];try{let t=localStorage.getItem(F);if(t)try{let n=JSON.parse(t);e=Array.isArray(n)?n:[]}catch{e=[]}k(e)}catch(e){console.error(`Failed to parse search history`,e),k([])}},[F]);s(()=>(I(),t.on(i.SEARCH_HISTORY_UPDATE,I),()=>t.off(i.SEARCH_HISTORY_UPDATE,I)),[I]);let L=()=>{k([]),localStorage.removeItem(F),j(!1),t.emit(i.SEARCH_HISTORY_UPDATE)},R=c(()=>(O.length?O:C===`editor`?D:[]).slice(0,v*10),[O,C,D,v]);if(R.length===0)return null;let z=e=>{if(S){S(e);return}let t=new URLSearchParams(P.toString());t.set(`q`,e);let n=N.includes(`/search-result`)?N:`/search-result`;M.push(`${n}?${t.toString()}`)};return d(n,{className:`px-4 py-2`,children:[d(n,{className:`flex justify-between items-center mb-2`,children:[u(r,{className:`text-[16px] font-bold text-text1`,children:w}),u(e,{variant:`ghost`,size:`sm`,className:`text-text3 text-[12px] p-0 h-auto`,onClick:()=>j(!0),children:T})]}),u(n,{className:`flex flex-wrap gap-2 overflow-hidden`,style:{maxHeight:`${v*30}px`},children:R.map((e,t)=>u(n,{className:`px-3 py-1 bg-bg2 rounded-full cursor-pointer`,onClick:()=>z(e),children:u(r,{className:`text-[14px] text-text2`,children:h(e,8)})},t))}),u(a,{open:A,onOpenChange:j,onConfirm:L,title:``,description:E})]})}export{g as SearchHistoryClient};
|
|
@@ -210,7 +210,6 @@ import e from"../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-
|
|
|
210
210
|
|
|
211
211
|
.style-module_videoBox__4Gmdw .xg-time-left {
|
|
212
212
|
margin-right: 0 !important;
|
|
213
|
-
line-height: 40px !important;
|
|
214
213
|
}
|
|
215
214
|
|
|
216
215
|
.style-module_videoBox__4Gmdw .xg-time-left::after {
|
|
@@ -220,7 +219,6 @@ import e from"../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-
|
|
|
220
219
|
.style-module_videoBox__4Gmdw .xg-time-right {
|
|
221
220
|
margin-right: 16px !important;
|
|
222
221
|
margin-left: 0 !important;
|
|
223
|
-
line-height: 40px !important;
|
|
224
222
|
}
|
|
225
223
|
|
|
226
224
|
.style-module_videoBox__4Gmdw .xg-seek-icon {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{gContentGetVideoDetail as e}from"../../../service/generated/client.mjs";import{normalizeEpisodeNumber as t,warmupProcessM3u8Auto as n}from"../../common/video-player/process-m3u8-cache.mjs";import{HydrationBoundary as r}from"../../../hooks/query/hydration-boundary.mjs";import{revalidate as i}from"../../../constants/revalidate.mjs";import{DetailStructuredData as a}from"../../biz/business/detail/shared/detail-structured-data.mjs";import o from"./video-detail-client.mjs";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";async function u({params:u,isWebView:d=!1,materialConfig:f}){let{level:p}=await u,m=p?.[0]||``,h=p.findIndex(e=>e===`episode`),g=t(h>=0?p?.[h+1]:void 0,1),_=null,v=null;if(m){_=await e({id:m},{revalidate:i.TIME});let t=_?.data?.video;t&&typeof t==`object`&&(await n(t.links,g),v={...t,mid:t.mid||t.id||``,content_type:
|
|
2
|
+
import{gContentGetVideoDetail as e}from"../../../service/generated/client.mjs";import{normalizeEpisodeNumber as t,warmupProcessM3u8Auto as n}from"../../common/video-player/process-m3u8-cache.mjs";import{HydrationBoundary as r}from"../../../hooks/query/hydration-boundary.mjs";import{revalidate as i}from"../../../constants/revalidate.mjs";import{DetailStructuredData as a}from"../../biz/business/detail/shared/detail-structured-data.mjs";import o from"./video-detail-client.mjs";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";async function u({params:u,isWebView:d=!1,materialConfig:f}){let{level:p}=await u,m=p?.[0]||``,h=p.findIndex(e=>e===`episode`),g=t(h>=0?p?.[h+1]:void 0,1),_=null,v=null;if(m){_=await e({id:m},{revalidate:i.TIME});let t=_?.data?.video;t&&typeof t==`object`&&(await n(t.links,g),v={...t,mid:t.mid||t.id||``,content_type:1,episode_cnt:t.links?.length||0})}return l(s,{children:[v&&c(a,{information:v,detailId:m}),c(r,{prefetch:m&&_?[{queryKey:[`video-detail`,m],queryFn:()=>Promise.resolve(_)}]:[],children:c(o,{detailId:m,isWebView:d,materialConfig:f})})]})}export{u as default};
|
|
@@ -6,7 +6,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
6
6
|
//#region components/ui/badge.d.ts
|
|
7
7
|
/** badgeVariants 工具定义。 */
|
|
8
8
|
declare const badgeVariants: (props?: ({
|
|
9
|
-
variant?: "default" | "link" | "destructive" | "
|
|
9
|
+
variant?: "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
/** Badge 组件。 */
|
|
12
12
|
declare function Badge({
|
|
@@ -8,7 +8,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
8
8
|
//#region components/ui/button-group.d.ts
|
|
9
9
|
/** buttonGroupVariants 工具定义。 */
|
|
10
10
|
declare const buttonGroupVariants: (props?: ({
|
|
11
|
-
orientation?: "
|
|
11
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
13
13
|
/** ButtonGroupText 组件属性。 */
|
|
14
14
|
type ButtonGroupTextProps = useRender.ComponentProps<'div'>;
|
|
@@ -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" | "destructive" | "
|
|
11
|
-
size?: "default" | "
|
|
10
|
+
variant?: "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
11
|
+
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
13
13
|
/** Button 组件属性。 */
|
|
14
14
|
type ButtonProps = Button.Props & VariantProps<typeof buttonVariants> & {
|
|
@@ -51,7 +51,7 @@ declare function FieldGroup({
|
|
|
51
51
|
}: FieldGroupProps): react_jsx_runtime0.JSX.Element;
|
|
52
52
|
/** fieldVariants 工具定义。 */
|
|
53
53
|
declare const fieldVariants: (props?: ({
|
|
54
|
-
orientation?: "
|
|
54
|
+
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
55
55
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
56
56
|
/** Field 组件。 */
|
|
57
57
|
declare function Field({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{useUserStore as e}from"../store/modules/user-store.mjs";import{gCommunityGetUserCollections as t,pCommunityAddContentToCollection as n,pInteractionBatchQueryContentInteractions as r,pInteractionCancelDislike as i,pInteractionCancelLike as a,pInteractionDislike as o,pInteractionLike as s,pInteractionRemoveCollect as c}from"../service/generated/client.mjs";import{useLoginModalStore as l}from"../store/modules/login-modal-store.mjs";import u from"../components/common/collection-popup/index.mjs";import d from"../components/common/share-popup/share-popup.mjs";import{useInteractionAnimation as f}from"./use-interaction-animation.mjs";import{useCallback as p,useEffect as m,useMemo as h,useState as g}from"react";import{toast as _}from"sonner";import{usePathname as v,useRouter as y,useSearchParams as b}from"next/navigation";function x(e){let t=Number(e);if(Number.isFinite(t))return t===0?1:t}function S(){let t=e.getState().userId||e.getState().userInfo?.userId;if(!t){let{open:e}=l.getState();return e(),null}return t}async function C(t,n){try{let i=e.getState().userId||e.getState().userInfo?.userId;if(!i)return console.warn(`用户未登录,无法查询交互状态`),null;let a=await r({app_id:0,user_id:i,content_ids:t,content_type:n});return a.code===0?a.data:(console.error(`查询交互状态失败:`,a.message),null)}catch(e){return console.error(`查询交互状态异常:`,e),null}}async function ee(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await s({
|
|
2
|
+
import{useUserStore as e}from"../store/modules/user-store.mjs";import{gCommunityGetUserCollections as t,pCommunityAddContentToCollection as n,pInteractionBatchQueryContentInteractions as r,pInteractionCancelDislike as i,pInteractionCancelLike as a,pInteractionDislike as o,pInteractionLike as s,pInteractionRemoveCollect as c}from"../service/generated/client.mjs";import{useLoginModalStore as l}from"../store/modules/login-modal-store.mjs";import u from"../components/common/collection-popup/index.mjs";import d from"../components/common/share-popup/share-popup.mjs";import{useInteractionAnimation as f}from"./use-interaction-animation.mjs";import{useCallback as p,useEffect as m,useMemo as h,useState as g}from"react";import{toast as _}from"sonner";import{usePathname as v,useRouter as y,useSearchParams as b}from"next/navigation";function x(e){let t=Number(e);if(Number.isFinite(t))return t===0?1:t}function S(){let t=e.getState().userId||e.getState().userInfo?.userId;if(!t){let{open:e}=l.getState();return e(),null}return t}async function C(t,n){try{let i=e.getState().userId||e.getState().userInfo?.userId;if(!i)return console.warn(`用户未登录,无法查询交互状态`),null;let a=await r({app_id:0,user_id:i,content_ids:t,content_type:n});return a.code===0?a.data:(console.error(`查询交互状态失败:`,a.message),null)}catch(e){return console.error(`查询交互状态异常:`,e),null}}async function ee(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await s({user_id:n,id:e,content_type:t});return r.code===0?{success:!0,data:r.data}:{success:!1,message:r.message||`点赞失败`}}catch(e){return console.error(`点赞失败:`,e),{success:!1,message:`点赞失败`}}}async function w(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await a({user_id:n,id:e,content_type:t});return r.code===0?{success:!0,data:r.data}:{success:!1,message:r.message||`取消点赞失败`}}catch(e){return console.error(`取消点赞失败:`,e),{success:!1,message:`取消点赞失败`}}}async function T(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await o({app_id:0,user_id:n,id:e,content_type:t});return r.code===0?{success:!0,data:r.data}:{success:!1,message:r.message||`点踩失败`}}catch(e){return console.error(`点踩异常:`,e),{success:!1,message:`点踩异常`}}}async function E(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await i({app_id:0,user_id:n,id:e,content_type:t});return r.code===0?{success:!0,data:r.data}:{success:!1,message:r.message||`取消点踩失败`}}catch(e){return console.error(`取消点踩异常:`,e),{success:!1,message:`取消点踩异常`}}}function D({id:r,isLike:i,isDislike:a,isCollect:o,likeCnt:s,dislikeCnt:S,contentType:C,animationClasses:D,copyUrl:O,prefetchDefaultCollection:k=!1}){let{isLogin:A,userInfo:j,userId:M}=e(),N=y(),P=v(),F=b()?.toString()||``,[I,L]=g(void 0),R=D?.like||`like-shake-animation`,z=D?.dislike||`dislike-shake-animation`,B=h(()=>String(M||j?.userId||``),[M,j?.userId]);m(()=>{L(void 0)},[B]);let[V,H]=g(!1),[U,W]=g(!1);m(()=>{d.clear(),u.clear()},[P,F]),m(()=>()=>{d.clear(),u.clear()},[]);let G=p(async()=>{if(!A||!B)return null;try{let e=await t({page:1,page_size:40});if(e.code!==0)return L(null),null;let n=(e.data?.data?.collections??[]).find(e=>e?.is_default),r=(typeof n?.title==`string`?n.title.trim():``)||null;return L(r),r}catch(e){return console.error(`获取默认收藏夹失败:`,e),L(null),null}},[A,B]);m(()=>{!A||!B||k&&I===void 0&&G()},[I,G,A,k,B]);let K=p(()=>{if(!A){let{open:e}=l.getState();return e(),!1}return!0},[A]),q=f(),J=f(),Y=p(async e=>{try{return e?await ee(r,C):await w(r,C)}catch(e){return console.error(`点赞操作失败`,e),{success:!1,message:`点赞操作失败`}}},[r,C]),X=p(async()=>{if(!(!K()||V)){H(!0);try{let e=!i;e&&q.trigger(R);let t={isLike:e,likeCnt:Math.max(0,s+(e?1:-1))};e&&a&&(t.isDislike=!1,t.dislikeCnt=Math.max(0,S-1));let n=await Y(e);if(!n.success){_.error(n.message||`点赞失败`);return}return t}finally{H(!1)}}},[q,i,a,s,S,Y,K,V,R]),Z=p(async e=>{try{return e?await T(r,C):await E(r,C)}catch(e){return console.error(`点踩操作失败`,e),{success:!1,message:`点踩操作失败`}}},[r,C]),te=p(async()=>{if(!(!K()||U)){W(!0);try{let e=!a;e&&J.trigger(z);let t={isDislike:e,dislikeCnt:Math.max(0,S+(e?1:-1))};e&&i&&(t.isLike=!1,t.likeCnt=Math.max(0,s-1));let n=await Z(e);if(!n.success){_.error(n.message||`操作失败`);return}return t}finally{W(!1)}}},[J,i,a,s,S,Z,K,U,z]),Q=p(async({currentId:e,isCancel:t,collectionIds:r})=>{try{if(t){let t=String(M||j?.userId||``);if(!t)return{success:!1};let n=await c({app_id:0,user_id:t,content_id:e,content_type:C});return n.code===0?{success:!0}:{success:!1,message:n.message}}if(!String(M||j?.userId||``))return{success:!1};let i=r?.[0],a=x(C),o=await n({...i?{collection_id:i}:{},content_id:e,...a===void 0?{}:{source_type:a}});return o.code===0?{success:!0}:{success:!1,message:o.message}}catch(e){return console.error(`取消收藏操作失败`,e),{success:!1,message:e?.message}}},[M,j?.userId,C]),$=p(({currentCollect:e,onUpdate:t})=>K()?(e?(async()=>{let e=await Q({currentId:r,isCancel:!0});if(!e?.success){_.error(e?.message||`操作失败`);return}t({isCollect:!1})})():(d.clear(),u.show({toCreateCollection:()=>{N.push(`/collection/create?information_id=${r}`)},onCollect:e=>{(async()=>{let n=await Q({currentId:r,isCancel:!1,collectionIds:[e]});if(!n?.success){_.error(n?.message||`操作失败`);return}t({isCollect:!0})})()}})),!0):!1,[r,N,K,Q]),ne=p(async({currentCollect:e,onUpdate:t})=>{if(!K())return;if(e){let e=await Q({currentId:r,isCancel:!0});return e?.success?(t({isCollect:!1}),{success:!0,isCollect:!1}):{success:!1,message:e?.message}}d.clear(),u.clear();let n=await Q({currentId:r,isCancel:!1});if(!n?.success)return{success:!1,message:n?.message};let i=I===void 0?await G():I;return t({isCollect:!0}),{success:!0,isCollect:!0,collectionTitle:i||void 0}},[I,G,Q,r,K]);return{likeAnimation:q,dislikeAnimation:J,handleLikeOperate:X,handleDislikeOperate:te,handleShareOperate:p((e,t)=>{let n=typeof t==`string`?{otherId:t}:t,i=n?.otherId||r,a=n?.shareUrl;d.show({copyUrl:O,data:{id:r,isCollect:o,parentId:i},...a?{shareUrl:a}:{},onCollect:t=>{$({currentCollect:t,onUpdate:e})}})},[r,o,$,O]),handleToCollectionOperate:$,handleDefaultCollectionOperate:ne}}export{C as batchQueryContentInteractions,D as useContentOperate};
|