@funhub/platform 0.1.30 → 0.1.33
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/config/tailwind/index.cjs +115 -1
- package/config/tailwind/index.d.ts +3 -0
- package/config/tailwind/index.mjs +115 -1
- package/dist/biz.d.mts +29 -25
- package/dist/biz.mjs +1 -1
- package/dist/common.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/index.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/runtime/client.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/runtime/post-slide.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/runtime/use-mixed-feed-controller.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/runtime/use-series-feed-controller.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/runtime/user-action.mjs +1 -1
- package/dist/components/biz/basics/logo/variants/basic-logo/runtime/client.mjs +1 -1
- package/dist/components/biz/basics/search/shared/components/search-box.mjs +1 -1
- package/dist/components/biz/basics/search/variants/simple-search/runtime/client.mjs +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/inspector-schema.mjs +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/runtime/client.mjs +1 -1
- package/dist/components/biz/business/banner-carousel/client.mjs +1 -1
- package/dist/components/biz/business/card-grid/variants/card-grid-2x3-infinite/runtime/client.mjs +1 -1
- package/dist/components/biz/business/card-grid/variants/card-grid-3x3-infinite/runtime/client.mjs +1 -1
- package/dist/components/biz/business/channel-list/client.d.mts +2 -2
- package/dist/components/biz/business/channel-list/client.mjs +1 -1
- package/dist/components/biz/business/channel-list/default-props.mjs +1 -1
- package/dist/components/biz/business/channel-list/material.d.mts +2 -2
- package/dist/components/biz/business/comment/comment-item.mjs +1 -1
- package/dist/components/biz/business/comment/reply-detail.mjs +1 -1
- package/dist/components/biz/business/contact/contact-list.mjs +1 -1
- package/dist/components/biz/business/detail/detail-operate.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-actions/schema.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info/schema.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title/schema.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/schema.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-player/schema.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-recommend/client.mjs +1 -1
- package/dist/components/biz/business/detail/video-hero.mjs +1 -1
- package/dist/components/biz/business/floating-ball/client.d.mts +2 -2
- package/dist/components/biz/business/floating-ball/client.mjs +1 -1
- package/dist/components/biz/business/floating-ball/index.d.mts +5 -0
- package/dist/components/biz/business/floating-ball/material.d.mts +6 -1
- package/dist/components/biz/business/floating-ball/schema.d.mts +11 -4
- package/dist/components/biz/business/floating-ball/schema.mjs +1 -1
- package/dist/components/biz/business/fullscreen-feed/variants/shared/runtime-compat.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
- package/dist/components/biz/business/index.d.mts +29 -24
- package/dist/components/biz/business/index.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/card-item.mjs +2 -0
- package/dist/components/biz/business/large-feature-grid/client.d.mts +8 -5
- package/dist/components/biz/business/large-feature-grid/client.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/mock.mjs +2 -0
- package/dist/components/biz/business/large-feature-grid/server.d.mts +4 -2
- package/dist/components/biz/business/large-feature-grid/types.d.mts +33 -0
- package/dist/components/biz/business/marquee/client.mjs +1 -1
- package/dist/components/biz/business/nav-bar/variants/basic-nav-bar/runtime/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/material.d.mts +1 -7
- package/dist/components/biz/business/profile/profile-header/schema.d.mts +14 -14
- package/dist/components/biz/business/profile/profile-header/schema.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/material.d.mts +1 -12
- package/dist/components/biz/business/profile/profile-main/schema.d.mts +14 -24
- package/dist/components/biz/business/profile/profile-main/schema.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/client.mjs +1 -1
- package/dist/components/biz/business/recommended-users/variants/basic-recommended-users/runtime/client.mjs +1 -1
- package/dist/components/biz/business/search-bar/variants/detail-search-bar/runtime/client.mjs +1 -1
- package/dist/components/biz/business/search-history/client.mjs +1 -1
- package/dist/components/biz/business/search-input/client.mjs +1 -1
- package/dist/components/biz/business/tab-bar/client.mjs +1 -1
- package/dist/components/biz/business/text-recommend/client.mjs +1 -1
- package/dist/components/common/at-element/index.mjs +1 -1
- package/dist/components/common/blocked-dialog/blocked-dialog.mjs +1 -1
- package/dist/components/common/funhub-provider/funhub-provider.mjs +1 -1
- package/dist/components/common/header-nav/client.mjs +1 -1
- package/dist/components/common/info-card/card-header.mjs +1 -1
- package/dist/components/common/list/post-list/post-list.mjs +1 -1
- package/dist/components/common/list/user-activity-list/user-activity-list-actions.mjs +1 -1
- package/dist/components/common/list/user-activity-list/user-activity-list-item.mjs +1 -1
- package/dist/components/common/list/video-list/video-list.mjs +1 -1
- package/dist/components/common/media-preview/index.mjs +1 -1
- package/dist/components/common/popup-video/index.mjs +1 -1
- package/dist/components/common/share-popup/share-popup.mjs +1 -1
- package/dist/components/common/tab-bar/index.mjs +1 -1
- package/dist/components/common/top-nav-bar/client.mjs +1 -1
- package/dist/components/common/video-player/index.mjs +2 -2
- package/dist/components/pages/(follow)/_components/interaction-tabs/index.mjs +1 -1
- package/dist/components/pages/(follow)/_components/user-list/index.mjs +1 -1
- package/dist/components/pages/collection-create/form.mjs +1 -1
- package/dist/components/pages/collection-detail/detail.mjs +1 -1
- package/dist/components/pages/feed-series/feed-series-client.mjs +1 -1
- package/dist/components/pages/feed-series/page.mjs +1 -1
- package/dist/components/pages/feedback/_components/feedback-form.mjs +1 -1
- package/dist/components/pages/fullscreen-feed/page.mjs +1 -1
- package/dist/components/pages/home/client.mjs +1 -1
- package/dist/components/pages/post-detail/post-detail-client.mjs +1 -1
- package/dist/components/pages/profile/_components/user-profile-container/client.mjs +1 -1
- package/dist/components/pages/publish/components/collection.mjs +1 -1
- package/dist/components/pages/publish/components/header.mjs +1 -1
- package/dist/components/pages/publish/page-client.mjs +1 -1
- package/dist/components/pages/search/page-client.mjs +1 -1
- package/dist/components/pages/search/search-result/search-video-info.mjs +1 -1
- package/dist/components/pages/search/top-header.mjs +1 -1
- package/dist/components/pages/user-follow/_components/follow-no-login.mjs +1 -1
- package/dist/components/pages/video-detail/page.mjs +1 -1
- package/dist/components/pages/video-detail/video-detail-client.mjs +1 -1
- package/dist/components/pages/video-list/video-list-client.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/components/ui/image.d.mts +4 -4
- package/dist/hooks/use-content-operate.mjs +1 -1
- package/dist/i18n.d.mts +1 -1
- package/dist/i18n.mjs +1 -1
- package/dist/materials.d.mts +5 -5
- package/dist/materials.mjs +1 -1
- package/dist/utils/share-manager.mjs +1 -1
- package/dist/utils.d.mts +4 -4
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
- package/dist/components/biz/business/large-feature-grid/schema.d.mts +0 -14
|
@@ -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{Carousel as n,CarouselContent as r,CarouselItem as i}from"../../../../ui/carousel.mjs";import{useBrowseReport as a}from"../../../../../hooks/use-browse-report.mjs";import
|
|
2
|
+
"use client";import{Image as e}from"../../../../ui/image.mjs";import{Box as t}from"../../../../ui/box.mjs";import{Carousel as n,CarouselContent as r,CarouselItem as i}from"../../../../ui/carousel.mjs";import{useBrowseReport as a}from"../../../../../hooks/use-browse-report.mjs";import o from"./styles.module.mjs";import s from"../../../../../assets/icons/common/video_play.mjs";import{useMediaPreview as c}from"../../../../common/media-preview/index.mjs";import{useCallback as l,useEffect as u,useMemo as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";function h(e,t){return e.cover_image||t}function g(e){return e.type===`video`&&e.cover||e.src}function _({item:_,isSettledActive:v,shouldMount:y}){let b=c();a({contentId:_.id,contentType:2,browseEpisode:1,enabled:v,enableIntervalReport:!1,enableExitReport:!1,oncePerSession:!0});let x=d(()=>(Array.isArray(_.originalData.preview_images)?_.originalData.preview_images:[]).map(e=>{if(!e)return null;if(typeof e==`string`)return{type:`image`,src:e,cover:``};let t=e,n=!!t.is_video,r=t.media_url;if(n){let e=h(t,_.originalData.img_y||``);return!r&&!e?null:{type:`video`,src:r,cover:e}}return r?{type:`image`,src:r,cover:``}:null}).filter(Boolean),[_.originalData.img_y,_.originalData.preview_images]),S=d(()=>{let e=x[0];return e?g(e):``},[x]),[C,w]=f(null),[T,E]=f(0),[D,O]=f(0),[k,A]=f(()=>new Set),j=l(e=>{E(e.selectedScrollSnap())},[]);u(()=>{if(C)return O(C.scrollSnapList().length),j(C),C.on(`select`,j),C.on(`reInit`,j),()=>{C.off(`select`,j),C.off(`reInit`,j)}},[C,j]),u(()=>{E(0),A(new Set)},[_.id]);let M=l(e=>{e&&A(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),N=d(()=>x.length?x.length>1?g(x[T]||x[0]):S:``,[S,x,T]),P=!!(y&&N&&!k.has(N));function F(e){x.length&&b.open(x,e)}return y?p(t,{"data-id":_.id,className:`w-full h-full bg-black`,children:x.length>1?m(t,{className:`relative w-full h-full`,children:[m(n,{opts:{loop:!0},setApi:e=>{e&&w(e)},className:`h-full w-full ${o.carouselFull}`,children:[p(r,{className:`h-full`,children:x.map((n,r)=>{let a=g(n);return p(i,{className:`h-full p-0`,children:p(t,{className:o.imageSlide,children:m(`button`,{type:`button`,className:`relative w-full h-full`,onClick:()=>F(r),children:[p(e,{src:a,fill:!0,alt:_.title||`post`,className:`object-contain`,sizes:`100vw`,onLoad:()=>M(a),onError:()=>M(a)}),n.type===`video`&&p(`span`,{className:`absolute left-1/2 top-1/2 z-10 flex h-14 w-14 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-black/50 text-white`,children:p(s,{className:`w-10 h-10`})})]})})},`${_.id}-${r}`)})}),D>1&&p(`div`,{className:`absolute bottom-[140px] left-1/2 z-20 flex -translate-x-1/2 items-center gap-2`,children:Array.from({length:D}).map((e,t)=>{let n=t===T;return p(`button`,{type:`button`,"aria-label":`Go to slide ${t+1}`,className:`h-2 rounded-full transition-all ${n?`w-6 bg-white/95`:`w-2 bg-white/40`}`,onClick:()=>C?.scrollTo(t)},`${_.id}-dot-${t}`)})})]}),P&&p(`div`,{className:o.posterLoading,children:p(e,{src:`/images/common/loading.gif`,alt:`loading`,width:36,height:36})})]}):m(t,{className:`relative w-full h-full`,children:[S?m(`button`,{type:`button`,className:`absolute inset-0`,onClick:()=>F(0),children:[p(e,{src:S,fill:!0,alt:_.title||`post`,className:`object-contain`,sizes:`100vw`,onLoad:()=>M(S),onError:()=>M(S)}),x[0]?.type===`video`&&p(`span`,{className:`absolute left-1/2 top-1/2 z-10 flex h-14 w-14 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-black/50 text-white`,children:p(s,{className:`w-10 h-10`})})]}):null,P&&p(`div`,{className:o.posterLoading,children:p(e,{src:`/images/common/loading.gif`,alt:`loading`,width:36,height:36})}),p(t,{className:`absolute inset-0 bg-[linear-gradient(to_top,rgba(0,0,0,0.75),rgba(0,0,0,0.15),rgba(0,0,0,0.75))]`})]})}):p(t,{"data-id":_.id,className:o.imageSlide,children:S?p(e,{src:S,fill:!0,alt:_.title||`post`,className:`object-contain`,sizes:`100vw`}):null})}export{_ as PostSlide};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{gContentGetAppChannelBlockData as t}from"../../../../../service/generated/client.mjs";import{useKeepAliveState as n}from"../../../../common/keep-scroll-position/index.mjs";import{
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{gContentGetAppChannelBlockData as t}from"../../../../../service/generated/client.mjs";import{useKeepAliveState as n}from"../../../../common/keep-scroll-position/index.mjs";import{adaptFeedItemToSafeInformation as r,normalizeToFeedItem as i}from"./adapters.mjs";import{batchQueryContentInteractions as a}from"../../../../../hooks/use-content-operate.mjs";import{buildInteractionMap as o,collectPendingInteractionIds as s,mergeInteractionIntoFeedItems as c}from"./interaction-sync.mjs";import{useCallback as l,useEffect as u,useRef as d}from"react";function f(e){return!e||typeof e!=`object`?null:i(r(e))}function p({blockId:r,appId:i,initialContents:p=[],initialActiveIndex:m=0,keepAliveKey:h}){let g=h||`fullscreen-mixed:${i||`app`}:${r}`,{isLogin:_,userId:v,userInfo:y}=e(),b=v||y?.userId||``,x=d((p||[]).map(e=>f(e)).filter(Boolean)).current,[S,C]=n(`${g}-active-index`,m),[w,T]=n(`${g}-user-interacted`,!1),[E,D]=n(`${g}-fetching`,!1),[O,k]=n(`${g}-has-more`,!0),[A,j]=n(`${g}-cursor`,``),[M,N]=n(`${g}-fetched-first`,!1),[P,F]=n(`${g}-items`,x),[I,L]=n(`${g}-checked-interaction-ids`,{video:[],post:[]}),R=d({video:new Set(I.video),post:new Set(I.post)}),z=d(I);z.current=I;let B=d(A);u(()=>{B.current=A},[A]),u(()=>{R.current={video:new Set(z.current.video),post:new Set(z.current.post)}},[I,b]),u(()=>{R.current={video:new Set,post:new Set},L({video:[],post:[]})},[b,L]);let V=l((e,t)=>{F(n=>n.map(n=>n.id===e?{...n,originalData:{...n.originalData,...t,static:t.static?{...n.originalData.static,...t.static}:n.originalData.static,author:t.author?{...n.originalData.author,...t.author}:n.originalData.author}}:n))},[F]),H=l(async e=>{if(!_||!b)return;let{pendingVideoIds:t,pendingPostIds:n}=s(e,R.current);if(t.length===0&&n.length===0)return;L({video:Array.from(R.current.video),post:Array.from(R.current.post)});let[r,i]=await Promise.all([t.length>0?a(t,1):Promise.resolve(null),n.length>0?a(n,2):Promise.resolve(null)]),l=o(r?.interaction_list),u=o(i?.interaction_list);F(e=>c(e,l,u))},[_,b,L,F]),U=l(async()=>{if(r&&!E&&O){D(!0);try{let e=(await t({app_id:i,block_id:r,cursor:B.current||void 0})).data.block?.data,n=e?.cursor,a=n==null?``:String(n),o=(e?.list||[]).map(e=>f(e)).filter(Boolean);o.length>0&&(F(e=>{let t=new Set(e.map(e=>`${e.kind}:${e.id}`)),n=[...e];return o.forEach(e=>{let r=`${e.kind}:${e.id}`;e.id&&(t.has(r)||(t.add(r),n.push(e)))}),n}),H(o)),B.current=a,j(a),k(!!a)}catch(e){console.error(`MixedFeed fetchMore failed:`,e),k(!1)}finally{D(!1)}}},[i,r,O,E,j]);u(()=>{M||(N(!0),!(P.length>0)&&U())},[U,M,P.length,N]),u(()=>{!_||!b||P.length!==0&&H(P)},[_,P,H,b]);let W=l(e=>{O&&e>=P.length-2&&U()},[U,O,P.length]);return{items:P,activeIndex:S,userInteracted:w,setUserInteracted:()=>T(!0),setActiveIndex:(e,t)=>{C(e)},updateItemData:V,getNavigationInfo:l(e=>{let t=P[e+1];return{showSeriesButton:!1,nextItemText:t?`\u4E0B\u4E00\u6761${t.title?`\u00B7${t.title}`:``}`:``}},[P]),maybeLoadMore:W,isFetching:E,hasMore:O}}export{p as useMixedFeedController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{gContentGetVideoDetail as t}from"../../../../../service/generated/client.mjs";import{useKeepAliveState as n}from"../../../../common/keep-scroll-position/index.mjs";import{
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{gContentGetVideoDetail as t}from"../../../../../service/generated/client.mjs";import{useKeepAliveState as n}from"../../../../common/keep-scroll-position/index.mjs";import{normalizeToSeriesFeedItem as r}from"./adapters.mjs";import{batchQueryContentInteractions as i}from"../../../../../hooks/use-content-operate.mjs";import{buildInteractionMap as a,collectPendingInteractionIdsFromInfos as o,mergeInteractionIntoInfos as s}from"./interaction-sync.mjs";import{useCallback as c,useEffect as l,useMemo as u,useRef as d}from"react";function f(e){let t=e.id||``,n=Array.isArray(e.links)?e.links:[],r={...e,id:t,name:e.name||``,episode_cnt:e.episode_cnt??n.length,links:[]};return n.length===0?[{...r,links:[]}]:n.map((e,t)=>{let n=e.name||`第${t+1}集`;return{...r,name:n,links:[e]}})}function p({seriesId:p,initialContents:m=[],initialActiveIndex:h=0,onEpisodeNavigate:g,keepAliveKey:_}){let v=_||`fullscreen-series:${p}`,{isLogin:y,userId:b,userInfo:x}=e(),S=b||x?.userId||``,[C,w]=n(`${v}-active-index`,h),[T,E]=n(`${v}-user-interacted`,!1),[D,O]=n(`${v}-series-selector-open`,!1),k=d(m),[A,j]=n(`${v}-infos`,k.current||[]),[M,N]=n(`${v}-checked-interaction-ids`,[]),P=d(new Set(M)),F=d(M);F.current=M;let[I,L]=n(`${v}-series-title`,``),[R,z]=n(`${v}-series-list`,[]);l(()=>{P.current=new Set(F.current)},[M,S]),l(()=>{P.current=new Set,N([])},[S,N]);let B=c(async e=>{if(!y||!S)return;let t=o(e,P.current);if(t.length===0)return;N(Array.from(P.current));let n=a((await i(t,1))?.interaction_list);n.size!==0&&j(e=>s(e,n))},[y,S,N,j]);l(()=>{if(R.length>0||A.length===0)return;let e=A.map((e,t)=>{let n=e.links?.[0];return{id:n?.id||e.id||`${t+1}`,name:n?.name||e.name||String(t+1),preview_m3u8_url:n?.preview_m3u8_url,m3u8_url:n?.m3u8_url}}).filter(e=>!!e.id);e.length>0&&z(e)},[A,R.length,z]),l(()=>{if(A.length>0||!p)return;let e=!0;async function n(){try{let n=(await t({id:p}))?.data?.video;if(!e||!n)return;L(n.name||``),z(Array.isArray(n.links)?n.links:[]),j(f(n))}catch(e){console.error(`SeriesFeed fetch detail failed:`,e)}}return n(),()=>{e=!1}},[A.length,p,j,z,L]),l(()=>{!y||!S||A.length!==0&&B(A)},[A,y,B,S]);let V=u(()=>A.map(e=>r(e)).filter(Boolean),[A]),H=u(()=>V[C]?.id||``,[C,V]),U=c((e,t)=>{if(w(e),t===`jump`){let t=V[e]?.id||``,n=Number.parseInt(R[e]?.name||``,10),r=Number.isNaN(n)?e+1:n;t&&g?.({episodeId:t,episodeNum:r})}},[V,g,R,w]),W=c((e,t)=>{j(n=>n.map(n=>n.id===e?{...n,...t,static:t.static?{...n.static,...t.static}:n.static,author:t.author?{...n.author,...t.author}:n.author}:n))},[j]),G=c(()=>O(!0),[O]),K=c(()=>O(!1),[O]),q=c((e,t)=>{let n=V.findIndex(t=>t.id===e);n>=0&&U(n,`jump`),g?.({episodeId:e,episodeNum:t})},[V,g,U]),J=c(e=>{let t=V[e];return{showSeriesButton:!0,seriesTitle:I,seriesText:t?t.title:void 0,nextItemText:void 0,onSeriesClick:G}},[V,G,I]);return{items:V,activeIndex:C,userInteracted:T,setUserInteracted:()=>E(!0),setActiveIndex:U,updateItemData:W,openSeriesSelector:G,closeSeriesSelector:K,isSeriesSelectorOpen:D,seriesMeta:{seriesTitle:I,seriesList:R},activeEpisodeId:H,onSelectEpisode:q,getNavigationInfo:J}}export{p as useSeriesFeedController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{followUser as t}from"../../../../../utils/follow-service.mjs";import{Avatar as n,AvatarImage as r}from"../../../../ui/avatar.mjs";import i from"../../../../ui/legacy/button.mjs";import a from"../../../../../assets/icons/common/collect_nor.mjs";import ee from"../../../../../assets/icons/common/collect_sel.mjs";import
|
|
2
|
+
import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{followUser as t}from"../../../../../utils/follow-service.mjs";import{Avatar as n,AvatarImage as r}from"../../../../ui/avatar.mjs";import i from"../../../../ui/legacy/button.mjs";import a from"../../../../../assets/icons/common/collect_nor.mjs";import ee from"../../../../../assets/icons/common/collect_sel.mjs";import te from"../../../../../assets/icons/common/heart-like.mjs";import o from"../../../../../assets/icons/common/heart-unlike.mjs";import s from"../../../../../assets/icons/common/share.mjs";import c from"../../../../../assets/icons/detail/comment.mjs";import l from"../../../../common/interaction-animations.module.mjs";import{useContentOperate as u}from"../../../../../hooks/use-content-operate.mjs";import{useCallback as d,useEffect as f,useMemo as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{toast as _}from"sonner";import{useTranslations as v}from"next-intl";const y=[];function b({information:b,activeEpisodeId:S,onUpdate:C,onOpenComment:w,onCustomActionRender:T,onUserNavigate:E,currentUserId:D,followIds:O=y,onFollowChange:ne,onRequireLogin:k}){let A=v(`components.biz.basics.fullscreenFeed.runtime`),[j,M]=m(!1),[N,P]=m({liked:!1,count:0}),[F,I]=m({collected:!1,count:0}),[L,R]=m(0),[z,B]=m(!1),{isLogin:V,userInfo:H,userId:U}=e(),W=b.author?.user_id||``,G=b.author?.avatar,K=D||U||H?.userId||``,q=b.static?.dislike_cnt||0,{likeAnimation:J,handleLikeOperate:Y,handleShareOperate:X,handleToCollectionOperate:re}=u({id:b.id,isLike:N.liked,isDislike:!!b.is_dislike,isCollect:F.collected,likeCnt:N.count,dislikeCnt:q,contentType:b.links?.length>0?1:2,animationClasses:{like:l.likeShakeAnimation,dislike:l.dislikeShakeAnimation}});f(()=>{let e=!!b.is_liked,t=Number(b.static?.like_cnt||0);P({liked:e,count:e&&t===0?1:t});let n=!!b.is_collected,r=Number(b.static?.collect_cnt||0);I({collected:n,count:n&&r===0?1:r}),R(b.static?.comment_cnt||0),B(!!b.is_followed)},[b.id,b.is_liked,b.is_collected,b.static?.like_cnt,b.static?.collect_cnt,b.static?.comment_cnt,b.is_followed]);let Z=p(()=>K===W,[W,K]),ie=p(()=>!!z,[z]),Q=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString(),$=()=>V?!0:(k?.(),!1),ae=d(()=>{if(typeof window>`u`)return``;let e=window.location.origin,t=b.id;return t?b.links?.length>0?(t=b.mid||b.id,`${e}/feed-series/${t}/episode/${S||`1`}`):`${e}/post/${t}`:``},[b.id,S,b.links?.length,b.mid]);return g(`div`,{className:`absolute right-3 bottom-5 z-20 flex flex-col items-center gap-4 g-safe-area text-white`,children:[W&&g(`div`,{className:`relative h-[62px] flex flex-col items-center`,children:[h(i,{className:`w-12 h-12 !p-0 rounded-full overflow-hidden cursor-pointer`,onClick:e=>{e.stopPropagation(),W&&E?.(W)},children:h(n,{className:`w-full h-full`,children:h(r,{src:G})})}),!Z&&!ie&&h(i,{onClick:async()=>{if(!j&&$()&&!(!W||!K||Z)){M(!0);try{let e=await t({app_id:0,follower_id:K,followee_id:W});if(e.success){let e=O.includes(W)?O:[...O,W];ne?.(e),C?.({is_followed:!0}),B(!0)}else console.error(`关注失败:`,e.message),_.error(A(`userAction.followFailed`),{description:e.message})}catch(e){console.error(`关注失败:`,e)}finally{M(!1)}}},className:`w-[34px] h-[18px] !p-0 -mt-2 bg-[linear-gradient(73deg,#FD4C5E,#F05D19)] flex items-center justify-center text-xs cursor-pointer relative z-[1]`,children:`+`})]}),g(`div`,{className:`flex flex-col gap-5 items-center`,children:[h(x,{active:N.liked,count:N.count<=0?A(`userAction.like`):Q(N.count),onClick:async()=>{if(!$())return;let e=await Y();if(!e)return;let t=e.isLike,n=t&&e.likeCnt===0?1:e.likeCnt,r=e.isDislike??b.is_dislike??!1,i=e.dislikeCnt??q;P({liked:t,count:n}),C?.({is_liked:t,is_dislike:r,static:{...b.static,like_cnt:n,dislike_cnt:i}})},label:A(`userAction.likeAction`),children:N.liked?h(te,{className:`w-full h-full ${J.animationClass||``}`}):h(o,{className:`w-full h-full`})}),h(x,{active:!1,count:Q(L),onClick:e=>{if(e.stopPropagation(),!V){k?.();return}w?.()},label:A(`userAction.commentAction`),children:h(c,{className:`w-full h-full`})}),h(x,{active:F.collected,count:Q(F.count),onClick:async()=>{$()&&(re({currentCollect:F.collected,onUpdate:({isCollect:e})=>{let t=Math.max(0,F.count+(e?1:-1));I({collected:e,count:t}),C?.({is_collected:e,static:{...b.static,collect_cnt:t}})}})||_.error(A(`userAction.loginRequired`)))},label:A(`userAction.collectAction`),children:F.collected?h(ee,{className:`w-full h-full`}):h(a,{className:`w-full h-full`})}),h(x,{active:!1,count:A(`userAction.shareAction`),onClick:async()=>{X(({isCollect:e})=>{let t=Math.max(0,F.count+(e?1:-1));I({collected:e,count:t}),C?.({is_collected:e,static:{...b.static,collect_cnt:t}})},{shareUrl:ae()})},label:A(`userAction.shareAction`),children:h(s,{className:`w-full h-full`})}),T?.(b)]})]})}function x({active:e,count:t,onClick:n,children:r}){return g(`div`,{className:`flex flex-col items-center gap-1`,children:[h(i,{onClick:e=>{e.stopPropagation(),n(e)},className:`w-8 h-8 !p-0 !rounded-full flex items-center justify-center transition ${e?`text-theme5`:`text-white`}`,children:r}),h(`span`,{className:`text-xs font-medium text-center min-w-5 drop-shadow`,children:t})]})}export{b as UserAction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{mergeStyles as e}from"../../../../../utils/styles/helpers.mjs";import{disablePageScroll as t,enablePageScroll as n,pxToVw as r}from"../../../../../../../utils/helper.mjs";import{Image as i}from"../../../../../../ui/image.mjs";import{Box as a}from"../../../../../../ui/box.mjs";import{Text as o}from"../../../../../../ui/text.mjs";import s from"../../../../../../ui/legacy/button.mjs";import{defaultProps as
|
|
2
|
+
"use client";import{mergeStyles as e}from"../../../../../utils/styles/helpers.mjs";import{disablePageScroll as t,enablePageScroll as n,pxToVw as r}from"../../../../../../../utils/helper.mjs";import{Image as i}from"../../../../../../ui/image.mjs";import{Box as a}from"../../../../../../ui/box.mjs";import{Text as o}from"../../../../../../ui/text.mjs";import s from"../../../../../../ui/legacy/button.mjs";import c from"../../../../../../ui/link.mjs";import{defaultProps as l}from"../defaults/default-props.mjs";import u from"../../../../../../../assets/images/logo.mjs";import{loadHiddenChannelIdsFromStorage as d}from"../../../../../business/nav-bar/variants/basic-nav-bar/runtime/channel-filter-dialog.mjs";import{Popover as f}from"../../../../../../ui/legacy/popover.mjs";import{Mask as p}from"../../../../../../ui/mask.mjs";import{urlPrefix as m}from"../../../../../../../constants/url-prefix.mjs";import{clsx as h}from"clsx";import{useIsClient as g}from"foxact/use-is-client";import{useEffect as _,useMemo as v,useRef as y,useState as b}from"react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{usePathname as C}from"next/navigation";const w={overscrollBehavior:`contain`},T={},E=[];function D(e,t){return t===0?`/`:`${m.CHANNEL}/${encodeURIComponent(e.cn_name)}`}function O(e,t,n){return h(`w-full leading-[58px] px-[20px] text-[16px] text-text2 border-t border-solid border-line1 transition-all duration-150 block`,e===0&&`border-t-0`,t&&`!text-[20px] !text-theme5 !font-bold`,n&&`!text-(--color-theme5)`)}function k(e){let t=e;try{t=decodeURIComponent(e)}catch{t=e}return t.length>1&&t.endsWith(`/`)?t.slice(0,-1):t}function A(e){e.stopPropagation()}function j({props:m=T,styles:h,events:j,data:M=E}){let{logoAlt:N,logoWidth:P,logoHeight:F,popoverPlacement:I,popoverWidth:L,maxHeight:R,itemHeight:z,currentChannelId:B}={...l,...m},[V,H]=b(!1),U=y(null),W=C(),[G,K]=b(B??null),q=g(),J=(e,t)=>{K(e.id),j?.onChannelChange?.(e,t),setTimeout(()=>{H(!1)},150)};_(()=>{if(B||!W||M.length===0)return;let e=k(W),t=M.find((t,n)=>k(D(t,n))===e);t?K(t.id):e===`/`&&K(M[0]?.id||null)},[W,q,M,B]);let Y=v(()=>{if(!q||!V)return M;let e=d();return M.filter(t=>!e.includes(t.id))},[M,q,V]);_(()=>{if(V)return t(),()=>{n()}},[V]);let X=h?e(h,{}):{},Z={width:r(L),maxHeight:r(R),...w};return S(a,{style:X,className:`leading-0 flex items-center`,children:[x(p,{visible:V,onMaskClick:()=>{H(!1)}}),x(f,{placement:I,visible:V,content:x(a,{as:`nav`,className:`overflow-y-auto overscroll-contain`,style:Z,onTouchMove:A,children:Y.map((e,t)=>{let n=D(e,t),i=k(W||``)===k(n);return x(c,{href:n,className:O(t,G===e.id,i),style:{height:r(z)},onClick:()=>J(e,t),children:e.cn_name},e.id||`channel-${t}`)})}),children:x(o,{ref:U,as:`h1`,className:`flex items-center`,children:x(s,{onClick:()=>{H(e=>!e),j?.onClick?.()},className:`!m-0 !p-0`,children:x(i,{alt:N,src:typeof u==`string`?u:u.src,width:P,height:F})})},`logo-button`)})]})}export{j as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{pxToVw as e}from"../../../../../../utils/helper.mjs";import{Box as t}from"../../../../../ui/box.mjs";import{Text as n}from"../../../../../ui/text.mjs";import r from"
|
|
2
|
+
"use client";import{pxToVw as e}from"../../../../../../utils/helper.mjs";import{Box as t}from"../../../../../ui/box.mjs";import{Text as n}from"../../../../../ui/text.mjs";import r from"../../../../../ui/link.mjs";import i from"../../../../../../assets/icons/search.mjs";import"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s({placeholder:s,searchUrl:c,iconSize:l,showPlaceholderText:u,borderColor:d,onClick:f,marginRight:p=16,className:m=`flex-1`,wrapperStyle:h}){let g=a(r,{className:m,href:c,onClick:()=>{f?.()},children:o(t,{className:`h-[38px] flex px-[12px] items-center rounded-[19px] cursor-pointer transition-colors text-text3 relative`,style:{border:`1px solid ${d}`,marginRight:p>0?e(p):void 0},children:[a(i,{width:e(l),height:e(l)}),u&&a(n,{className:`ml-[4px] text-text3 text-[16px] leading-none select-none flex-1`,children:s})]})});return h?a(t,{style:h,children:g}):g}export{s as SearchBox};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{mergeStyles as e}from"../../../../../utils/styles/helpers.mjs";import{pxToVw as t}from"../../../../../../../utils/helper.mjs";import n from"
|
|
2
|
+
"use client";import{mergeStyles as e}from"../../../../../utils/styles/helpers.mjs";import{pxToVw as t}from"../../../../../../../utils/helper.mjs";import n from"../../../../../../ui/link.mjs";import{defaultProps as r}from"../defaults/default-props.mjs";import i from"../../../../../../../assets/icons/search.mjs";import{jsx as a}from"react/jsx-runtime";function o({props:o,styles:s,events:c}){let{searchUrl:l,iconSize:u}={...r,...o||{}},d=()=>{c?.onClick?.()},f=s?e(s,{}):void 0,p=t(u);return a(n,{href:l,onClick:d,style:f,"aria-label":`搜索`,children:a(i,{width:p,height:p})})}export{o as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{defineArrayItemPropSchema as
|
|
2
|
+
import{defaultProps as e}from"./defaults/default-props.mjs";import{defineArrayItemPropSchema as t,defineComponentPropsSchema as n,defineNumberPropSchema as r,defineSwitchPropSchema as i,defineTextPropSchema as a,getSchemaDefaultProps as o}from"../../../../../../utils/schema/schema.mjs";import s from"zod";const c=n({interval:r({label:`播放间隔`,defaultValue:e.interval}),list:t(s.object({contentId:r({label:`内容ID`,required:!1}),title:a({label:`内容标题`,required:!1}),coverUrl:a({label:`封面`,required:!1}),showViewCount:i({label:`角标`,required:!1})}),{required:!1,label:`list`,defaultValue:[{contentId:1,title:`视频标题一`,desc:`视频描述`,coverUrl:`/static/components-resource/banner.png`,showViewCount:!1},{contentId:2,title:`视频标题二`,coverUrl:`/static/components-resource/banner.png`,showViewCount:!1},{contentId:3,title:`视频标题三`,coverUrl:`/static/components-resource/banner.png`,showViewCount:!1}]})}),l=o(c);export{l as basicBannerInspectorDefaultProps,c as basicBannerInspectorPropsSchema};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{buildContentUrl as e}from"../../../../../utils/helpers/url.mjs";import{mergeStyles as t}from"../../../../../utils/styles/helpers.mjs";import{
|
|
2
|
+
"use client";import{buildContentUrl as e}from"../../../../../utils/helpers/url.mjs";import{mergeStyles as t}from"../../../../../utils/styles/helpers.mjs";import{defaultProps as n}from"../defaults/default-props.mjs";import{Image as r}from"../../../../../../ui/image.mjs";import{Box as i}from"../../../../../../ui/box.mjs";import{Carousel as a,CarouselContent as o,CarouselItem as s}from"../../../../../../ui/carousel.mjs";import{Text as c}from"../../../../../../ui/text.mjs";import l from"../../../../../../ui/legacy/button.mjs";import u from"../../../../../../ui/link.mjs";import d from"clsx";import{useIsClient as f}from"foxact/use-is-client";import{useEffect as p,useRef as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";const v={list:[]};function y({props:y=v,styles:b,events:x}){let{autoplay:S=n.autoplay,interval:C=n.interval,loop:w=n.loop,showTitle:T=n.showTitle,showIndicator:E=n.showIndicator,list:D=[]}={...n,...y},[O,k]=h(),[A,j]=h(0),M=f(),N=m(null);if(p(()=>{if(!O||!M)return;let e=()=>{j(O.selectedScrollSnap())};return O.on(`select`,e),e(),()=>{O.off(`select`,e)}},[O,x,M]),p(()=>!S||!O||D.length<=1?void 0:(N.current=setInterval(()=>{O.canScrollNext()?O.scrollNext():w&&O.scrollTo(0)},C),()=>{N.current&&=(clearInterval(N.current),null)}),[S,O,C,w,D.length]),!D||D.length===0)return null;let P=D[A];return _(i,{className:`relative w-full`,style:b?t(b,{}):void 0,children:[g(a,{setApi:k,opts:{align:`start`,loop:w,skipSnaps:!1,dragFree:!1},className:`w-full`,children:g(o,{className:`ml-0`,children:D.map((t,n)=>g(s,{className:`pl-0`,children:g(u,{href:e({url:``,contentId:t.contentId,contentType:1,title:t.title}),className:`block relative w-full h-[242px] overflow-hidden touch-manipulation`,children:g(r,{src:t.coverUrl,alt:t.title||`Banner ${n+1}`,fill:!0,objectFit:`cover`,unoptimized:!0})})},n))})}),T&&P?.title&&g(i,{className:`absolute bottom-[8px] left-[8px]`,children:g(c,{as:`p`,className:`text-white text-[16px] line-clamp-1`,children:P.title})}),E&&D.length>1&&g(i,{className:`absolute bottom-[16px] right-[8px] flex items-center gap-[4px]`,children:D.map((e,t)=>g(l,{type:`button`,className:d(`transition-all duration-300 rounded-full !p-0`,t===A?`w-[10px] h-[6px] bg-black`:`w-[6px] h-[6px] bg-white/50`),"aria-label":`跳转到第 ${t+1} 个 Banner`},t))})]})}export{y as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{buildContentUrl as e}from"../../utils/helpers/url.mjs";import{mergeStyles as t}from"../../utils/styles/helpers.mjs";import{Image as n}from"../../../ui/image.mjs";import{Box as r}from"../../../ui/box.mjs";import{Carousel as i,CarouselContent as a,CarouselItem as o}from"../../../ui/carousel.mjs";import{Text as s}from"../../../ui/text.mjs";import c from"../../../ui/legacy/button.mjs";import l from"../../../ui/link.mjs";import{defaultProps as u}from"./default-props.mjs";import{useEffect as
|
|
2
|
+
"use client";import{buildContentUrl as e}from"../../utils/helpers/url.mjs";import{mergeStyles as t}from"../../utils/styles/helpers.mjs";import{Image as n}from"../../../ui/image.mjs";import{Box as r}from"../../../ui/box.mjs";import{Carousel as i,CarouselContent as a,CarouselItem as o}from"../../../ui/carousel.mjs";import{Text as s}from"../../../ui/text.mjs";import c from"../../../ui/legacy/button.mjs";import l from"../../../ui/link.mjs";import{defaultProps as u}from"./default-props.mjs";import d from"clsx";import{useIsClient as f}from"foxact/use-is-client";import{useEffect as p,useRef as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";const v={list:[]};function y({props:y=v,styles:b,events:x}){let{autoplay:S=u.autoplay,interval:C=u.interval,loop:w=u.loop,showTitle:T=u.showTitle,showIndicator:E=u.showIndicator,list:D=[]}={...u,...y},[O,k]=h(),[A,j]=h(0),M=f(),N=m(null);if(p(()=>{if(!O||!M)return;let e=()=>{j(O.selectedScrollSnap())};return O.on(`select`,e),e(),()=>{O.off(`select`,e)}},[O,x,M]),p(()=>!S||!O||D.length<=1?void 0:(N.current=setInterval(()=>{O.canScrollNext()?O.scrollNext():w&&O.scrollTo(0)},C*1e3),()=>{N.current&&=(clearInterval(N.current),null)}),[S,O,C,w,D.length]),!D||D.length===0)return null;let P=D[A];return _(r,{className:`relative w-full`,style:b?t(b,{}):void 0,children:[g(i,{setApi:k,opts:{align:`start`,loop:w,skipSnaps:!1,dragFree:!1},className:`w-full`,children:g(a,{className:`ml-0`,children:D.map((t,r)=>g(o,{className:`pl-0`,children:g(l,{href:e({url:``,contentId:t.contentId,contentType:1,title:t.title}),className:`block relative w-full h-[242px] overflow-hidden touch-manipulation`,children:g(n,{src:t.coverUrl,alt:t.title||`Banner ${r+1}`,fill:!0,objectFit:`cover`,unoptimized:!0})})},r))})}),T&&P?.title&&g(r,{className:`absolute bottom-[8px] left-[8px]`,children:g(s,{as:`p`,className:`text-white text-[16px] line-clamp-1`,children:P.title})}),E&&D.length>1&&g(r,{className:`absolute bottom-[16px] right-[8px] flex items-center gap-[4px]`,children:D.map((e,t)=>g(c,{type:`button`,className:d(`transition-all duration-300 rounded-full !p-0`,t===A?`w-[10px] h-[6px] bg-black`:`w-[6px] h-[6px] bg-white/50`),"aria-label":`跳转到第 ${t+1} 个 Banner`},t))})]})}export{y as default};
|
package/dist/components/biz/business/card-grid/variants/card-grid-2x3-infinite/runtime/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{CardSpec as e}from"../../../../../utils/constants/card-spec.mjs";import{mergeStyles as t}from"../../../../../utils/styles/helpers.mjs";import{transformContentListToCardItems as n}from"../../../../../utils/transformers/card-grid.mjs";import{gContentGetAppChannelBlockData as r}from"../../../../../../../service/generated/client.mjs";import{Box as i}from"../../../../../../ui/box.mjs";import{InfiniteScroll as a}from"../../../../../../ui/infinite-scroll.mjs";import{Text as o}from"../../../../../../ui/text.mjs";import
|
|
2
|
+
"use client";import{CardSpec as e}from"../../../../../utils/constants/card-spec.mjs";import{mergeStyles as t}from"../../../../../utils/styles/helpers.mjs";import{transformContentListToCardItems as n}from"../../../../../utils/transformers/card-grid.mjs";import{gContentGetAppChannelBlockData as r}from"../../../../../../../service/generated/client.mjs";import{Box as i}from"../../../../../../ui/box.mjs";import{InfiniteScroll as a}from"../../../../../../ui/infinite-scroll.mjs";import{Text as o}from"../../../../../../ui/text.mjs";import s from"../../../../../basics/card-layout/runtime/client.mjs";import{usePaginated as c}from"../../../../../../../hooks/query/use-query.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";const h={},g={list:[],title:``,cursor:``,block_id:``};function _({props:_=h,styles:v,data:y=g}){let b=e.V2_LARGE,{gap:x=8}=_||{},{title:S,cursor:C,block_id:w,list:T}=y,E=v?t(v,{}):void 0,D=T&&T.length>0,O=u(()=>{if(!D)return;let e=C&&C.trim()?C:void 0;return{pages:[{data:{block:{data:{videos:T,cursor:C||``}}}}],pageParams:[e]}},[D,T,C]),{data:k,fetchNextPage:A,hasNextPage:j}=c({key:[`card-grid-2x3-infinite`,w],queryFn:e=>r({block_id:w,cursor:e||void 0,page_size:20}),getNextPageParam:e=>{let t=e.data?.block?.data?.cursor;return t&&t.trim()?t:void 0},options:{enabled:!!w,initialData:O,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1},initialPageParam:D&&C&&C.trim()?C:void 0}),M=d(T),[N,P]=f(!1);l(()=>{P(!0)},[]);let F=u(()=>{let e=[...M.current];if(!N)return e;let t=[...e],n=k?.pages;if(n&&n.length>1)for(let e=1;e<n.length;e++){let r=n[e].data?.block?.data?.videos||[];t.push(...r)}return t},[N,k?.pages]),I=u(()=>n(F,`view-duration`),[F]);return m(i,{children:[S&&p(o,{as:`h2`,className:`text-[18px] font-bold text-text1 mb-[10px] px-[12px]`,children:S}),p(a,{loadMore:()=>A().then(()=>void 0),hasMore:j===!0||j===void 0&&!!C&&T.length>0,initialLoad:!0,rootId:`app-scroll-container`,threshold:1e3,className:``,children:p(s,{props:{cardSpec:b,gap:x},data:I,styles:E})})]})}export{_ as default};
|
package/dist/components/biz/business/card-grid/variants/card-grid-3x3-infinite/runtime/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{CardSpec as e}from"../../../../../utils/constants/card-spec.mjs";import{mergeStyles as t}from"../../../../../utils/styles/helpers.mjs";import{transformContentListToCardItems as n}from"../../../../../utils/transformers/card-grid.mjs";import{gContentGetAppChannelBlockData as r}from"../../../../../../../service/generated/client.mjs";import{Box as i}from"../../../../../../ui/box.mjs";import{InfiniteScroll as a}from"../../../../../../ui/infinite-scroll.mjs";import{Text as o}from"../../../../../../ui/text.mjs";import
|
|
2
|
+
"use client";import{CardSpec as e}from"../../../../../utils/constants/card-spec.mjs";import{mergeStyles as t}from"../../../../../utils/styles/helpers.mjs";import{transformContentListToCardItems as n}from"../../../../../utils/transformers/card-grid.mjs";import{gContentGetAppChannelBlockData as r}from"../../../../../../../service/generated/client.mjs";import{Box as i}from"../../../../../../ui/box.mjs";import{InfiniteScroll as a}from"../../../../../../ui/infinite-scroll.mjs";import{Text as o}from"../../../../../../ui/text.mjs";import s from"../../../../../basics/card-layout/runtime/client.mjs";import{usePaginated as c}from"../../../../../../../hooks/query/use-query.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";const h={},g={list:[],title:``,cursor:``,block_id:``};function _({props:_=h,styles:v,data:y=g}){let b=e.V3_SMALL,{gap:x=8}=_||{},{title:S,cursor:C,block_id:w,list:T}=y,E=v?t(v,{}):void 0,D=T&&T.length>0,O=u(()=>{if(!D)return;let e=C&&C.trim()?C:void 0;return{pages:[{data:{block:{data:{videos:T,cursor:C||``}}}}],pageParams:[e]}},[D,T,C]),{data:k,fetchNextPage:A,hasNextPage:j}=c({key:[`card-grid-3x3-infinite`,w],queryFn:e=>r({block_id:w,cursor:e||void 0,page_size:21}),getNextPageParam:e=>{let t=e.data?.block?.data?.cursor;return t&&t.trim()?t:void 0},options:{enabled:!!w,initialData:O,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1},initialPageParam:D&&C&&C.trim()?C:void 0}),M=d(T),[N,P]=f(!1);l(()=>{P(!0)},[]);let F=u(()=>{let e=[...M.current];if(!N)return e;let t=[...e],n=k?.pages;if(n&&n.length>1)for(let e=1;e<n.length;e++){let r=n[e].data?.block?.data?.videos||[];t.push(...r)}return t},[N,k?.pages]),I=u(()=>n(F,`view-duration`),[F]);return m(i,{children:[S&&p(o,{as:`h2`,className:`text-[18px] font-bold text-text1 mb-[10px] px-[12px]`,children:S}),p(a,{loadMore:()=>A().then(()=>void 0),hasMore:j===!0||j===void 0&&!!C&&T.length>0,className:``,initialLoad:!0,rootId:`app-scroll-container`,threshold:1e3,children:p(s,{props:{cardSpec:b,gap:x},data:I,styles:E})})]})}export{_ as default};
|
|
@@ -3,6 +3,6 @@ import { ChannelListProps } from "./schema.mjs";
|
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region components/biz/business/channel-list/client.d.ts
|
|
6
|
-
declare function
|
|
6
|
+
declare function BasicChannelListClient(props: ChannelListProps): react_jsx_runtime0.JSX.Element;
|
|
7
7
|
//#endregion
|
|
8
|
-
export {
|
|
8
|
+
export { BasicChannelListClient };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{mergeStyles as e}from"../../utils/styles/helpers.mjs";import{
|
|
2
|
+
"use client";import{mergeStyles as e}from"../../utils/styles/helpers.mjs";import{Box as t}from"../../../ui/box.mjs";import n from"../../../ui/link.mjs";import{useSticky as r}from"../../../../hooks/use-sticky.mjs";import{urlPrefix as i}from"../../../../constants/url-prefix.mjs";import a,{loadHiddenChannelIdsFromStorage as o}from"./channel-filter-dialog.mjs";import{defaultProps as s}from"./default-props.mjs";import{clsx as c}from"clsx";import{useEffect as l,useMemo as u,useState as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";const h={};function g(e,t){return t===0?`/`:`${i.CHANNEL}/${encodeURIComponent(e.name)}`}function _(i){let{styles:_,events:v,...y}=i,b=y||h,x={...s,...b},[S,C]=d(!1),{isSticky:w,ref:T}=r(),[E,D]=d(x.list),O=u(()=>x.currentChannelId??null,[x.currentChannelId]);l(()=>{let e=o();D(e?.length?x.list.filter(t=>!e.includes(t.name)):x.list)},[x.list]);let k=e=>{D(e)},A=(e,t)=>{v?.onChannelChange?.(e,t)},j=_?e(_,{}):void 0;return m(f,{children:[w&&p(t,{className:`w-full h-11`}),p(t,{as:`nav`,ref:T,className:c(`w-full transition-all duration-200`,!x.isFullfeed&&w&&`fixed top-0 left-0 right-0 z-50`,x.isFullfeed&&`fixed top-[54px] left-0 z-10 w-full`,!x.isFullfeed&&`bg-bg1`),style:j,children:p(t,{className:`relative flex items-center h-[44px]`,children:p(t,{className:`flex-1 overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:hidden`,style:{scrollbarWidth:`none`,msOverflowStyle:`none`,WebkitOverflowScrolling:`touch`},children:p(t,{className:`flex items-center h-full w-4 h-4 gap-4`,children:E.map((e,t)=>{let r=O===e.name||O===null&&t===0;return p(n,{href:g(e,t),className:c(`whitespace-nowrap cursor-pointer transition-all duration-200`,`flex items-center justify-center h-11`,`${r?`text-xl`:`text-base`}`),style:{fontWeight:r?`bold`:`normal`,color:r?`var(--color-theme5)`:`var(--color-text2)`},onClick:()=>A(e,t),children:e.name},e.name||`channel-${t}`)})})})})}),p(a,{open:S,onOpenChange:C,channels:x.list,currentChannelId:O,onChannelClick:A,onChannelsChange:k})]})}export{_ as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
const e={currentChannelId:null,
|
|
2
|
+
const e={currentChannelId:null,isFullfeed:!1,list:[]};export{e as defaultProps};
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
3
3
|
import { DefineMaterialOption } from "../../../../utils/schema/material.mjs";
|
|
4
4
|
import "../../../../utils/schema/index.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { BasicChannelListClient } from "./client.mjs";
|
|
6
6
|
import * as zod from "zod";
|
|
7
7
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
8
8
|
|
|
9
9
|
//#region components/biz/business/channel-list/material.d.ts
|
|
10
|
-
declare const channelListMaterial: DefineMaterialOption<typeof
|
|
10
|
+
declare const channelListMaterial: DefineMaterialOption<typeof BasicChannelListClient, typeof BasicChannelListClient, zod.ZodObject<{
|
|
11
11
|
list: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
12
12
|
name: zod.ZodOptional<zod.ZodString>;
|
|
13
13
|
icon: zod.ZodOptional<zod.ZodString>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{Avatar as t,AvatarImage as n}from"../../../ui/avatar.mjs";import r from"../../../../assets/icons/common/right_arrow.mjs";import{useInteractionAnimation as
|
|
2
|
+
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{Avatar as t,AvatarImage as n}from"../../../ui/avatar.mjs";import r from"../../../common/interaction-animations.module.mjs";import i from"../../../../assets/icons/common/right_arrow.mjs";import{useInteractionAnimation as a}from"../../../../hooks/use-interaction-animation.mjs";import o from"../../../../assets/icons/detail/give_like.mjs";import s from"../../../../assets/icons/detail/give_like_sel.mjs";import c from"../../../../assets/icons/common/god_comment.mjs";import l from"../../../../assets/icons/detail/un_like.mjs";import u from"../../../../assets/icons/detail/un_like_sel.mjs";import{CommentMedia as d}from"./comment-media.mjs";import{CommentRichText as f}from"./comment-rich-text.mjs";import{TimeDisplay as p}from"./time-display.mjs";import{memo as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useTranslations as _}from"next-intl";import v from"next/link";function y(e){let t=Number(e)||0;return t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}const b=m(({comment:m,isHighlight:b,onReply:x,onViewReplies:S,onReplyAction:C,onLike:w,onDislike:T,onRequireLogin:E,variant:D=`dark`,rightSlot:O,showReplyButton:k=!0,isLogin:A=!0})=>{let j=_(`components.biz.business.comment`),M=D===`light`,N=m.status===`0`,P=a();function F(){E?.()}function I(){if(!A){F();return}P.trigger(r.likeShakeAnimation),w?.(m)}function L(){if(!A){F();return}T?.(m)}function R(){if(!A){F();return}if(!x){F();return}x(m)}function z(){if(!A){F();return}S?.(m)}function B(){if(!A){F();return}if(C){C(m);return}if(+m.reply_cnt==0){R();return}z()}function V(){return m.reply_cnt===`0`?j(`commentItem.reply`):j(`commentItem.replyCount`,{count:m.reply_cnt})}return g(`div`,{className:e(`flex flex-col p-[16px] relative`,M?`text-text1`:`text-white`),children:[b&&h(c,{className:`w-[70px] h-[70px] absolute top-0 right-[80px]`}),g(`div`,{className:`flex flex-row justify-between relative z-[2]`,children:[g(v,{className:`flex flex-row items-center`,href:`/profile/${m.user_id}`,children:[h(t,{children:h(n,{src:m.avatar,alt:m.user_name})}),g(`div`,{className:`ml-[12px] flex flex-col min-w-0`,children:[h(`span`,{className:e(`text-[14px] leading-[14px] max-w-[180px] text-ellipsis overflow-hidden whitespace-nowrap`,M?`text-text2`:`text-white/80`),children:m.user_name}),h(`span`,{className:e(`mt-[8px] text-[12px] leading-[12px]`,M?`text-text3`:`text-white/50`),children:h(p,{timestamp:m.created_at})})]})]}),N?h(`div`,{className:`px-[8px] py-[4px] bg-text3/10 rounded-[12px]`,children:h(`span`,{className:e(`text-[12px] leading-[12px]`,M?`text-text3`:`text-white/60`),children:j(`commentItem.contentInReview`)})}):O||g(`div`,{className:`flex flex-row items-center`,children:[g(`button`,{type:`button`,className:`px-[4px] flex flex-col items-center`,onClick:I,children:[m.like_flag===`1`?h(s,{className:e(`w-[14px] h-[14px]`,P.animationClass)}):h(o,{className:e(`w-[14px] h-[14px]`,M?`text-text3`:`text-white/70`,P.animationClass)}),h(`span`,{className:e(`mt-[4px] text-[12px] leading-[12px]`,M?`text-text3`:`text-white/70`),children:m.like_cnt===`0`?j(`commentItem.like`):y(m.like_cnt)})]}),g(`button`,{type:`button`,className:`ml-[12px] px-[4px] flex flex-col items-center`,onClick:L,children:[m.like_flag===`2`?h(u,{className:`w-[14px] h-[14px]`}):h(l,{className:e(`w-[14px] h-[14px]`,M?`text-text3`:`text-white/70`)}),h(`span`,{className:e(`mt-[4px] text-[12px] leading-[12px]`,M?`text-text3`:`text-white/70`),children:m.dislike_cnt===`0`?j(`commentItem.dislike`):y(m.dislike_cnt)})]})]})]}),g(`div`,{className:`mt-[4px] pl-[50px] flex flex-col`,children:[m.text&&h(f,{className:e(`text-[14px] leading-[22px] break-all`,M?`text-text1`:`text-white/90`),text:m.text,atUsers:m.at_users}),h(d,{list:m.nine_grid_content_info,disabled:N,hasText:!!m.text,playerId:m.id}),k&&g(`button`,{type:`button`,className:e(`mt-[4px] w-[fit-content] h-[30px] px-[12px] text-[14px] leading-[22px] flex flex-row items-center rounded-[15px]`,M?`text-text1 bg-bg2`:`text-white bg-white/10`),onClick:B,children:[h(`span`,{children:V()}),m.reply_cnt!==`0`&&h(i,{className:`w-[10px] h-[10px] ml-[2px]`})]})]})]})});export{b as CommentItem};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{debounceFun as t,getCurrentSecondTime as n,parseTextAtUserIds as r,replaceAtUserElement as i}from"../../../../utils/common.mjs";import{useFollowIdsState as a}from"../../../../store/modules/follow-ids-store.mjs";import{useUserStore as o}from"../../../../store/modules/user-store.mjs";import{gCommunityGetComments as s,pCommunityCreateComment as c,pCommunityDislikeComment as l,pCommunityLikeComment as u,pInteractionFollow as d,pInteractionUnfollow as f}from"../../../../service/generated/client.mjs";import{checkFollowStatus as p}from"../../../../utils/follow-service.mjs";import{Image as m}from"../../../ui/image.mjs";import{Dialog as h,DialogContent as g}from"../../../ui/dialog.mjs";import{InfiniteScroll as _}from"../../../ui/infinite-scroll.mjs";import{useLikeDislike as v}from"../../../../hooks/use-like-dislike.mjs";import{useKeepAliveState as y}from"../../../common/keep-scroll-position/index.mjs";import b from"../../../../assets/icons/close.mjs";import x from"../../../../assets/icons/common/follow_sel.mjs";import S from"../../../../assets/icons/common/follow_user.mjs";import{UnfollowConfirmDialog as C}from"../../../common/follow-button/unfollow-confirm-dialog.mjs";import w from"../../../../assets/icons/detail/give_like.mjs";import T from"../../../../assets/icons/detail/give_like_sel.mjs";import E from"./comment-input.mjs";import D from"../../../../assets/icons/detail/un_like.mjs";import O from"../../../../assets/icons/detail/un_like_sel.mjs";import{CommentMedia as k}from"./comment-media.mjs";import{CommentRichText as A}from"./comment-rich-text.mjs";import{TimeDisplay as j}from"./time-display.mjs";import{CommentItem as M}from"./comment-item.mjs";import{mapApiReplayToReplay as N}from"../../../../types/safe-replay.mjs";import{useRouter as P}from"next/navigation";import{memo as F,useCallback as I,useEffect as L,useMemo as R,useRef as z,useState as B}from"react";import{Fragment as V,jsx as H,jsxs as U}from"react/jsx-runtime";import{toast as W}from"sonner";import{useTranslations as G}from"next-intl";function K(e){if(e==null)return 0;let t=typeof e==`number`?e:Number(e);if(!Number.isNaN(t)&&t>0)return t>0xe8d4a51000?Math.floor(t/1e3):Math.floor(t);let n=Date.parse(String(e));return Number.isNaN(n)?0:Math.floor(n/1e3)}function q(e,t,n){let r=[];return Array.isArray(n)&&n.length>0?(n.forEach(e=>{let t=!!e?.is_video,n=String(e?.media_url||``),i=String(e?.cover_image||``);!n&&!i||r.push({cover_image:i,cover_image_thumbnail:i,cover_image_radio:1,cover_image_resolution:String(e?.cover_image_resolution||``),image_url:t?``:n,image_thumbnail:t?``:n,image_radio:1,image_resolution:String(e?.image_resolution||``),is_video:t,resolution:String(e?.video_resolution||``),video_duration:Number(e?.video_duration||0),video_url:t?n:``,video_size:Number(e?.video_size||0),video_codec_info:{hls_info:[],video_codec_deal:!1}})}),r):(e?.length&&e.forEach(e=>{r.push({cover_image:``,cover_image_thumbnail:``,cover_image_radio:1,cover_image_resolution:``,image_url:e,image_thumbnail:e,image_radio:1,image_resolution:``,is_video:!1,resolution:``,video_duration:0,video_url:``,video_size:0,video_codec_info:{hls_info:[],video_codec_deal:!1}})}),t?.length&&t.forEach(e=>{r.push({cover_image:``,cover_image_thumbnail:``,cover_image_radio:1,cover_image_resolution:``,image_url:``,image_thumbnail:``,image_radio:1,image_resolution:``,is_video:!0,resolution:``,video_duration:0,video_url:e,video_size:0,video_codec_info:{hls_info:[],video_codec_deal:!1}})}),r)}function J(e){let t=X(e.mentioned_users),n=t.length>0?t:Z(e.content||``);return{id:String(e.comment_id??e.id??``),user_name:e.user?.nickname||e.user?.username||``,text:e.content||``,type:`4`,files:[],at_users:n,cover_image:``,nine_grid_content_info:q(e?.images,e?.videos,e?.medias)}}function Y(e,t){let n=e.is_liked?`1`:e.is_dislike?`2`:`0`,r=X(e.mentioned_users),i=r.length>0?r:Z(e.content||``),a=String(e.comment_id??e.id??``),o=typeof e.like_count==`number`?e.like_count:0,s=N({id:a,like_cnt:(e.is_liked&&o===0?1:o).toString(),dislike_cnt:(e.dislike_count||0).toString(),created_at:K(e.create_time),text:e.content||``,type:`4`,like_flag:n,user_id:e.user_id||``,user_name:e.user?.nickname||e.user?.username||``,avatar:e.user?.avatar_url||``,reply_cnt:(e.reply_count||0).toString(),nine_grid_content_info:q(e?.images,e?.videos,e?.medias),at_users:i,parent_reply:void 0});return t&&(s.parent_reply=J(t)),s}function X(e){return Array.isArray(e)?e.map(e=>({user_id:e.user_id||``,name:e.nickname||e.username||``,avatar:e.avatar_url||``,birthday:``,signature:e.signature||``})):[]}function Z(e){if(!e)return[];let t=new Map,n=/<span[^>]*class=['"]mention['"][^>]*data-id=['"]([^'"]+)['"][^>]*>@([^<]*)<\/span>/g,r;for(;(r=n.exec(e))!==null;){let e=r[1]?String(r[1]):``,n=(r[2]?String(r[2]):``).replace(/^@/,``)||e;!e||t.has(e)||t.set(e,{user_id:e,name:n,avatar:``,birthday:``,signature:``})}if(t.size>0)return Array.from(t.values());let i=/<@_user>(\w+)<\/@_user>/g;for(;(r=i.exec(e))!==null;){let e=r[1]?String(r[1]):``;!e||t.has(e)||t.set(e,{user_id:e,name:e,avatar:``,birthday:``,signature:``})}return Array.from(t.values())}function ee(e){return!Array.isArray(e)||e.length===0?[]:e.map(e=>{let t=!!e.is_video,n=t?String(e.video_url||``):String(e.image_url||e.cover_image||``),r=String(e.cover_image||e.image_url||``);return{media_url:n,is_video:t,image_resolution:String(e.image_resolution||``),cover_image:r,cover_image_resolution:String(e.cover_image_resolution||``),video_resolution:String(e.resolution||``),video_duration:Number(e.video_duration||0),video_size:Number(e.video_size||0)}}).filter(e=>!!e.media_url)}function Q(e,t){let n=[];return e.forEach(e=>{n.push(Y(e,t)),e.sub_comments?.length&&n.push(...Q(e.sub_comments,e))}),n}function $(e){let t=Number(e)||0;return t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}const te=t((e,t,n)=>{try{if(!e?.id)return;u({comment_id:e.id,is_like:e.like_flag!==`1`},{revalidate:!1})}catch(e){console.error(`点赞回复失败:`,e)}},200),ne=t((e,t,n)=>{try{if(!e?.id)return;l({comment_id:e.id,is_dislike:e.like_flag!==`2`},{revalidate:!1})}catch(e){console.error(`点踩回复失败:`,e)}},200),re=F(({comment:e,updateFollow:t,onRequireLogin:n})=>{let{userInfo:r,userId:i,isLogin:a}=o(),s=r?.userId||r?.user_id||i||``;return H(`div`,{className:`w-full bg-bg1`,children:H(M,{comment:e,variant:`light`,isLogin:a,onRequireLogin:n,rightSlot:R(()=>!!s&&String(s)===String(e.user_id||``),[e.user_id,s])?H(V,{}):H(ie,{userId:e.user_id,hasFollow:e.is_follow,onChange:t,onRequireLogin:n}),showReplyButton:!1})})});function ie({userId:t,hasFollow:n=!1,onChange:r,onRequireLogin:i}){let s=G(`components.biz.business.comment`),{isLogin:c,userInfo:l,userId:u}=o(),{followIds:p}=a(),[m,h]=B(n),[g,_]=B(!1),v=l?.userId||l?.user_id||u||``,y=R(()=>!!v&&String(v)===String(t||``),[t,v]),b=R(()=>n||p.includes(t),[p,n,t]);L(()=>{h(b)},[b]);let w=I(async()=>{try{if(!v||!t||t===`0`){W.error(s(`replyDetail.loginRequired`));return}if(m){let e=await f({follower_id:String(v),followee_id:t});if(e.code!==0){W.error(e.message||s(`replyDetail.unfollowFailed`));return}}else{let e=await d({follower_id:String(v),followee_id:t});if(e.code!==0){W.error(e.message||s(`replyDetail.followFailed`));return}}window.sensors?.track(`detail_follow_click`,{object_id:``,action:m?`取消关注`:`关注`,author_id:t}),sessionStorage.setItem(`user_page_refresh`,`1`)}catch(e){console.error(`关注或取消关注失败:`,e),W.error(s(m?`replyDetail.unfollowFailed`:`replyDetail.followFailed`));return}let e=!m;r?.(e),h(e);let{followIds:n,setFollowIds:i}=a.getState(),o=new Set(n);e?o.add(t):o.delete(t),i(Array.from(o))},[t,m,r,v,s]),T=I(()=>{if(!c){i?.();return}if(m){_(!0);return}w()},[w,m,c,i]);function E(){_(!1),w()}function D(){_(!1)}return y||!t||t===`0`?null:U(V,{children:[H(`div`,{className:e(`h-[28px] rounded-[14px] px-[8px] border border-solid cursor-pointer flex items-center justify-center`,m?`border-text3`:`border-theme5`),onClick:T,children:m?U(V,{children:[H(x,{className:`w-[12px] h-[12px] text-text3 shrink-0`}),H(`span`,{className:`text-text3 text-[12px] leading-[18px] ml-[4px] shrink-0`,children:s(`replyDetail.followed`)})]}):U(V,{children:[H(S,{className:`block w-[12px] h-[12px] text-theme5 shrink-0`}),H(`span`,{className:`block text-theme5 text-[12px] leading-[18px] ml-[4px] shrink-0`,children:s(`replyDetail.follow`)})]})}),H(C,{open:g,onOpenChange:_,onCancel:D,onConfirm:E})]})}const ae=t(e=>{e()},0);function oe(e,t,n,r){let i=z(!1);L(()=>{i.current=!1},[r]),L(()=>{let r=e.current;if(!r)return;!i.current&&t>0&&(r.scrollTop=t,i.current=!0);let a=()=>{i.current=!0,n(r.scrollTop)};return r.addEventListener(`scroll`,a,{passive:!0}),()=>r.removeEventListener(`scroll`,a)},[e,n,t,r])}const se=F(({commentId:e,informationId:t,handleReplyComment:n,onReplyListUpdate:r})=>{let i=G(`components.biz.business.comment`),[a,o]=y(`replay-detail-list-${e}`,[]),[c,l]=y(`replay-detail-has-more-${e}`,!0),[u,d]=y(`replay-detail-page-${e}`,1),{getLikedListData:f,getDislikedListData:p}=v(),m=z(!1),h=I(async()=>{if(!(!e||!t)&&!m.current){m.current=!0;try{let n=await s({content_id:t,parent_id:e,page:u,page_size:20,sort_by:`latest`});if(n.code!==0)throw Error(n.message||i(`replyDetail.fetchRepliesFailed`));let r=n.data?.data?.comments??[],a=Q(r);((n.data?.data?.has_more??!1)===!1||r.length<20)&&l(!1),o(e=>{let t=new Set(e.map(e=>e.id)),n=a.filter(e=>!t.has(e.id));return[...e,...n]}),a.length>0&&d(u+1)}catch(e){console.error(`获取回复列表失败:`,e),l(!1)}finally{m.current=!1}}},[e,t,u,o,l,d,i]),g=I(e=>{o(t=>[e,...t])},[o]);L(()=>{r(g)},[r,g]),L(()=>{e&&t&&(o(e=>e.length===0?e:[]),l(e=>e===!0?e:!0),d(e=>e===1?e:1))},[e,t,o,l,d]);let b=I(n=>{o(e=>f(e,n.id)),te(n,t,e)},[e,f,t,o]),x=I(n=>{n.like_flag!==`2`&&W.message(i(`replyDetail.dislikeHint`)),o(e=>p(e,n.id)),ne(n,t,e)},[e,p,t,o,i]),[S,C]=y(`replay-detail-scroll-top-${e}`,0),w=z(null);oe(w,S,C,e),L(()=>{!e||!t||a.length===0&&c&&h()},[e,t,h,a.length,c]);let T=I(async()=>{await h()},[h]);return U(`div`,{ref:w,className:`w-full pb-[66px]`,children:[a.map((e,t)=>H(ce,{replyItem:e,replyComment:n,onLikeReply:b,onDislikeReply:x},`${e.id}-${t}`)),H(_,{loadMore:T,hasMore:c})]})});function ce({replyItem:e,replyComment:t,onLikeReply:n,onDislikeReply:r}){let i=G(`components.biz.business.comment`),a=P(),o=e.status===`0`;function s(){n?.(e)}function c(){r?.(e)}function l(){t(e)}return U(`div`,{className:`p-[16px] flex flex-col`,children:[U(`div`,{className:`flex flex-row justify-between`,children:[U(`button`,{type:`button`,className:`flex flex-row items-center text-left`,onClick:()=>{a.push(`/profile/${e.user_id}`)},children:[H(`div`,{className:`w-[38px] h-[38px] rounded-full overflow-hidden relative bg-bg2`,children:e.avatar&&H(m,{src:e.avatar,fill:!0,objectFit:`cover`,alt:`avatar`})}),U(`div`,{className:`ml-[12px] flex flex-col`,children:[H(`span`,{className:`text-text2 text-[14px] leading-[14px] max-w-[180px] text-ellipsis overflow-hidden whitespace-nowrap`,children:e.user_name}),H(`span`,{className:`mt-[8px] text-text3 text-[12px] leading-[12px]`,children:H(j,{timestamp:e.created_at})})]})]}),o?H(`div`,{className:`px-[8px] py-[4px] bg-text3/10 rounded-[12px]`,children:H(`span`,{className:`text-text3 text-[12px] leading-[12px]`,children:i(`replyDetail.underReview`)})}):U(`div`,{className:`flex flex-row items-center`,children:[U(`div`,{className:`px-[4px] flex flex-col items-center`,onClick:s,children:[e.like_flag===`1`?H(T,{className:`w-[14px] h-[14px]`}):H(w,{className:`w-[14px] h-[14px] text-text3`}),H(`span`,{className:`mt-[4px] text-text3 text-[12px] leading-[12px]`,children:e.like_cnt===`0`?i(`replyDetail.like`):$(e.like_cnt)})]}),U(`div`,{className:`ml-[12px] px-[4px] flex flex-col items-center`,onClick:c,children:[e.like_flag===`2`?H(O,{className:`w-[14px] h-[14px]`}):H(D,{className:`w-[14px] h-[14px] text-text3`}),H(`span`,{className:`mt-[4px] text-text3 text-[12px] leading-[12px]`,children:e.dislike_cnt===`0`?i(`replyDetail.dislike`):$(e.dislike_cnt)})]})]})]}),U(`div`,{className:`mt-[4px] pl-[50px] flex flex-col`,children:[e.text&&H(A,{className:`text-text1 text-[14px] leading-[22px] break-all`,text:e.text,atUsers:e.at_users}),H(k,{list:e.nine_grid_content_info,disabled:o,hasText:!!e.text,playerId:e.id}),e.parent_reply&&e.parent_reply.text&&U(V,{children:[U(`div`,{className:`mt-[4px] flex flex-row items-center text-[14px] leading-[22px] relative pl-[8px]`,children:[H(`div`,{className:`w-[2px] h-full bg-line1 mr-[8px] absolute left-0 top-0 bottom-0 m-auto`}),U(`span`,{className:`text-theme1`,children:[e.parent_reply.user_name,`:`,e.parent_reply.text&&H(`span`,{className:`text-text1`,children:H(A,{text:e.parent_reply.text,atUsers:e.parent_reply.at_users})})]})]}),H(`div`,{className:`mt-1`,children:H(k,{list:e.parent_reply.nine_grid_content_info,disabled:o,hasText:!!e.parent_reply.text,playerId:e.parent_reply.id})})]}),H(`div`,{className:`mt-[4px] w-[fit-content] h-[30px] px-[12px] text-text1 text-[14px] leading-[22px] flex flex-row items-center bg-bg1 rounded-[15px]`,onClick:l,children:H(`span`,{children:i(`replyDetail.reply`)})})]})]})}function le({comment:e,information:t,contentType:s,visible:l,onClose:u,onReplyComment:d,onReplyAdded:f,onRequireLogin:m}){let _=G(`components.biz.business.comment`),v=z(null),[y,x]=B(()=>N({})),[S,C]=B(!1),{userInfo:w,userId:T}=o(),{followIds:D,setFollowIds:O}=a(),k=w?.userId||w?.user_id||T||``,A=w?.name||w?.nick_name||w?.nickname||w?.user_name||``,j=w?.avatar||w?.avatar_url||``,M=z({commentId:``,userId:``});function P(e){if(!e)return``;if(Array.isArray(e))return String(e[0]||``);if(typeof e==`object`){if(Object.prototype.hasOwnProperty.call(e,`comment_id`))return String(e.comment_id??``);if(Array.isArray(e.data))return String(e.data[0]||``)}return``}L(()=>{l&&(!k||!e.user_id||e.user_id!==`0`&&String(k)!==String(e.user_id)&&(M.current.commentId===e.id&&M.current.userId===k||(M.current={commentId:e.id,userId:k},(async()=>{let t=await p({app_id:0,follower_id:k,followee_ids:[e.user_id]});if(!t.success||!t.data?.is_following_map)return;let n=!!t.data.is_following_map[e.user_id];e.is_follow=n;let r=new Set(D);n?r.add(e.user_id):r.delete(e.user_id),O(Array.from(r))})())))},[e,D,k,O,l]);let F=I(e=>{x(e),setTimeout(()=>{C(!0),v.current?.focus()},10)},[]);function R(){ae(()=>{C(!1)})}async function V({text:e,imageVideoInfoList:t}){let n=e=>e.success?e:(W.error(e.message||_(`replyDetail.publishReplyFailed`)),{...e,toastHandled:!0});if(S){let r=await q({text:e,imageVideoInfoList:t});return C(!1),n(r)}else{let r=await K({text:e,imageVideoInfoList:t});return C(!1),n(r)}}async function K({text:e,imageVideoInfoList:t}){return await d?.({text:e,imageVideoInfoList:t,callback:r=>{let i=Z(e);if(!r||r===`0`)return;let a=N({id:r,user_id:k,user_name:A,avatar:j,text:e,created_at:n(),type:`4`,nine_grid_content_info:t,at_users:i});J?.(a)}})??{success:!0}}async function q({text:e,imageVideoInfoList:a}){if(!y?.id||y.id===`0`)return{success:!1,message:_(`replyDetail.invalidReplyTarget`)};let o=ee(a),l=r(e),u=s===`video`?1:2;try{let r=await c({content_id:t.id,content:i(e),medias:o,mentioned_users:l,parent_id:y.id,source_type:u},{revalidate:!1});if(r.code!==0)return{success:!1,message:r.message||_(`replyDetail.publishReplyFailed`)};let s=P(r.data);if(!s||s===`0`)return{success:!1,message:_(`replyDetail.publishReplyFailed`)};let d=N({id:s,user_id:k,user_name:A,avatar:j,text:e,created_at:n(),type:`4`,nine_grid_content_info:a,at_users:Z(e)});return d.parent_reply=y,J?.(d),f?.(),{success:!0}}catch(e){return console.error(`发布回复回复失败:`,e),{success:!1,message:_(`replyDetail.publishReplyFailed`)}}}let[J,Y]=B(null),X=I(e=>{Y(()=>e)},[]),Q=S?`回复@${y.user_name}`:``;function $(e){e||u()}return H(h,{open:l,onOpenChange:$,children:U(g,{showCloseButton:!1,className:`fixed left-0 right-0 bottom-0 top-[84px] z-[1000] h-auto w-full max-w-none translate-x-0 translate-y-0 rounded-none bg-bg2 p-0 text-text1 !flex !flex-col !gap-0`,children:[U(`div`,{className:`w-full h-[60px] bg-bg1 flex items-center justify-center relative`,children:[H(`button`,{type:`button`,className:`w-[48px] focus-within:outline-none focus-within:border-none focus-within:ring-0 h-full flex items-center justify-center absolute left-0 top-0`,onClick:u,children:H(b,{className:`w-[16px] h-[16px] text-text1`})}),H(`span`,{className:`text-[18px] font-bold`,children:_(`replyDetail.commentDetail`)})]}),U(`div`,{className:`flex-1 min-h-0 w-full overflow-y-auto bg-bg2`,children:[H(re,{comment:e,updateFollow:t=>{e.is_follow=t},onRequireLogin:m}),H(se,{commentId:e.id,informationId:t.id,handleReplyComment:F,onReplyListUpdate:X}),H(E,{placeholder:Q,onInputBlur:R,onPublish:V,onRequireLogin:m,ref:v})]})]})})}export{le as default};
|
|
2
|
+
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{debounceFun as t,getCurrentSecondTime as n,parseTextAtUserIds as r,replaceAtUserElement as i}from"../../../../utils/common.mjs";import{useFollowIdsState as a}from"../../../../store/modules/follow-ids-store.mjs";import{useUserStore as o}from"../../../../store/modules/user-store.mjs";import{gCommunityGetComments as s,pCommunityCreateComment as c,pCommunityDislikeComment as l,pCommunityLikeComment as u,pInteractionFollow as d,pInteractionUnfollow as f}from"../../../../service/generated/client.mjs";import{checkFollowStatus as p}from"../../../../utils/follow-service.mjs";import{Image as m}from"../../../ui/image.mjs";import{Dialog as h,DialogContent as g}from"../../../ui/dialog.mjs";import{InfiniteScroll as _}from"../../../ui/infinite-scroll.mjs";import{useLikeDislike as v}from"../../../../hooks/use-like-dislike.mjs";import{useKeepAliveState as y}from"../../../common/keep-scroll-position/index.mjs";import b from"../../../../assets/icons/close.mjs";import x from"../../../../assets/icons/common/follow_sel.mjs";import S from"../../../../assets/icons/common/follow_user.mjs";import{UnfollowConfirmDialog as C}from"../../../common/follow-button/unfollow-confirm-dialog.mjs";import w from"../../../../assets/icons/detail/give_like.mjs";import T from"../../../../assets/icons/detail/give_like_sel.mjs";import E from"./comment-input.mjs";import D from"../../../../assets/icons/detail/un_like.mjs";import O from"../../../../assets/icons/detail/un_like_sel.mjs";import{CommentMedia as k}from"./comment-media.mjs";import{CommentRichText as A}from"./comment-rich-text.mjs";import{TimeDisplay as j}from"./time-display.mjs";import{CommentItem as M}from"./comment-item.mjs";import{mapApiReplayToReplay as N}from"../../../../types/safe-replay.mjs";import{memo as P,useCallback as F,useEffect as I,useMemo as L,useRef as R,useState as z}from"react";import{Fragment as B,jsx as V,jsxs as H}from"react/jsx-runtime";import{toast as U}from"sonner";import{useTranslations as W}from"next-intl";import{useRouter as G}from"next/navigation";function K(e){if(e==null)return 0;let t=typeof e==`number`?e:Number(e);if(!Number.isNaN(t)&&t>0)return t>0xe8d4a51000?Math.floor(t/1e3):Math.floor(t);let n=Date.parse(String(e));return Number.isNaN(n)?0:Math.floor(n/1e3)}function q(e,t,n){let r=[];return Array.isArray(n)&&n.length>0?(n.forEach(e=>{let t=!!e?.is_video,n=String(e?.media_url||``),i=String(e?.cover_image||``);!n&&!i||r.push({cover_image:i,cover_image_thumbnail:i,cover_image_radio:1,cover_image_resolution:String(e?.cover_image_resolution||``),image_url:t?``:n,image_thumbnail:t?``:n,image_radio:1,image_resolution:String(e?.image_resolution||``),is_video:t,resolution:String(e?.video_resolution||``),video_duration:Number(e?.video_duration||0),video_url:t?n:``,video_size:Number(e?.video_size||0),video_codec_info:{hls_info:[],video_codec_deal:!1}})}),r):(e?.length&&e.forEach(e=>{r.push({cover_image:``,cover_image_thumbnail:``,cover_image_radio:1,cover_image_resolution:``,image_url:e,image_thumbnail:e,image_radio:1,image_resolution:``,is_video:!1,resolution:``,video_duration:0,video_url:``,video_size:0,video_codec_info:{hls_info:[],video_codec_deal:!1}})}),t?.length&&t.forEach(e=>{r.push({cover_image:``,cover_image_thumbnail:``,cover_image_radio:1,cover_image_resolution:``,image_url:``,image_thumbnail:``,image_radio:1,image_resolution:``,is_video:!0,resolution:``,video_duration:0,video_url:e,video_size:0,video_codec_info:{hls_info:[],video_codec_deal:!1}})}),r)}function J(e){let t=X(e.mentioned_users),n=t.length>0?t:Z(e.content||``);return{id:String(e.comment_id??e.id??``),user_name:e.user?.nickname||e.user?.username||``,text:e.content||``,type:`4`,files:[],at_users:n,cover_image:``,nine_grid_content_info:q(e?.images,e?.videos,e?.medias)}}function Y(e,t){let n=e.is_liked?`1`:e.is_dislike?`2`:`0`,r=X(e.mentioned_users),i=r.length>0?r:Z(e.content||``),a=String(e.comment_id??e.id??``),o=typeof e.like_count==`number`?e.like_count:0,s=N({id:a,like_cnt:(e.is_liked&&o===0?1:o).toString(),dislike_cnt:(e.dislike_count||0).toString(),created_at:K(e.create_time),text:e.content||``,type:`4`,like_flag:n,user_id:e.user_id||``,user_name:e.user?.nickname||e.user?.username||``,avatar:e.user?.avatar_url||``,reply_cnt:(e.reply_count||0).toString(),nine_grid_content_info:q(e?.images,e?.videos,e?.medias),at_users:i,parent_reply:void 0});return t&&(s.parent_reply=J(t)),s}function X(e){return Array.isArray(e)?e.map(e=>({user_id:e.user_id||``,name:e.nickname||e.username||``,avatar:e.avatar_url||``,birthday:``,signature:e.signature||``})):[]}function Z(e){if(!e)return[];let t=new Map,n=/<span[^>]*class=['"]mention['"][^>]*data-id=['"]([^'"]+)['"][^>]*>@([^<]*)<\/span>/g,r;for(;(r=n.exec(e))!==null;){let e=r[1]?String(r[1]):``,n=(r[2]?String(r[2]):``).replace(/^@/,``)||e;!e||t.has(e)||t.set(e,{user_id:e,name:n,avatar:``,birthday:``,signature:``})}if(t.size>0)return Array.from(t.values());let i=/<@_user>(\w+)<\/@_user>/g;for(;(r=i.exec(e))!==null;){let e=r[1]?String(r[1]):``;!e||t.has(e)||t.set(e,{user_id:e,name:e,avatar:``,birthday:``,signature:``})}return Array.from(t.values())}function ee(e){return!Array.isArray(e)||e.length===0?[]:e.map(e=>{let t=!!e.is_video,n=t?String(e.video_url||``):String(e.image_url||e.cover_image||``),r=String(e.cover_image||e.image_url||``);return{media_url:n,is_video:t,image_resolution:String(e.image_resolution||``),cover_image:r,cover_image_resolution:String(e.cover_image_resolution||``),video_resolution:String(e.resolution||``),video_duration:Number(e.video_duration||0),video_size:Number(e.video_size||0)}}).filter(e=>!!e.media_url)}function Q(e,t){let n=[];return e.forEach(e=>{n.push(Y(e,t)),e.sub_comments?.length&&n.push(...Q(e.sub_comments,e))}),n}function $(e){let t=Number(e)||0;return t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}const te=t((e,t,n)=>{try{if(!e?.id)return;u({comment_id:e.id,is_like:e.like_flag!==`1`},{revalidate:!1})}catch(e){console.error(`点赞回复失败:`,e)}},200),ne=t((e,t,n)=>{try{if(!e?.id)return;l({comment_id:e.id,is_dislike:e.like_flag!==`2`},{revalidate:!1})}catch(e){console.error(`点踩回复失败:`,e)}},200),re=P(({comment:e,updateFollow:t,onRequireLogin:n})=>{let{userInfo:r,userId:i,isLogin:a}=o(),s=r?.userId||r?.user_id||i||``;return V(`div`,{className:`w-full bg-bg1`,children:V(M,{comment:e,variant:`light`,isLogin:a,onRequireLogin:n,rightSlot:L(()=>!!s&&String(s)===String(e.user_id||``),[e.user_id,s])?V(B,{}):V(ie,{userId:e.user_id,hasFollow:e.is_follow,onChange:t,onRequireLogin:n}),showReplyButton:!1})})});function ie({userId:t,hasFollow:n=!1,onChange:r,onRequireLogin:i}){let s=W(`components.biz.business.comment`),{isLogin:c,userInfo:l,userId:u}=o(),{followIds:p}=a(),[m,h]=z(n),[g,_]=z(!1),v=l?.userId||l?.user_id||u||``,y=L(()=>!!v&&String(v)===String(t||``),[t,v]),b=L(()=>n||p.includes(t),[p,n,t]);I(()=>{h(b)},[b]);let w=F(async()=>{try{if(!v||!t||t===`0`){U.error(s(`replyDetail.loginRequired`));return}if(m){let e=await f({follower_id:String(v),followee_id:t});if(e.code!==0){U.error(e.message||s(`replyDetail.unfollowFailed`));return}}else{let e=await d({follower_id:String(v),followee_id:t});if(e.code!==0){U.error(e.message||s(`replyDetail.followFailed`));return}}window.sensors?.track(`detail_follow_click`,{object_id:``,action:m?`取消关注`:`关注`,author_id:t}),sessionStorage.setItem(`user_page_refresh`,`1`)}catch(e){console.error(`关注或取消关注失败:`,e),U.error(s(m?`replyDetail.unfollowFailed`:`replyDetail.followFailed`));return}let e=!m;r?.(e),h(e);let{followIds:n,setFollowIds:i}=a.getState(),o=new Set(n);e?o.add(t):o.delete(t),i(Array.from(o))},[t,m,r,v,s]),T=F(()=>{if(!c){i?.();return}if(m){_(!0);return}w()},[w,m,c,i]);function E(){_(!1),w()}function D(){_(!1)}return y||!t||t===`0`?null:H(B,{children:[V(`div`,{className:e(`h-[28px] rounded-[14px] px-[8px] border border-solid cursor-pointer flex items-center justify-center`,m?`border-text3`:`border-theme5`),onClick:T,children:m?H(B,{children:[V(x,{className:`w-[12px] h-[12px] text-text3 shrink-0`}),V(`span`,{className:`text-text3 text-[12px] leading-[18px] ml-[4px] shrink-0`,children:s(`replyDetail.followed`)})]}):H(B,{children:[V(S,{className:`block w-[12px] h-[12px] text-theme5 shrink-0`}),V(`span`,{className:`block text-theme5 text-[12px] leading-[18px] ml-[4px] shrink-0`,children:s(`replyDetail.follow`)})]})}),V(C,{open:g,onOpenChange:_,onCancel:D,onConfirm:E})]})}const ae=t(e=>{e()},0);function oe(e,t,n,r){let i=R(!1);I(()=>{i.current=!1},[r]),I(()=>{let r=e.current;if(!r)return;!i.current&&t>0&&(r.scrollTop=t,i.current=!0);let a=()=>{i.current=!0,n(r.scrollTop)};return r.addEventListener(`scroll`,a,{passive:!0}),()=>r.removeEventListener(`scroll`,a)},[e,n,t,r])}const se=P(({commentId:e,informationId:t,handleReplyComment:n,onReplyListUpdate:r})=>{let i=W(`components.biz.business.comment`),[a,o]=y(`replay-detail-list-${e}`,[]),[c,l]=y(`replay-detail-has-more-${e}`,!0),[u,d]=y(`replay-detail-page-${e}`,1),{getLikedListData:f,getDislikedListData:p}=v(),m=R(!1),h=F(async()=>{if(!(!e||!t)&&!m.current){m.current=!0;try{let n=await s({content_id:t,parent_id:e,page:u,page_size:20,sort_by:`latest`});if(n.code!==0)throw Error(n.message||i(`replyDetail.fetchRepliesFailed`));let r=n.data?.data?.comments??[],a=Q(r);((n.data?.data?.has_more??!1)===!1||r.length<20)&&l(!1),o(e=>{let t=new Set(e.map(e=>e.id)),n=a.filter(e=>!t.has(e.id));return[...e,...n]}),a.length>0&&d(u+1)}catch(e){console.error(`获取回复列表失败:`,e),l(!1)}finally{m.current=!1}}},[e,t,u,o,l,d,i]),g=F(e=>{o(t=>[e,...t])},[o]);I(()=>{r(g)},[r,g]),I(()=>{e&&t&&(o(e=>e.length===0?e:[]),l(e=>e===!0?e:!0),d(e=>e===1?e:1))},[e,t,o,l,d]);let b=F(n=>{o(e=>f(e,n.id)),te(n,t,e)},[e,f,t,o]),x=F(n=>{n.like_flag!==`2`&&U.message(i(`replyDetail.dislikeHint`)),o(e=>p(e,n.id)),ne(n,t,e)},[e,p,t,o,i]),[S,C]=y(`replay-detail-scroll-top-${e}`,0),w=R(null);oe(w,S,C,e),I(()=>{!e||!t||a.length===0&&c&&h()},[e,t,h,a.length,c]);let T=F(async()=>{await h()},[h]);return H(`div`,{ref:w,className:`w-full pb-[66px]`,children:[a.map((e,t)=>V(ce,{replyItem:e,replyComment:n,onLikeReply:b,onDislikeReply:x},`${e.id}-${t}`)),V(_,{loadMore:T,hasMore:c})]})});function ce({replyItem:e,replyComment:t,onLikeReply:n,onDislikeReply:r}){let i=W(`components.biz.business.comment`),a=G(),o=e.status===`0`;function s(){n?.(e)}function c(){r?.(e)}function l(){t(e)}return H(`div`,{className:`p-[16px] flex flex-col`,children:[H(`div`,{className:`flex flex-row justify-between`,children:[H(`button`,{type:`button`,className:`flex flex-row items-center text-left`,onClick:()=>{a.push(`/profile/${e.user_id}`)},children:[V(`div`,{className:`w-[38px] h-[38px] rounded-full overflow-hidden relative bg-bg2`,children:e.avatar&&V(m,{src:e.avatar,fill:!0,objectFit:`cover`,alt:`avatar`})}),H(`div`,{className:`ml-[12px] flex flex-col`,children:[V(`span`,{className:`text-text2 text-[14px] leading-[14px] max-w-[180px] text-ellipsis overflow-hidden whitespace-nowrap`,children:e.user_name}),V(`span`,{className:`mt-[8px] text-text3 text-[12px] leading-[12px]`,children:V(j,{timestamp:e.created_at})})]})]}),o?V(`div`,{className:`px-[8px] py-[4px] bg-text3/10 rounded-[12px]`,children:V(`span`,{className:`text-text3 text-[12px] leading-[12px]`,children:i(`replyDetail.underReview`)})}):H(`div`,{className:`flex flex-row items-center`,children:[H(`div`,{className:`px-[4px] flex flex-col items-center`,onClick:s,children:[e.like_flag===`1`?V(T,{className:`w-[14px] h-[14px]`}):V(w,{className:`w-[14px] h-[14px] text-text3`}),V(`span`,{className:`mt-[4px] text-text3 text-[12px] leading-[12px]`,children:e.like_cnt===`0`?i(`replyDetail.like`):$(e.like_cnt)})]}),H(`div`,{className:`ml-[12px] px-[4px] flex flex-col items-center`,onClick:c,children:[e.like_flag===`2`?V(O,{className:`w-[14px] h-[14px]`}):V(D,{className:`w-[14px] h-[14px] text-text3`}),V(`span`,{className:`mt-[4px] text-text3 text-[12px] leading-[12px]`,children:e.dislike_cnt===`0`?i(`replyDetail.dislike`):$(e.dislike_cnt)})]})]})]}),H(`div`,{className:`mt-[4px] pl-[50px] flex flex-col`,children:[e.text&&V(A,{className:`text-text1 text-[14px] leading-[22px] break-all`,text:e.text,atUsers:e.at_users}),V(k,{list:e.nine_grid_content_info,disabled:o,hasText:!!e.text,playerId:e.id}),e.parent_reply&&e.parent_reply.text&&H(B,{children:[H(`div`,{className:`mt-[4px] flex flex-row items-center text-[14px] leading-[22px] relative pl-[8px]`,children:[V(`div`,{className:`w-[2px] h-full bg-line1 mr-[8px] absolute left-0 top-0 bottom-0 m-auto`}),H(`span`,{className:`text-theme1`,children:[e.parent_reply.user_name,`:`,e.parent_reply.text&&V(`span`,{className:`text-text1`,children:V(A,{text:e.parent_reply.text,atUsers:e.parent_reply.at_users})})]})]}),V(`div`,{className:`mt-1`,children:V(k,{list:e.parent_reply.nine_grid_content_info,disabled:o,hasText:!!e.parent_reply.text,playerId:e.parent_reply.id})})]}),V(`div`,{className:`mt-[4px] w-[fit-content] h-[30px] px-[12px] text-text1 text-[14px] leading-[22px] flex flex-row items-center bg-bg1 rounded-[15px]`,onClick:l,children:V(`span`,{children:i(`replyDetail.reply`)})})]})]})}function le({comment:e,information:t,contentType:s,visible:l,onClose:u,onReplyComment:d,onReplyAdded:f,onRequireLogin:m}){let _=W(`components.biz.business.comment`),v=R(null),[y,x]=z(()=>N({})),[S,C]=z(!1),{userInfo:w,userId:T}=o(),{followIds:D,setFollowIds:O}=a(),k=w?.userId||w?.user_id||T||``,A=w?.name||w?.nick_name||w?.nickname||w?.user_name||``,j=w?.avatar||w?.avatar_url||``,M=R({commentId:``,userId:``});function P(e){if(!e)return``;if(Array.isArray(e))return String(e[0]||``);if(typeof e==`object`){if(Object.prototype.hasOwnProperty.call(e,`comment_id`))return String(e.comment_id??``);if(Array.isArray(e.data))return String(e.data[0]||``)}return``}I(()=>{l&&(!k||!e.user_id||e.user_id!==`0`&&String(k)!==String(e.user_id)&&(M.current.commentId===e.id&&M.current.userId===k||(M.current={commentId:e.id,userId:k},(async()=>{let t=await p({app_id:0,follower_id:k,followee_ids:[e.user_id]});if(!t.success||!t.data?.is_following_map)return;let n=!!t.data.is_following_map[e.user_id];e.is_follow=n;let r=new Set(D);n?r.add(e.user_id):r.delete(e.user_id),O(Array.from(r))})())))},[e,D,k,O,l]);let L=F(e=>{x(e),setTimeout(()=>{C(!0),v.current?.focus()},10)},[]);function B(){ae(()=>{C(!1)})}async function G({text:e,imageVideoInfoList:t}){let n=e=>e.success?e:(U.error(e.message||_(`replyDetail.publishReplyFailed`)),{...e,toastHandled:!0});if(S){let r=await q({text:e,imageVideoInfoList:t});return C(!1),n(r)}else{let r=await K({text:e,imageVideoInfoList:t});return C(!1),n(r)}}async function K({text:e,imageVideoInfoList:t}){return await d?.({text:e,imageVideoInfoList:t,callback:r=>{let i=Z(e);if(!r||r===`0`)return;let a=N({id:r,user_id:k,user_name:A,avatar:j,text:e,created_at:n(),type:`4`,nine_grid_content_info:t,at_users:i});J?.(a)}})??{success:!0}}async function q({text:e,imageVideoInfoList:a}){if(!y?.id||y.id===`0`)return{success:!1,message:_(`replyDetail.invalidReplyTarget`)};let o=ee(a),l=r(e),u=s===`video`?1:2;try{let r=await c({content_id:t.id,content:i(e),medias:o,mentioned_users:l,parent_id:y.id,source_type:u},{revalidate:!1});if(r.code!==0)return{success:!1,message:r.message||_(`replyDetail.publishReplyFailed`)};let s=P(r.data);if(!s||s===`0`)return{success:!1,message:_(`replyDetail.publishReplyFailed`)};let d=N({id:s,user_id:k,user_name:A,avatar:j,text:e,created_at:n(),type:`4`,nine_grid_content_info:a,at_users:Z(e)});return d.parent_reply=y,J?.(d),f?.(),{success:!0}}catch(e){return console.error(`发布回复回复失败:`,e),{success:!1,message:_(`replyDetail.publishReplyFailed`)}}}let[J,Y]=z(null),X=F(e=>{Y(()=>e)},[]),Q=S?`回复@${y.user_name}`:``;function $(e){e||u()}return V(h,{open:l,onOpenChange:$,children:H(g,{showCloseButton:!1,className:`fixed left-0 right-0 bottom-0 top-[84px] z-[1000] h-auto w-full max-w-none translate-x-0 translate-y-0 rounded-none bg-bg2 p-0 text-text1 !flex !flex-col !gap-0`,children:[H(`div`,{className:`w-full h-[60px] bg-bg1 flex items-center justify-center relative`,children:[V(`button`,{type:`button`,className:`w-[48px] focus-within:outline-none focus-within:border-none focus-within:ring-0 h-full flex items-center justify-center absolute left-0 top-0`,onClick:u,children:V(b,{className:`w-[16px] h-[16px] text-text1`})}),V(`span`,{className:`text-[18px] font-bold`,children:_(`replyDetail.commentDetail`)})]}),H(`div`,{className:`flex-1 min-h-0 w-full overflow-y-auto bg-bg2`,children:[V(re,{comment:e,updateFollow:t=>{e.is_follow=t},onRequireLogin:m}),V(se,{commentId:e.id,informationId:t.id,handleReplyComment:L,onReplyListUpdate:X}),V(E,{placeholder:Q,onInputBlur:B,onPublish:G,onRequireLogin:m,ref:v})]})]})})}export{le as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../../store/modules/user-store.mjs";import{gInteractionGetFollowingList as t,pCommunitySearchCurAccountFollowingUsersInfo as n}from"../../../../service/generated/client.mjs";import{Box as r}from"../../../ui/box.mjs";import{InfiniteScroll as i}from"../../../ui/infinite-scroll.mjs";import{Text as a}from"../../../ui/text.mjs";import{usePaginated as
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../../store/modules/user-store.mjs";import{gInteractionGetFollowingList as t,pCommunitySearchCurAccountFollowingUsersInfo as n}from"../../../../service/generated/client.mjs";import{Box as r}from"../../../ui/box.mjs";import{InfiniteScroll as i}from"../../../ui/infinite-scroll.mjs";import{Text as a}from"../../../ui/text.mjs";import o from"../../../ui/loading.mjs";import{usePaginated as s}from"../../../../hooks/query/use-query.mjs";import{ContactItem as c}from"./contact-item.mjs";import l from"../../../../assets/icons/empty/img-empty-adduser.mjs";import{ContactSearch as u}from"./contact-search.mjs";import{useMemo as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{useTranslations as h}from"next-intl";function g(e){let t=e.user_brief;return{user_id:String(t?.user_id||``),name:t?.nickname||t?.username||``,avatar:t?.avatar_url||``,signature:t?.signature||``}}function _({onClose:_,onSelect:v}){let y=h(`components.biz.business.contact`),{userInfo:b}=e(),x=String(b.user_id||``),[S,C]=f(``),w=S.length>0,{data:T,fetchNextPage:E,hasNextPage:D,isLoading:O}=s({key:[`contact-list`,`following`,x],queryFn:e=>t({page:e,page_size:20,user_id:x}),getNextPageParam:(e,t)=>{let n=e.data.following||[],r=Number(e.data.total??0),i=t.reduce((e,t)=>e+(t.data.following||[]).length,0);if(r>0&&i>=r)return;let a=new Set;for(let e of t.slice(0,-1))for(let t of e.data.following||[]){let e=String(t?.user_brief?.user_id||``);e&&a.add(e)}if(!(!n.some(e=>{let t=String(e?.user_brief?.user_id||``);return!t||a.has(t)?!1:(a.add(t),!0)})&&t.length>1)&&!(n.length<20)&&!(t.length>=150))return t.length+1},options:{enabled:!!x},initialPageParam:1}),{data:k,fetchNextPage:A,hasNextPage:j,isLoading:M}=s({key:[`contact-list`,`search`,x,S],queryFn:e=>n({user_id:x,keyword:S,page_size:20,page:e}),getNextPageParam:(e,t)=>{if(e.data?.has_more===!1)return;let n=e.data?.following||[],r=Number(e.data?.total??0),i=t.reduce((e,t)=>e+(t.data?.following||[]).length,0);if(r>0&&i>=r)return;let a=new Set;for(let e of t.slice(0,-1))for(let t of e.data?.following||[]){let e=String(t?.user_brief?.user_id||``);e&&a.add(e)}if(!(!n.some(e=>{let t=String(e?.user_brief?.user_id||``);return!t||a.has(t)?!1:(a.add(t),!0)})&&t.length>1)&&!(n.length<20)&&!(t.length>=150))return t.length+1},options:{enabled:w&&!!x},initialPageParam:1}),N=d(()=>{let e=T?.pages??[],t=[];for(let n of e){let e=n.data?.following??[];t.push(...e)}return t},[T?.pages]),P=d(()=>{if(!w||!k?.pages)return[];let e=[];for(let t of k.pages){let n=t.data?.following??[];e.push(...n.map(e=>({name:e.user_brief?.username||``,avatar:e.user_brief?.avatar_url||``,user_id:e.user_id||e.user_brief?.user_id||``,...e})))}return e},[w,k?.pages]),F=w?P.map(e=>g(e)):N.map(e=>g(e)),I=w?!!j:!!D,L=w?M:O,R=y(w?`contactList.noSearchResult`:`contactList.noFollowingUsers`);function z(e){C(e)}function B(e){v(e),_()}function V(){P.length===0?_():C(``)}function H(e){return m(r,{className:`flex flex-col items-center justify-center py-12`,children:[p(l,{className:`w-[145px] h-[145px]`}),p(a,{className:`mt-[12px] text-[14px] text-text2`,children:e})]})}return m(r,{className:`w-full bg-bg2 h-[90vh] flex flex-col`,children:[p(u,{searchHandler:z,onCancel:V,searchList:P}),p(r,{className:`flex-1 overflow-y-auto`,children:m(r,{className:`flex flex-col`,children:[!w&&N.length>0&&p(r,{className:`mt-[12px] px-[16px]`,children:p(a,{children:y(`contactList.myFollowing`)})}),L&&F.length===0?p(r,{className:`flex items-center justify-center pt-[58px]`,children:p(o,{size:`medium`})}):p(r,{className:`mt-[10px] flex flex-col flex-1`,children:m(i,{loadMore:()=>w?A().then(()=>void 0):E().then(()=>void 0),hasMore:I,noMoreText:F.length?y(`contactList.noMore`):``,children:[F.map((e,t)=>p(r,{children:p(c,{user:e,onSelect:B,value:w?S:``})},`${e.user_id}-${t}`)),F.length===0&&H(R)]})})]})})]})}export{_ as ContactList};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../../store/modules/user-store.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import{useDeleteRequest as r}from"../../../../hooks/query/use-query.mjs";import{useLoginModalStore as i}from"../../../../store/modules/login-modal-store.mjs";import{debounceFun as a}from"../../../../utils/tools.mjs";import o from"../../../common/collection-popup/index.mjs";import{useContentOperate as
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../../store/modules/user-store.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import{useDeleteRequest as r}from"../../../../hooks/query/use-query.mjs";import{useLoginModalStore as i}from"../../../../store/modules/login-modal-store.mjs";import{debounceFun as a}from"../../../../utils/tools.mjs";import o from"../../../common/interaction-animations.module.mjs";import s from"../../../common/collection-popup/index.mjs";import{useContentOperate as c}from"../../../../hooks/use-content-operate.mjs";import l from"../../../../assets/icons/detail/check-ok.mjs";import u from"../../../../assets/icons/detail/collect_nor.mjs";import d from"../../../../assets/icons/detail/collect_sel.mjs";import f from"../../../../assets/icons/detail/give_like.mjs";import p from"../../../../assets/icons/detail/give_like_sel.mjs";import m from"../../../../assets/icons/detail/share.mjs";import{useCallback as h,useMemo as g,useRef as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{toast as x}from"sonner";import{useTranslations as S}from"next-intl";function C({information:C,onUpdate:E}){let D=S(`components.biz.business.detail`),[O,k]=v(!1),[A,j]=v(!1),M=_(0),N=e(e=>e.userId),P=e(e=>e.isLogin),F=r(),I=h(()=>{N&&(F([`user-profile`,`mine`,N,`user-like-video`]),F([`user-profile`,`mine`,N,`user-like-post`]),F([`user-profile`,`mine`,N,`user-collect-video`,N]),F([`user-profile`,`mine`,N,`user-collect-post`,N]))},[F,N]),{likeAnimation:L,handleLikeOperate:R,handleDefaultCollectionOperate:z,handleShareOperate:B}=c({id:C.id,isLike:C.like||!1,isDislike:C.dislike||!1,isCollect:C.collect||!1,likeCnt:T(C.static?.like_cnt),dislikeCnt:T(C.static?.dislike_cnt),contentType:C.content_type,prefetchDefaultCollection:!0,animationClasses:{like:o.likeShakeAnimation,dislike:o.dislikeShakeAnimation}}),V=h(e=>{E?.({...e})},[E]),H=h(async()=>{if(O)return;if(!P){i.getState().open();return}let e=Date.now();if(e-M.current<300)return;M.current=e,k(!0);let t=C.like||!1,n=C.dislike||!1,r=T(C.static?.like_cnt),a=T(C.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;V({like:o,dislike:c,static:{...C.static,like_cnt:s,dislike_cnt:l}});try{let e=await R();if(!e){V({like:t,dislike:n,static:{...C.static,like_cnt:r,dislike_cnt:a}});return}V({like:e.isLike,dislike:e.isDislike??c,static:{...C.static,like_cnt:e.likeCnt,dislike_cnt:e.dislikeCnt??l}}),I(),window.sensors?.track?.(`detail_like_click`,{object_id:C.id,action:e.isLike?`点赞`:`取消点赞`,like_count:e.likeCnt})}catch(e){console.error(`点赞操作失败:`,e),x.error(D(`detailOperate.operateFailed`))}finally{k(!1)}},[R,C,I,O,P,D,V]),U=g(()=>C.id,[C.id]),W=h(()=>{B(({isCollect:e})=>{V({collect:e})},U)},[B,U,V]);async function G(e){return await new Promise(e=>setTimeout(e,300)),e}let K=h(()=>{s.show({mode:`select`,onCollect:async e=>{try{await G({contentId:C.id,collectionId:e}),V({collect:!0}),I(),x.success(D(`detailOperate.modifyCollectionSuccess`))}catch(e){console.error(`修改收藏夹失败:`,e),x.error(D(`detailOperate.collectFailed`))}}})},[C.id,I,D,V]),q=h(e=>{let t=e||D(`detailOperate.defaultCollection`);x.custom(e=>b(`div`,{className:`flex items-center justify-between gap-[16px] px-[16px] py-[12px] rounded-[12px] bg-black text-white shadow-lg min-w-[280px]`,children:[b(`div`,{className:`flex items-center gap-[10px]`,children:[y(`div`,{className:`w-[24px] h-[24px] rounded-full bg-white flex items-center justify-center`,children:y(l,{className:`w-[14px] h-[14px]`})}),b(`div`,{className:`flex items-center gap-[6px]`,children:[y(`span`,{className:`text-[14px] leading-[20px]`,children:D(`detailOperate.collectAdded`)}),y(`span`,{className:`text-[14px] leading-[20px] font-semibold`,children:t})]})]}),y(`button`,{type:`button`,className:`text-[14px] text-theme5 font-semibold`,onClick:()=>{x.dismiss(e),K()},children:D(`detailOperate.modifyCollection`)})]}))},[K,D]),J=h(async()=>{if(A)return;if(!P){i.getState().open();return}let e=C.collect||!1;j(!0),window.sensors?.track?.(`detail_fav_click`,{object_id:C.id,action:e?`取消收藏`:`收藏`});try{let t=await z({currentCollect:e,onUpdate:({isCollect:e})=>{V({collect:e})}});if(!t?.success){x.error(t?.message||D(`detailOperate.collectFailed`));return}I(),window.sensors?.track?.(`detail_fav_click`,{object_id:C.id,action:t.isCollect?`收藏`:`取消收藏`}),!e&&t.isCollect&&q(t.collectionTitle)}catch(e){console.error(`收藏操作失败:`,e),x.error(e?.message||D(`detailOperate.collectFailed`))}finally{j(!1)}},[z,C.collect,C.id,I,A,P,q,D,V]),Y=g(()=>a(J,300),[J]);return b(t,{className:`w-full h-[42px] mt-[16px] flex items-center justify-between`,children:[b(t,{className:`w-[25%] h-full flex flex-col items-center justify-center ${O?`opacity-50 cursor-not-allowed`:`cursor-pointer`}`,onClick:H,children:[C.like?y(p,{className:`w-[20px] h-[20px] ${L.animationClass}`}):y(f,{className:`w-[20px] h-[20px] text-text2`}),y(n,{className:`text-[12px] text-text2 leading-[20px]`,children:C.static?C.static.like_cnt===0?D(`detailOperate.like`):w(C.static?.like_cnt):D(`detailOperate.like`)})]}),b(t,{className:`w-[25%] h-full flex flex-col items-center justify-center ${A?`opacity-50 cursor-not-allowed`:`cursor-pointer`}`,onClick:Y,children:[C.collect?y(d,{className:`w-[20px] h-[20px]`}):y(u,{className:`w-[20px] h-[20px] text-text2`}),y(n,{className:`text-[12px] text-text2 leading-[20px]`,children:D(`detailOperate.collection`)})]}),b(t,{className:`w-[25%] h-full flex flex-col items-center justify-center cursor-pointer`,onClick:W,children:[y(m,{className:`w-[20px] h-[20px] text-text2`}),y(n,{className:`text-[12px] text-text2 leading-[20px]`,children:D(`detailOperate.share`)})]})]})}function w(e){let t=Number(e||0);return Number.isNaN(t)||t<=0?`0`:t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function T(e){if(e==null)return 0;if(typeof e==`number`)return e;let t=Number(e);return Number.isNaN(t)?0:t}export{C as DetailOperate};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { SafeInformationType } from "../../../../../../types/safe-information.mjs";
|
|
3
2
|
import { InferSchemaProps } from "../../../../../../utils/schema/schema.mjs";
|
|
4
3
|
import "../../../../../../utils/schema/index.mjs";
|
|
4
|
+
import { SafeInformationType } from "../../../../../../types/safe-information.mjs";
|
|
5
5
|
import * as zod from "zod";
|
|
6
6
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { SafeInformationType } from "../../../../../../types/safe-information.mjs";
|
|
3
2
|
import { InferSchemaProps, SchemaHasDefaultValue } from "../../../../../../utils/schema/schema.mjs";
|
|
4
3
|
import "../../../../../../utils/schema/index.mjs";
|
|
4
|
+
import { SafeInformationType } from "../../../../../../types/safe-information.mjs";
|
|
5
5
|
import * as zod from "zod";
|
|
6
6
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { SafeInformationType } from "../../../../../../types/safe-information.mjs";
|
|
3
2
|
import { InferSchemaProps } from "../../../../../../utils/schema/schema.mjs";
|
|
4
3
|
import "../../../../../../utils/schema/index.mjs";
|
|
4
|
+
import { SafeInformationType } from "../../../../../../types/safe-information.mjs";
|
|
5
5
|
import * as zod from "zod";
|
|
6
6
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { SafeInformationType } from "../../../../../../types/safe-information.mjs";
|
|
3
2
|
import { InferSchemaProps, SchemaHasDefaultValue } from "../../../../../../utils/schema/schema.mjs";
|
|
4
3
|
import "../../../../../../utils/schema/index.mjs";
|
|
4
|
+
import { SafeInformationType } from "../../../../../../types/safe-information.mjs";
|
|
5
5
|
import * as zod from "zod";
|
|
6
6
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { SafeInformationType } from "../../../../../../types/safe-information.mjs";
|
|
3
2
|
import { InferSchemaProps } from "../../../../../../utils/schema/schema.mjs";
|
|
4
3
|
import "../../../../../../utils/schema/index.mjs";
|
|
4
|
+
import { SafeInformationType } from "../../../../../../types/safe-information.mjs";
|
|
5
5
|
import * as zod from "zod";
|
|
6
6
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
7
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{gContentGetGuessYouLikeVideos as e}from"../../../../../../service/generated/client.mjs";import{Box as t}from"../../../../../ui/box.mjs";import{Text as n}from"../../../../../ui/text.mjs";import{useRequest as r}from"../../../../../../hooks/query/use-query.mjs";import{useAppContext as i}from"../../../../../../hooks/use-app-context/index.mjs";import{MiniThreeCard as
|
|
2
|
+
"use client";import{gContentGetGuessYouLikeVideos as e}from"../../../../../../service/generated/client.mjs";import{Box as t}from"../../../../../ui/box.mjs";import{Text as n}from"../../../../../ui/text.mjs";import{useRequest as r}from"../../../../../../hooks/query/use-query.mjs";import{useAppContext as i}from"../../../../../../hooks/use-app-context/index.mjs";import a from"../../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as o}from"../../../../../common/cards/mini-three-card.mjs";import{useCardDecoration as s}from"../../../../../../hooks/use-card-decoration.mjs";import{applyPlayCountDelta as c,buildEpisodeLabel as l,clampColumns as u,mergeManualAndPool as d,mockPagedList as f,resolveRows as p}from"./utils.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{useTranslations as b}from"next-intl";function x({detailId:x,rows:w,columns:T,smartTagEnabled:E,smartTagIds:D,title:O,showPlayCount:k,playCountDelta:A,showEpisode:j,enableInfinite:M,items:N}){let P=i()===`editor`,te=b(`components.biz.business.detail`),{getVerticalHoCoverImageUrl:F,getTitleText:I}=s(),[L,R]=_(1),z=g(null),B=h(()=>D??[],[D]),V=h(()=>N??[],[N]),{data:H}=r([`video-detail-recommend`,x],async()=>!x||P?null:await e(),{enabled:!P&&!!x}),U=h(()=>{let e=H?.data?.videos;return Array.isArray(e)?e.map(e=>S(e)).filter(e=>!x||!e.id||e.id!==x):[]},[H?.data?.videos,x]),W=p(w,M),G=u(T),K=W*G,q=h(()=>new Set(V.map(e=>e.contentId)),[V]),J=h(()=>{let e=U.filter(e=>!q.has(e.id));if(!E||B.length===0)return e;let t=new Set(B.map(String));return e.filter(e=>(Array.isArray(e.source_tags)?e.source_tags:String(e.source_tags||``).split(`,`).filter(Boolean)).some(e=>t.has(String(e?.id??e))))},[q,U,E,B]),Y=h(()=>{if(!V.length)return[];let e=new Map(J.map(e=>[e.id,e]));return V.map(t=>{let n=e.get(t.contentId);if(!n)return null;let r=t.titleMode===`custom`?t.title:I(n),i=t.coverMode===`upload`?t.coverUrl:F(n);return{info:{...n,name:r||n.name,img_y:i||n.img_y,img_x:i||n.img_x},config:{showPlayCount:t.showPlayCount,playCountDelta:t.playCountDelta,showEpisode:t.showEpisode}}}).filter(Boolean)},[J,I,F,V]),X=h(()=>J.map(e=>({info:e})),[J]),Z=h(()=>d(Y,X,K),[Y,K,X]),Q=h(()=>{if(!M)return Z;let e=f(X,L,K,5);return L===1?Z:Z.concat(e)},[Z,M,L,K,X]),$=M&&L<5&&X.length>0;return m(()=>{M&&R(1)},[x,M]),m(()=>{if(!M)return;let e=z.current;if(!e||!$)return;let t=new IntersectionObserver(e=>{e[0]?.isIntersecting&&R(e=>Math.min(e+1,5))});return t.observe(e),()=>{t.disconnect()}},[M,$]),P?v(`div`,{children:`占位`}):Q.length?y(t,{className:`w-full mt-[16px]`,children:[v(n,{className:`block pl-[12px] mb-[8px] text-text1 text-[18px] leading-[26px] font-bold`,children:O||te(`detailGuessLike.title`)}),v(t,{className:`w-full flex flex-wrap px-[12px]`,children:Q.map((e,t)=>{let n=e.config?.showPlayCount??k,r=e.config?.playCountDelta??A,i=e.config?.showEpisode??j,s=C(c(e.info.play_count||0,r)),u=l(Number(e.info.update_status)===1?`done`:`updating`,e.info.episode_cnt||e.info.links?.length,e.info.episode_cnt||e.info.links?.length),d=Number.isFinite(G)&&G>0?`${100/G}%`:`33.333333%`;return v(o,{url:F(e.info),text:I(e.info),style:{width:d},bottomLeftChild:n?y(`div`,{className:`h-[20px] leading-[20px] text-[#fff] text-[12px] px-[4px] rounded-[4px] bg-[#333] ml-[4px] flex items-center`,children:[v(a,{className:`w-[16px] h-[auto] text-[#fff] mr-[4px]`}),s]}):null,bottomRightChild:i&&u?v(`div`,{className:`text-[#F59E0B] text-[12px] font-bold leading-[20px] pr-[8px]`,children:u}):null,linkPath:ee(e.info)},`guess-like-${t}`)})}),M&&v(`div`,{ref:z,className:`h-[1px] w-full`})]}):null}function S(e){return{id:e.video_id||``,mid:``,name:e.name||``,cat_id:``,cat_name:``,status:`1`,status_text:``,create_time:``,content_type:0,episode_cnt:e.episode_count||0,show_at:e.show_at??``,position:``,img_type:e.img_type??``,img_x:e.img_x??``,img_y:e.img_y??``,img_width:``,img_height:``,play_count:e.play_count,preview_images:[],duration:String(e.duration??``),score:String(e.score??``),is_more_link:e.is_more_link?`y`:`n`,update_status:String(e.update_status??``),description:e.description??``,language:``,director:``,actor:``,area:``,issue_date:``,publisher:``,series:``,number:``,tags:[],source_tags:e.source_tags??``,source_actor:[],links:Array.isArray(e.episodes)?e.episodes.map(e=>({id:e.id??``,name:e.name??``,preview_m3u8_url:e.preview_m3u8_url??``,m3u8_url:e.m3u8_url??``})):[],money:``,up_user:``,source_username:``,task_id:``,file_status:``}}function C(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 ee(e){if(e.content_type===0){let t=encodeURIComponent(e.name||``);return`/video/${e.id}/${t}/episode/1`}return`/post/${e.id}`}export{x as VideoDetailRecommendClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{pxToVw as t}from"../../../../utils/helper.mjs";import{Image as n}from"../../../ui/image.mjs";import{Box as r}from"../../../ui/box.mjs";import{Text as i}from"../../../ui/text.mjs";import{useBrowseReport as a}from"../../../../hooks/use-browse-report.mjs";import{MediaPreview as o,useMediaPreview as s}from"../../../common/media-preview/index.mjs";import{UserActivityMediaGrid as
|
|
2
|
+
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{pxToVw as t}from"../../../../utils/helper.mjs";import{Image as n}from"../../../ui/image.mjs";import{Box as r}from"../../../ui/box.mjs";import{Text as i}from"../../../ui/text.mjs";import{useBrowseReport as a}from"../../../../hooks/use-browse-report.mjs";import{MediaPreview as o,useMediaPreview as s}from"../../../common/media-preview/index.mjs";import c from"../../../common/video-player/index.mjs";import{UserActivityMediaGrid as l}from"../../../common/list/user-activity-list/user-activity-list-item.mjs";import{memo as u,useCallback as d,useEffect as f,useMemo as p,useRef as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";import{useTranslations as v}from"next-intl";const y=u(({information:t,isVideo:n,episodeIndex:a=0,resumeProgressSeconds:c=0,className:u=``})=>{let d=p(()=>({id:t.id,name:t.name,preview_images:t.preview_images,img_y:t.img_y,img_x:t.img_x}),[t.id,t.name,t.preview_images,t.img_y,t.img_x]),f=p(()=>{let e=t?.medias,n=Array.isArray(e)?e.filter(Boolean):[];return n.length>0?n:(d.preview_images?.length?d.preview_images:[d.img_y||d.img_x||``].filter(Boolean)).filter(Boolean).map(e=>({media_url:e,is_video:!1,cover_image:``}))},[d.img_x,d.img_y,d.preview_images,t]),m=s(),h=p(()=>f.filter(Boolean).map(e=>{let n=e?.is_video?`video`:`image`,r=String(e?.media_url||``),i=e?.cover_image||t.img_y||t.img_x;return{src:r,type:n,...i?{cover:String(i)}:{}}}).filter(e=>!!e.src),[t.img_x,t.img_y,f]);return n?g(b,{information:t,episodeIndex:a,resumeProgressSeconds:c}):_(`div`,{className:e(`w-full`,u),children:[_(r,{className:`mt-3 px-[12px] space-y-1`,children:[g(i,{as:`p`,className:`break-all`,dangerouslySetInnerHTML:{__html:t.description}}),g(l,{medias:f,onItemClick:e=>{h.length&&m.open(h,e)}})]}),g(o,{})]})});y.displayName=`DetailHero`;const b=u(({information:e,episodeIndex:t,resumeProgressSeconds:n})=>{let r=p(()=>({id:e.id,mid:e.mid,img_width:e.img_width,img_height:e.img_height,img_y:e.img_y,img_x:e.img_x,preview_images:e.preview_images}),[e.id,e.mid,e.img_width,e.img_height,e.img_y,e.img_x,e.preview_images]);return g(x,{information:{...e,...r},episodeIndex:t,resumeProgressSeconds:n})},(e,t)=>{let n=e.information,r=t.information;return n.id===r.id&&n.mid===r.mid&&n.img_width===r.img_width&&n.img_height===r.img_height&&n.img_y===r.img_y&&n.img_x===r.img_x&&e.resumeProgressSeconds===t.resumeProgressSeconds&&e.episodeIndex===t.episodeIndex});b.displayName=`StableDetailPlayerBox`;function x({information:e,episodeIndex:i,resumeProgressSeconds:o}){let s=v(`components.biz.business.detail`),l=m(0),u=m(0),y=Math.max(0,Number(i)||0),b=y+1,x=p(()=>e?.id,[e?.id]),T=p(()=>({id:e.id,mid:e.mid,img_width:e.img_width,img_height:e.img_height,img_y:e.img_y,img_x:e.img_x,preview_images:e.preview_images,links:e.links}),[e.id,e.mid,e.img_width,e.img_height,e.img_y,e.img_x,e.preview_images,e.links]),E=p(()=>T.mid||T.id,[T.id,T.mid]),D=p(()=>{let e=T.links?.[y]?.id;return e?String(e):`ep-${y+1}`},[y,T.links]),O=p(()=>`__reportData_detail_page__${T.id}:${D}`,[D,T.id]),k=p(()=>{if(typeof window>`u`)return 0;try{let e=sessionStorage.getItem(O);if(!e)return 0;let t=JSON.parse(e),n=Number(t.currentTime||0),r=Number(t.duration||0);if(!Number.isFinite(n)||!Number.isFinite(r))return 0;if(n>0&&r>0)return n}catch(e){console.error(`读取 sessionStorage 数据失败:`,e)}return 0},[O]),A=p(()=>{let e=Number(o||0);return Number.isFinite(e)&&e>0?e:0},[o]),j=p(()=>A>0?A:k,[A,k]),M=p(()=>{let t=w(e),n=t[t.length?Math.max(0,Math.min(y,t.length-1)):0]?.url||``,r=!!t.length;if(!r)return{hasVideo:!1,hlsList:[],videoUrl:``,width:1,height:1,resolution:`0x0`,aspectRatio:1,poster:``};let i=Number(T.img_width||0)||1,a=Number(T.img_height||0)||1;return{hasVideo:r,hlsList:t,videoUrl:n,width:i,height:a,resolution:S(i,a),aspectRatio:(i||1)/(a||1),poster:T.img_y||T.img_x||T.preview_images?.[0]||``}},[e.id,e.links,y,T.img_width,T.img_height,T.img_y,T.img_x,T.preview_images]),N=d((e,t)=>{l.current=e,u.current=t},[]),P=p(()=>M.videoUrl.endsWith(`m3u8`)?{startTimeSeconds:j,preload:`none`}:{startTimeSeconds:j},[j,M.videoUrl]);f(()=>{l.current=0,u.current=0},[x,y]);let F=a({contentId:x,browseEpisode:b,contentType:1,enabled:!!x,intervalMs:60*1e3,getCurrentTimeSeconds:()=>l.current,getDurationSeconds:()=>u.current});if(f(()=>{let e=()=>{if(!(typeof window>`u`)&&!(l.current<=0||u.current<=0))try{sessionStorage.setItem(O,JSON.stringify({episodeId:D,currentTime:l.current,duration:u.current}))}catch(e){console.error(`写入 sessionStorage 失败:`,e)}},t=()=>{e()},n=()=>{document.visibilityState===`hidden`&&e()},r=()=>{e()};return window.addEventListener(`beforeunload`,t),document.addEventListener(`visibilitychange`,n),window.addEventListener(`popstate`,r),()=>{window.removeEventListener(`beforeunload`,t),document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`popstate`,r),e()}},[D,O]),!M.hasVideo)return g(`div`,{className:`mt-3 rounded-xl bg-bg1 px-3 py-10 text-center text-text3`,children:s(`videoHero.noVideos`)});let I=C(430,M.aspectRatio,242),L=I.height>0?t(I.height):`auto`,R=t(242);return _(h,{children:[g(r,{suppressHydrationWarning:!0,className:`w-full`,style:{height:L,maxWidth:`100%`,maxHeight:R}}),_(r,{className:`w-full relative bg-bg2 !fixed !top-[44px] !left-0 z-[10]`,children:[M.poster&&_(`div`,{className:`w-full h-full bg-bg2 absolute top-0 left-0 z-[1] overflow-hidden`,style:{height:L},children:[g(n,{src:M.poster,alt:s(`videoHero.coverAlt`),fill:!0,className:`object-cover`,priority:!0}),g(`div`,{className:`w-full h-full absolute top-0 left-0 z-[1] bg-[rgba(255,255,255,0.2)] backdrop-blur-[4px]`})]}),g(r,{suppressHydrationWarning:!0,"data-aspect-ratio":M.resolution,className:`w-full overflow-hidden flex justify-center relative z-[2]`,style:{height:L,maxWidth:`100%`,maxHeight:R,backdropFilter:`blur(0)`,WebkitBackdropFilter:`blur(0)`},children:g(c,{plyerId:`detail-player-${T.id}-${y}`,parentId:E,resolution:M.resolution||`0x0`,videoUrl:M.videoUrl,poster:M.poster,mergeConfig:P,onProgressUpdate:N,onPlay:F.handlePlay,onPause:F.handlePause,onEnded:F.handleEnded},`stable-player-${T.id}-${y}`)})]})]})}function S(e,t){return!e||!t?``:`${e}x${t}`}function C(e,t,n){let r=e/t;return r<=n?{width:e,height:r}:{width:n*t,height:n}}function w(e){let t=e.links||[];return t.length>0?t.map((e,t)=>({text:e.name||String(t+1),url:e.m3u8_url||e.preview_m3u8_url||``,definition:``,isDefault:t===0})).filter(e=>e.url):[]}export{y as DetailHero};
|