@funhub/platform 0.1.126 → 0.1.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/common/skeleton/search-video-card-skeleton.mjs +2 -0
- package/dist/components/pages/search/search-result/search-video-info.mjs +1 -1
- package/dist/components/pages/search-result/search-result-skeleton.mjs +1 -1
- package/dist/components/pages/search-result/search-video.mjs +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{Box as e}from"../../ui/box.mjs";import{useId as t}from"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";import{useTranslations as i}from"next-intl";import a from"react-content-loader";function o({uniqueKey:o}){let s=i(`components.common`),c=t();return n(e,{className:`mb-[12px] w-full border-b border-line1 px-[12px] pb-[12px]`,children:r(a,{uniqueKey:o||c,viewBox:`0 0 375 312`,className:`h-auto w-full text-text1`,backgroundColor:`currentColor`,foregroundColor:`currentColor`,backgroundOpacity:.08,foregroundOpacity:.18,preserveAspectRatio:`none`,title:s(`skeleton.loading`),children:[n(`rect`,{x:0,y:0,rx:12,ry:12,width:375,height:211}),n(`rect`,{x:8,y:187,rx:4,ry:4,width:34,height:14}),n(`rect`,{x:325,y:187,rx:4,ry:4,width:42,height:14}),n(`rect`,{x:8,y:221,rx:4,ry:4,width:176,height:24}),n(`rect`,{x:8,y:257,rx:4,ry:4,width:205,height:20}),n(`rect`,{x:255,y:225,rx:21,ry:21,width:112,height:42})]})})}function s({count:t=3,uniqueKeyPrefix:r=`search-video-card-skeleton`,className:i=``}){return n(e,{className:`w-full px-[12px] pt-[12px] bg-bg1 ${i}`.trim(),children:Array.from({length:t}).map((e,t)=>n(o,{uniqueKey:`${r}-${t}`},`${r}-${t}`))})}export{s as SearchVideoCardSkeleton};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{gContentGetRecommendVideoList as e}from"../../../../service/generated/client.mjs";import{Image as t}from"../../../ui/image.mjs";import{Box as n}from"../../../ui/box.mjs";import{EmptyState as r}from"../../../ui/empty.mjs";import{Text as i}from"../../../ui/text.mjs";import{usePaginated as a,useRefetchQuery as o,useUpdateRequest as s}from"../../../../hooks/query/use-query.mjs";import{formatVideoDuration as c,getPostDetailPagePath as l}from"../../../../utils/tools.mjs";import{apiCollectCustom as u}from"../../../../utils/api-collect.mjs";import{UserActivityList as d}from"../../../common/list/user-activity-list/user-activity-list.mjs";import
|
|
2
|
+
"use client";import{gContentGetRecommendVideoList as e}from"../../../../service/generated/client.mjs";import{Image as t}from"../../../ui/image.mjs";import{Box as n}from"../../../ui/box.mjs";import{EmptyState as r}from"../../../ui/empty.mjs";import{Text as i}from"../../../ui/text.mjs";import{usePaginated as a,useRefetchQuery as o,useUpdateRequest as s}from"../../../../hooks/query/use-query.mjs";import{formatVideoDuration as c,getPostDetailPagePath as l}from"../../../../utils/tools.mjs";import{apiCollectCustom as u}from"../../../../utils/api-collect.mjs";import{UserActivityList as d}from"../../../common/list/user-activity-list/user-activity-list.mjs";import f from"../../../../assets/icons/view.mjs";import{SearchVideoCardSkeleton as p}from"../../../common/skeleton/search-video-card-skeleton.mjs";import{mapRecommendContentToUserActivityItem as m}from"../search-utils.mjs";import{memo as h,useCallback as g,useMemo as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{useTranslations as b}from"next-intl";import x from"next/link";const S=h(()=>v(p,{count:3,uniqueKeyPrefix:`search-video-info-skeleton`}));S.displayName=`SearchVideoListSkeleton`;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 w(e){let t=Number(e.episode_count||0),n=Number.isFinite(t)&&t>0,r=String(e.update_status??``).trim();return!n||t<=1?c(Number(e.duration||0)):r===`1`?`${t}集全`:`更新至${t}集`}const T=h(({item:e})=>{let r=e.name||``,a=e.img_x||e.img_y||``,o=w(e);return y(x,{className:`mb-[12px] block border-b border-line1 px-[12px] pb-[12px]`,href:l({id:e.video_id,contentType:0}),onClick:()=>{e.video_id},children:[y(n,{className:`relative w-full overflow-hidden rounded-[12px] bg-neutral-800`,style:{aspectRatio:`16/9`},children:[a&&v(t,{src:a,alt:r||`封面`,fill:!0,objectFit:`cover`}),v(n,{className:`absolute inset-x-0 bottom-0 h-[40px] bg-gradient-to-t from-black/80 to-transparent z-0 pointer-events-none`}),y(n,{className:`absolute bottom-0 left-[8px] mb-[6px] z-10 flex items-center gap-[4px]`,children:[v(f,{className:`h-[14px] w-[14px] text-white`}),v(i,{as:`span`,className:`text-[12px] font-medium text-white drop-shadow-md`,children:C(e.play_count)})]}),o&&v(n,{className:`absolute bottom-0 right-[8px] mb-[6px] z-10 flex items-center`,children:v(i,{as:`span`,className:`text-[12px] font-medium text-white drop-shadow-md`,children:o})})]}),y(n,{className:`flex items-center justify-between gap-[12px] pt-[10px] px-2`,children:[y(n,{className:`flex-1 min-w-0`,children:[v(i,{as:`h3`,className:`text-[16px] font-semibold leading-[24px] text-text1 line-clamp-1`,children:r}),e.description&&v(i,{as:`p`,className:`mt-[4px] text-[13px] leading-[20px] text-text2 line-clamp-1`,children:e.description})]}),v(i,{className:`shrink-0 rounded-[20px] border border-[#FD4C5E] px-[24px] py-[8px] text-[14px] font-normal text-[#FD4C5E]`,children:`观看`})]})]})});T.displayName=`VideoItem`;const E=h(({list:e})=>v(n,{className:`w-full px-[12px] pt-[12px]`,children:e.map((e,t)=>v(T,{item:e},String(e.video_id??t)))}));E.displayName=`VideoList`;const D=h(({list:e,onUpdate:t,onActionSuccess:n})=>{let r=g(n=>{let r=e.findIndex(e=>e.content_id===n.content_id);if(r!==-1){let i=[...e];i[r]=n,t(i)}},[e,t]);return v(d,{list:_(()=>e.map(e=>({...m(e),onLikeSuccess(t){r({...e,like_count:String(t.count),dislike_count:t.dislikeCount===void 0?e.dislike_count:String(t.dislikeCount),interaction:{...e.interaction,is_liked:t.isLiked,is_dislike:t.isDisliked??e.interaction?.is_dislike}})},onDislikeSuccess(t){r({...e,like_count:t.likeCount===void 0?e.like_count:String(t.likeCount),dislike_count:String(t.count),interaction:{...e.interaction,is_dislike:t.isDisliked,is_liked:t.isLiked??e.interaction?.is_liked}})}})),[r,e]),showGroupHeaders:!1,onActionSuccess:n})});D.displayName=`InfoList`;const O=h(({searchType:t,inputVal:i})=>{let c=b(`components.pages.search.searchResult`),l=g(async n=>await e({data_type:2,extra_params:JSON.stringify({type:t===`video`?3:2,keywords:i}),page:n||1,page_size:20}),[i,20,t]),u=_(()=>[`searchByKeyForVideoInfo`,i,t===`video`?3:2],[i,t]),f=a({key:u,initialPageParam:1,async queryFn(e){let n=await l(e);return(t===`video`?n?.data?.videos:n?.data?.contents)??{has_more:!1,total:0,list:[]}},getNextPageParam(e,t){if(e.has_more)return t.length+1}}),p=_(()=>{let e=f.data?.pages??[],t=[];for(let n of e){let e=n.list??[];t.push(...e)}return t},[f.data?.pages]),h=_(()=>p,[p,t]),y=s(),x=o(),C=g(e=>{y(u,t=>{if(!t)return t;let n=t.pages.map(t=>({...t,list:(t.list??[]).map(t=>t.content_id===e.content_id?e:t)}));return{...t,pages:n}})},[u,y]),w=g(()=>{x(u)},[u,x]),T=g(e=>({...m(e),onLikeSuccess(t){C({...e,like_count:String(t.count),dislike_count:t.dislikeCount===void 0?e.dislike_count:String(t.dislikeCount),interaction:{...e.interaction,is_liked:t.isLiked,is_dislike:t.isDisliked??e.interaction?.is_dislike}})},onDislikeSuccess(t){C({...e,like_count:t.likeCount===void 0?e.like_count:String(t.likeCount),dislike_count:String(t.count),interaction:{...e.interaction,is_dislike:t.isDisliked,is_liked:t.isLiked??e.interaction?.is_liked}})}}),[C]),D=_(()=>h.map(T),[T,h]),O=f.isPending||f.isFetching,k=t===`video`&&O&&h.length===0;return v(n,{className:`w-full`,children:t===`video`?k?v(S,{}):h.length>0?v(E,{list:h}):v(r,{type:`no-content`,text:c(`searchVideoInfo.noRelevantContent`),className:`mt-[12px]`}):v(d,{list:D,loading:O,hasMore:f.hasNextPage??!1,loadMore:async e=>{if(e!==!1)try{f&&await f.fetchNextPage()}catch(e){console.error(`获取内容列表失败`,e)}},showGroupHeaders:!1,emptyText:c(`searchVideoInfo.noRelevantContent`),onActionSuccess:w})})});O.displayName=`SearchInfoOrVideoList`;export{E as VideoList,O as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{SearchVideoCardSkeleton as e}from"../../common/skeleton/search-video-card-skeleton.mjs";import{jsx as t}from"react/jsx-runtime";function n({count:n=6}){return t(e,{count:n,uniqueKeyPrefix:`search-result-skeleton`})}export{n as SearchResultSkeleton};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../ui/button.mjs";import t from"../../../utils/event-bus.mjs";import{gContentGetRecommendVideoList as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{Box as i}from"../../ui/box.mjs";import{Item as a}from"../../ui/item.mjs";import{List as o}from"../../ui/list.mjs";import{Text as s}from"../../ui/text.mjs";import{usePaginated as c}from"../../../hooks/query/use-query.mjs";import{eventKey as l}from"../../../constants/event-key.mjs";import{getPostDetailPagePath as
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import t from"../../../utils/event-bus.mjs";import{gContentGetRecommendVideoList as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{Box as i}from"../../ui/box.mjs";import{Item as a}from"../../ui/item.mjs";import{List as o}from"../../ui/list.mjs";import{Text as s}from"../../ui/text.mjs";import{usePaginated as c}from"../../../hooks/query/use-query.mjs";import{eventKey as l}from"../../../constants/event-key.mjs";import{formatVideoDuration as u,getPostDetailPagePath as d}from"../../../utils/tools.mjs";import{apiCollectCustom as f}from"../../../utils/api-collect.mjs";import p from"../../../assets/icons/view.mjs";import m from"../../../assets/icons/right_arrow.mjs";import{SearchVideoCardSkeleton as h}from"../../common/skeleton/search-video-card-skeleton.mjs";import{memo as g,useCallback as _,useMemo as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{useTranslations as x}from"next-intl";import S from"next/link";const C=g(()=>y(h,{count:3}));C.displayName=`SearchVideoListSkeleton`;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){let t=Number(e.episode_count||0),n=Number.isFinite(t)&&t>0,r=String(e.update_status??``).trim();return!n||t<=1?u(Number(e.duration||0)):r===`1`?`${t}集全`:`更新至${t}集`}const E=g(({item:e})=>{let t=e.name||``,n=e.img_x||e.img_y||``,a=T(e);return b(S,{className:`mb-[12px] block w-full border-b border-line1 px-[12px] pb-[12px]`,href:d({id:e.video_id,contentType:0}),onClick:()=>{e.video_id},children:[b(i,{className:`relative w-full overflow-hidden rounded-[12px] bg-neutral-800`,style:{aspectRatio:`16/9`},children:[n&&y(r,{src:n,alt:t||`封面`,fill:!0,objectFit:`cover`}),y(i,{className:`absolute inset-x-0 bottom-0 h-[40px] bg-gradient-to-t from-black/80 to-transparent z-0 pointer-events-none`}),b(i,{className:`absolute bottom-0 left-[8px] mb-[6px] z-10 flex items-center gap-[4px]`,children:[y(p,{className:`h-[14px] w-[14px] text-white`}),y(s,{as:`span`,className:`text-[12px] font-medium text-white drop-shadow-md`,children:w(e.play_count)})]}),a&&y(i,{className:`absolute bottom-0 right-[8px] mb-[6px] z-10 flex items-center`,children:y(s,{as:`span`,className:`text-[12px] font-medium text-white drop-shadow-md`,children:a})})]}),b(i,{className:`flex items-center justify-between gap-[12px] pt-[10px] px-2`,children:[b(i,{className:`flex-1 min-w-0`,children:[y(s,{as:`h3`,className:`text-[16px] font-semibold leading-[24px] text-text1 line-clamp-1`,children:t}),e.description&&y(s,{as:`p`,className:`mt-[4px] text-[13px] leading-[20px] text-text2 line-clamp-1`,children:e.description})]}),y(s,{className:`shrink-0 rounded-[20px] border border-[#FD4C5E] px-[24px] py-[8px] text-[14px] font-normal text-[#FD4C5E]`,children:`观看`})]})]})});E.displayName=`VideoItem`;const D=g(({list:e})=>y(i,{className:`w-full px-[12px] pt-[12px]`,children:e.map((e,t)=>y(E,{item:e},String(e.video_id??t)))}));D.displayName=`VideoListContent`;const O=g(({list:n,hasMore:r})=>{let a=_(()=>{t.emit(l.EXCHANGE_SEARCH_TYPE,`video`)},[]);return b(i,{className:`w-full`,children:[y(D,{list:n}),r&&y(i,{className:`w-full flex items-center justify-center`,children:b(e,{variant:`ghost`,className:`w-fit h-[46px] leading-[46px] mx-auto mt-[-12px] text-[14px] text-text2`,onClick:a,children:[y(s,{as:`span`,children:`查看更多`}),y(m,{className:`w-[12px] h-[12px]`})]})})]})});O.displayName=`SearchVideoWithAll`;const k=g(({inputVal:e,sort:t,refreshVersion:r})=>{let s=x(`components.pages.search.searchResult`),l=_(async r=>await n({data_type:2,extra_params:JSON.stringify({type:3,keywords:e,sort:t}),page:r||1,page_size:20}),[e,t]),u=c({key:v(()=>[`searchByKeyForVideoInfo`,e,3,t,r],[e,t,r]),initialPageParam:1,async queryFn(e){return(await l(e))?.data?.videos??{has_more:!1,total:0,list:[]}},getNextPageParam(e,t){if(e.has_more)return t.length+1}}),d=v(()=>{let e=u.data?.pages??[],t=[];for(let n of e){let e=n.list??[];t.push(...e)}return t},[u.data?.pages]),f=u.isPending||u.isFetching;return f&&d.length===0?y(C,{}):y(i,{className:`w-full`,children:y(o,{loading:f,hasMore:u.hasNextPage??!1,loadMore:async e=>{try{await u.fetchNextPage()}catch(e){console.error(`获取内容列表失败`,e)}},empty:`nodata`,emptyText:s(`searchVideoInfo.noRelevantContent`),children:d.map((e,t)=>y(a,{className:`p-0`,children:y(E,{item:e})},String(e.video_id??t)))})})});k.displayName=`SearchVideoWithPagination`;const A=g(e=>e.mode===`all`?y(O,{list:e.list,hasMore:e.hasMore}):y(k,{inputVal:e.inputVal,sort:e.sort,refreshVersion:e.refreshVersion}));A.displayName=`SearchVideo`;export{A as default};
|