@funhub/platform 0.1.124 → 0.1.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{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{usePaginated as
|
|
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{VideoListItemSkeleton as f}from"../../../common/skeleton/video-list-item-skeleton.mjs";import p from"../../../../assets/icons/view.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(n,{className:`w-full px-[12px] pt-[12px]`,children:Array.from({length:3}).map((e,t)=>v(f,{},`search-video-skeleton-${t}`))}));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(p,{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};
|
|
@@ -8,7 +8,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
8
8
|
/** buttonVariants 工具定义。 */
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
10
|
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
11
|
-
size?: "default" | "
|
|
11
|
+
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
13
13
|
/** Button 组件属性。 */
|
|
14
14
|
type ButtonProps = Button.Props & VariantProps<typeof buttonVariants> & {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
-
import
|
|
4
|
+
import Image from "next/image";
|
|
5
5
|
|
|
6
6
|
//#region components/ui/image.d.ts
|
|
7
7
|
/** BaseImageProps 属性定义。 */
|
|
8
|
-
type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof
|
|
8
|
+
type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof Image>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
|
|
9
9
|
type CommonImageProps = BaseImageProps & {
|
|
10
10
|
/** 图片地址,支持普通 URL、默认资源路径和加密地址。 */src: string; /** 图片替代文本。 */
|
|
11
11
|
alt?: string; /** 图片类名。 */
|
|
@@ -27,6 +27,6 @@ type ImagePropsWithSize = CommonImageProps & {
|
|
|
27
27
|
/** ImageProps 属性定义。 */
|
|
28
28
|
type ImageProps = ImagePropsWithFill | ImagePropsWithSize;
|
|
29
29
|
/** 图片组件:支持 bnc 解密、默认资源域名拼接与错误占位。 */
|
|
30
|
-
declare function Image(props: ImageProps): react_jsx_runtime0.JSX.Element;
|
|
30
|
+
declare function Image$1(props: ImageProps): react_jsx_runtime0.JSX.Element;
|
|
31
31
|
//#endregion
|
|
32
|
-
export { BaseImageProps, CommonImageProps, Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
|
|
32
|
+
export { BaseImageProps, CommonImageProps, Image$1 as Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
|