@funhub/platform 0.1.98 → 0.1.100

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{cn as e}from"../../../../../utils/cn.mjs";import{Button as t}from"../../../../ui/button.mjs";import{useUserStore as n}from"../../../../../store/modules/user-store.mjs";import{gUserGetUserInfo as r,gUserViewUserInfo as i,pInteractionFollow as a,pInteractionUnfollow as o}from"../../../../../service/generated/client.mjs";import{Box as s}from"../../../../ui/box.mjs";import{Skeleton as c}from"../../../../ui/skeleton.mjs";import{Text as l}from"../../../../ui/text.mjs";import{useLoginModalStore as u}from"../../../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as d,useMutation as f,useRequest as p,useUpdateRequest as m}from"../../../../../hooks/query/use-query.mjs";import{LeftArrowIcon as h}from"../../../../common/icons/left-arrow.mjs";import{SettingIcon as g}from"../../../../common/icons/setting.mjs";import{UserProfileAvatar as _}from"./user-profile-avatar.mjs";import{UserProfileCoverBackground as v}from"./user-profile-cover-background.mjs";import{useEffect as y,useMemo as b,useState as x}from"react";import{jsx as S,jsxs as C}from"react/jsx-runtime";import{toast as w}from"sonner";import{useTranslations as T}from"next-intl";import E from"next/link";import{useRouter as ee}from"next/navigation";const D=n.persist,O=`https://guadd-sg-ccs-sing-dev.s3.ap-southeast-1.amazonaws.com/default/default_avatar.png`,k=`/images/mine/img_mine_head_bg.png`;function A({showBackButton:n,isMine:r,enableCustomBackground:i,className:a}){return C(s,{className:e(`flex flex-col relative`,a),children:[C(s,{className:`absolute top-0 p-3 z-10 flex items-center justify-between w-full`,children:[S(t,{variant:`ghost`,size:`icon-xs`,className:e(`h-4 w-4 p-0 hover:bg-transparent`,{invisible:!n}),disabled:!0,children:S(h,{className:`w-4 h-4`})}),S(s,{className:e({invisible:!r}),children:S(g,{})})]}),S(s,{className:i?`h-33.75`:`h-24`,children:S(c,{className:`h-full w-full rounded-none`})}),C(s,{className:`flex-1 px-3`,children:[C(s,{className:`relative flex justify-end`,children:[S(c,{className:`absolute bottom-3 left-0 h-22 w-22 rounded-full`}),S(s,{className:`py-4 h-12`})]}),C(s,{className:`flex items-center justify-between gap-1`,children:[S(c,{className:`h-7 w-[132px]`}),S(c,{className:`h-10 w-[104px] rounded-full shrink-0`})]}),C(s,{className:`min-h-11 pt-1 pb-0 flex flex-col gap-2`,children:[S(c,{className:`h-4 w-[76%]`}),S(c,{className:`h-4 w-[58%]`})]})]})]})}function te({userId:e,currentUserId:n,isFollowing:r}){let i=T(`components.pages.profile`),{open:s}=u(),c=d(),l=m(),{mutateAsync:p,isPending:h}=f(async e=>a(e)),{mutateAsync:g,isPending:_}=f(async e=>o(e)),v=h||_;async function y(){if(!v){if(!n){s();return}try{if(r){let t=await g({app_id:0,follower_id:n,followee_id:e});t.code===0?(w.success(i(`client.unfollowSuccess`)),b(!1),c([`check-follow`,e]),c([`user-profile`,`profile`,e])):w.error(t.message||i(`client.unfollowFailed`))}else{let t=await p({app_id:0,follower_id:n,followee_id:e});t.code===0?(w.success(i(`client.followSuccess`)),b(!0),c([`check-follow`,e]),c([`user-profile`,`profile`,e])):w.error(t.message||i(`client.followFailed`))}}catch(e){console.error(`关注操作失败`,e),w.error(i(`client.operationFailed`))}}}function b(t){l([`user-profile`,`profile`,e],e=>!e||!e.data?e:{...e,data:{...e.data,is_following:t}})}return S(t,{variant:r?`outline`:`default`,className:`rounded-full disabled:opacity-100`,onClick:y,disabled:v,children:i(v?`client.processing`:r?`client.followed`:`client.follow`)})}function j({id:a,enableCustomBackground:o=!0,showBackButton:c=!0,requireLogin:d=!1,isEditorPreview:f=!1,className:m,mode:w=`renderer`}){let j=T(`components.pages.profile`);T(`components.pages.profile.components`);let M=f||w===`editor`,N=!M,ne=ee(),{open:re}=u(),{isLogin:P,userId:F,token:ie}=n(),[ae,I]=x(!1);y(()=>{if(!D){I(!0);return}I(D.hasHydrated());let e=D.onHydrate(()=>{I(!1)}),t=D.onFinishHydration(()=>{I(!0)});return()=>{e(),t()}},[]);let L=M?!1:P&&!!F&&!!ie,R=M?``:F,z=R,B=a==null||!!a&&!!z&&a===z,oe=!B&&!!a,V=B?[`user-profile`,`mine`]:[`user-profile`,`profile`,a],{data:H,isLoading:U}=p(M?[`editor-preview`,...V]:V,()=>a?i({target_user_id:a,user_id:R||a}):r({user_id:a||R||``}),{staleTime:0,enabled:N&&(!!a||!!R)}),W=b(()=>{let e=H?H.data:void 0;return e?{userId:e.user_id,isFollowing:e.is_following||!1,name:e.nick_name||`User${a??``}`,avatar:e.avatar||O,followingCnt:e.following_count??0,followersCnt:e.follower_count??0,likeCnt:e.like_count??0,signature:e.signature||``,background:e.bg_image||k}:{}},[a,H]),G=M||d&&B&&!L,K=!G&&!L&&oe,q=B&&L&&!G,J=!L,se=o&&q,ce=o&&J,le={name:j(`client.welcomeToPlanet`),description:j(`client.exploreAdventures`),avatar:O,followingCnt:0,followersCnt:0,likeCnt:0,background:k};function Y(){re()}function X(){ne.back()}let ue=G?S(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:j(`client.loginNow`)}):K?S(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:j(`client.follow`)}):L?B?S(E,{href:`/edit`,children:S(t,{variant:`outline`,className:`rounded-full`,children:j(`client.editProfile`)})}):S(te,{userId:a||``,currentUserId:R,isFollowing:W?.isFollowing}):S(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:j(`client.loginNow`)}),Z=G?le:W,Q=Z.name||``,$=Z.description||Z.signature||``;Z.followingCnt,Z.followersCnt,Z.likeCnt;let de=Z.avatar||``;return N&&U&&!H?S(A,{showBackButton:c,isMine:B,enableCustomBackground:o,className:m}):C(s,{className:e(`flex flex-col relative`,m),children:[C(s,{className:`absolute top-0 p-3 z-10 flex items-center justify-between w-full`,children:[S(t,{variant:`ghost`,size:`icon-xs`,onClick:X,className:e(`h-4 w-4 p-0 hover:bg-transparent`,{invisible:!c}),children:S(h,{className:`w-4 h-4`})}),S(E,{href:`/settings`,className:e({invisible:!B}),children:S(g,{})})]}),S(v,{isMine:se,enableCustomBackground:o,src:Z.background,onUnauthorizedClick:ce?Y:void 0}),C(s,{className:`flex-1 px-3`,children:[C(s,{className:`relative flex justify-end`,children:[S(_,{isMine:q,src:de,alt:Q||`avatar`,onUnauthorizedClick:J?Y:void 0}),S(s,{className:`flex divide-x divide-text1/5 py-4 h-12`})]}),C(s,{className:`flex items-center justify-between gap-1`,children:[P&&B?S(E,{href:`/edit`,children:S(l,{as:`p`,className:`text-text1 text-xl overflow-hidden whitespace-nowrap text-ellipsis font-bold `,children:Q})}):S(l,{as:`p`,className:`text-text1 text-xl overflow-hidden whitespace-nowrap text-ellipsis font-bold `,children:Q}),ue]}),S(s,{className:`min-h-11 pt-1 pb-0`,children:$&&S(l,{as:`p`,className:`text-sm line-clamp-2 break-all text-text1/66`,children:$})})]})]})}export{j as UserProfileHeaderClient};
2
+ "use client";import{cn as e}from"../../../../../utils/cn.mjs";import{Button as t}from"../../../../ui/button.mjs";import{useUserStore as n}from"../../../../../store/modules/user-store.mjs";import{gUserGetUserInfo as r,gUserViewUserInfo as i,pInteractionFollow as a,pInteractionUnfollow as o}from"../../../../../service/generated/client.mjs";import{Box as s}from"../../../../ui/box.mjs";import{Skeleton as c}from"../../../../ui/skeleton.mjs";import{Text as l}from"../../../../ui/text.mjs";import{useLoginModalStore as u}from"../../../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as d,useMutation as f,useRequest as p,useUpdateRequest as m}from"../../../../../hooks/query/use-query.mjs";import{LeftArrowIcon as h}from"../../../../common/icons/left-arrow.mjs";import{SettingIcon as g}from"../../../../common/icons/setting.mjs";import{UserProfileAvatar as _}from"./user-profile-avatar.mjs";import{UserProfileCoverBackground as v}from"./user-profile-cover-background.mjs";import{useEffect as y,useMemo as b,useState as x}from"react";import{jsx as S,jsxs as C}from"react/jsx-runtime";import{toast as w}from"sonner";import{useTranslations as T}from"next-intl";import E from"next/link";import{useRouter as ee}from"next/navigation";const D=n.persist,O=`https://guadd-sg-ccs-sing-dev.s3.ap-southeast-1.amazonaws.com/default/default_avatar.png`,k=`/images/mine/img_mine_head_bg.png`;function A({showBackButton:n,isMine:r,enableCustomBackground:i,className:a}){return C(s,{className:e(`flex flex-col relative`,a),children:[C(s,{className:`absolute top-0 p-3 z-10 flex items-center justify-between w-full`,children:[S(t,{variant:`ghost`,size:`icon-xs`,className:e(`h-4 w-4 p-0 hover:bg-transparent`,{invisible:!n}),disabled:!0,children:S(h,{className:`w-4 h-4`})}),S(s,{className:e({invisible:!r}),children:S(g,{})})]}),S(s,{className:i?`h-33.75`:`h-24`,children:S(c,{className:`h-full w-full rounded-none`})}),C(s,{className:`flex-1 px-3`,children:[C(s,{className:`relative flex justify-end`,children:[S(c,{className:`absolute bottom-3 left-0 h-22 w-22 rounded-full`}),S(s,{className:`py-4 h-12`})]}),C(s,{className:`flex items-center justify-between gap-1`,children:[S(c,{className:`h-7 w-[132px]`}),S(c,{className:`h-10 w-[104px] rounded-full shrink-0`})]}),C(s,{className:`min-h-11 pt-1 pb-0 flex flex-col gap-2`,children:[S(c,{className:`h-4 w-[76%]`}),S(c,{className:`h-4 w-[58%]`})]})]})]})}function te({userId:e,currentUserId:n,isFollowing:r}){let i=T(`components.pages.profile`),{open:s}=u(),c=d(),l=m(),{mutateAsync:p,isPending:h}=f(async e=>a(e)),{mutateAsync:g,isPending:_}=f(async e=>o(e)),v=h||_;async function y(){if(!v){if(!n){s();return}try{if(r){let t=await g({app_id:0,follower_id:n,followee_id:e});t.code===0?(w.success(i(`client.unfollowSuccess`)),b(!1),c([`check-follow`,e]),c([`user-profile`,`profile`,e])):w.error(t.message||i(`client.unfollowFailed`))}else{let t=await p({app_id:0,follower_id:n,followee_id:e});t.code===0?(w.success(i(`client.followSuccess`)),b(!0),c([`check-follow`,e]),c([`user-profile`,`profile`,e])):w.error(t.message||i(`client.followFailed`))}}catch(e){console.error(`关注操作失败`,e),w.error(i(`client.operationFailed`))}}}function b(t){l([`user-profile`,`profile`,e],e=>!e||!e.data?e:{...e,data:{...e.data,is_following:t}})}return S(t,{variant:r?`outline`:`default`,className:`rounded-full disabled:opacity-100`,onClick:y,disabled:v,children:i(v?`client.processing`:r?`client.followed`:`client.follow`)})}function j({id:a,enableCustomBackground:o=!0,showBackButton:c=!0,requireLogin:d=!1,isEditorPreview:f=!1,className:m,mode:w=`renderer`}){let j=T(`components.pages.profile`);T(`components.pages.profile.components`);let M=f||w===`editor`,N=!M,ne=ee(),{open:re}=u(),{isLogin:P,userId:F,token:ie}=n(),[ae,I]=x(!1);y(()=>{if(!D){I(!0);return}I(D.hasHydrated());let e=D.onHydrate(()=>{I(!1)}),t=D.onFinishHydration(()=>{I(!0)});return()=>{e(),t()}},[]);let L=M?!1:P&&!!F&&!!ie,R=M?``:F,z=R,B=a==null||!!a&&!!z&&a===z,oe=!B&&!!a,V=B?[`user-profile`,`mine`]:[`user-profile`,`profile`,a],{data:H,isLoading:U}=p(M?[`editor-preview`,...V]:V,()=>a?i({target_user_id:a,user_id:R||a}):r({user_id:a||R||``}),{staleTime:0,enabled:N&&(!!a||!!R)}),W=b(()=>{let e=H?H.data:void 0;return e?{userId:e.user_id,isFollowing:e.is_following||!1,name:e.nick_name||`User${a??``}`,avatar:e.avatar||O,followingCnt:e.following_count??0,followersCnt:e.follower_count??0,likeCnt:e.like_count??0,signature:e.signature||``,background:e.bg_image||k}:{}},[a,H]),G=M||d&&B&&!L,K=!G&&!L&&oe,q=B&&L&&!G,J=!L,se=o&&q,ce=o&&J,le={name:j(`client.welcomeToPlanet`),description:j(`client.exploreAdventures`),avatar:O,followingCnt:0,followersCnt:0,likeCnt:0,background:k};function Y(){re()}function X(){ne.back()}let ue=G?S(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:j(`client.loginNow`)}):K?S(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:j(`client.follow`)}):L?B?S(E,{href:`/edit`,children:S(t,{variant:`outline`,className:`rounded-full`,children:j(`client.editProfile`)})}):S(te,{userId:a||``,currentUserId:R,isFollowing:W?.isFollowing}):S(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:j(`client.loginNow`)}),Z=G?le:W,Q=Z.name||``,$=Z.description||Z.signature||``;Z.followingCnt,Z.followersCnt,Z.likeCnt;let de=Z.avatar||``;return N&&U&&!H?S(A,{showBackButton:c,isMine:B,enableCustomBackground:o,className:m}):C(s,{className:e(`flex flex-col relative`,m),children:[C(s,{className:`absolute top-0 p-3 z-10 flex items-center justify-between w-full`,children:[S(t,{variant:`ghost`,size:`icon-xs`,onClick:X,className:e(`h-4 w-4 p-0 hover:bg-transparent`,{invisible:!c}),children:S(h,{className:`w-4 h-4`})}),S(E,{href:`/settings`,className:e({invisible:!B}),children:S(g,{})})]}),S(v,{isMine:se,enableCustomBackground:o,src:Z.background,onUnauthorizedClick:ce?Y:void 0}),C(s,{className:`flex-1 px-3`,children:[C(s,{className:`relative flex justify-end`,children:[S(_,{isMine:q,src:de,alt:Q||`avatar`,onUnauthorizedClick:J?Y:void 0}),S(s,{className:`flex divide-x divide-text1/5 py-4 h-12`})]}),C(s,{className:`flex items-center justify-between gap-1`,children:[P&&B?S(E,{href:`/edit`,children:S(l,{as:`p`,className:`text-text1 max-w-[14em] text-xl overflow-hidden whitespace-nowrap text-ellipsis font-bold `,children:Q})}):S(l,{as:`p`,className:`text-text1 max-w-[14em] text-xl overflow-hidden whitespace-nowrap text-ellipsis font-bold `,children:Q}),ue]}),S(s,{className:`min-h-11 pt-1 pb-0`,children:$&&S(l,{as:`p`,className:`text-sm line-clamp-2 break-all text-text1/66`,children:$})})]})]})}export{j as UserProfileHeaderClient};
@@ -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{Text as n}from"../../ui/text.mjs";import{memo as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";const o=r(({item:r})=>{let o=r.img_x??r.img_y??``,s=r.name??r.id??``;return a(t,{className:`overflow-hidden rounded-[8px] shadow-sm`,children:[o?i(t,{className:`relative w-full aspect-video h-[240px]`,children:i(e,{src:o,alt:s,fill:!0,className:`object-cover`})}):null,i(t,{className:`py-[8px]`,children:i(n,{as:`h3`,className:`line-clamp-1 text-[16px] text-bold text-text1`,children:s})})]})});export{o as VideoListItemComponent};
2
+ "use client";import{Image as e}from"../../ui/image.mjs";import{Box as t}from"../../ui/box.mjs";import{Text as n}from"../../ui/text.mjs";import{memo as r,useMemo as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";const s=r(({item:r})=>{let s=r.img_x??r.img_y??``,c=r.name??r.id??``;function l(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}let u=i(()=>{let e=r.static?.browse_cnt??0;if(!Number.isFinite(e)||e<=0)return``;if(e>=1e6){let t=(e/1e6).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}M`:`${t}M`}if(e>=1e3){let t=(e/1e3).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}k`:`${t}k`}return Math.floor(e).toString()},[r]),d=i(()=>{let{type:e,duration:t,links:n}=r;if(e===1)return l(t??0);if(e===2)return`全${n?.length??0}集`},[r]);return o(t,{className:`overflow-hidden rounded-[8px] shadow-sm relative`,children:[s?a(t,{className:`relative w-full aspect-video h-[240px]`,children:a(e,{src:s,alt:c,fill:!0,className:`object-cover`})}):null,a(t,{className:`py-[8px]`,children:a(n,{as:`h3`,className:`line-clamp-1 text-[16px] text-bold text-text1`,children:c})}),u&&o(t,{className:`absolute z-[2] bottom-10 left-1 rounded-xs bg-black/60 px-1 text-[10px] text-white flex items-center gap-1`,children:[a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`10`,viewBox:`0 0 12 10`,fill:`none`,className:`shrink-0`,"aria-hidden":!0,children:a(`path`,{d:`M7.56 5.18437L5.013 6.56737C4.893 6.63337 4.761 6.66937 4.638 6.66937C4.269 6.66937 4.002 6.38737 4.002 5.99737V3.28237C4.002 2.89237 4.269 2.61037 4.638 2.61037C4.764 2.61037 4.893 2.64637 5.013 2.70937L7.572 4.09237C7.803 4.21837 7.938 4.41637 7.938 4.63237C7.938 4.85137 7.8 5.05537 7.56 5.18437ZM9.807 9.27637L2.133 8.52937C0.954 8.52937 0 7.57537 0 6.39637V2.79937C0 1.62037 0.954 0.666368 2.133 0.666368L9.81 0.000367165C10.989 0.000367165 11.943 0.954367 11.943 2.13337V7.14337C11.9422 7.70935 11.7168 8.25188 11.3163 8.65181C10.9158 9.05174 10.373 9.27637 9.807 9.27637ZM10.875 2.13337C10.875 1.99351 10.8475 1.85502 10.7939 1.72581C10.7404 1.5966 10.662 1.47919 10.5631 1.3803C10.4642 1.2814 10.3468 1.20296 10.2176 1.14944C10.0883 1.09591 9.94986 1.06837 9.81 1.06837L2.133 1.73437C1.99314 1.73437 1.85465 1.76191 1.72544 1.81544C1.59623 1.86896 1.47883 1.9474 1.37993 2.0463C1.28104 2.14519 1.20259 2.2626 1.14907 2.39181C1.09555 2.52102 1.068 2.65951 1.068 2.79937V6.39637C1.068 6.67882 1.1802 6.94971 1.37993 7.14944C1.57966 7.34916 1.85054 7.46137 2.133 7.46137L9.807 8.20837C9.94686 8.20837 10.0853 8.18082 10.2146 8.1273C10.3438 8.07378 10.4612 7.99533 10.5601 7.89644C10.659 7.79754 10.7374 7.68014 10.7909 7.55093C10.8445 7.42171 10.872 7.28323 10.872 7.14337V2.13337H10.875Z`,fill:`white`})}),a(n,{className:`text-white text-[12px] leading-[20px]`,children:u})]}),d&&a(t,{className:`absolute z-[2] bottom-10 right-1`,children:a(n,{className:`text-white text-[12px] leading-[20px]`,children:d})})]})});export{s as VideoListItemComponent};
@@ -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?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
9
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | 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?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
11
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
10
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
11
+ size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
12
12
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
13
13
  /** Button 组件属性。 */
14
14
  type ButtonProps = Button.Props & VariantProps<typeof buttonVariants> & {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funhub/platform",
3
3
  "type": "module",
4
- "version": "0.1.98",
4
+ "version": "0.1.100",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"