@funhub/platform 0.1.114 → 0.1.115
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{Button as e}from"../../ui/button.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetRecommendVideoList as r}from"../../../service/generated/client.mjs";import{Image as i}from"../../ui/image.mjs";import{Box as a}from"../../ui/box.mjs";import{Item as o}from"../../ui/item.mjs";import{List as s}from"../../ui/list.mjs";import{Skeleton as c}from"../../ui/skeleton.mjs";import{Text as l}from"../../ui/text.mjs";import{usePaginated as u,useUpdateRequest as d}from"../../../hooks/query/use-query.mjs";import{useRequireLogin as f}from"../../../hooks/use-auth.mjs";import{eventKey as p}from"../../../constants/event-key.mjs";import m from"../../../assets/icons/right_arrow.mjs";import
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetRecommendVideoList as r}from"../../../service/generated/client.mjs";import{Image as i}from"../../ui/image.mjs";import{Box as a}from"../../ui/box.mjs";import{Item as o}from"../../ui/item.mjs";import{List as s}from"../../ui/list.mjs";import{Skeleton as c}from"../../ui/skeleton.mjs";import{Text as l}from"../../ui/text.mjs";import{usePaginated as u,useUpdateRequest as d}from"../../../hooks/query/use-query.mjs";import{useRequireLogin as f}from"../../../hooks/use-auth.mjs";import{eventKey as p}from"../../../constants/event-key.mjs";import m from"../../../assets/icons/right_arrow.mjs";import h from"../../../assets/images/user/default_avatar.mjs";import{memo as g,useCallback as _,useEffect as v,useMemo as y,useState as b}from"react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{useTranslations as C}from"next-intl";import w from"next/link";const T=typeof h==`string`?h:h.src;function E(){return x(a,{className:`w-full`,children:Array.from({length:6}).map((e,t)=>S(a,{className:`w-full h-[56px] flex items-center justify-between mb-[12px]`,children:[S(a,{className:`flex items-center`,children:[x(c,{className:`w-[56px] h-[56px] rounded-[28px]`}),S(a,{className:`ml-[8px]`,children:[x(c,{className:`w-[120px] h-[18px] mb-[8px]`}),x(c,{className:`w-[72px] h-[14px]`})]})]}),x(c,{className:`w-[76px] h-[34px] rounded-[18px]`})]},`search-user-skeleton-${t}`))})}const D=g(({item:e,onUpdate:t})=>{let r=C(`components.pages.search.searchResult`),{userInfo:o}=n();return _(n=>{t({...e,is_following:n?1:0})},[e,t]),x(a,{className:`w-full h-[56px] bg-bg1 flex flex-row items-center justify-between mb-[12px]`,children:S(w,{className:`cursor-pointer flex flex-row items-center justify-center`,href:`/profile/${e.user_id}`,children:[x(a,{className:`w-[56px] h-[56px] rounded-[28px] overflow-hidden bg-bg2 relative`,children:x(i,{src:e.avatar||T,fill:!0,objectFit:`cover`,alt:e.nick_name})}),S(a,{className:`flex flex-col ml-[8px]`,children:[x(l,{as:`span`,className:`text-text1 text-[16px] leading-[24px] h-[24px] font-bold w-[200px] inline-block truncate`,children:e.nick_name}),S(l,{as:`span`,className:`text-text2 leading-[22px] text-[14px]`,children:[e.follower_count??0,r(`searchUser.followersSuffix`)]})]})]})})});D.displayName=`UserItem`;const O=g(({list:n})=>{let r=f(),[i,o]=b({});v(()=>{o({})},[n]);let s=_(e=>{e.user_id&&o(t=>({...t,[e.user_id]:e.is_following?1:0}))},[]),c=y(()=>n.slice(0,3).map(e=>{let t=e.user_id||``;return!t||i[t]===void 0?e:{...e,is_following:i[t]}}),[i,n,3]),u=n.length>3,d=_(()=>{t.emit(p.EXCHANGE_SEARCH_TYPE,`user`)},[]);return c.length===0?null:S(a,{className:`w-full pt-[12px]`,children:[x(a,{className:`px-[12px]`,children:c.map((e,t)=>x(D,{item:e,onUpdate:e=>{r(()=>s(e))}},String(e.user_id??t)))}),u&&x(a,{className:`w-full flex items-center justify-center`,children:S(e,{variant:`ghost`,className:`w-fit h-[46px] leading-[46px] mx-auto mt-[-12px] text-[14px] text-text2`,onClick:d,children:[x(l,{as:`span`,children:`查看更多`}),x(m,{className:`w-[12px] h-[12px]`})]})})]})});O.displayName=`SearchUserWithLimit`;const k=g(({inputVal:e,sort:t,refreshVersion:n})=>{let i=C(`components.pages.search.searchResult`),c=f(),l=_(async n=>await r({data_type:2,extra_params:JSON.stringify({type:4,keywords:e,sort:t}),page:n||1,page_size:20}),[e,t]),p=y(()=>[`searchByKeyForUser`,e,4,t,n],[e,t,n]),m=u({key:p,initialPageParam:1,async queryFn(e){return(await l(e))?.data?.users??{has_more:!1,total:0,list:[]}},getNextPageParam(e,t){if(e.has_more)return t.length+1}}),h=d(),g=_((e,t)=>{e&&h(p,n=>n&&{...n,pages:n.pages.map(n=>({...n,list:(n.list??[]).map(n=>n.user_id===e?{...n,is_following:t?1:0}:n)}))})},[h,p]),v=async e=>{try{await m.fetchNextPage()}catch(e){console.error(`获取用户列表失败`,e)}},b=(m?.data?.pages??[]).flatMap(e=>e.list??[]),S=!!(m?.isPending||m?.isFetching);return S&&b.length===0?x(E,{}):x(a,{className:`w-full`,children:x(s,{loading:S,hasMore:m?.hasNextPage??!1,loadMore:v,empty:`nodata`,emptyText:i(`searchUser.emptyResult`),children:b.map((e,t)=>x(o,{children:x(D,{item:e,onUpdate:e=>{c(()=>{g(e.user_id||``,!!e.is_following)})}})},String(e.user_id??t)))})})});k.displayName=`SearchUserWithPagination`;const A=g(e=>e.mode===`all`?x(O,{list:e.list??[]}):x(k,{inputVal:e.inputVal??``,sort:e.sort??1,refreshVersion:e.refreshVersion??0}));A.displayName=`SearchUser`;export{A as default};
|
|
@@ -6,7 +6,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
6
6
|
//#region components/ui/badge.d.ts
|
|
7
7
|
/** badgeVariants 工具定义。 */
|
|
8
8
|
declare const badgeVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "default" | "destructive" | "secondary" | "outline" | "ghost" | "link" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
/** Badge 组件。 */
|
|
12
12
|
declare function Badge({
|
|
@@ -7,8 +7,8 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
7
7
|
//#region components/ui/button.d.ts
|
|
8
8
|
/** buttonVariants 工具定义。 */
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
|
-
variant?: "
|
|
11
|
-
size?: "default" | "
|
|
10
|
+
variant?: "default" | "destructive" | "secondary" | "outline" | "ghost" | "link" | null | undefined;
|
|
11
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "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> & {
|