@funhub/platform 0.1.33 → 0.1.34
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/biz/business/large-feature-grid/card-item.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/client.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/default.mjs +2 -0
- package/dist/components/biz/business/large-feature-grid/types.d.mts +20 -0
- package/dist/components/biz/business/marquee/material.d.mts +1 -1
- package/dist/components/biz/business/marquee/schema.d.mts +2 -2
- package/dist/components/biz/business/profile/profile-header/client.d.mts +1 -0
- package/dist/components/biz/business/profile/profile-header/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/material.d.mts +5 -1
- package/dist/components/biz/business/profile/profile-header/schema.d.mts +10 -4
- package/dist/components/biz/business/profile/profile-header/schema.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/user-profile-cover-background.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/package.json +1 -1
- package/dist/components/biz/business/large-feature-grid/mock.mjs +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
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 r from"../../../ui/link.mjs";import i from"../../../../assets/icons/view.mjs";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s(e){if(e.duration===void 0||e.duration===null||e.duration===``)return null;let t=String(e.duration);if(t.includes(`集`))return t.startsWith(`全`)?t:`全${t.replace(/\D/g,``)}集`;let n=Number(e.duration);if(!Number.isNaN(n)&&n>0){let e=Math.floor(n),t=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60,a=e=>String(e).padStart(2,`0`);return t>0?`${a(t)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}return String(e.duration)}function c(e){if(e==null||e===``)return null;let t=Number(e);if(Number.isNaN(t))return String(e);if(t<1e3)return String(t);if(t<1e6){let e=(t/1e3).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}K`:`${e}K`}else{let e=(t/1e6).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}M`:`${e}M`}}function l(e){let t=e.tag_image||e.tag_image_url||e.tagImage||e.tagImageUrl;return t?String(t):null}function
|
|
2
|
+
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 r from"../../../ui/link.mjs";import i from"../../../../assets/icons/view.mjs";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s(e){if(e.duration===void 0||e.duration===null||e.duration===``)return null;let t=String(e.duration);if(t.includes(`集`))return t.startsWith(`全`)?t:`全${t.replace(/\D/g,``)}集`;let n=Number(e.duration);if(!Number.isNaN(n)&&n>0){let e=Math.floor(n),t=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60,a=e=>String(e).padStart(2,`0`);return t>0?`${a(t)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}return String(e.duration)}function c(e){if(e==null||e===``)return null;let t=Number(e);if(Number.isNaN(t))return String(e);if(t<1e3)return String(t);if(t<1e6){let e=(t/1e3).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}K`:`${e}K`}else{let e=(t/1e6).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}M`:`${e}M`}}function l(e,t,n){return t===`showPlayCount`?e.showPlayCount??n:t===`showEpisode`?e.showEpisode??n:n}function u(e){if(!l(e,`showPlayCount`,!0))return;let t=e.playCount,n=Number(e.playCountDelta??0);if(t==null||t===``)return t;let r=Number(t);return Number.isNaN(r)?t:r+(Number.isNaN(n)?0:n)}function d(e){let t=e.tag_image||e.tag_image_url||e.tagImage||e.tagImageUrl;return t?String(t):null}function f({data:f}){return f?a(t,{children:(Array.isArray(f)?f:[f]).map(f=>{let p=f.id?`/video/${f.id}/${f.title?encodeURIComponent(f.title):``}`:`#`,m=(e=>e===1?{text:`新剧`,fromColor:`#FD4C5E`,toColor:`#F05D19`,textColor:`#FFFFFF`}:e===2?{text:`热门`,fromColor:`#FFE485`,toColor:`#CF8125`,textColor:`#674100`}:null)(f.superscript),h=f.tag||m?.text,g=d(f),_=m?{from:m.fromColor,to:m.toColor,text:m.textColor}:{from:`#FD4C5E`,to:`#F05D19`,text:`#FFFFFF`},v=l(f,`showEpisode`,!0)?s(f):null,y=c(u(f));return a(t,{children:o(r,{href:p,children:[o(t,{className:`relative w-full overflow-hidden rounded-[12px] bg-neutral-800`,style:{aspectRatio:`16/9`},children:[f.cover&&a(e,{src:f.cover,alt:f.title,fill:!0,objectFit:`cover`}),g&&a(t,{className:`absolute right-0 top-0 z-10 h-[24px] w-[64px]`,children:a(e,{src:g,alt:f.title,fill:!0,objectFit:`contain`})}),!g&&h&&a(t,{className:`absolute right-0 top-0 flex items-center justify-center z-10`,style:{height:`24px`,padding:`0 10px`,borderTopRightRadius:`12px`,borderBottomLeftRadius:`18px`,background:`linear-gradient(to right, ${_.from}, ${_.to})`,color:_.text},children:a(n,{as:`span`,className:`text-[13px] font-medium leading-none`,children:h})}),a(t,{className:`absolute inset-x-0 bottom-0 h-[40px] bg-gradient-to-t from-black/80 to-transparent z-0 pointer-events-none`}),y&&o(t,{className:`absolute bottom-0 left-[8px] mb-[6px] z-10 flex items-center gap-[4px]`,children:[a(i,{className:`h-[14px] w-[14px] text-white`}),a(n,{as:`span`,className:`text-[12px] font-medium text-white drop-shadow-md`,children:y})]}),v&&a(t,{className:`absolute bottom-0 right-[8px] mb-[6px] z-10 flex items-center`,children:a(n,{as:`span`,className:`text-[12px] font-medium text-white drop-shadow-md`,children:v})})]}),o(t,{className:`flex items-center justify-between gap-[12px] pt-[10px] px-2`,children:[o(t,{className:`flex-1 min-w-0`,children:[a(n,{as:`h3`,className:`text-[16px] font-semibold leading-[24px] text-text1 line-clamp-1`,children:f.title}),f.desc&&a(n,{as:`p`,className:`mt-[4px] text-[13px] leading-[20px] text-text2 line-clamp-1`,children:f.desc})]}),a(n,{className:`shrink-0 rounded-[20px] border border-[#FD4C5E] px-[24px] py-[8px] text-[14px] font-normal text-[#FD4C5E]`,children:`观看`})]})]})},f.id||f.title)})}):null}export{f as LargeGridItemClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Box as e}from"../../../ui/box.mjs";import{Text as t}from"../../../ui/text.mjs";import n from"../../../ui/link.mjs";import r from"../../../../assets/icons/common/right_arrow.mjs";import{LargeGridItemClient as i}from"./card-item.mjs";import{
|
|
2
|
+
"use client";import{Box as e}from"../../../ui/box.mjs";import{Text as t}from"../../../ui/text.mjs";import n from"../../../ui/link.mjs";import r from"../../../../assets/icons/common/right_arrow.mjs";import{LargeGridItemClient as i}from"./card-item.mjs";import{defaultData as a}from"./default.mjs";import{jsx as o,jsxs as s}from"react/jsx-runtime";const c=[];function l(e){return e==null||e===``}function u(e,t){return l(e)?t:e}function d(e,t){return t?{...e,...t,id:u(t.id,e.id),cover:u(t.cover,e.cover),title:u(t.title,e.title),desc:u(t.desc,e.desc),tag:u(t.tag,e.tag),superscript:t.superscript??e.superscript,playCount:u(t.playCount,e.playCount),playCountDelta:t.playCountDelta??e.playCountDelta,showPlayCount:t.showPlayCount??e.showPlayCount,duration:u(t.duration,e.duration),showEpisode:t.showEpisode??e.showEpisode,useContentCover:t.useContentCover??e.useContentCover,tagImageUrl:u(t.tagImageUrl,e.tagImageUrl),tag_image:u(t.tag_image,e.tag_image),tag_image_url:u(t.tag_image_url,e.tag_image_url),tagImage:u(t.tagImage,e.tagImage)}:e}function f(e,t){if(!t)return e;let n=e.items;return{...e,...t,title:u(t.title,e.title),moreUrl:u(t.moreUrl,e.moreUrl),moreLinkType:t.moreLinkType??e.moreLinkType,recommendMode:t.recommendMode??e.recommendMode,items:n?d(n,t.items):t.items}}function p({data:l=c}){let u=Array.isArray(l)&&l.length>0?[f(a[0],l[0])]:a;if(!u||u.length===0)return null;let d=u[0],p=d?.title,m=d?.moreUrl;return s(e,{className:`p-3`,children:[s(e,{className:`flex items-center justify-between mb-[10px] h-[24px]`,children:[p&&o(t,{as:`h2`,className:`text-[18px] font-bold text-text1 line-clamp-1 flex-1 min-w-0 mr-[12px]`,children:p}),m&&s(n,{href:m,className:`flex items-center text-[14px] text-text2 ml-auto`,children:[`更多`,o(r,{className:`ml-[2px] h-[12px] w-[12px] text-text2`})]})]}),u.map((t,n)=>{let{items:r}=t;return r?o(e,{className:n>0?`mt-3`:``,children:o(i,{data:r})},`large-feature-grid-items-${n}`):null})]})}export{p as LargeFeatureGridClient};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
const e=[{title:`推荐位名称`,moreUrl:`/channel`,items:{id:`22edc8693ebbdaf1`,cover:`https://base-resources.guadd.fun/md-204/dcc-file/f7/f70a9f9f0c17aa9aff6c3a3e03a822db-small.jpg`,tag:`独家`,playCount:0,playCountDelta:0,showPlayCount:!0,duration:0,showEpisode:!0,useContentCover:!0,title:`穷小伙一睁眼穿越古代,娶个老婆就能得到奖励,后宫3000宠都宠不过来!谁料女帝主动送上门来,征服女帝可以直接开终极宝箱,不用选择全都可以!`,desc:`穷小伙一睁眼穿越古代,娶个老婆就能得到奖励,后宫3000宠都宠不过来!谁料女帝主动送上门来,征服女帝可以直接开终极宝箱,不用选择全都可以!`}}];export{e as defaultData};
|
|
@@ -14,18 +14,38 @@ interface LargeGridItem {
|
|
|
14
14
|
superscript?: 0 | 1 | 2;
|
|
15
15
|
/** 播放量 */
|
|
16
16
|
playCount?: string | number;
|
|
17
|
+
/** 播放量增量 */
|
|
18
|
+
playCountDelta?: number;
|
|
19
|
+
/** 是否展示播放量,默认 true */
|
|
20
|
+
showPlayCount?: boolean;
|
|
17
21
|
/** 视频时长或剧集数 */
|
|
18
22
|
duration?: string | number;
|
|
23
|
+
/** 是否展示时长/集数,默认 true */
|
|
24
|
+
showEpisode?: boolean;
|
|
19
25
|
/** 内容标题 */
|
|
20
26
|
title: string;
|
|
21
27
|
/** 内容描述 */
|
|
22
28
|
desc?: string;
|
|
29
|
+
/** 是否沿用内容海报(渲染层只做透传兼容) */
|
|
30
|
+
useContentCover?: boolean;
|
|
31
|
+
/** 角标图 URL(主字段) */
|
|
32
|
+
tagImageUrl?: string;
|
|
33
|
+
/** 角标图 URL(历史兼容字段) */
|
|
34
|
+
tag_image?: string;
|
|
35
|
+
/** 角标图 URL(历史兼容字段) */
|
|
36
|
+
tag_image_url?: string;
|
|
37
|
+
/** 角标图 URL(历史兼容字段) */
|
|
38
|
+
tagImage?: string;
|
|
23
39
|
}
|
|
24
40
|
interface LargeGridData {
|
|
25
41
|
/** 推荐位名称 */
|
|
26
42
|
title?: string;
|
|
27
43
|
/** 更多链接地址 */
|
|
28
44
|
moreUrl?: string;
|
|
45
|
+
/** 更多链接类型(编辑态持久字段) */
|
|
46
|
+
moreLinkType?: 'content-list' | 'content' | 'url';
|
|
47
|
+
/** 推荐位内容类型(编辑态持久字段) */
|
|
48
|
+
recommendMode?: 'content' | 'algorithm';
|
|
29
49
|
/** 卡片内容 */
|
|
30
50
|
items?: LargeGridItem;
|
|
31
51
|
}
|
|
@@ -15,7 +15,7 @@ declare const marqueeMaterial: DefineMaterialOption<typeof MarqueeServer, typeof
|
|
|
15
15
|
contents: zod.ZodArray<zod.ZodObject<{
|
|
16
16
|
text: zod.ZodString & SchemaHasDefaultValue;
|
|
17
17
|
enableClick: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
18
|
-
linkType: zod.ZodType<"content" | "
|
|
18
|
+
linkType: zod.ZodType<"content" | "content-list" | "url", unknown, zod_v4_core0.$ZodTypeInternals<"content" | "content-list" | "url", unknown>> & SchemaHasDefaultValue;
|
|
19
19
|
link: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
20
20
|
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
21
21
|
showClose: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
@@ -11,7 +11,7 @@ declare const marqueeInspectorPropsSchema: z$1.ZodObject<{
|
|
|
11
11
|
contents: z$1.ZodArray<z$1.ZodObject<{
|
|
12
12
|
text: z$1.ZodString & SchemaHasDefaultValue;
|
|
13
13
|
enableClick: z$1.ZodBoolean & SchemaHasDefaultValue;
|
|
14
|
-
linkType: z$1.ZodType<"content" | "
|
|
14
|
+
linkType: z$1.ZodType<"content" | "content-list" | "url", unknown, z$1.core.$ZodTypeInternals<"content" | "content-list" | "url", unknown>> & SchemaHasDefaultValue;
|
|
15
15
|
link: z$1.ZodOptional<z$1.ZodString> & SchemaHasDefaultValue;
|
|
16
16
|
}, z$1.core.$strip>> & SchemaHasDefaultValue;
|
|
17
17
|
showClose: z$1.ZodBoolean & SchemaHasDefaultValue;
|
|
@@ -23,7 +23,7 @@ declare const marqueeInspectorDefaultProps: {
|
|
|
23
23
|
contents: {
|
|
24
24
|
text: string;
|
|
25
25
|
enableClick: boolean;
|
|
26
|
-
linkType: "content" | "
|
|
26
|
+
linkType: "content" | "content-list" | "url";
|
|
27
27
|
link?: string | undefined;
|
|
28
28
|
}[];
|
|
29
29
|
showClose: boolean;
|
|
@@ -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{useDeleteRequest as u,useMutation as d,useRequest as f,useUpdateRequest as p}from"../../../../../hooks/query/use-query.mjs";import{useAppContext as m}from"../../../../../hooks/use-app-context/index.mjs";import{useLoginModalStore as h}from"../../../../../store/modules/login-modal-store.mjs";import{LeftArrowIcon as g}from"../../../../common/icons/left-arrow.mjs";import{SettingIcon as _}from"../../../../common/icons/setting.mjs";import{UserProfileAvatar as v}from"./user-profile-avatar.mjs";import{UserProfileCoverBackground as y}from"./user-profile-cover-background.mjs";import{useEffect as b,useMemo as ee,useState as
|
|
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{useDeleteRequest as u,useMutation as d,useRequest as f,useUpdateRequest as p}from"../../../../../hooks/query/use-query.mjs";import{useAppContext as m}from"../../../../../hooks/use-app-context/index.mjs";import{useLoginModalStore as h}from"../../../../../store/modules/login-modal-store.mjs";import{LeftArrowIcon as g}from"../../../../common/icons/left-arrow.mjs";import{SettingIcon as _}from"../../../../common/icons/setting.mjs";import{UserProfileAvatar as v}from"./user-profile-avatar.mjs";import{UserProfileCoverBackground as y}from"./user-profile-cover-background.mjs";import{useEffect as b,useMemo as ee,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 te}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 ne({userId:e,currentUserId:n,isFollowing:r}){let i=T(`components.pages.profile`),{open:s}=h(),c=u(),l=p(),{mutateAsync:f,isPending:m}=d(async e=>a(e)),{mutateAsync:g,isPending:_}=d(async e=>o(e)),v=m||_;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 f({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 A({showBackButton:t=!0,enableCustomBackground:n=!0,className:r}){return C(s,{className:e(`flex flex-col relative`,r),children:[C(s,{className:`absolute top-0 p-3 z-10 flex items-center justify-between w-full`,children:[S(c,{className:e(`w-4 h-4 rounded-sm bg-muted`,{invisible:!t})}),S(c,{className:`w-4 h-4 rounded-sm bg-muted`})]}),S(s,{className:e(n?`h-33.75`:`h-16`),children:n?S(c,{className:`h-full w-full rounded-none bg-white/10`}):S(s,{className:`h-full w-full bg-bg1`})}),C(s,{className:`flex-1 px-3`,children:[C(s,{className:`relative flex justify-end`,children:[S(c,{className:`!absolute bottom-3 left-0 w-22 h-22 rounded-full animate-none`}),C(s,{className:`flex divide-x divide-text1/5 py-4`,children:[C(s,{className:`px-4 flex flex-col items-center gap-1`,children:[S(c,{className:`w-8 h-4`}),S(c,{className:`w-10 h-3`})]}),C(s,{className:`px-4 flex flex-col items-center gap-1`,children:[S(c,{className:`w-8 h-4`}),S(c,{className:`w-10 h-3`})]}),C(s,{className:`px-4 flex flex-col items-center gap-1`,children:[S(c,{className:`w-8 h-4`}),S(c,{className:`w-10 h-3`})]})]})]}),C(s,{className:`flex items-center justify-between gap-1`,children:[S(c,{className:`h-6 w-26`}),S(c,{className:`h-9 w-20 rounded-full`})]}),S(c,{className:`h-4 w-2/3 mt-2`})]})]})}function j({id:a,enableCustomBackground:o=!0,showBackButton:c=!0,requireLogin:u=!1,cookieToken:d,cookieUserId:p,isEditorPreview:w=!1,className:j}){let M=T(`components.pages.profile`),N=T(`components.pages.profile.components`),re=m(),P=w||re===`editor`,ie=!P,ae=te(),{open:F}=h(),{isLogin:oe,userId:I,token:se}=n(),[L,R]=x(!1);b(()=>{if(!D){R(!0);return}R(D.hasHydrated());let e=D.onHydrate(()=>{R(!1)}),t=D.onFinishHydration(()=>{R(!0)});return()=>{e(),t()}},[]);let z=L?oe&&!!I&&!!se:!!p&&!!d,B=L?I:I||p,V=B,H=a==null||!!a&&!!V&&a===V,ce=!H&&!!a,U=H?[`user-profile`,`mine`]:[`user-profile`,`profile`,a],{data:W}=f(P?[`editor-preview`,...U]:U,()=>a?i({target_user_id:a,user_id:B||a}):r({user_id:a||B||``}),{staleTime:0,enabled:ie&&(!!a||!!B)}),G=ee(()=>{let e=W?W.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,W]),K=u&&H&&!z,le=!z&&ce,q=H&&z&&!K,J=!z,ue=o&&q,de=o&&J,fe={name:M(`client.welcomeToPlanet`),description:M(`client.exploreAdventures`),avatar:O,followingCnt:0,followersCnt:0,likeCnt:0,background:k};function Y(){F()}function pe(){ae.back()}function X(e){!H||z||(e.preventDefault(),e.stopPropagation(),F())}let me=K?S(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:M(`client.loginNow`)}):le?S(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:M(`client.follow`)}):z?H?S(E,{href:`/edit`,children:S(t,{variant:`outline`,className:`rounded-full`,children:M(`client.editProfile`)})}):S(ne,{userId:a||``,currentUserId:B,isFollowing:G?.isFollowing}):S(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:M(`client.loginNow`)}),Z=K?fe:G,Q=Z.name||``,$=Z.description||Z.signature||``,he=Z.followingCnt??0,ge=Z.followersCnt??0,_e=Z.likeCnt??0,ve=Z.avatar||``;return P?S(A,{showBackButton:c,enableCustomBackground:o,className:j}):C(s,{className:e(`flex flex-col relative`,j),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:pe,className:e(`h-4 w-4 p-0 hover:bg-transparent`,{invisible:!c}),children:S(g,{className:`w-4 h-4`})}),S(E,{href:`/settings`,className:e({invisible:!H}),children:S(_,{})})]}),S(y,{isMine:ue,enableCustomBackground:o,src:Z.background,onUnauthorizedClick:de?Y:void 0}),C(s,{className:`flex-1 px-3`,children:[C(s,{className:`relative flex justify-end`,children:[S(v,{isMine:q,src:ve,alt:Q||`avatar`,onUnauthorizedClick:J?Y:void 0}),C(s,{className:`flex divide-x divide-text1/5 py-4`,children:[S(E,{href:H?`/followed`:`/followed?user_id=${Z.userId}`,onClick:X,children:C(s,{className:`px-4 flex flex-col items-center`,children:[S(l,{className:`font-bold text-base`,children:he}),S(l,{className:`font-normal text-sm text-text1/66`,children:N(`userProfileHeader.follow`)})]})}),S(E,{href:H?`/fans`:`/fans?user_id=${Z.userId}`,onClick:X,children:C(s,{className:`px-4 flex flex-col items-center`,children:[S(l,{className:`font-bold text-base`,children:ge}),S(l,{className:`font-normal text-sm text-text1/66`,children:N(`userProfileHeader.fans`)})]})}),C(s,{className:`px-4 flex flex-col items-center`,children:[S(l,{className:`font-bold text-base`,children:_e}),S(l,{className:`font-normal text-sm text-text1/66`,children:N(`userProfileHeader.likesReceived`)})]})]})]}),C(s,{className:`flex items-center justify-between gap-1`,children:[S(l,{as:`p`,className:`text-text1 text-xl line-clamp-2 font-bold`,children:Q}),me]}),$&&S(l,{as:`p`,className:`text-sm py-1 line-clamp-3 text-text1/66`,children:$})]})]})}export{j as UserProfileHeaderClient};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
|
|
2
|
+
import { SchemaHasDefaultValue } from "../../../../../utils/schema/schema.mjs";
|
|
2
3
|
import { DefineMaterialOption } from "../../../../../utils/schema/material.mjs";
|
|
4
|
+
import "../../../../../utils/schema/index.mjs";
|
|
3
5
|
import { UserProfileHeaderClient } from "./client.mjs";
|
|
4
6
|
import { UserProfileHeader } from "./server.mjs";
|
|
5
7
|
import * as zod from "zod";
|
|
6
8
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
9
|
|
|
8
10
|
//#region components/biz/business/profile/profile-header/material.d.ts
|
|
9
|
-
declare const profileHeaderMaterial: DefineMaterialOption<typeof UserProfileHeader, typeof UserProfileHeaderClient, zod.ZodObject<{
|
|
11
|
+
declare const profileHeaderMaterial: DefineMaterialOption<typeof UserProfileHeader, typeof UserProfileHeaderClient, zod.ZodObject<{
|
|
12
|
+
enableCustomBackground: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
13
|
+
}, zod_v4_core0.$strip>, "profile-header">;
|
|
10
14
|
//#endregion
|
|
11
15
|
export { profileHeaderMaterial };
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
|
|
2
|
-
import { InferSchemaProps } from "../../../../../utils/schema/schema.mjs";
|
|
2
|
+
import { InferSchemaProps, SchemaHasDefaultValue } from "../../../../../utils/schema/schema.mjs";
|
|
3
3
|
import "../../../../../utils/schema/index.mjs";
|
|
4
4
|
import * as zod from "zod";
|
|
5
5
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
6
6
|
|
|
7
7
|
//#region components/biz/business/profile/profile-header/schema.d.ts
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* 用户资料头部物料 inspector 配置。
|
|
10
10
|
*/
|
|
11
|
-
declare const profileHeaderInspectorPropsSchema: zod.ZodObject<{
|
|
12
|
-
|
|
11
|
+
declare const profileHeaderInspectorPropsSchema: zod.ZodObject<{
|
|
12
|
+
enableCustomBackground: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
13
|
+
}, zod_v4_core0.$strip>;
|
|
14
|
+
declare const profileHeaderInspectorDefaultProps: {
|
|
15
|
+
enableCustomBackground: boolean;
|
|
16
|
+
};
|
|
13
17
|
type ProfileHeaderInspectorProps = InferSchemaProps<typeof profileHeaderInspectorPropsSchema>;
|
|
14
18
|
interface UserProfileHeaderAuthConfig {
|
|
15
19
|
headers?: Record<string, string>;
|
|
@@ -17,6 +21,8 @@ interface UserProfileHeaderAuthConfig {
|
|
|
17
21
|
interface UserProfileHeaderClientProps {
|
|
18
22
|
/** 用户 ID。 */
|
|
19
23
|
id?: string;
|
|
24
|
+
/** 是否允许自定义背景图。 */
|
|
25
|
+
enableCustomBackground?: boolean;
|
|
20
26
|
/** 是否显示返回按钮。 */
|
|
21
27
|
showBackButton?: boolean;
|
|
22
28
|
/** 是否要求登录。 */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{defineComponentPropsSchema as e,getSchemaDefaultProps as
|
|
2
|
+
import{defineComponentPropsSchema as e,defineSwitchPropSchema as t,getSchemaDefaultProps as n}from"../../../../../utils/schema/schema.mjs";const r=e({enableCustomBackground:t({label:`允许自定义背景图`,defaultValue:!0})}),i=n(r);export{i as profileHeaderInspectorDefaultProps,r as profileHeaderInspectorPropsSchema};
|
package/dist/components/biz/business/profile/profile-header/user-profile-cover-background.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pUserUploadUserBgImage as t}from"../../../../../service/generated/client.mjs";import{uploadFile as n}from"../../../../../utils/upload-file.mjs";import{Image as r}from"../../../../ui/image.mjs";import{Box as i}from"../../../../ui/box.mjs";import{Input as a}from"../../../../ui/input.mjs";import{useDeleteRequest as o}from"../../../../../hooks/query/use-query.mjs";import{BackgroundPreviewModal as s}from"../../../../common/background-preview-modal/background-preview-modal.mjs";import{showImageCrop as c}from"../../../../common/image-crop/show-image-crop.mjs";import{
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pUserUploadUserBgImage as t}from"../../../../../service/generated/client.mjs";import{uploadFile as n}from"../../../../../utils/upload-file.mjs";import{Image as r}from"../../../../ui/image.mjs";import{Box as i}from"../../../../ui/box.mjs";import{Input as a}from"../../../../ui/input.mjs";import{useDeleteRequest as o}from"../../../../../hooks/query/use-query.mjs";import{BackgroundPreviewModal as s}from"../../../../common/background-preview-modal/background-preview-modal.mjs";import{showImageCrop as c}from"../../../../common/image-crop/show-image-crop.mjs";import{useEffect as l,useRef as u,useState as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{toast as h}from"sonner";const g=[`image/jpeg`,`image/png`];function _(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return g.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function v({isMine:g,enableCustomBackground:v=!0,src:y,onUnauthorizedClick:b}){let x=`/images/mine/img_mine_head_bg.png`,S=u(null),{userId:C,setUserInfo:w,userInfo:T}=e(),E=o(),[D,O]=d(!1),[k,A]=d(!1),j=v&&(!!g||typeof b==`function`);l(()=>{v||A(!1)},[v]);let M=()=>{if(v){if(g){D||A(!0);return}b?.()}},N=()=>{A(!1)};function P(){D||S.current?.click()}async function F(e){let r=e.target.files?.[0];if(e.target&&(e.target.value=``),r)try{if(!_(r)){h.error(`仅支持 JPG/JPEG/PNG 格式`);return}O(!0);let e=await n(await c(r,{aspectRatio:430/256,cropShape:`rect`,quality:.92,maxWidth:1920,maxHeight:1920}),1);await t({user_id:String(C),bg_image:e.objectKey}),w({...T,bg_image:e.objectKey}),E([`user-profile`,`mine`]),A(!1),h.success(`更换完成`)}catch(e){console.error(`上传背景图失败`,e),e instanceof Error&&e.message!==`用户取消`&&h.error(`背景图上传失败,请稍后再试`)}finally{O(!1)}}return m(f,{children:[p(i,{className:v?`h-33.75`:`h-16`,children:v?p(i,{className:`relative h-full w-full`,onClick:j?M:void 0,children:p(r,{alt:`cover background`,fill:!0,objectFit:`cover`,className:`pointer-events-none`,src:y||x})}):p(i,{className:`h-full w-full bg-bg1`})}),v&&m(f,{children:[p(s,{open:k,onClose:N,bgUrl:y||x,onUpload:P}),p(a,{ref:S,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:F})]})]})}export{v as UserProfileCoverBackground};
|
|
@@ -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" | "
|
|
9
|
+
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
/** Badge 组件。 */
|
|
12
12
|
declare function Badge({
|
|
@@ -8,7 +8,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
8
8
|
//#region components/ui/button-group.d.ts
|
|
9
9
|
/** buttonGroupVariants 工具定义。 */
|
|
10
10
|
declare const buttonGroupVariants: (props?: ({
|
|
11
|
-
orientation?: "
|
|
11
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
13
13
|
/** ButtonGroupText 组件属性。 */
|
|
14
14
|
type ButtonGroupTextProps = useRender.ComponentProps<'div'>;
|
|
@@ -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" | "
|
|
11
|
-
size?: "default" | "
|
|
10
|
+
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "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> & {
|
|
@@ -51,7 +51,7 @@ declare function FieldGroup({
|
|
|
51
51
|
}: FieldGroupProps): react_jsx_runtime0.JSX.Element;
|
|
52
52
|
/** fieldVariants 工具定义。 */
|
|
53
53
|
declare const fieldVariants: (props?: ({
|
|
54
|
-
orientation?: "
|
|
54
|
+
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
55
55
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
56
56
|
/** Field 组件。 */
|
|
57
57
|
declare function Field({
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const e=[{title:`推荐位名称`,moreUrl:`/channel`,items:{id:`22edc8693ebbdaf1`,cover:`https://base-resources.guadd.fun/md-204/dcc-file/f7/f70a9f9f0c17aa9aff6c3a3e03a822db-small.jpg`,tag:`独家`,playCount:1205,duration:3665,title:`穷小伙一睁眼穿越古代,娶个老婆就能得到奖励,后宫3000宠都宠不过来!谁料女帝主动送上门来,征服女帝可以直接开终极宝箱,不用选择全都可以!`,desc:`穷小伙一睁眼穿越古代,娶个老婆就能得到奖励,后宫3000宠都宠不过来!谁料女帝主动送上门来,征服女帝可以直接开终极宝箱,不用选择全都可以!`}},{items:{id:`242686c512b41c98`,cover:`https://base-resources.guadd.fun/md-204/dcc-file/2c/2cd615a5e471d2bc8a9ccd95038c9067.jpg`,tag:`独家`,playCount:1205,duration:3665,title:`老神医都治不好老爷子的绝症,美女总裁路边随便拉来的穷小伙竟一针救活,老爷子醒后直接把女总裁嫁他,九世的有缘无分换来今世的相守终生`,desc:`老神医都治不好老爷子的绝症,美女总裁路边随便拉来的穷小伙竟一针救活,老爷子醒后直接把女总裁嫁他,九世的有缘无分换来今世的相守终生`}}];export{e as mockData};
|