@funhub/platform 0.1.36 → 0.1.38

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.
Files changed (105) hide show
  1. package/config/tailwind/index.cjs +4 -0
  2. package/config/tailwind/index.mjs +4 -0
  3. package/dist/assets/images/subscript.mjs +2 -0
  4. package/dist/biz.mjs +1 -1
  5. package/dist/components/biz/business/comment/comment-input.mjs +1 -1
  6. package/dist/components/biz/business/detail/detail-operate.mjs +1 -1
  7. package/dist/components/biz/business/detail/materials/editor-preview.mjs +2 -0
  8. package/dist/components/biz/business/detail/materials/registry.d.mts +1 -1
  9. package/dist/components/biz/business/detail/materials/video-detail-actions/client.mjs +1 -1
  10. package/dist/components/biz/business/detail/materials/video-detail-info/client.d.mts +1 -1
  11. package/dist/components/biz/business/detail/materials/video-detail-info/client.mjs +1 -1
  12. package/dist/components/biz/business/detail/materials/video-detail-info/material.mjs +1 -1
  13. package/dist/components/biz/business/detail/materials/video-detail-info/schema.d.mts +2 -2
  14. package/dist/components/biz/business/detail/materials/video-detail-info/server.d.mts +1 -1
  15. package/dist/components/biz/business/detail/materials/video-detail-info-title/client.d.mts +1 -1
  16. package/dist/components/biz/business/detail/materials/video-detail-info-title/client.mjs +1 -1
  17. package/dist/components/biz/business/detail/materials/video-detail-info-title/material.mjs +1 -1
  18. package/dist/components/biz/business/detail/materials/video-detail-info-title/schema.d.mts +2 -2
  19. package/dist/components/biz/business/detail/materials/video-detail-info-title/server.d.mts +1 -1
  20. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.d.mts +1 -1
  21. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.mjs +1 -1
  22. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/material.mjs +1 -1
  23. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/schema.d.mts +2 -2
  24. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/server.d.mts +1 -1
  25. package/dist/components/biz/business/detail/materials/video-detail-player/client.mjs +1 -1
  26. package/dist/components/biz/business/detail/materials/video-detail-recommend/client.mjs +1 -1
  27. package/dist/components/biz/business/detail/materials/video-detail-recommend/material.d.mts +1 -1
  28. package/dist/components/biz/business/detail/materials/video-detail-recommend/material.mjs +1 -1
  29. package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.d.mts +1 -1
  30. package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.mjs +1 -1
  31. package/dist/components/biz/business/detail/video-hero.mjs +1 -1
  32. package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
  33. package/dist/components/biz/business/home-recommend/shared/home-recommend-preview.mjs +2 -0
  34. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.d.mts +4 -0
  35. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.mjs +1 -1
  36. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.d.mts +2 -0
  37. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.mjs +1 -1
  38. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/client.mjs +1 -1
  39. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/schema/component.mjs +1 -1
  40. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/server.mjs +1 -1
  41. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/defaults/default-props.d.mts +1 -3
  42. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/defaults/default-props.mjs +1 -1
  43. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.d.mts +4 -2
  44. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.mjs +1 -1
  45. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.d.mts +2 -1
  46. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.mjs +1 -1
  47. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.mjs +1 -1
  48. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/component.mjs +1 -1
  49. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/props.schema.mjs +1 -1
  50. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/server.mjs +1 -1
  51. package/dist/components/biz/business/index.mjs +1 -1
  52. package/dist/components/biz/business/large-feature-grid/client.mjs +1 -1
  53. package/dist/components/biz/business/large-feature-grid/material.d.mts +4 -3
  54. package/dist/components/biz/business/large-feature-grid/material.mjs +1 -1
  55. package/dist/components/biz/business/large-feature-grid/schema.mjs +1 -1
  56. package/dist/components/biz/business/marquee/material.d.mts +1 -1
  57. package/dist/components/biz/business/marquee/schema.d.mts +1 -1
  58. package/dist/components/biz/business/profile/profile-header/client.mjs +1 -1
  59. package/dist/components/biz/business/profile/profile-header/material.mjs +1 -1
  60. package/dist/components/biz/business/profile/profile-main/material.mjs +1 -1
  61. package/dist/components/biz/business/profile/profile-main/server.mjs +1 -1
  62. package/dist/components/biz/business/profile/profile-main/shell.mjs +1 -1
  63. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.mjs +1 -1
  64. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/server.mjs +1 -1
  65. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.mjs +1 -1
  66. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/server.mjs +1 -1
  67. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +1 -1
  68. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/server.mjs +1 -1
  69. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/client.d.mts +1 -1
  70. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/client.mjs +1 -1
  71. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/server.mjs +1 -1
  72. package/dist/components/biz/business/profile/profile-main/utils.mjs +1 -1
  73. package/dist/components/biz/business/profile/profile-main/variants.d.mts +3 -3
  74. package/dist/components/biz/business/profile/profile-main/variants.mjs +1 -1
  75. package/dist/components/biz/business/search-history/client.mjs +1 -1
  76. package/dist/components/biz/business/shortcut-grid/material.d.mts +1 -1
  77. package/dist/components/biz/business/shortcut-grid/schema.d.mts +1 -1
  78. package/dist/components/biz/business/shortcut-grid/schema.mjs +1 -1
  79. package/dist/components/biz/business/tab-bar/client.mjs +1 -1
  80. package/dist/components/biz/business/tab-bar/material.d.mts +6 -2
  81. package/dist/components/biz/business/tab-bar/schema.d.mts +6 -2
  82. package/dist/components/biz/business/tab-bar/schema.mjs +1 -1
  83. package/dist/components/biz/business/video-horizontal-list/client.mjs +1 -1
  84. package/dist/components/biz/business/video-horizontal-list/schema.mjs +1 -1
  85. package/dist/components/common/list/collection-list/collection-list-item.d.mts +1 -0
  86. package/dist/components/common/list/collection-list/collection-list-item.mjs +1 -1
  87. package/dist/components/common/list/post-list/post-list.d.mts +2 -0
  88. package/dist/components/common/list/post-list/post-list.mjs +1 -1
  89. package/dist/components/common/list/video-list/video-list.d.mts +2 -0
  90. package/dist/components/common/list/video-list/video-list.mjs +1 -1
  91. package/dist/components/pages/collection-create/form.mjs +1 -1
  92. package/dist/components/pages/collection-detail/_components/collection-detail-card.mjs +1 -1
  93. package/dist/components/pages/collection-detail/detail.mjs +1 -1
  94. package/dist/components/pages/feedback/_components/feedback-form.mjs +1 -1
  95. package/dist/components/ui/image.d.mts +4 -4
  96. package/dist/i18n/locales/en.mjs +1 -1
  97. package/dist/i18n/locales/zh-CN.mjs +1 -1
  98. package/dist/utils/schema/material.d.mts +1 -1
  99. package/package.json +1 -1
  100. package/theme.css +4 -0
  101. package/dist/components/biz/business/large-feature-grid/client.d.mts +0 -15
  102. package/dist/components/biz/business/large-feature-grid/default.mjs +0 -2
  103. package/dist/components/biz/business/large-feature-grid/server.d.mts +0 -13
  104. package/dist/components/biz/business/large-feature-grid/types.d.mts +0 -53
  105. package/dist/components/common/icons/edit.mjs +0 -2
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionUnifiedBatchLikeDislike as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Tabs as a,TabsList as o,TabsTrigger as s}from"../../../../../../ui/tabs.mjs";import{Text as c}from"../../../../../../ui/text.mjs";import{useMutation as l,usePaginated as u,useUpdateRequest as d}from"../../../../../../../hooks/query/use-query.mjs";import{useAppContext as ee}from"../../../../../../../hooks/use-app-context/index.mjs";import{PostList as f}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as te}from"../../../../../../common/list/video-list/video-list.mjs";import{getLikeData as p,likeContentType as m}from"../../utils.mjs";import{useEffect as h,useMemo as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{toast as b}from"sonner";import{useTranslations as x}from"next-intl";import{parseAsString as ne,useQueryState as S}from"nuqs";function C(e,t,n){if(!e)return e;let r=0,i=e.pages.map(e=>({page:e,filteredList:(e.data?.list??[]).filter(e=>{let i=n(e)??``,a=t.has(i);return a&&(r+=1),!a})}));return{...e,pages:i.map(({page:e,filteredList:t})=>{if(!e.data)return e;let n=typeof e.data.total==`number`?Math.max(0,e.data.total-r):e.data.total;return{...e,data:{...e.data,list:t,total:n}}})}}function w(e){let{detail:t}=e,{info:n,publish_time:r}=t;return{id:e.id,title:n?.name||n?.text||n?.content||``,coverImage:n?.cover_image_thumbnail||n?.cover_image||n?.cover_horizontal_image_thumbnail||``,publishTime:r??0}}function T(e){let{detail:t}=e,{user_info:n,info:r,statics_cnt:i,publish_time:a,parent_content_info:o}=t;return{id:e.id,is_more_link:r?.is_more_link||!1,title:r?.name||r?.text||r?.content||``,coverImage:r?.cover_image_thumbnail||r?.cover_image||r?.cover_horizontal_image_thumbnail||``,duration:Number(r?.video_duration??0),progress:e.content_play_progress?.percent??0,seriesNum:e.content_play_progress?.series_num,authorName:n?.name||``,viewCount:r?.play_count??i?.browse_cnt??0,publishTime:a??0,type:o?.type}}const E=[`video`,`post`];function D({targetUserId:D,queryKeyPrefix:re,isMine:O=!1}){let k=x(`components.pages.profile.components.tabs`),A=ee()===`renderer`,j=re??[],[M,N]=S(`likeTab`,ne.withDefault(`video`)),P=g(()=>E.includes(M)?M:`video`,[M]),[F,I]=_(!1),[L,R]=_(()=>new Set),z=t(e=>e.userId),B=d(),V=[...j,`user-like-video`],H=[...j,`user-like-post`],U=u({key:V,initialPageParam:1,async queryFn(e){return p({targetUserId:D,page:e,contentType:m.video})},options:{staleTime:0,enabled:A},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),W=u({key:H,options:{staleTime:0,enabled:A},initialPageParam:1,async queryFn(e){return p({targetUserId:D,page:e,contentType:m.post})},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),G=P===`video`?U:W,K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(T))??[],q=W.data?.pages.flatMap(e=>(e.data?.list??[]).map(w))??[],J=P===`video`?K:q,Y=new Set(J.map(e=>e.id)),X=P===`video`,{mutateAsync:ie,isPending:Z}=l(async e=>await n({app_id:0,user_id:z,action:`cancel_like`,content_ids:e,content_type:X?1:2})),ae=()=>{I(!F),R(new Set)};h(()=>{R(new Set)},[P]),h(()=>{M!==P&&N(P)},[P,M,N]);let Q=e=>{R(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},oe=()=>{L.size===Y.size&&Y.size>0?R(new Set):R(new Set(Y))},se=async()=>{if(!(L.size===0||Z)){if(!z){b.error(k(`likeTab.pleaseLogin`));return}try{let e=Array.from(L),t=await ie(e);if(t.code===0){b.success(k(`likeTab.unlikedSuccess`));let t=new Set(e);B(X?V:H,e=>C(e,t,e=>e.id)),R(new Set),I(!1)}else b.error(t.message||k(`likeTab.unlikeFailed`))}catch(e){console.error(`取消点赞失败`,e),b.error(k(`likeTab.operationFailed`))}}},$=async()=>{A&&await G.fetchNextPage()};return y(r,{children:[y(r,{className:`flex justify-between items-center`,children:[v(a,{value:P,onValueChange:e=>{N(e)},children:y(o,{variant:`tag`,children:[v(s,{value:`video`,className:`text-sm`,children:k(`likeTab.video`)}),v(s,{value:`post`,className:`text-sm`,children:k(`likeTab.posts`)})]})}),O&&v(e,{variant:`ghost`,size:`sm`,className:`h-6.25 px-0 text-sm text-text3`,onClick:ae,children:k(F?`likeTab.cancel`:`likeTab.edit`)})]}),v(r,{className:`pt-2`,children:P===`video`?v(te,{list:K,loading:G.isFetching,hasMore:G.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,showVideoProgress:!1,onToggleSelection:Q}):v(f,{list:q,loading:G.isFetching,hasMore:G.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,onToggleSelection:Q})}),F&&y(r,{style:{bottom:`calc(56px + env(safe-area-inset-bottom, 0px))`},className:`flex fixed z-10 left-0 w-full items-center justify-between px-3 py-2 bg-bg1 `,children:[y(r,{className:`flex items-center gap-2`,children:[v(i,{checked:L.size===Y.size&&Y.size>0,onCheckedChange:oe}),v(c,{className:`text-sm text-text1`,children:k(`likeTab.selectAll`)})]}),v(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:L.size>0?`default`:`outline`,disabled:L.size===0||Z,onClick:se,children:k(Z?`likeTab.processing`:`likeTab.delete`)})]})]})}export{D as LikeTab};
2
+ "use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionUnifiedBatchLikeDislike as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as c}from"../../../../../../../hooks/query/use-query.mjs";import{useAppContext as l}from"../../../../../../../hooks/use-app-context/index.mjs";import{PostList as u}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as d}from"../../../../../../common/list/video-list/video-list.mjs";import{getLikeData as f,likeContentType as p}from"../../utils.mjs";import{useEffect as m,useMemo as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useTranslations as ee}from"next-intl";import{parseAsString as b,useQueryState as x}from"nuqs";function S(e,t,n){if(!e)return e;let r=0,i=e.pages.map(e=>({page:e,filteredList:(e.data?.list??[]).filter(e=>{let i=n(e)??``,a=t.has(i);return a&&(r+=1),!a})}));return{...e,pages:i.map(({page:e,filteredList:t})=>{if(!e.data)return e;let n=typeof e.data.total==`number`?Math.max(0,e.data.total-r):e.data.total;return{...e,data:{...e.data,list:t,total:n}}})}}function C(e){let{detail:t}=e,{info:n,publish_time:r}=t;return{id:e.id,title:n?.name||n?.text||n?.content||``,coverImage:n?.cover_image_thumbnail||n?.cover_image||n?.cover_horizontal_image_thumbnail||``,publishTime:r??0}}function w(e){let{detail:t}=e,{user_info:n,info:r,statics_cnt:i,publish_time:a,parent_content_info:o}=t;return{id:e.id,is_more_link:r?.is_more_link||!1,title:r?.name||r?.text||r?.content||``,coverImage:r?.cover_image_thumbnail||r?.cover_image||r?.cover_horizontal_image_thumbnail||``,duration:Number(r?.video_duration??0),progress:e.content_play_progress?.percent??0,seriesNum:e.content_play_progress?.series_num,authorName:n?.name||``,viewCount:r?.play_count??i?.browse_cnt??0,publishTime:a??0,type:o?.type}}const T=[`video`,`post`];function E({targetUserId:E,queryKeyPrefix:D,isMine:te=!1}){let O=ee(`components.pages.profile.components.tabs`),k=l()===`renderer`,A=D??[],[j,M]=x(`likeTab`,b.withDefault(`video`)),N=h(()=>T.includes(j)?j:`video`,[j]),[P,F]=g(!1),[I,L]=g(()=>new Set),R=t(e=>e.userId),z=c(),B=[...A,`user-like-video`],V=[...A,`user-like-post`],H=s({key:B,initialPageParam:1,async queryFn(e){return f({targetUserId:E,page:e,contentType:p.video})},options:{staleTime:0,enabled:k},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}});console.log({videoData:H});let U=s({key:V,options:{staleTime:0,enabled:k},initialPageParam:1,async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),W=N===`video`?H:U,G=H.data?.pages.flatMap(e=>(e.data?.list??[]).map(w))??[],K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(C))??[],q=N===`video`?G:K,J=new Set(q.map(e=>e.id)),Y=N===`video`,{mutateAsync:X,isPending:Z}=o(async e=>await n({app_id:0,user_id:R,action:`cancel_like`,content_ids:e,content_type:Y?1:2}));m(()=>{L(new Set)},[N]),m(()=>{j!==N&&M(N)},[N,j,M]);let Q=e=>{L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ne=()=>{I.size===J.size&&J.size>0?L(new Set):L(new Set(J))},re=async()=>{if(!(I.size===0||Z)){if(!R){y.error(O(`likeTab.pleaseLogin`));return}try{let e=Array.from(I),t=await X(e);if(t.code===0){y.success(O(`likeTab.unlikedSuccess`));let t=new Set(e);z(Y?B:V,e=>S(e,t,e=>e.id)),L(new Set),F(!1)}else y.error(t.message||O(`likeTab.unlikeFailed`))}catch(e){console.error(`取消点赞失败`,e),y.error(O(`likeTab.operationFailed`))}}},$=async()=>{k&&await W.fetchNextPage()};return v(r,{children:[_(r,{className:``,children:N===`video`?_(d,{list:G,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`likeTab.emptyContent`),isEditMode:P,selectedIds:I,showVideoProgress:!1,onToggleSelection:Q}):_(u,{list:K,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`likeTab.emptyContent`),isEditMode:P,selectedIds:I,onToggleSelection:Q})}),P&&v(r,{style:{bottom:`calc(56px + env(safe-area-inset-bottom, 0px))`},className:`flex fixed z-10 left-0 w-full items-center justify-between px-3 py-2 bg-bg1 `,children:[v(r,{className:`flex items-center gap-2`,children:[_(i,{checked:I.size===J.size&&J.size>0,onCheckedChange:ne}),_(a,{className:`text-sm text-text1`,children:O(`likeTab.selectAll`)})]}),_(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:I.size>0?`default`:`outline`,disabled:I.size===0||Z,onClick:re,children:O(Z?`likeTab.processing`:`likeTab.delete`)})]})]})}export{E as LikeTab};
@@ -1,2 +1,2 @@
1
1
 
2
- import{HydrationBoundary as e}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{getLikeData as t,likeContentType as n}from"../../utils.mjs";import{LikeTab as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";function a({queryKeyPrefix:e,targetUserId:r,resolvedLikeTab:i}){if(!r)return[];let a=i===`post`;return[{type:`infinite`,queryKey:a?[...e,`user-like-post`]:[...e,`user-like-video`],async queryFn(e){return t({targetUserId:r,page:e,contentType:a?n.post:n.video})},initialPageParam:1,getNextPageParam(){}}]}function o({prefetch:t,resolvedLikeTab:n=`video`,...o}){return i(e,{prefetch:t??a({queryKeyPrefix:o.queryKeyPrefix??[],targetUserId:o.targetUserId,resolvedLikeTab:n}),children:i(r,{...o})})}export{o as LikeTabServer,a as buildLikeTabPrefetch};
2
+ import{HydrationBoundary as e}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{getLikeData as t,likeContentType as n}from"../../utils.mjs";import{LikeTab as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";function a({queryKeyPrefix:e,targetUserId:r,resolvedLikeTab:i}){return r?[{type:`infinite`,queryKey:i===`post`?[...e,`user-like-post`]:[...e,`user-like-video`],async queryFn(e){return t({targetUserId:r,page:e,contentType:n.video})},initialPageParam:1,getNextPageParam(){}}]:[]}function o({prefetch:t,resolvedLikeTab:n=`video`,...o}){return i(e,{prefetch:t??a({queryKeyPrefix:o.queryKeyPrefix??[],targetUserId:o.targetUserId,resolvedLikeTab:n}),children:i(r,{...o})})}export{o as LikeTabServer,a as buildLikeTabPrefetch};
@@ -22,7 +22,7 @@ interface PublishTabProps {
22
22
  * 发布内容 Tab 页。
23
23
  */
24
24
  declare function PublishTab({
25
- targetUserId,
25
+ targetUserId: _targetUserId,
26
26
  queryKeyPrefix,
27
27
  isMine
28
28
  }: PublishTabProps): react_jsx_runtime0.JSX.Element;
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{pCommunityDeleteContent as e}from"../../../../../../../service/generated/client.mjs";import{useDeleteRequest as t,useMutation as n,usePaginated as r,useUpdateRequest as i}from"../../../../../../../hooks/query/use-query.mjs";import{useAppContext as a}from"../../../../../../../hooks/use-app-context/index.mjs";import{DeleteConfirmDialog as o}from"../../../../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{UserActivityList as s}from"../../../../../../common/list/user-activity-list/user-activity-list.mjs";import{getPublishData as c}from"../../utils.mjs";import{useState as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{toast as p}from"sonner";import{useTranslations as m}from"next-intl";function h(e,t,n){if(!e)return e;let r=0,i=e.pages.map(e=>({page:e,filteredList:(e.data?.list??[]).filter(e=>{let i=n(e)??``,a=t.has(i);return a&&(r+=1),!a})}));return{...e,pages:i.map(({page:e,filteredList:t})=>{if(!e.data)return e;let n=typeof e.data.total==`number`?Math.max(0,e.data.total-r):e.data.total;return{...e,data:{...e.data,list:t,total:n}}})}}function g({targetUserId:g,queryKeyPrefix:_,isMine:v=!1}){let y=m(`components.pages.profile.components.tabs`),b=a()===`renderer`,x=_??[],S=t(),C=i(),[w,T]=l(null),{mutateAsync:E,isPending:D}=n(async t=>await e({content_id:t})),{data:O,isFetching:k,fetchNextPage:A,hasNextPage:j}=r({key:[...x,`user-publish`],initialPageParam:1,async queryFn(e){return c({targetUserId:g,page:e})},options:{staleTime:0,enabled:b},getNextPageParam(e,t){let n=e?.data||{},r=n.list||[];if(typeof n.has_more==`boolean`)return n.has_more?t.length+1:void 0;if(!(r.length===0||n.total===0))return t.length+1}}),M=O?.pages.flatMap(e=>(e?.data||{}).list||[])??[];function N(e){T(e)}function P(){T(null)}async function F(){if(!(!w||D))try{await E(w);let e=new Set([w]);C([...x,`user-publish`],t=>h(t,e,e=>e.content_id)),p.success(y(`publishTab.deleteSuccess`)),T(null)}catch(e){console.error(`删除内容失败`,e),p.error(y(`publishTab.deleteFailed`))}}let I=M.map(e=>({...e,isDeleting:D&&w===e.content_id,onDelete:()=>N(e.content_id??``)})),L=async()=>{b&&await A()};function R(){S([...x,`user-publish`]),S(x)}function z(e){console.log(`分享到微信:`,e)}function B(e){console.log(`分享到QQ:`,e)}function V(e){console.log(`分享到朋友圈:`,e)}return f(u,{children:[d(s,{list:I,loading:k,hasMore:j,loadMore:L,canEdit:v,showGroupHeaders:!1,emptyText:y(`publishTab.emptyText`),onActionSuccess:R,onShareWeChat:z,onShareQQ:B,onShareMoments:V}),d(o,{open:!!w,onOpenChange:e=>!e&&P(),onCancel:P,onConfirm:F,isConfirming:D})]})}export{g as PublishTab};
2
+ "use client";import{pCommunityDeleteContent as e}from"../../../../../../../service/generated/client.mjs";import{useDeleteRequest as t,useMutation as n,usePaginated as r,useUpdateRequest as i}from"../../../../../../../hooks/query/use-query.mjs";import{useAppContext as a}from"../../../../../../../hooks/use-app-context/index.mjs";import{DeleteConfirmDialog as o}from"../../../../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{UserActivityList as s}from"../../../../../../common/list/user-activity-list/user-activity-list.mjs";import{useState as c}from"react";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";import{toast as f}from"sonner";import{useTranslations as p}from"next-intl";function m(e,t,n){if(!e)return e;let r=0,i=e.pages.map(e=>({page:e,filteredList:(e.data?.list??[]).filter(e=>{let i=n(e)??``,a=t.has(i);return a&&(r+=1),!a})}));return{...e,pages:i.map(({page:e,filteredList:t})=>{if(!e.data)return e;let n=typeof e.data.total==`number`?Math.max(0,e.data.total-r):e.data.total;return{...e,data:{...e.data,list:t,total:n}}})}}function h({targetUserId:h,queryKeyPrefix:g,isMine:_=!1}){let v=p(`components.pages.profile.components.tabs`),y=a()===`renderer`,b=g??[],x=t(),S=i(),[C,w]=c(null),{mutateAsync:T,isPending:E}=n(async t=>await e({content_id:t})),{data:D,isFetching:O,fetchNextPage:k,hasNextPage:A}=r({key:[...b,`user-publish`],initialPageParam:1,async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},options:{staleTime:0,enabled:y},getNextPageParam(e,t){let n=e?.data||{},r=n.list||[];if(typeof n.has_more==`boolean`)return n.has_more?t.length+1:void 0;if(!(r.length===0||n.total===0))return t.length+1}}),j=D?.pages.flatMap(e=>(e?.data||{}).list||[])??[];function M(e){w(e)}function N(){w(null)}async function P(){if(!(!C||E))try{await T(C);let e=new Set([C]);S([...b,`user-publish`],t=>m(t,e,e=>e.content_id)),f.success(v(`publishTab.deleteSuccess`)),w(null)}catch(e){console.error(`删除内容失败`,e),f.error(v(`publishTab.deleteFailed`))}}let F=j.map(e=>({...e,isDeleting:E&&C===e.content_id,onDelete:()=>M(e.content_id??``)})),I=async()=>{y&&await k()};function L(){x([...b,`user-publish`]),x(b)}function R(e){console.log(`分享到微信:`,e)}function z(e){console.log(`分享到QQ:`,e)}function B(e){console.log(`分享到朋友圈:`,e)}return d(l,{children:[u(s,{list:F,loading:O,hasMore:A,loadMore:I,canEdit:_,showGroupHeaders:!1,emptyText:v(`publishTab.emptyText`),onActionSuccess:L,onShareWeChat:R,onShareQQ:z,onShareMoments:B}),u(o,{open:!!C,onOpenChange:e=>!e&&N(),onCancel:N,onConfirm:P,isConfirming:E})]})}export{h as PublishTab};
@@ -1,2 +1,2 @@
1
1
 
2
- import{HydrationBoundary as e}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{getPublishData as t}from"../../utils.mjs";import{PublishTab as n}from"./client.mjs";import{jsx as r}from"react/jsx-runtime";function i({queryKeyPrefix:e,targetUserId:n}){return n?[{type:`infinite`,queryKey:[...e,`user-publish`],async queryFn(e){return t({targetUserId:n,page:e})},initialPageParam:1,getNextPageParam(){}}]:[]}function a({prefetch:t,...a}){return r(e,{prefetch:t??i({queryKeyPrefix:a.queryKeyPrefix??[],targetUserId:a.targetUserId}),children:r(n,{...a})})}export{a as PublishTabServer,i as buildPublishTabPrefetch};
2
+ import{HydrationBoundary as e}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{PublishTab as t}from"./client.mjs";import{jsx as n}from"react/jsx-runtime";function r({queryKeyPrefix:e,targetUserId:t}){return t?[{type:`infinite`,queryKey:[...e,`user-publish`],async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},initialPageParam:1,getNextPageParam(){}}]:[]}function i({prefetch:i,...a}){return n(e,{prefetch:i??r({queryKeyPrefix:a.queryKeyPrefix??[],targetUserId:a.targetUserId}),children:n(t,{...a})})}export{i as PublishTabServer,r as buildPublishTabPrefetch};
@@ -1,2 +1,2 @@
1
1
 
2
- import{gCommunityGetContentList as e,gInteractionGetBrowseList as t,gInteractionGetLikeList as n}from"../../../../../service/generated/client.mjs";import r from"dayjs";const i=10,a={video:1,post:2};function o(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function s(e,t){let n=e.name,i=r(t?t?.[e.content_id||``]?.create_time:e.create_time).toDate().getTime(),a=o(e);return{id:e.content_id||``,content_play_progress:{percent:0,series_num:0},detail:{user_info:{name:e.author?.nickname,avatar:e.author?.avatar},info:{name:n,content_id:e.content_id,user_id:e.user_id,content:e.content,tags:e.tags,cover_image:a,like_count:e.like_count,dislike_count:e.dislike_count,comment_count:e.comment_count,share_count:e.share_count,view_count:e.view_count,create_time:e.create_time,update_time:e.update_time,author:e.author?{user_id:e.author.user_id,username:e.author.username,nickname:e.author.nickname,avatar_url:e.author.avatar}:void 0},statics_cnt:{browse_cnt:e.view_count||0},publish_time:i,parent_content_info:{type:0}}}}function c(e,t){let n=e.is_more_link,i=r(t?t?.[e.id||``]?.create_time:e.show_at).toDate().getTime(),a=Number(e.duration??0),o=Number.isFinite(a)?Math.max(0,Math.floor(a)):0;return{id:e.id||``,content_play_progress:{percent:0,series_num:0},detail:{user_info:{name:e.source_username||e.up_user||e.director||e.actor,avatar:void 0},info:{is_more_link:n,name:e.name,content_id:e.id,content:e.description,tags:e.tags?.map(e=>e.name).filter(e=>!!e),cover_image:e.img_y||e.img_x,create_time:e.show_at,video_duration:o},statics_cnt:{browse_cnt:e.play_count||0},publish_time:i,parent_content_info:{type:0}}}}function l(e,t){let n=e.name,i=e.is_more_link,a=t[e.content_id||``].browse_time,s=r(a).toDate().getTime(),c=o(e);return{id:e.content_id||``,content_play_progress:{percent:0,series_num:0},detail:{user_info:{name:e.author?.nickname,avatar:e.author?.avatar},info:{is_more_link:i,name:n||e.content,title:n||e.content,content_id:e.content_id,user_id:e.user_id,content:e.content,tags:e.tags,cover_image:c,like_count:e.like_count,dislike_count:e.dislike_count,comment_count:e.comment_count,share_count:e.share_count,view_count:e.view_count,create_time:e.create_time,update_time:e.update_time,author:e.author?{user_id:e.author.user_id,username:e.author.username,nickname:e.author.nickname,avatar_url:e.author.avatar}:void 0},statics_cnt:{browse_cnt:e.view_count||0},publish_time:s,parent_content_info:{type:0}}}}function u(e,t){let n=e.is_more_link,i=t[e.id||``].browse_time,a=r(i).toDate().getTime(),o=Number(e.duration??0),s=Number.isFinite(o)?Math.max(0,Math.floor(o)):0,c=t[e.id||``]?.browse_duration||0,l=Number(t[e.id||``]?.browse_episode),u=0,d=0;return Number.isNaN(l)||(u=l),s&&c&&(d=Math.min(100,Math.floor(c/s*100))),{id:e.id||``,content_play_progress:{percent:d,series_num:u},detail:{user_info:{name:e.source_username||e.up_user||e.director||e.actor,avatar:void 0},info:{is_more_link:n,name:e.name,content_id:e.id,content:e.description,tags:e.tags?.map(e=>e.name).filter(e=>!!e),cover_image:e.img_y||e.img_x,create_time:e.show_at,video_duration:s},statics_cnt:{browse_cnt:e.play_count||0},publish_time:a,parent_content_info:{type:0}}}}async function d({targetUserId:t,page:n,pageSize:r=10}){if(!t)return{data:{list:[],total:0}};let i=await e({user_id:t,page:n,page_size:r}),a=i.data?.data?.contents??[];return{data:{list:a,total:i.data?.data?.total??a.length,has_more:i.data?.data?.has_more?!0:void 0}}}async function f({targetUserId:e,page:t,contentType:r,pageSize:i=10}){if(!e)return{data:{list:[],total:0}};let o=await n({user_id:e,page:t,content_type:r,page_size:i}),l=o.data.like_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},u=r===a.post?(o.data?.post_infos??[]).map(e=>s(e,l)):(o.data?.video_infos??[]).map(e=>c(e,l)),d=o.data?.has_more,f=typeof d==`boolean`?d:void 0;return{data:{list:u,total:o.data?.total??u.length,has_more:f}}}async function p({targetUserId:e,page:n,contentType:r,pageSize:i=10,authConfig:o}){if(!e)return{data:{list:[],total:0}};let s=await t({user_id:e,page:n,page_size:i,content_type:r},o),c=s.data.records?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},d=r===a.post?(s.data?.post_infos??[]).map(e=>l(e,c)):(s.data?.video_infos??[]).map(e=>u(e,c)),f=s.data?.has_more?!0:void 0;return{data:{list:d,total:s.data?.total??d.length,has_more:f}}}export{i as defaultPageSize,p as getHistoryData,f as getLikeData,d as getPublishData,a as likeContentType};
2
+ import{gInteractionGetBrowseList as e,gInteractionGetLikeList as t}from"../../../../../service/generated/client.mjs";import n from"dayjs";const r=10,i={video:1,post:2};function a(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function o(e,t){let r=e.name,i=n(t?t?.[e.content_id||``]?.create_time:e.create_time).toDate().getTime(),o=a(e);return{id:e.content_id||``,content_play_progress:{percent:0,series_num:0},detail:{user_info:{name:e.author?.nickname,avatar:e.author?.avatar},info:{name:r,content_id:e.content_id,user_id:e.user_id,content:e.content,tags:e.tags,cover_image:o,like_count:e.like_count,dislike_count:e.dislike_count,comment_count:e.comment_count,share_count:e.share_count,view_count:e.view_count,create_time:e.create_time,update_time:e.update_time,author:e.author?{user_id:e.author.user_id,username:e.author.username,nickname:e.author.nickname,avatar_url:e.author.avatar}:void 0},statics_cnt:{browse_cnt:e.view_count||0},publish_time:i,parent_content_info:{type:0}}}}function s(e,t){let r=e.is_more_link,i=n(t?t?.[e.id||``]?.create_time:e.show_at).toDate().getTime(),a=Number(e.duration??0),o=Number.isFinite(a)?Math.max(0,Math.floor(a)):0;return{id:e.id||``,content_play_progress:{percent:0,series_num:0},detail:{user_info:{name:e.source_username||e.up_user||e.director||e.actor,avatar:void 0},info:{is_more_link:r,name:e.name,content_id:e.id,content:e.description,tags:e.tags?.map(e=>e.name).filter(e=>!!e),cover_image:e.img_y||e.img_x,create_time:e.show_at,video_duration:o},statics_cnt:{browse_cnt:e.play_count||0},publish_time:i,parent_content_info:{type:0}}}}function c(e,t){let r=e.name,i=e.is_more_link,o=t[e.content_id||``].browse_time,s=n(o).toDate().getTime(),c=a(e);return{id:e.content_id||``,content_play_progress:{percent:0,series_num:0},detail:{user_info:{name:e.author?.nickname,avatar:e.author?.avatar},info:{is_more_link:i,name:r||e.content,title:r||e.content,content_id:e.content_id,user_id:e.user_id,content:e.content,tags:e.tags,cover_image:c,like_count:e.like_count,dislike_count:e.dislike_count,comment_count:e.comment_count,share_count:e.share_count,view_count:e.view_count,create_time:e.create_time,update_time:e.update_time,author:e.author?{user_id:e.author.user_id,username:e.author.username,nickname:e.author.nickname,avatar_url:e.author.avatar}:void 0},statics_cnt:{browse_cnt:e.view_count||0},publish_time:s,parent_content_info:{type:0}}}}function l(e,t){let r=e.is_more_link,i=t[e.id||``].browse_time,a=n(i).toDate().getTime(),o=Number(e.duration??0),s=Number.isFinite(o)?Math.max(0,Math.floor(o)):0,c=t[e.id||``]?.browse_duration||0,l=Number(t[e.id||``]?.browse_episode),u=0,d=0;return Number.isNaN(l)||(u=l),s&&c&&(d=Math.min(100,Math.floor(c/s*100))),{id:e.id||``,content_play_progress:{percent:d,series_num:u},detail:{user_info:{name:e.source_username||e.up_user||e.director||e.actor,avatar:void 0},info:{is_more_link:r,name:e.name,content_id:e.id,content:e.description,tags:e.tags?.map(e=>e.name).filter(e=>!!e),cover_image:e.img_y||e.img_x,create_time:e.show_at,video_duration:s},statics_cnt:{browse_cnt:e.play_count||0},publish_time:a,parent_content_info:{type:0}}}}async function u({targetUserId:e,page:n,contentType:r,pageSize:a=10}){if(!e)return{data:{list:[],total:0}};let c=await t({user_id:e,page:n,content_type:r,page_size:a}),l=c.data.like_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},u=r===i.post?(c.data?.post_infos??[]).map(e=>o(e,l)):(c.data?.video_infos??[]).map(e=>s(e,l)),d=c.data?.has_more,f=typeof d==`boolean`?d:void 0;return{data:{list:u,total:c.data?.total??u.length,has_more:f}}}async function d({targetUserId:t,page:n,contentType:r,pageSize:a=10,authConfig:o}){if(!t)return{data:{list:[],total:0}};let s=await e({user_id:t,page:n,page_size:a,content_type:r},o),u=s.data.records?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},d=r===i.post?(s.data?.post_infos??[]).map(e=>c(e,u)):(s.data?.video_infos??[]).map(e=>l(e,u)),f=s.data?.has_more?!0:void 0;return{data:{list:d,total:s.data?.total??d.length,has_more:f}}}export{r as defaultPageSize,d as getHistoryData,u as getLikeData,i as likeContentType};
@@ -3,15 +3,15 @@
3
3
  /**
4
4
  * 个人主页主 Tab(本人视角)。
5
5
  */
6
- declare const profileMainMineTabOptions: readonly ["collect", "publish", "like", "history"];
6
+ declare const profileMainMineTabOptions: readonly ["collect", "like", "history"];
7
7
  /**
8
8
  * 个人主页主 Tab(他人视角)。
9
9
  */
10
- declare const profileMainProfileTabOptions: readonly ["collect", "publish", "like"];
10
+ declare const profileMainProfileTabOptions: readonly ["collect", "like"];
11
11
  /**
12
12
  * 物料主 Tab 可选项。
13
13
  */
14
- declare const profileMainTabOptions: readonly ["collect", "publish", "like", "history"];
14
+ declare const profileMainTabOptions: readonly ["collect", "like", "history"];
15
15
  /**
16
16
  * 点赞子 Tab 可选项。
17
17
  */
@@ -1,2 +1,2 @@
1
1
 
2
- const e=[`collect`,`publish`,`like`,`history`],t=[`collect`,`publish`,`like`],n=e,r=[`video`,`post`],i=[`video`,`post`],a=[`video`,`post`,`collection`],o=[`created`,`subscribed`];export{o as profileMainCollectCollectionTabOptions,a as profileMainCollectTabOptions,i as profileMainHistoryTabOptions,r as profileMainLikeTabOptions,e as profileMainMineTabOptions,t as profileMainProfileTabOptions,n as profileMainTabOptions};
2
+ const e=[`collect`,`like`,`history`],t=[`collect`,`like`],n=e,r=[`video`,`post`],i=[`video`,`post`],a=[`video`,`post`,`collection`],o=[`created`,`subscribed`];export{o as profileMainCollectCollectionTabOptions,a as profileMainCollectTabOptions,i as profileMainHistoryTabOptions,r as profileMainLikeTabOptions,e as profileMainMineTabOptions,t as profileMainProfileTabOptions,n as profileMainTabOptions};
@@ -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{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import{DeleteConfirmDialog as a}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{useCallback as o,useEffect as s,useMemo as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{usePathname as f,useRouter as p,useSearchParams as m}from"next/navigation";function h(h){let{title:g,rows:_=1,clearText:v=`清理`,confirmDescription:y=`确认删除全部搜索历史吗?`,storageKey:b=`guest`,onHistoryClick:x}=h,[S,C]=l([]),[w,T]=l(!1),E=p(),D=f(),O=m(),k=`search_history_${b}`,A=o(()=>{let e=localStorage.getItem(k);if(e)try{C(JSON.parse(e))}catch(e){console.error(`Failed to parse search history`,e)}else C([])},[k]);s(()=>{A()},[A]),s(()=>(t.on(i.SEARCH_HISTORY_UPDATE,A),()=>{t.off(i.SEARCH_HISTORY_UPDATE,A)}),[A]);let j=()=>{C([]),localStorage.removeItem(k),T(!1),t.emit(i.SEARCH_HISTORY_UPDATE)},M=c(()=>{let e=_*10;return S.slice(0,e)},[S,_]);if(S.length===0)return null;let N=e=>{if(x)x(e);else{let t=new URLSearchParams(O.toString());t.set(`q`,e);let n=D.includes(`/search`)?D:`/search`;E.push(`${n}?${t.toString()}`)}};return d(n,{className:`px-4 py-2`,children:[d(n,{className:`flex justify-between items-center mb-2`,children:[u(r,{className:`text-[16px] font-bold text-text1`,children:g}),u(e,{variant:`ghost`,size:`sm`,className:`text-text3 text-[12px] p-0 h-auto`,onClick:()=>T(!0),children:v})]}),u(n,{className:`flex flex-wrap gap-2 overflow-hidden`,style:{maxHeight:`${_*40}px`},children:M.map((e,t)=>u(n,{className:`px-3 py-1 bg-bg2 rounded-full cursor-pointer`,onClick:()=>N(e),children:u(r,{className:`text-[14px] text-text2 truncate max-w-[150px]`,children:e})},t))}),u(a,{open:w,onOpenChange:T,onConfirm:()=>{j()},title:``,description:y})]})}export{h as SearchHistoryClient};
2
+ "use client";import{Button as e}from"../../../ui/button.mjs";import t from"../../../../utils/event-bus.mjs";import{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import{useAppContext as i}from"../../../../hooks/use-app-context/index.mjs";import{eventKey as a}from"../../../../constants/event-key.mjs";import{DeleteConfirmDialog as o}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{useCallback as s,useEffect as c,useMemo as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{usePathname as p,useRouter as m,useSearchParams as h}from"next/navigation";const g=[`示例历史1`,`示例历史2`,`示例历史3`];function _(_){let{title:v,rows:y=1,clearText:b=`清理`,confirmDescription:x=`确认删除全部搜索历史吗?`,storageKey:S=`guest`,onHistoryClick:C}=_,w=i(),[T,E]=u([]),[D,O]=u(!1),k=m(),A=p(),j=h(),M=`search_history_${S}`,N=s(()=>{let e=localStorage.getItem(M);if(e)try{E(JSON.parse(e))}catch(e){console.error(`Failed to parse search history`,e)}else E([])},[M]);c(()=>{N()},[N]),c(()=>(t.on(a.SEARCH_HISTORY_UPDATE,N),()=>{t.off(a.SEARCH_HISTORY_UPDATE,N)}),[N]);let P=()=>{E([]),localStorage.removeItem(M),O(!1),t.emit(a.SEARCH_HISTORY_UPDATE)},F=l(()=>{let e=T.length>0?T:w===`editor`?g:[],t=y*10;return e.slice(0,t)},[T,y,w]);if(F.length===0)return null;let I=e=>{if(C)C(e);else{let t=new URLSearchParams(j.toString());t.set(`q`,e);let n=A.includes(`/search`)?A:`/search`;k.push(`${n}?${t.toString()}`)}};return f(n,{className:`px-4 py-2`,children:[f(n,{className:`flex justify-between items-center mb-2`,children:[d(r,{className:`text-[16px] font-bold text-text1`,children:v}),d(e,{variant:`ghost`,size:`sm`,className:`text-text3 text-[12px] p-0 h-auto`,onClick:()=>O(!0),children:b})]}),d(n,{className:`flex flex-wrap gap-2 overflow-hidden`,style:{maxHeight:`${y*40}px`},children:F.map((e,t)=>d(n,{className:`px-3 py-1 bg-bg2 rounded-full cursor-pointer`,onClick:()=>I(e),children:d(r,{className:`text-[14px] text-text2 truncate max-w-[150px]`,children:e})},t))}),d(o,{open:D,onOpenChange:O,onConfirm:()=>{P()},title:``,description:x})]})}export{_ as SearchHistoryClient};
@@ -9,7 +9,7 @@ import * as zod_v4_core0 from "zod/v4/core";
9
9
 
10
10
  //#region components/biz/business/shortcut-grid/material.d.ts
11
11
  declare const shortcutGridMaterial: DefineMaterialOption<typeof ShortcutGrid, typeof ShortcutGridClient, zod.ZodObject<{
12
- title: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
12
+ title: zod.ZodString & SchemaHasDefaultValue;
13
13
  shortcutCount: zod.ZodNumber & SchemaHasDefaultValue;
14
14
  isShortcutTitle: zod.ZodBoolean & SchemaHasDefaultValue;
15
15
  shortcuts: zod.ZodArray<zod.ZodObject<{
@@ -8,7 +8,7 @@ import z$1 from "zod";
8
8
  * 金刚区物料可配置字段:
9
9
  */
10
10
  declare const shortcutGridInspectorPropsSchema: z$1.ZodObject<{
11
- title: z$1.ZodOptional<z$1.ZodString> & SchemaHasDefaultValue;
11
+ title: z$1.ZodString & SchemaHasDefaultValue;
12
12
  shortcutCount: z$1.ZodNumber & SchemaHasDefaultValue;
13
13
  isShortcutTitle: z$1.ZodBoolean & SchemaHasDefaultValue;
14
14
  shortcuts: z$1.ZodArray<z$1.ZodObject<{
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineSwitchPropSchema as r,defineTextPropSchema as i,getSchemaDefaultProps as a}from"../../../../utils/schema/schema.mjs";import o from"zod";const s=t({title:i({label:`推荐位名称`,required:!1,defaultValue:`推荐列表`}),shortcutCount:n({label:`入口数量`,required:!0,defaultValue:4}).refine(e=>e>=3&&e<=5,`入口数量必须为 3-5`),isShortcutTitle:r({label:`是否显示入口标题`,required:!0,defaultValue:!0}),shortcuts:e(o.object({label:i({label:`入口标题`,required:!1,defaultValue:`最新`}),icon:i({label:`图标`,required:!0,defaultValue:``}),href:i({label:`跳转指向`,required:!0,defaultValue:``})}),{label:`推荐列表`,required:!0,defaultValue:[{label:`热门`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`},{label:`新上架`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`},{label:`排行榜`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`},{label:`筛选`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`}]})}),c=a(s);export{c as shortcutGridInspectorDefaultProps,s as shortcutGridInspectorPropsSchema};
2
+ import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineSwitchPropSchema as r,defineTextPropSchema as i,getSchemaDefaultProps as a}from"../../../../utils/schema/schema.mjs";import o from"zod";const s=t({title:i({label:`推荐位名称`,required:!0,defaultValue:`推荐列表`}),shortcutCount:n({label:`入口数量`,required:!0,defaultValue:4}).refine(e=>e>=3&&e<=5,`入口数量必须为 3-5`),isShortcutTitle:r({label:`是否显示入口标题`,required:!0,defaultValue:!0}),shortcuts:e(o.object({label:i({label:`入口标题`,required:!1,defaultValue:`最新`}),icon:i({label:`图标`,required:!0,defaultValue:``}),href:i({label:`跳转指向`,required:!0,defaultValue:``})}),{label:`推荐列表`,required:!0,defaultValue:[{label:`热门`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`},{label:`新上架`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`},{label:`排行榜`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`},{label:`筛选`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`}]})}),c=a(s);export{c as shortcutGridInspectorDefaultProps,s as shortcutGridInspectorPropsSchema};
@@ -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{useMemo as n}from"react";import{HomeIcon as r,UserIcon as i,UsersIcon as a}from"lucide-react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{usePathname as c,useRouter as l}from"next/navigation";const u=[];function d(d){let{items:f=u}=d,p=l(),m=c(),h=n(()=>f.findIndex(e=>e.path===m)||0,[f,m]),g=(e,t)=>{let n=`w-6 h-6 ${t?`text-brand`:`text-text3`}`;switch(e){case`home`:return o(r,{className:n});case`follow`:return o(a,{className:n});case`mine`:return o(i,{className:n});default:return o(r,{className:n})}};return!f||f.length===0?null:o(e,{className:`fixed bottom-0 left-0 right-0 bg-bg1 border-t border-line safe-area-bottom z-50`,children:o(e,{className:`flex h-[50px] items-center justify-around`,children:f.map((n,r)=>{let i=h===r;return s(e,{className:`flex flex-col items-center justify-center flex-1 cursor-pointer`,onClick:()=>p.push(n.path),children:[g(n.iconType,i),o(t,{className:`text-[10px] mt-0.5 ${i?`text-brand font-medium`:`text-text3`}`,children:n.label})]},r)})})})}export{d as TabBarClient};
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{useAppContext as r}from"../../../../hooks/use-app-context/index.mjs";import{useMemo as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{usePathname as s,useRouter as c}from"next/navigation";const l=[];function u(u){let{items:d=l}=u,f=c(),p=s(),m=r(),h=i(()=>m===`editor`?0:d.findIndex(e=>!!(e.domainId===`home`&&p===`/`||e.domainId===`mine`&&p.includes(`/mine`))),[d,p,m]),g=e=>{if(m!==`editor`)if(e.configType===`function`)switch(e.functionPageType){case`search`:f.push(`/search`);break;case`profile`:f.push(`/user/mine`);break;case`detail`:e.selectData&&f.push(`/video/detail/${e.selectData}`);break;case`content_list`:f.push(`/video/list?tag=${e.selectData}`);break;default:f.push(`/`)}else f.push(`/`)};return!d||d.length===0?null:a(t,{className:`fixed bottom-0 left-0 right-0 bg-bg1 border-t border-line safe-area-bottom z-50`,children:a(t,{className:`flex h-[50px] items-center justify-around`,children:d.map((r,i)=>{let s=h===i,c=r.icon;return s&&r.activeIcon&&(c=r.activeIcon),o(t,{className:`flex flex-col items-center justify-center flex-1 cursor-pointer active:opacity-70 transition-opacity`,onClick:()=>g(r),children:[a(t,{className:`relative w-6 h-6`,children:c?a(e,{src:c,alt:r.label,fill:!0,className:`object-contain`}):a(t,{className:`w-full h-full rounded-sm ${s?`bg-theme5`:`bg-text3`}`})}),a(n,{className:`text-[10px] mt-1 truncate max-w-full px-1 ${s?`text-theme5 font-medium`:`text-text3`}`,children:r.label})]},i)})})})}export{u as TabBarClient};
@@ -14,8 +14,12 @@ import * as zod_v4_core0 from "zod/v4/core";
14
14
  declare const tabBarMaterial: DefineMaterialOption<typeof TabBarServer, typeof TabBarClient, zod.ZodObject<{
15
15
  items: zod.ZodArray<zod.ZodObject<{
16
16
  label: zod.ZodString & SchemaHasDefaultValue;
17
- path: zod.ZodString & SchemaHasDefaultValue;
18
- iconType: zod.ZodString & SchemaHasDefaultValue;
17
+ domainId: zod.ZodString & SchemaHasDefaultValue;
18
+ icon: zod.ZodString & SchemaHasDefaultValue;
19
+ activeIcon: zod.ZodString & SchemaHasDefaultValue;
20
+ configType: zod.ZodType<"function" | "product", unknown, zod_v4_core0.$ZodTypeInternals<"function" | "product", unknown>> & SchemaHasDefaultValue;
21
+ functionPageType: zod.ZodType<"search" | "detail" | "profile" | "content_list", unknown, zod_v4_core0.$ZodTypeInternals<"search" | "detail" | "profile" | "content_list", unknown>> & SchemaHasDefaultValue;
22
+ selectData: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
19
23
  }, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
20
24
  }, zod_v4_core0.$strip>, "tab-bar">;
21
25
  //#endregion
@@ -11,8 +11,12 @@ import * as zod_v4_core0 from "zod/v4/core";
11
11
  declare const tabBarInspectorPropsSchema: zod.ZodObject<{
12
12
  items: zod.ZodArray<zod.ZodObject<{
13
13
  label: zod.ZodString & SchemaHasDefaultValue;
14
- path: zod.ZodString & SchemaHasDefaultValue;
15
- iconType: zod.ZodString & SchemaHasDefaultValue;
14
+ domainId: zod.ZodString & SchemaHasDefaultValue;
15
+ icon: zod.ZodString & SchemaHasDefaultValue;
16
+ activeIcon: zod.ZodString & SchemaHasDefaultValue;
17
+ configType: zod.ZodType<"function" | "product", unknown, zod_v4_core0.$ZodTypeInternals<"function" | "product", unknown>> & SchemaHasDefaultValue;
18
+ functionPageType: zod.ZodType<"search" | "detail" | "profile" | "content_list", unknown, zod_v4_core0.$ZodTypeInternals<"search" | "detail" | "profile" | "content_list", unknown>> & SchemaHasDefaultValue;
19
+ selectData: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
16
20
  }, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
17
21
  }, zod_v4_core0.$strip>;
18
22
  //#endregion
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineTextPropSchema as n}from"../../../../utils/schema/schema.mjs";const r=t({items:e(t({label:n({label:`名称`,defaultValue:`首页`}),path:n({label:`跳转路径`,defaultValue:`/`}),iconType:n({label:`图标类型`,defaultValue:`home`})}),{label:`导航项`,defaultValue:[{label:`首页`,path:`/`,iconType:`home`},{label:`关注`,path:`/user/follow`,iconType:`follow`},{label:`我的`,path:`/user/mine`,iconType:`mine`}]})});export{r as tabBarInspectorPropsSchema};
2
+ import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineSelectEnumPropSchema as n,defineTextPropSchema as r}from"../../../../utils/schema/schema.mjs";const i=t({items:e(t({label:r({label:`导航入口名称`,defaultValue:`入口`,description:`支持输入,中/英/数/符,不支持Emoji,4个字符`}),domainId:r({label:`导航入口域名ID`,defaultValue:``,description:`输入,英/数,10个字符`}),icon:r({label:`导航外显图标`,defaultValue:``,description:`支持上传,尺寸为1:1,支持jpg/png,50KB左右`}),activeIcon:r({label:`导航外显图标(选中)`,defaultValue:``,description:`支持上传,尺寸为1:1,支持jpg/png,50KB左右`}),configType:n([`product`,`function`],{label:`配置类型`,defaultValue:`function`}),functionPageType:n([`detail`,`search`,`profile`,`content_list`],{label:`功能页面类型`,defaultValue:`search`}),selectData:r({label:`选择数据`,defaultValue:``,required:!1})}),{label:`底部导航入口`,description:`注最少2个,最多5个,自动居中`,defaultValue:[{label:`首页`,domainId:`home`,icon:``,activeIcon:``,configType:`function`,functionPageType:`search`,selectData:``},{label:`我的`,domainId:`mine`,icon:``,activeIcon:``,configType:`function`,functionPageType:`profile`,selectData:``}]})});export{i as tabBarInspectorPropsSchema};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import e from"../../../../assets/images/frame.mjs";import{jsx as t,jsxs as n}from"react/jsx-runtime";import r from"next/image";const i=[];function a(a){let{title:o,items:s=i,commonPlayCount:c,commonEpisodes:l}=a;return!s||s.length===0?null:n(`div`,{className:`bg-bg1 px-3 py-3`,children:[o&&t(`div`,{className:`mb-3 flex items-center justify-between`,children:t(`h2`,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:o})}),t(`div`,{className:`flex overflow-x-auto pb-2 scrollbar-hide space-x-2`,children:s.map((i,a)=>{let o=i.showPlayCount??c?.enabled,s=i.playCountDelta||c?.delta,u=i.showEpisodes??l;return n(`div`,{className:`flex-shrink-0 w-[116.67px]`,children:[n(`div`,{className:`relative aspect-[116.67/155.56] rounded-lg overflow-hidden bg-bg2`,children:[t(r,{src:i.cover||e,alt:i.title,fill:!0,sizes:`116.67px`,className:`object-cover text-[10px] text-text3`}),i.badge&&t(`div`,{className:`absolute top-0 right-0 text-white text-[12px] px-[6px] py-0 rounded-bl-[8px] rounded-tr-[8px] font-normal leading-[20px]`,style:{backgroundImage:`linear-gradient(120deg, #FD4C5E 1.59%, #F05D19 99.08%)`},children:i.badge}),n(`div`,{className:`absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pb-1 pt-3 px-1 flex justify-between items-center`,children:[o&&s&&n(`span`,{className:`text-white text-[10px] flex items-center leading-none`,children:[t(`span`,{className:`mr-0.5 opacity-80`,children:`▶`}),s]}),u&&i.contentDescription&&t(`span`,{className:`text-white text-[12px] leading-[20px]`,children:i.contentDescription})]})]}),t(`div`,{className:`mt-2 py-2`,children:t(`h3`,{className:`text-[16px] text-text1 truncate font-bold leading-[24px]`,children:i.title})})]},a)})})]})}export{a as VideoHorizontalListClient};
2
+ "use client";import{useAppContext as e}from"../../../../hooks/use-app-context/index.mjs";import t from"../../../../assets/images/frame.mjs";import n from"../../../../assets/images/subscript.mjs";import{jsx as r,jsxs as i}from"react/jsx-runtime";import a from"next/image";const o=[];function s(s){let{title:c,items:l=o,commonPlayCount:u,commonEpisodes:d}=s,f=e();return!l||l.length===0?null:i(`div`,{className:`bg-bg1 px-3 py-3`,children:[c&&r(`div`,{className:`mb-3 flex items-center justify-between`,children:r(`h2`,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:c})}),r(`div`,{className:`flex overflow-x-auto pb-2 scrollbar-hide space-x-2`,children:l.map((e,o)=>{let s=e.showPlayCount??u?.enabled,c=e.playCountDelta||u?.delta,l=e.showEpisodes??d;return i(`div`,{className:`flex-shrink-0 w-[116.67px]`,children:[i(`div`,{className:`relative aspect-[116.67/155.56] rounded-lg overflow-hidden bg-bg2`,children:[f===`editor`||e.cover?r(a,{src:e.cover||t,alt:e.title,fill:!0,sizes:`116.67px`,className:`object-cover text-[10px] text-text3`}):r(`div`,{className:`w-full h-full flex items-center justify-center text-text3 text-xs`,children:`无封面`}),(f===`editor`?!0:!!e.badge)&&r(`div`,{className:`absolute top-0 right-0 w-8 h-8`,children:r(a,{src:e.badge||n,alt:``,fill:!0,sizes:`32px`,className:`object-contain`})}),i(`div`,{className:`absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pb-1 pt-3 px-1 flex justify-between items-center`,children:[s&&c&&i(`div`,{className:`flex items-center gap-1 rounded bg-overlay px-1 py-0`,children:[r(`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:r(`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`})}),r(`span`,{className:`text-white text-[12px] leading-[20px]`,children:c})]}),l&&e.contentDescription&&r(`span`,{className:`text-white text-[12px] leading-[20px]`,children:e.contentDescription})]})]}),r(`div`,{className:`mt-2 py-2`,children:r(`h3`,{className:`text-[16px] text-text1 truncate font-bold leading-[24px]`,children:e.title})})]},o)})})]})}export{s as VideoHorizontalListClient};
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineObjectPropSchema as r,defineSwitchPropSchema as i,defineTextPropSchema as a}from"../../../../utils/schema/schema.mjs";import{z as o}from"zod";const s=o.object({content:a({label:`推荐位内容`,defaultValue:``}),title:a({label:`推荐位内容名称`,defaultValue:`视频标题`}),contentDescription:a({label:`内容说明简介`,defaultValue:``}),cover:a({label:`推荐位封面`,defaultValue:``}),useVideoPoster:i({label:`沿用视频海报`,defaultValue:!0}),showPlayCount:i({label:`播放量显示`,defaultValue:!0}),playCountDelta:a({label:`播放量浮动`,defaultValue:``,required:!1}),showEpisodes:i({label:`集数展示`,defaultValue:!0}),badge:a({label:`推荐位角标`,defaultValue:``})}),c=t({title:a({label:`推荐位名称`,defaultValue:`推荐视频`}),moduleCount:n({label:`推荐模块数`,defaultValue:1}),layout:r({enabled:i({label:`组件铺设`,defaultValue:!1}),tag:a({label:`取数范围标签`,defaultValue:`动作`,required:!1})},{label:`组件铺设`,defaultValue:{enabled:!1,tag:`动作`}}),commonPlayCount:r({enabled:i({label:`通用播放量`,defaultValue:!0}),delta:a({label:`播放量浮动值`,defaultValue:``,required:!1})},{label:`通用播放量`,defaultValue:{enabled:!0,delta:``}}),commonEpisodes:i({label:`通用集数`,defaultValue:!0}),items:e(s,{label:`推荐位模块`,defaultValue:[{content:``,title:`视频标题 1`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{content:``,title:`视频标题 2`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{content:``,title:`视频标题 3`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``}]})});export{c as videoHorizontalListInspectorPropsSchema};
2
+ import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineObjectPropSchema as r,defineSwitchPropSchema as i,defineTextPropSchema as a}from"../../../../utils/schema/schema.mjs";import{z as o}from"zod";const s=o.object({content:a({label:`推荐位内容`,defaultValue:``}),title:a({label:`推荐位内容名称`,defaultValue:`视频标题`}),contentDescription:a({label:`内容说明简介`,defaultValue:``}),cover:a({label:`推荐位封面`,defaultValue:``}),useVideoPoster:i({label:`沿用视频海报`,defaultValue:!0}),showPlayCount:i({label:`播放量显示`,defaultValue:!0}),playCountDelta:a({label:`播放量浮动`,defaultValue:``,required:!1}),showEpisodes:i({label:`集数展示`,defaultValue:!0}),badge:a({label:`推荐位角标`,defaultValue:``,description:`角标图片地址,可通过低代码平台配置上传;留空则使用默认角标图`})}),c=t({title:a({label:`推荐位名称`,defaultValue:`推荐视频`}),moduleCount:n({label:`推荐模块数`,defaultValue:1}),layout:r({enabled:i({label:`组件铺设`,defaultValue:!1}),tag:a({label:`取数范围标签`,defaultValue:`动作`,required:!1})},{label:`组件铺设`,defaultValue:{enabled:!1,tag:`动作`}}),commonPlayCount:r({enabled:i({label:`通用播放量`,defaultValue:!0}),delta:a({label:`播放量浮动值`,defaultValue:``,required:!1})},{label:`通用播放量`,defaultValue:{enabled:!0,delta:``}}),commonEpisodes:i({label:`通用集数`,defaultValue:!0}),items:e(s,{label:`推荐位模块`,defaultValue:[{content:``,title:`视频标题 1`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{content:``,title:`视频标题 2`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{content:``,title:`视频标题 3`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``}]})});export{c as videoHorizontalListInspectorPropsSchema};
@@ -10,6 +10,7 @@ interface CollectionListMediaItem {
10
10
  isVideo?: boolean;
11
11
  isMovie?: boolean;
12
12
  videoDuration?: number;
13
+ isPlaceholder?: boolean;
13
14
  }
14
15
  interface CollectionListItemProps {
15
16
  /** 合集 ID。 */
@@ -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{RightArrowIcon as r}from"../../icons/right-arrow.mjs";import{Fragment as i,jsx as a,jsxs as o}from"react/jsx-runtime";import{useTranslations as s}from"next-intl";import c from"next/link";const l=[];function u({size:e=12}){return a(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`currentColor`,children:a(`path`,{d:`M8 5v14l11-7z`})})}function d(e){if(!e)return``;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`}function f(f){let p=s(`components.common.list.collectionList`),{id:m,title:h,contentCount:g,contents:_=l}=f,v=_.slice(0,3);return o(t,{className:`bg-bg1 rounded-lg py-3`,children:[o(t,{className:`flex items-center justify-between mb-3 gap-2`,children:[a(n,{className:`text-sm text-text1 font-medium line-clamp-1`,children:h}),o(c,{href:`/collection/${m}`,className:`flex items-center shrink-0 gap-1 text-text3`,children:[o(n,{className:`text-xs`,children:[g,p(`collectionListItem.contentCountSuffix`)]}),a(r,{})]})]}),a(t,{className:`grid grid-cols-3 gap-2`,children:v.map((r,s)=>o(c,{href:`/${r.contentType===1?`video`:`post`}/${r.id}`,className:`flex flex-col gap-1`,children:[o(t,{className:`relative aspect-video rounded-md overflow-hidden bg-gray-100`,children:[a(e,{src:r.coverImage||`/empty/default-cover.png`,alt:r.title||h,fill:!0,className:`object-cover`}),r.isVideo&&o(i,{children:[a(t,{className:`absolute inset-0 flex items-center justify-center bg-black/20`,children:a(t,{className:`w-6 h-6 rounded-full bg-white/80 flex items-center justify-center`,children:a(u,{size:12})})}),r.isMovie&&a(t,{className:`absolute bottom-1 left-1 rounded-xs bg-black/60 px-1 text-[10px] text-white`,children:p(`collectionListItem.movieLabel`)}),r.videoDuration&&a(t,{className:`absolute bottom-1 right-1 rounded-xs bg-black/60 px-1 text-[10px] text-white`,children:d(r.videoDuration)})]})]}),a(t,{className:`flex items-center justify-between gap-1`,children:a(n,{className:`text-xs text-text1 line-clamp-1`,dangerouslySetInnerHTML:{__html:r.title||``}})})]},r.id??`${h}-${s}`))})]})}export{f as CollectionListItem};
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{RightArrowIcon as r}from"../../icons/right-arrow.mjs";import{Fragment as i,jsx as a,jsxs as o}from"react/jsx-runtime";import{useTranslations as s}from"next-intl";import c from"next/link";const l=[];function u({size:e=12}){return a(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`currentColor`,children:a(`path`,{d:`M8 5v14l11-7z`})})}function d(e){if(!e)return``;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`}function f(f){let p=s(`components.common.list.collectionList`),{id:m,title:h,contentCount:g,contents:_=l}=f,v=_.slice(0,3);return o(t,{className:`bg-bg1 rounded-lg py-3`,children:[o(t,{className:`flex items-center justify-between mb-3 gap-2`,children:[a(n,{className:`text-sm text-text1 font-medium line-clamp-1`,children:h}),o(c,{href:`/collection/${m}`,className:`flex items-center shrink-0 gap-1 text-text3`,children:[o(n,{className:`text-xs`,children:[g,p(`collectionListItem.contentCountSuffix`)]}),a(r,{})]})]}),a(t,{className:`grid grid-cols-3 gap-2`,children:v.map((r,s)=>r.isPlaceholder?a(t,{className:`aspect-video rounded-md bg-bg2`},r.id??`${h}-${s}`):o(c,{href:`/${r.contentType===1?`video`:`post`}/${r.id}`,className:`flex flex-col gap-1`,children:[o(t,{className:`relative aspect-video rounded-md overflow-hidden bg-gray-100`,children:[a(e,{src:r.coverImage||`/empty/default-cover.png`,alt:r.title||h,fill:!0,className:`object-cover`}),r.isVideo&&o(i,{children:[a(t,{className:`absolute inset-0 flex items-center justify-center bg-black/20`,children:a(t,{className:`w-6 h-6 rounded-full bg-white/80 flex items-center justify-center`,children:a(u,{size:12})})}),r.isMovie&&a(t,{className:`absolute bottom-1 left-1 rounded-xs bg-black/60 px-1 text-[10px] text-white`,children:p(`collectionListItem.movieLabel`)}),r.videoDuration&&a(t,{className:`absolute bottom-1 right-1 rounded-xs bg-black/60 px-1 text-[10px] text-white`,children:d(r.videoDuration)})]})]}),a(t,{className:`flex items-center justify-between gap-1`,children:a(n,{className:`text-xs text-text1 line-clamp-1`,dangerouslySetInnerHTML:{__html:r.title||``}})})]},r.id??`${h}-${s}`))})]})}export{f as CollectionListItem};
@@ -18,6 +18,8 @@ interface PostListProps {
18
18
  selectedIds?: Set<string>;
19
19
  /** 切换选中状态的回调 */
20
20
  onToggleSelection?: (id: string) => void;
21
+ /** 空状态文案 */
22
+ emptyText?: string;
21
23
  }
22
24
  /**
23
25
  * 帖子列表组件。
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{Text as n}from"../../../ui/text.mjs";import{normalizeTimeToMilliseconds as r}from"../../../ui/time.mjs";import{PostListItemSkeleton as i}from"../../skeleton/post-list-item-skeleton.mjs";import{PostListItem as a}from"./post-list-item.mjs";import{useIsClient as o}from"foxact/use-is-client";import{useMemo as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";import f from"next/link";import{orderBy as p}from"lodash-es";function m(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function h(r){let h=d(`components.ui.list`),g=o(),{list:_,loading:v,hasMore:y=!1,loadMore:b,isEditMode:x,selectedIds:S,onToggleSelection:C}=r,w=s(()=>p(_,[`publishTime`],[`desc`]),[_]),{todayList:T,earlierList:E}=s(()=>{if(!g)return{todayList:[],earlierList:w};let e=[],t=[];for(let n of _)m(n.publishTime)?e.push(n):t.push(n);return{todayList:p(e,[`publishTime`],[`desc`]),earlierList:p(t,[`publishTime`],[`desc`])}},[g,_,w]),D=!!v&&_.length===0,O=g;return D?l(e,{className:`bg-bg1`,children:Array.from({length:6}).map((e,t)=>l(i,{isEditMode:x},`post-list-item-skeleton-${t}`))}):u(t,{loading:v,loadMore:b,hasMore:y,empty:`no-content`,emptyText:h(`postList.empty`),children:[O&&T.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`postList.today`)})}),T.map(e=>x?l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)},e.id):l(f,{href:`/post/${e.id}`,children:l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)})},e.id))]}),E.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`postList.earlier`)})}),E.map(e=>x?l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)},e.id):l(f,{href:`/post/${e.id}`,children:l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)})},e.id))]})]})}export{h as PostList};
2
+ "use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{Text as n}from"../../../ui/text.mjs";import{normalizeTimeToMilliseconds as r}from"../../../ui/time.mjs";import{PostListItemSkeleton as i}from"../../skeleton/post-list-item-skeleton.mjs";import{PostListItem as a}from"./post-list-item.mjs";import{useIsClient as o}from"foxact/use-is-client";import{useMemo as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";import f from"next/link";import{orderBy as p}from"lodash-es";function m(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function h(r){let h=d(`components.ui.list`),g=o(),{list:_,loading:v,hasMore:y=!1,loadMore:b,isEditMode:x,selectedIds:S,onToggleSelection:C,emptyText:w}=r,T=s(()=>p(_,[`publishTime`],[`desc`]),[_]),{todayList:E,earlierList:D}=s(()=>{if(!g)return{todayList:[],earlierList:T};let e=[],t=[];for(let n of _)m(n.publishTime)?e.push(n):t.push(n);return{todayList:p(e,[`publishTime`],[`desc`]),earlierList:p(t,[`publishTime`],[`desc`])}},[g,_,T]),O=!!v&&_.length===0,k=g;return O?l(e,{className:`bg-bg1`,children:Array.from({length:6}).map((e,t)=>l(i,{isEditMode:x},`post-list-item-skeleton-${t}`))}):u(t,{loading:v,loadMore:b,hasMore:y,empty:`no-content`,emptyText:w||h(`postList.empty`),children:[k&&E.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`postList.today`)})}),E.map(e=>x?l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)},e.id):l(f,{href:`/post/${e.id}`,children:l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)})},e.id))]}),D.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`postList.earlier`)})}),D.map(e=>x?l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)},e.id):l(f,{href:`/post/${e.id}`,children:l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)})},e.id))]})]})}export{h as PostList};
@@ -20,6 +20,8 @@ interface VideoListProps {
20
20
  onToggleSelection?: (id: string) => void;
21
21
  /** 是否显示视频进度 */
22
22
  showVideoProgress?: boolean;
23
+ /** 空状态文案 */
24
+ emptyText?: string;
23
25
  }
24
26
  /**
25
27
  * 视频列表组件。
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{Text as n}from"../../../ui/text.mjs";import{normalizeTimeToMilliseconds as r}from"../../../ui/time.mjs";import{VideoListItemSkeleton as i}from"../../skeleton/video-list-item-skeleton.mjs";import{VideoListItem as a}from"./video-list-item.mjs";import{useIsClient as o}from"foxact/use-is-client";import{useMemo as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";import f from"next/link";import{orderBy as p}from"lodash-es";function m(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function h(r){let h=d(`components.ui.list`),g=o(),{list:_,showVideoProgress:v,loading:y,hasMore:b=!1,loadMore:x,isEditMode:S,selectedIds:C,onToggleSelection:w}=r,T=s(()=>p(_,[`publishTime`],[`desc`]),[_]),{todayList:E,earlierList:D}=s(()=>{if(!g)return{todayList:[],earlierList:T};let e=[],t=[];for(let n of _)m(n.publishTime)?e.push(n):t.push(n);return{todayList:p(e,[`publishTime`],[`desc`]),earlierList:p(t,[`publishTime`],[`desc`])}},[g,_,T]),O=!!y&&_.length===0,k=g;return O?l(e,{className:`bg-bg1`,children:Array.from({length:6}).map((e,t)=>l(i,{isEditMode:S,showVideoProgress:v},`video-list-item-skeleton-${t}`))}):u(t,{loading:y,loadMore:x,hasMore:b,empty:`no-content`,emptyText:h(`videoList.empty`),children:[k&&E.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`videoList.today`)})}),E.map(e=>S?l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id):l(f,{href:`/video/${e.id}/${e.title}`,children:l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id)},e.id))]}),D.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`videoList.earlier`)})}),D.map(e=>S?l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id):l(f,{href:`/video/${e.id}/${e.title}`,children:l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id)},e.id))]})]})}export{h as VideoList};
2
+ "use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{Text as n}from"../../../ui/text.mjs";import{normalizeTimeToMilliseconds as r}from"../../../ui/time.mjs";import{VideoListItemSkeleton as i}from"../../skeleton/video-list-item-skeleton.mjs";import{VideoListItem as a}from"./video-list-item.mjs";import{useIsClient as o}from"foxact/use-is-client";import{useMemo as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";import f from"next/link";import{orderBy as p}from"lodash-es";function m(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function h(r){let h=d(`components.ui.list`),g=o(),{list:_,showVideoProgress:v,loading:y,hasMore:b=!1,loadMore:x,isEditMode:S,selectedIds:C,onToggleSelection:w,emptyText:T}=r,E=s(()=>p(_,[`publishTime`],[`desc`]),[_]),{todayList:D,earlierList:O}=s(()=>{if(!g)return{todayList:[],earlierList:E};let e=[],t=[];for(let n of _)m(n.publishTime)?e.push(n):t.push(n);return{todayList:p(e,[`publishTime`],[`desc`]),earlierList:p(t,[`publishTime`],[`desc`])}},[g,_,E]),k=!!y&&_.length===0,A=g;return k?l(e,{className:`bg-bg1`,children:Array.from({length:6}).map((e,t)=>l(i,{isEditMode:S,showVideoProgress:v},`video-list-item-skeleton-${t}`))}):u(t,{loading:y,loadMore:x,hasMore:b,empty:`no-content`,emptyText:T||h(`videoList.empty`),children:[A&&D.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`videoList.today`)})}),D.map(e=>S?l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id):l(f,{href:`/video/${e.id}/${e.title}`,children:l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id)},e.id))]}),O.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`videoList.earlier`)})}),O.map(e=>S?l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id):l(f,{href:`/video/${e.id}/${e.title}`,children:l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id)},e.id))]})]})}export{h as VideoList};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,pCommunityCreateCollection as r,pCommunityUpdateCollection as i}from"../../../service/generated/client.mjs";import{compressImage as a}from"../../../utils/image-compression.mjs";import{uploadFile as o}from"../../../utils/upload-file.mjs";import{Image as s}from"../../ui/image.mjs";import{Box as c}from"../../ui/box.mjs";import{InputGroup as l,InputGroupAddon as u,InputGroupTextarea as d}from"../../ui/input-group.mjs";import{Field as f,FieldLabel as p}from"../../ui/field.mjs";import{Text as m}from"../../ui/text.mjs";import{useDeleteRequest as h,useRequest as g}from"../../../hooks/query/use-query.mjs";import{HeaderNav as _}from"../../common/header-nav/client.mjs";import{AddIcon as v}from"../../common/icons/add.mjs";import{useEffect as y,useRef 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{useRouter as E}from"next/navigation";function D({mode:D=`create`,collectionId:O}){let k=T(`components.pages.collectionCreate`),A=E(),{userId:j}=t(),M=h(),N=b(null),P=D===`edit`&&!!O,F=b(!1),[I,L]=x(!1),[R,z]=x(!1),[B,V]=x(``),[H,U]=x({title:``,description:``}),W=g([`collection-detail`,O],()=>n({collection_id:O}),{enabled:!!(P&&O)}).data?.data?.data?.collection;y(()=>{!P||F.current||!W||(U({title:W.title??``,description:W.description??``}),V(W.cover_image??``),F.current=!0)},[W,P]);function G(e,t){U(n=>({...n,[e]:t}))}function K(){N.current?.click()}async function q(e){let t=e.target.files?.[0];if(t)try{z(!0),V((await o(await a(t),1)).objectKey)}catch(e){console.error(`上传封面失败`,e),w.error(k(`form.coverUploadFailed`))}finally{z(!1),e.target&&(e.target.value=``)}}async function J(){if(I)return;let e=H.title.trim(),t=H.description.trim();if(!e){w.error(k(`form.titleRequired`));return}if(P&&!O){w.error(k(`form.collectionNotFound`));return}try{L(!0);let n=w.loading(k(P?`form.saving`:`form.creating`)),a=P?await i({collection_id:O,title:e,description:t,cover_image:B}):await r({title:e,description:t,cover_image:B});if(a.code===0){w.success(k(P?`form.saveSuccess`:`form.createSuccess`),{id:n}),j&&M([`user-profile`,`mine`,j,`user-collection-created`,j]),P&&O&&M([`collection-detail`,O]),A.back();return}w.error(a.message||k(P?`form.saveFailed`:`form.createFailed`),{id:n})}catch(e){console.error(P?`编辑合集失败`:`创建合集失败`,e),w.error(k(P?`form.saveFailed`:`form.createFailed`))}finally{L(!1)}}return C(c,{className:`min-h-screen !bg-bg2`,children:[S(_,{title:k(P?`form.editTitle`:`form.createTitle`),className:`!bg-bg2`,rightChild:S(e,{onClick:J,disabled:I||R,children:k(I?P?`form.saving`:`form.creating`:P?`form.save`:`form.create`)})}),C(c,{className:`pb-3`,children:[C(f,{className:`!bg-bg2 px-3 border-none`,children:[S(p,{required:!0,children:k(`form.label`)}),C(l,{children:[S(d,{className:`!bg-bg1 p-2.5`,maxLength:50,placeholder:k(`form.titlePlaceholder`),value:H.title,onChange:e=>G(`title`,e.target.value)}),S(u,{className:`!bg-bg1`,align:`block-end`,children:S(`div`,{className:`text-right w-full`,children:C(`span`,{className:`text-xs`,children:[H.title.length,`/50`]})})})]})]}),C(f,{className:`border-none px-3 bg-bg2! `,children:[S(p,{children:k(`form.descriptionLabel`)}),C(l,{children:[S(d,{className:`!bg-bg1 p-2.5`,maxLength:100,placeholder:k(`form.descriptionPlaceholder`),value:H.description,onChange:e=>G(`description`,e.target.value)}),S(u,{className:`!bg-bg1`,align:`block-end`,children:S(`div`,{className:`text-right w-full`,children:C(`span`,{className:`text-xs`,children:[H.description.length,`/100`]})})})]})]}),C(f,{className:`!bg-bg2 px-3 border-none`,children:[S(p,{children:k(`form.coverLabel`)}),S(`input`,{ref:N,type:`file`,accept:`image/*`,className:`hidden`,onChange:q}),S(c,{className:`relative mt-2 flex aspect-video items-center justify-center gap-2 overflow-hidden rounded-lg border border-dashed border-text1/10 !bg-bg1`,onClick:K,children:B?S(s,{src:B,alt:k(`form.coverAlt`),fill:!0,className:`object-cover`}):C(c,{className:`flex flex-col items-center justify-center gap-2 py-6`,children:[S(v,{}),S(m,{className:`text-xs text-text3`,children:k(R?`form.uploading`:`form.addCover`)})]})})]})]})]})}export{D as CollectionCreateForm};
2
+ "use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,pCommunityCreateCollection as r,pCommunityUpdateCollection as i}from"../../../service/generated/client.mjs";import{Box as a}from"../../ui/box.mjs";import{InputGroup as o,InputGroupAddon as s,InputGroupTextarea as c}from"../../ui/input-group.mjs";import{Field as l,FieldLabel as u}from"../../ui/field.mjs";import{useDeleteRequest as d,useRequest as f}from"../../../hooks/query/use-query.mjs";import{HeaderNav as p}from"../../common/header-nav/client.mjs";import{useEffect as m,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useTranslations as b}from"next-intl";import{useRouter as x}from"next/navigation";function S({mode:S=`create`,collectionId:C}){let w=b(`components.pages.collectionCreate`),T=x(),{userId:E}=t(),D=d();h(null);let O=S===`edit`&&!!C,k=h(!1),[A,j]=g(!1),[M,N]=g(!1),[P,F]=g(``),[I,L]=g({title:``,description:``}),R=f([`collection-detail`,C],()=>n({collection_id:C}),{enabled:!!(O&&C)}).data?.data?.data?.collection;m(()=>{!O||k.current||!R||(L({title:R.title??``,description:R.description??``}),F(R.cover_image??``),k.current=!0)},[R,O]);function z(e,t){L(n=>({...n,[e]:t}))}async function B(){if(A)return;let e=I.title.trim(),t=I.description.trim();if(!e){y.error(w(`form.titleRequired`));return}if(O&&!C){y.error(w(`form.collectionNotFound`));return}try{j(!0);let n=y.loading(w(O?`form.saving`:`form.creating`)),a=O?await i({collection_id:C,title:e,description:t,cover_image:P}):await r({title:e,description:t,cover_image:P});if(a.code===0){y.success(w(O?`form.saveSuccess`:`form.createSuccess`),{id:n}),E&&D([`user-profile`,`mine`,E,`user-collection-created`,E]),O&&C&&D([`collection-detail`,C]),T.back();return}y.error(a.message||w(O?`form.saveFailed`:`form.createFailed`),{id:n})}catch(e){console.error(O?`编辑合集失败`:`创建合集失败`,e),y.error(w(O?`form.saveFailed`:`form.createFailed`))}finally{j(!1)}}return v(a,{className:`min-h-screen !bg-bg2`,children:[_(p,{title:w(O?`form.editTitle`:`form.createTitle`),className:`!bg-bg2`,rightChild:_(e,{onClick:B,disabled:A||M,children:w(A?O?`form.saving`:`form.creating`:O?`form.save`:`form.create`)})}),v(a,{className:`pb-3`,children:[v(l,{className:`!bg-bg2 px-3 border-none`,children:[_(u,{required:!0,children:w(`form.label`)}),v(o,{children:[_(c,{className:`!bg-bg1 p-2.5`,maxLength:50,placeholder:w(`form.titlePlaceholder`),value:I.title,onChange:e=>z(`title`,e.target.value)}),_(s,{className:`!bg-bg1`,align:`block-end`,children:_(`div`,{className:`text-right w-full`,children:v(`span`,{className:`text-xs`,children:[I.title.length,`/50`]})})})]})]}),v(l,{className:`border-none px-3 bg-bg2! `,children:[_(u,{children:w(`form.descriptionLabel`)}),v(o,{children:[_(c,{className:`!bg-bg1 p-2.5`,maxLength:100,placeholder:w(`form.descriptionPlaceholder`),value:I.description,onChange:e=>z(`description`,e.target.value)}),_(s,{className:`!bg-bg1`,align:`block-end`,children:_(`div`,{className:`text-right w-full`,children:v(`span`,{className:`text-xs`,children:[I.description.length,`/100`]})})})]})]})]})]})}export{S as CollectionCreateForm};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{cn as e}from"../../../../utils/cn.mjs";import{Image as t}from"../../../ui/image.mjs";import{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import{Time as i}from"../../../ui/time.mjs";import{MoreIcon as a}from"../../../common/icons/more.mjs";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{useTranslations as c}from"next-intl";import l from"next/link";function u(e){return Number.isFinite(e)?e.toFixed(1):`--`}function d(d){let{title:f,coverImage:p,score:m,isMovie:h,collectedAt:g,tags:_,id:v,type:y,onOpenShare:b}=d,x=c(`components.pages.collectionDetail`);function S(){b?.({id:v,type:y,title:f})}return s(n,{className:`pt-2`,children:[s(n,{className:`flex justify-between items-center`,children:[s(r,{className:`text-sm text-text2`,children:[x(`components.collectionDetailCard.collectedInLabel`),`:`,o(i,{value:g,format:`YYYY-MM-DD HH:mm`,fallback:`--`})]}),o(`button`,{className:e(`p-2`),onClick:S,children:o(a,{})})]}),s(l,{className:`flex items-start gap-3 py-3`,href:y===1?`/video/${v}/${f}`:`/post/${v}`,children:[o(n,{className:`relative w-32 h-20 shrink-0 rounded-lg overflow-hidden bg-gray-100`,children:o(t,{src:p||`/empty/default-cover.png`,alt:f||x(`detail.coverAlt`),fill:!0,className:`object-cover`})}),s(n,{className:`flex-1 min-w-0 flex flex-col gap-1.5`,children:[s(n,{className:`flex justify-between `,children:[o(r,{className:`text-base font-bold text-text1 line-clamp-1`,dangerouslySetInnerHTML:{__html:f}}),h&&o(r,{className:`text-xl font-bold text-[#ff9f1a]`,children:u(m)})]}),o(n,{className:`flex flex-wrap gap-1`,children:_.map(e=>o(n,{className:`px-2 py-0.5 rounded-full scale-90 text-sm text-[rgb(226,76,37)] bg-[rgba(226,76,37,.3)] `,children:e},e))})]})]})]})}export{d as CollectionDetailCard};
2
+ "use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Checkbox as n}from"../../../ui/checkbox.mjs";import{Text as r}from"../../../ui/text.mjs";import{VideoListItem as i}from"../../../common/list/video-list/video-list-item.mjs";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{useTranslations as s}from"next-intl";import c from"next/link";const l=[];function u(e){return Number.isFinite(e)?e.toFixed(1):`--`}function d(e){return e===1}function f(f){let{title:p,coverImage:m,score:h=0,isMovie:g=!1,collectedAt:_,tags:v=l,id:y,type:b,duration:x=0,authorName:S=``,viewCount:C=0,publishTime:w,is_more_link:T=!1,seriesNum:E,isEditMode:D=!1,isSelected:O=!1,onToggleSelection:k}=f,A=s(`components.pages.collectionDetail`);function j(){k?.(y)}function M(e){e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),j())}function N(e){e.stopPropagation(),j()}return d(b)?D?a(t,{role:`button`,tabIndex:0,className:`w-full text-left`,onClick:j,onKeyDown:M,children:o(t,{className:`flex items-start gap-2`,children:[a(`button`,{type:`button`,className:`-m-2 p-2 shrink-0 self-center`,onClick:N,children:a(n,{checked:O,className:`pointer-events-none`})}),a(t,{className:`flex-1 min-w-0`,children:a(i,{id:y,title:p,coverImage:m,duration:x,authorName:S,viewCount:C,publishTime:w??_??``,is_more_link:T,seriesNum:E,showVideoProgress:!1})})]})}):a(c,{className:`block`,href:`/video/${y}/${p}`,children:a(i,{id:y,title:p,coverImage:m,duration:x,authorName:S,viewCount:C,publishTime:w??_??``,is_more_link:T,seriesNum:E,showVideoProgress:!1})}):D?a(t,{role:`button`,tabIndex:0,className:`w-full text-left`,onClick:j,onKeyDown:M,children:o(t,{className:`flex items-start gap-2 py-1.5`,children:[a(`button`,{type:`button`,className:`-m-2 p-2 shrink-0 self-center`,onClick:N,children:a(n,{checked:O,className:`pointer-events-none`})}),o(t,{className:`flex-1 min-w-0 flex items-start gap-3`,children:[a(t,{className:`relative w-32 h-20 shrink-0 rounded-lg overflow-hidden bg-gray-100`,children:a(e,{src:m||`/empty/default-cover.png`,alt:p||A(`detail.coverAlt`),fill:!0,className:`object-cover`})}),o(t,{className:`flex-1 min-w-0 flex flex-col gap-1.5`,children:[o(t,{className:`flex justify-between `,children:[a(r,{className:`text-base font-bold text-text1 line-clamp-1`,dangerouslySetInnerHTML:{__html:p}}),g&&a(r,{className:`text-xl font-bold text-[#ff9f1a]`,children:u(h)})]}),a(t,{className:`flex flex-wrap gap-1`,children:v.map(e=>a(t,{className:`px-2 py-0.5 rounded-full scale-90 text-sm text-[rgb(226,76,37)] bg-[rgba(226,76,37,.3)] `,children:e},e))})]})]})]})}):a(t,{className:`pt-2`,children:o(c,{className:`flex items-start gap-3 py-3`,href:b===1?`/video/${y}/${p}`:`/post/${y}`,children:[a(t,{className:`relative w-32 h-20 shrink-0 rounded-lg overflow-hidden bg-gray-100`,children:a(e,{src:m||`/empty/default-cover.png`,alt:p||A(`detail.coverAlt`),fill:!0,className:`object-cover`})}),o(t,{className:`flex-1 min-w-0 flex flex-col gap-1.5`,children:[o(t,{className:`flex justify-between `,children:[a(r,{className:`text-base font-bold text-text1 line-clamp-1`,dangerouslySetInnerHTML:{__html:p}}),g&&a(r,{className:`text-xl font-bold text-[#ff9f1a]`,children:u(h)})]}),a(t,{className:`flex flex-wrap gap-1`,children:v.map(e=>a(t,{className:`px-2 py-0.5 rounded-full scale-90 text-sm text-[rgb(226,76,37)] bg-[rgba(226,76,37,.3)] `,children:e},e))})]})]})})}export{f as CollectionDetailCard};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,gUserViewUserInfo as r,pCommunityDeleteCollection as i,pCommunityRemoveContentFromCollection as a,pCommunitySubscribeCollection as o}from"../../../service/generated/client.mjs";import{Image as s}from"../../ui/image.mjs";import{Box as c}from"../../ui/box.mjs";import{List as ee}from"../../ui/list.mjs";import{Text as l}from"../../ui/text.mjs";import{Time as u}from"../../ui/time.mjs";import{useDeleteRequest as te,useMutation as d,useRequest as f,useUpdateRequest as p}from"../../../hooks/query/use-query.mjs";import{useLoginModalStore as m}from"../../../store/modules/login-modal-store.mjs";import{ShareDrawer as h}from"../../common/share-popup/share-drawer.mjs";import{SharePlatformEnum as g}from"../../../types/share.mjs";import _ from"../../../utils/share-manager.mjs";import{HeaderNav as v}from"../../common/header-nav/client.mjs";import{DeleteIcon as y}from"../../common/icons/delete.mjs";import{MoreIcon as b}from"../../common/icons/more.mjs";import{EditIcon as x}from"../../common/icons/edit.mjs";import{CollectionDetailCard as S}from"./_components/collection-detail-card.mjs";import{useMemo as C,useState as w}from"react";import{Fragment as ne,jsx as T,jsxs as E}from"react/jsx-runtime";import{toast as D}from"sonner";import{useTranslations as re}from"next-intl";import{useRouter as ie,useSearchParams as ae}from"next/navigation";function O(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function oe(e){let t=e.detail,n=t.info,r=O(e),i=n?.text||n?.title||t.content||``,a=t.author_score??0,o=t.tags??[];return{id:e.content_id?String(e.content_id):String(e.id),title:i,type:e.type,coverImage:r,score:a,collectedAt:t.create_time,tags:o}}function k({id:O}){let k=re(`components.pages.collectionDetail`),A=ie(),se=ae(),{userId:j,isLogin:M}=t(),{open:N}=m(),P=te(),F=p(),I=f([`collection-detail`,O],()=>n({collection_id:O})),L=I.data?.data?.data?.collection?.user_id,R=!!(L&&j&&String(L)===String(j)),z=f([`user-info`,L],()=>r({target_user_id:L,user_id:L})),[B,V]=w(!1),[H,U]=w(null),W=I.data?.data?.data?.collection,G=W?.contents,K=C(()=>G?G.map(e=>({content_id:e.content_id,id:Number(e.content_id),detail:e,type:e.source_type,medias:e.medias,cover_image:e.cover_image})):[],[G]).map(oe),ce=W?.cover_image,le=W?.content_count??0,q=W?.is_subscribe===!0,{mutateAsync:ue,isPending:J}=d(async e=>await o({collection_id:O,subscribe:e})),{mutateAsync:de,isPending:fe}=d(async e=>await a({collection_id:O,content_id:e})),{mutateAsync:pe,isPending:Y}=d(async e=>await i({collection_id:e})),X=z.data?.data,me=X?.avatar,he=X?.nick_name,Z=R&&W?.is_default===!1;function ge(e){U({kind:`content`,id:e.id,type:e.type,title:e.title,isCollected:!0}),V(!0)}function _e(){U({kind:`collection`,id:O}),V(!0)}function ve(e){if(typeof window>`u`)return``;if(e.kind===`collection`)return`${window.location.origin}/collection/${e.id}`;let t=e.title?encodeURIComponent(e.title):`detail`,n=e.type===1?`/video/${e.id}/${t}`:`/post/${e.id}`;return`${window.location.origin}${n}`}function Q(e){if(!H)return;let t=ve(H);t&&_.showSharePopup({type:e,data:{id:H.id},copyUrl:t})}function $(){Q(g.WECHAT)}function ye(){Q(g.QQ)}function be(){Q(g.WECHAT_MOMENTS)}function xe(){A.push(`/collection/add?id=${O}`)}function Se(){if(!fe){if(!M||!j){D.error(k(`detail.pleaseLogin`)),N();return}!H||H.kind!==`content`||de(H.id).then(e=>{if(e.code===0){D.success(k(`detail.uncollectSuccess`)),P([`collection-detail`,O]),U(e=>e&&{...e,isCollected:!1});return}D.error(e.message||k(`detail.uncollectFailed`))}).catch(e=>{console.error(`取消收藏失败`,e),D.error(k(`detail.operationFailed`))})}}function Ce(){let e=new URLSearchParams(se.toString());e.set(`id`,O),e.set(`type`,`edit`),A.push(`/collection/create?${e.toString()}`),V(!1)}async function we(){if(!Y){if(!M||!j){D.error(k(`detail.pleaseLogin`)),N();return}if(!Z){D.error(k(`detail.defaultCollectionDeleteNotSupported`));return}try{let e=await pe(O);if(e.code===0){D.success(k(`detail.deleteSuccess`)),P([`collection-detail`,O]),P([`user-profile`,`mine`]),P([`user-profile`,`profile`,L]),V(!1),A.back();return}D.error(e.message||k(`detail.deleteFailed`))}catch(e){console.error(`删除合集失败`,e),D.error(k(`detail.operationFailed`))}}}function Te(e){F([`collection-detail`,O],t=>t?.data?.data?.collection?{...t,data:{...t.data,data:{...t.data.data,collection:{...t.data.data.collection,is_subscribe:e}}}}:t)}async function Ee(){if(!J){if(!M||!j){D.error(k(`detail.pleaseLogin`)),N();return}try{let e=await ue(!q);e.code===0?(D.success(k(q?`detail.unsubscribeSuccess`:`detail.subscribeSuccess`)),Te(!q),P([`collection-detail`,O])):D.error(e.message||k(`detail.subscribeOperateFailed`))}catch(e){console.error(`订阅合集失败`,e),D.error(k(`detail.operationFailed`))}}}return E(c,{className:`flex flex-col gap-4 pb-6 bg-bg1 min-h-screen`,children:[T(v,{title:W?.title??``,rightChild:T(`button`,{onClick:_e,className:`p-2`,children:T(b,{})})}),E(c,{className:`px-4 flex items-start gap-4`,children:[T(c,{className:`relative h-20 shrink-0 rounded-lg overflow-hidden aspect-video bg-gray-100`,children:T(s,{src:ce||``,alt:W?.title??k(`detail.coverAlt`),fill:!0,className:`object-cover`})}),E(c,{className:`flex-1 flex flex-col gap-2`,children:[E(c,{className:`flex items-center justify-between`,children:[T(l,{className:`text-base text-text1 font-medium line-clamp-2`,children:W?.title??k(`detail.defaultTitle`)}),R?T(e,{variant:`secondary`,size:`sm`,onClick:xe,children:k(`detail.add`)}):T(e,{variant:q?`secondary`:`default`,size:`sm`,className:`rounded-md`,onClick:Ee,disabled:J,children:k(J?`detail.subscribeProcessing`:q?`detail.subscribed`:`detail.subscribe`)})]}),E(c,{className:`flex flex-wrap items-center gap-2 text-xs text-text3`,children:[T(c,{className:`relative w-3 h-3 rounded-full overflow-hidden bg-gray-100`,children:T(s,{src:me||``,alt:k(`detail.ownerAvatarAlt`),fill:!0,className:`object-cover`})}),E(c,{className:`flex items-center justify-between gap-2`,children:[T(l,{className:`text-xs text-text1`,children:he}),E(l,{className:`text-xs text-text1 shrink-0`,children:[le,k(`detail.contentCountSuffix`)]})]}),T(c,{className:`flex gap-2`,children:E(l,{className:`text-xs text-text3`,children:[T(u,{value:W?.update_time,format:`YYYY-MM-DD`,fallback:`--`}),k(`detail.updatedSuffix`)]})})]})]})]}),W?.description&&T(c,{className:`p-2 text-text2 text-sm`,children:W?.description}),T(c,{className:`px-4`,children:T(ee,{loading:I.isLoading,hasMore:!1,emptyText:k(`detail.emptyContent`),className:`divide-y divide-text1/5`,children:K.map(e=>T(S,{...e,onOpenShare:ge},e.id))})}),T(h,{isShowCollect:H?.kind===`content`&&R&&M,isCollected:H?.isCollected,open:B,onOpenChange:V,onShareWeChat:$,onShareQQ:ye,onShareMoments:be,onUncollect:Se,secondRow:H?.kind===`collection`&&R?E(ne,{children:[E(`button`,{className:`flex items-center justify-center py-3 flex-col gap-2`,onClick:Ce,children:[T(`i`,{className:`rounded-full bg-bg2 w-12 h-12 flex items-center justify-center`,children:T(x,{className:`w-5 h-5`})}),T(l,{children:k(`detail.editCollection`)})]}),Z&&E(`button`,{className:`flex items-center justify-center py-3 flex-col gap-2 ${Y?`cursor-not-allowed opacity-60`:``}`,onClick:we,disabled:Y,children:[T(`i`,{className:`rounded-full bg-bg2 w-12 h-12 flex items-center justify-center `,children:T(y,{})}),T(l,{className:``,children:k(Y?`detail.deleting`:`detail.deleteCollection`)})]})]}):void 0})]})}export{k as CollectionDetail};
2
+ "use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,gUserViewUserInfo as r,pCommunityDeleteCollection as i,pCommunityRemoveContentFromCollection as a,pCommunitySubscribeCollection as o,pInteractionBatchDeleteCollects as s}from"../../../service/generated/client.mjs";import{Box as c}from"../../ui/box.mjs";import{Checkbox as ee}from"../../ui/checkbox.mjs";import{Drawer as te,DrawerContent as ne,DrawerDescription as re,DrawerTitle as ie}from"../../ui/drawer.mjs";import{List as ae}from"../../ui/list.mjs";import{Text as l}from"../../ui/text.mjs";import{useDeleteRequest as oe,useMutation as u,useRequest as d,useUpdateRequest as se}from"../../../hooks/query/use-query.mjs";import{useLoginModalStore as ce}from"../../../store/modules/login-modal-store.mjs";import{ShareDrawer as le}from"../../common/share-popup/share-drawer.mjs";import{SharePlatformEnum as f}from"../../../types/share.mjs";import p from"../../../utils/share-manager.mjs";import{HeaderNav as m}from"../../common/header-nav/client.mjs";import{MoreIcon as h}from"../../common/icons/more.mjs";import{CollectionDetailCard as g}from"./_components/collection-detail-card.mjs";import{useMemo as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{toast as x}from"sonner";import{useTranslations as ue}from"next-intl";import{useRouter as S,useSearchParams as de}from"next/navigation";function C(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function w(e){let t=e.detail.info?.video_duration;if(typeof t==`number`&&Number.isFinite(t)&&t>0)return Math.floor(t);let n=e.medias?.find(e=>{let t=e?.video_duration;return typeof t==`number`&&Number.isFinite(t)&&t>0})?.video_duration;return typeof n==`number`&&Number.isFinite(n)&&n>0?Math.floor(n):0}function T(e){let t=e.detail.info?.play_count;if(typeof t==`number`&&Number.isFinite(t))return Math.max(0,Math.floor(t));let n=e.detail.view_count;return typeof n==`number`&&Number.isFinite(n)?Math.max(0,Math.floor(n)):0}function fe(e){let t=e.detail,n=t.info,r=n?.cover_image||t.cover_image||C(e),i=n?.text||n?.title||t.title||t.content||``,a=t.author_score??0,o=t.tags??[];return{id:e.content_id?String(e.content_id):String(e.id),title:i,type:e.type,coverImage:r,score:a,collectedAt:t.create_time,tags:o,duration:w(e),viewCount:T(e),publishTime:t.create_time||t.update_time||``,is_more_link:n?.is_more_link??!1,authorName:``}}function E({id:C}){let w=ue(`components.pages.collectionDetail`),T=S(),E=de(),{userId:D,isLogin:O}=t(),{open:k}=ce(),A=oe();se();let j=d([`collection-detail`,C],()=>n({collection_id:C})),M=j.data?.data?.data?.collection?.user_id,N=!!(M&&D&&String(M)===String(D)),P=d([`user-info`,M],()=>r({target_user_id:M,user_id:M})),[F,I]=v(!1),[L,R]=v(!1),[z,B]=v(!1),[V,H]=v(()=>new Set),[U,W]=v(null),G=j.data?.data?.data?.collection,K=G?.contents,q=_(()=>K?K.map(e=>({content_id:e.content_id,id:Number(e.content_id),detail:e,type:Number(e.source_type??0),medias:e.medias,cover_image:e.cover_image})):[],[K]).map(fe),J=_(()=>new Set(q.map(e=>e.id)),[q]),Y=J.size>0&&V.size===J.size;G?.cover_image,G?.content_count,G?.is_subscribe;let{mutateAsync:pe,isPending:me}=u(async e=>await o({collection_id:C,subscribe:e})),{mutateAsync:he,isPending:ge}=u(async e=>await a({collection_id:C,content_id:e})),{mutateAsync:_e,isPending:X}=u(async e=>await i({collection_id:e})),{mutateAsync:ve,isPending:Z}=u(async e=>await s({app_id:0,user_id:D,folder_id:C,content_type:1,content_ids:e})),Q=P.data?.data;Q?.avatar,Q?.nick_name;let ye=N&&G?.is_default===!1;function be(e){W({kind:`content`,id:e.id,type:e.type,title:e.title,isCollected:!0}),I(!0)}function xe(){if(N){R(!0);return}W({kind:`collection`,id:C}),I(!0)}function Se(){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}if(!N){x.error(w(`detail.operationFailed`));return}R(!1),H(new Set),B(!0)}function Ce(){H(new Set),B(!1)}function we(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function Te(){if(Y){H(new Set);return}H(new Set(J))}async function Ee(){if(!(V.size===0||Z)){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}try{let e=await ve(Array.from(V));if(e.code===0){x.success(w(`detail.uncollectSuccess`)),A([`collection-detail`,C]),A([`user-profile`,`mine`]),A([`user-profile`,`profile`,M]),H(new Set),B(!1);return}x.error(e.message||w(`detail.uncollectFailed`))}catch(e){console.error(`批量取消收藏失败`,e),x.error(w(`detail.operationFailed`))}}}function De(e){if(typeof window>`u`)return``;if(e.kind===`collection`)return`${window.location.origin}/collection/${e.id}`;let t=e.title?encodeURIComponent(e.title):`detail`,n=e.type===1?`/video/${e.id}/${t}`:`/post/${e.id}`;return`${window.location.origin}${n}`}function $(e){if(!U)return;let t=De(U);t&&p.showSharePopup({type:e,data:{id:U.id},copyUrl:t})}function Oe(){$(f.WECHAT)}function ke(){$(f.QQ)}function Ae(){$(f.WECHAT_MOMENTS)}function je(){if(!ge){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}!U||U.kind!==`content`||he(U.id).then(e=>{if(e.code===0){x.success(w(`detail.uncollectSuccess`)),A([`collection-detail`,C]),W(e=>e&&{...e,isCollected:!1});return}x.error(e.message||w(`detail.uncollectFailed`))}).catch(e=>{console.error(`取消收藏失败`,e),x.error(w(`detail.operationFailed`))})}}function Me(){let e=new URLSearchParams(E.toString());e.set(`id`,C),e.set(`type`,`edit`),T.push(`/collection/create?${e.toString()}`),R(!1),I(!1)}async function Ne(){if(!X){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}if(!ye){x.error(w(`detail.defaultCollectionDeleteNotSupported`));return}try{let e=await _e(C);if(e.code===0){x.success(w(`detail.deleteSuccess`)),A([`collection-detail`,C]),A([`user-profile`,`mine`]),A([`user-profile`,`profile`,M]),R(!1),I(!1),T.back();return}x.error(e.message||w(`detail.deleteFailed`))}catch(e){console.error(`删除合集失败`,e),x.error(w(`detail.operationFailed`))}}}return b(c,{className:`flex flex-col bg-bg1 min-h-screen ${z?`pb-28`:`pb-6`}`,children:[y(m,{title:G?.title??``,rightChild:N?z?y(`button`,{type:`button`,onClick:Ce,className:`px-2 py-1 text-sm text-text1`,children:w(`detail.done`)}):y(`button`,{type:`button`,onClick:xe,className:`p-2`,children:y(h,{})}):void 0}),y(c,{className:`px-4 flex items-start gap-4`,children:b(c,{className:`flex-1 flex flex-col gap-2`,children:[y(c,{className:`flex items-center justify-between`,children:y(l,{className:`text-xl text-text1 font-medium line-clamp-2`,children:G?.title??w(`detail.defaultTitle`)})}),y(c,{className:`text-text2 text-sm`,children:G?.description})]})}),y(c,{className:`px-4 ${z?`pb-20`:``}`,children:y(ae,{loading:j.isLoading,hasMore:!1,emptyText:w(`detail.emptyContent`),className:`divide-y divide-text1/5`,children:q.map(e=>y(g,{...e,onOpenShare:be,isEditMode:z,isSelected:V.has(e.id),onToggleSelection:we},e.id))})}),z&&b(c,{style:{paddingBottom:`calc(12px + env(safe-area-inset-bottom, 0px))`},className:`fixed left-0 right-0 bottom-0 z-10 bg-bg1 border-t border-text1/10 px-4 pt-3 flex items-center justify-between`,children:[b(c,{className:`flex items-center gap-2`,children:[y(ee,{checked:Y,onCheckedChange:Te}),y(l,{className:`text-sm text-text1`,children:w(`detail.selectAll`)})]}),y(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:V.size>0?`default`:`outline`,disabled:V.size===0||Z,onClick:Ee,children:w(Z?`detail.deleting`:`detail.delete`)})]}),b(te,{open:L,onOpenChange:R,children:[y(ie,{className:`hidden`,children:w(`detail.collectionManageTitle`)}),y(re,{className:`hidden`,children:w(`detail.collectionManageTitle`)}),b(ne,{className:`z-[2000]`,children:[b(c,{className:`px-4 py-5`,children:[y(l,{className:`text-sm text-text1 text-center font-medium`,children:w(`detail.collectionManageTitle`)}),b(c,{className:`mt-4 border-t border-text1/10`,children:[y(`button`,{className:`w-full text-left py-4 border-b border-text1/10`,onClick:Me,children:y(l,{className:`text-text1`,children:w(`detail.editCollection`)})}),y(`button`,{className:`w-full text-left py-4 border-b border-text1/10`,onClick:Se,children:y(l,{className:`text-text1`,children:w(`detail.manageCollection`)})}),y(`button`,{className:`w-full text-left py-4 ${X?`opacity-60 cursor-not-allowed`:``}`,onClick:Ne,disabled:X,children:y(l,{className:`text-destructive`,children:w(X?`detail.deleting`:`detail.deleteCollection`)})})]})]}),y(e,{className:`w-full h-auto py-4 text-lg text-text1`,size:`lg`,onClick:()=>R(!1),variant:`secondary`,children:w(`detail.cancel`)})]})]}),y(le,{isShowCollect:U?.kind===`content`&&N&&O,isCollected:U?.isCollected,open:F,onOpenChange:I,onShareWeChat:Oe,onShareQQ:ke,onShareMoments:Ae,onUncollect:je})]})}export{E as CollectionDetail};
@@ -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{pUserUserFeedback as r}from"../../../../service/generated/client.mjs";import{compressImage as i}from"../../../../utils/image-compression.mjs";import{uploadFile as a}from"../../../../utils/upload-file.mjs";import{Image as o}from"../../../ui/image.mjs";import{Box as s}from"../../../ui/box.mjs";import{InputGroup as c,InputGroupAddon as l,InputGroupInput as u,InputGroupTextarea as d}from"../../../ui/input-group.mjs";import{Field as f,FieldLabel as p}from"../../../ui/field.mjs";import{Text as m}from"../../../ui/text.mjs";import{HeaderNav as h}from"../../../common/header-nav/client.mjs";import{AddIcon as g}from"../../../common/icons/add.mjs";import{useRef as _,useState as v}from"react";import{XIcon as y}from"lucide-react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{toast as S}from"sonner";import{useTranslations as C}from"next-intl";import{useRouter as w}from"next/navigation";const T=new Set([`image/jpeg`,`image/jpg`,`image/png`]),E=new Set([`jpg`,`jpeg`,`png`]);function D(e){let t=e.type.toLowerCase(),n=e.name.split(`.`).pop()?.toLowerCase()||``;return t?T.has(t):E.has(n)}function O({className:T}={}){let E=C(`components.pages.feedback.components`),O=w(),{userId:k}=n(),A=_(null),[j,M]=v({content:``,contact:``}),[N,P]=v([]),[F,I]=v(!1),[L,R]=v(!1),z=!j.content.trim();function B(e,t){M(n=>({...n,[e]:t}))}function V(){L||F||N.length>=3||A.current?.click()}async function H(e){let t=Array.from(e.target.files??[]);if(!t.length)return;let n=3-N.length;if(n<=0){e.target&&(e.target.value=``);return}let r=t.slice(0,n),o=r.filter(D);if(!o.length){S.error(E(`feedbackForm.imageTypeInvalid`)),e.target&&(e.target.value=``);return}o.length!==r.length&&S.error(E(`feedbackForm.imageTypeInvalid`));try{R(!0);let e=[],t=!1;for(let n of o)try{let t=await a(await i(n),1);e.push(t.objectKey)}catch(e){console.error(`上传截图失败`,e),t=!0}e.length&&P(t=>[...t,...e].slice(0,3)),t&&S.error(E(`feedbackForm.screenshotUploadFailed`))}catch(e){console.error(`上传截图失败`,e),S.error(E(`feedbackForm.screenshotUploadFailed`))}finally{R(!1),e.target&&(e.target.value=``)}}function U(e){L||F||P(t=>t.filter((t,n)=>n!==e))}async function W(){let e=j.content.trim(),t=j.contact.trim();if(!e){S.error(E(`feedbackForm.missingFeedback`));return}if(e.length<4){S.error(E(`feedbackForm.contentMinLength`));return}if(!N.length){S.error(E(`feedbackForm.missingScreenshot`));return}if(F)return;let n=S.loading(E(`feedbackForm.loading`));try{I(!0);let i=await r({user_id:k,feedback_content:e,feedback_screenshots:N.length?N:void 0,contact_info:t||void 0});if(i.code===0){M({content:``,contact:``}),P([]),O.push(`/settings`),S.success(E(`feedbackForm.submitsuccess`),{id:n});return}S.error(i.message||E(`feedbackForm.message`),{id:n})}catch(e){console.error(`提交反馈失败`,e),S.error(e.message||E(`feedbackForm.message`),{id:n})}finally{I(!1)}}return x(s,{className:e(`min-h-screen bg-bg2`,T),children:[b(h,{title:E(`feedbackForm.title`),className:`!bg-bg2`,rightChild:b(t,{onClick:W,disabled:F||L||z,children:E(F?`feedbackForm.loading`:`feedbackForm.submit`)})}),x(s,{className:`pb-3`,children:[x(f,{className:`bg-bg2 px-3 border-none`,children:[b(p,{required:!0,children:E(`feedbackForm.label`)}),x(c,{children:[b(d,{className:`!bg-bg1 p-2.5`,maxLength:500,placeholder:E(`feedbackForm.placeholder`),value:j.content,onChange:e=>B(`content`,e.target.value)}),b(l,{className:`!bg-bg1`,align:`block-end`,children:b(`div`,{className:`text-right w-full`,children:x(`span`,{className:`text-xs`,children:[j.content.length,`/500`]})})})]})]}),x(f,{className:`bg-bg2 px-3 border-none`,children:[b(p,{required:!0,children:E(`feedbackForm.screenshotLabel`)}),b(`input`,{ref:A,type:`file`,multiple:!0,accept:`image/jpeg,image/jpg,image/png,.jpg,.jpeg,.png`,className:`hidden`,onChange:H}),x(s,{className:`mt-2 grid grid-cols-3 gap-2`,children:[N.map((e,n)=>x(s,{className:`relative overflow-hidden rounded-lg border border-line1 !bg-bg1 aspect-video`,children:[b(o,{src:e,alt:E(`feedbackForm.alt`),fill:!0,className:`object-cover`}),b(t,{size:`icon-xs`,variant:`secondary`,className:`absolute right-1 top-1 rounded-full bg-bg1/85`,onClick:()=>U(n),"aria-label":E(`feedbackForm.delete`),children:b(y,{})})]},`${e}-${n}`)),N.length<3&&x(s,{className:`flex flex-col aspect-video items-center justify-center gap-2 rounded-lg border border-dashed border-text1/10 !bg-bg1 py-3 text-center`,onClick:V,children:[b(g,{}),b(m,{className:`text-xs text-text3`,children:E(L?`feedbackForm.uploading`:`feedbackForm.addScreenshot`)})]})]})]}),x(f,{className:`bg-bg2 px-3 border-none`,children:[b(p,{children:E(`feedbackForm.contactLabel`)}),x(c,{children:[b(u,{className:`!bg-bg1 p-2.5`,placeholder:E(`feedbackForm.placeholder1_6d0242`),value:j.contact,onChange:e=>B(`contact`,e.target.value)}),b(l,{className:`!bg-bg1`,align:`block-end`,children:b(`div`,{className:`text-right w-full`,children:x(`span`,{className:`text-xs`,children:[j.contact.length,`/100`]})})})]})]})]})]})}export{O as FeedbackForm};
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{pUserUserFeedback as r}from"../../../../service/generated/client.mjs";import{compressImage as i}from"../../../../utils/image-compression.mjs";import{uploadFile as a}from"../../../../utils/upload-file.mjs";import{Image as o}from"../../../ui/image.mjs";import{Box as s}from"../../../ui/box.mjs";import{InputGroup as c,InputGroupAddon as l,InputGroupInput as u,InputGroupTextarea as d}from"../../../ui/input-group.mjs";import{Field as f,FieldLabel as p}from"../../../ui/field.mjs";import{Text as m}from"../../../ui/text.mjs";import{HeaderNav as h}from"../../../common/header-nav/client.mjs";import{AddIcon as g}from"../../../common/icons/add.mjs";import{useRef as _,useState as v}from"react";import{XIcon as y}from"lucide-react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{toast as S}from"sonner";import{useTranslations as C}from"next-intl";import{useRouter as w}from"next/navigation";const T=new Set([`image/jpeg`,`image/jpg`,`image/png`]),E=new Set([`jpg`,`jpeg`,`png`]);function D(e){let t=e.type.toLowerCase(),n=e.name.split(`.`).pop()?.toLowerCase()||``;return t?T.has(t):E.has(n)}function O({className:T}={}){let E=C(`components.pages.feedback.components`),O=w(),{userId:k}=n(),A=_(null),[j,M]=v({content:``,contact:``}),[N,P]=v([]),[F,I]=v(!1),[L,R]=v(!1),z=!j.content.trim();function B(e,t){M(n=>({...n,[e]:t}))}function V(){L||F||N.length>=3||A.current?.click()}async function H(e){let t=Array.from(e.target.files??[]);if(!t.length)return;let n=3-N.length;if(n<=0){e.target&&(e.target.value=``);return}let r=t.slice(0,n),o=r.filter(D);if(!o.length){S.error(E(`feedbackForm.imageTypeInvalid`)),e.target&&(e.target.value=``);return}o.length!==r.length&&S.error(E(`feedbackForm.imageTypeInvalid`));try{R(!0);let e=[],t=!1;for(let n of o)try{let t=await a(await i(n),1);e.push(t.objectKey)}catch(e){console.error(`上传截图失败`,e),t=!0}e.length&&P(t=>[...t,...e].slice(0,3)),t&&S.error(E(`feedbackForm.screenshotUploadFailed`))}catch(e){console.error(`上传截图失败`,e),S.error(E(`feedbackForm.screenshotUploadFailed`))}finally{R(!1),e.target&&(e.target.value=``)}}function U(e){L||F||P(t=>t.filter((t,n)=>n!==e))}async function W(){let e=j.content.trim(),t=j.contact.trim();if(!e){S.error(E(`feedbackForm.missingFeedback`));return}if(e.length<4){S.error(E(`feedbackForm.contentMinLength`));return}if(!N.length){S.error(E(`feedbackForm.missingScreenshot`));return}if(F)return;let n=S.loading(E(`feedbackForm.loading`));try{I(!0);let i=await r({user_id:k,feedback_content:e,feedback_screenshots:N.length?N:void 0,contact_info:t||void 0});if(i.code===0){M({content:``,contact:``}),P([]),O.push(`/settings`),S.success(E(`feedbackForm.submitsuccess`),{id:n});return}S.error(i.message||E(`feedbackForm.message`),{id:n})}catch(e){console.error(`提交反馈失败`,e),S.error(e.message||E(`feedbackForm.message`),{id:n})}finally{I(!1)}}return x(s,{className:e(`min-h-screen bg-bg2`,T),children:[b(h,{title:E(`feedbackForm.title`),className:`!bg-bg2`,rightChild:b(t,{onClick:W,disabled:F||L||z,children:E(F?`feedbackForm.loading`:`feedbackForm.submit`)})}),x(s,{className:`pb-3`,children:[x(f,{className:`bg-bg2 px-3 border-none`,children:[b(p,{required:!0,children:E(`feedbackForm.label`)}),x(c,{children:[b(d,{className:`!bg-bg1 p-2.5 rounded-md`,maxLength:500,placeholder:E(`feedbackForm.placeholder`),value:j.content,onChange:e=>B(`content`,e.target.value)}),b(l,{className:`!bg-bg1`,align:`block-end`,children:b(`div`,{className:`text-right w-full`,children:x(`span`,{className:`text-xs`,children:[j.content.length,`/500`]})})})]})]}),x(f,{className:`bg-bg2 px-3 border-none`,children:[b(p,{required:!0,children:E(`feedbackForm.screenshotLabel`)}),b(`input`,{ref:A,type:`file`,multiple:!0,accept:`image/jpeg,image/jpg,image/png,.jpg,.jpeg,.png`,className:`hidden`,onChange:H}),x(s,{className:`mt-2 grid grid-cols-3 gap-2`,children:[N.map((e,n)=>x(s,{className:`relative overflow-hidden rounded-lg border border-line1 !bg-bg1 aspect-square`,children:[b(o,{src:e,alt:E(`feedbackForm.alt`),fill:!0,className:`object-cover`}),b(t,{size:`icon-xs`,variant:`secondary`,className:`absolute right-1 top-1 rounded-full bg-bg1/85`,onClick:()=>U(n),"aria-label":E(`feedbackForm.delete`),children:b(y,{})})]},`${e}-${n}`)),N.length<3&&x(s,{className:`flex flex-col aspect-square items-center justify-center gap-2 rounded-lg border border-dashed border-text1/10 !bg-bg1 py-3 text-center`,onClick:V,children:[b(g,{}),b(m,{className:`text-xs text-text3`,children:E(L?`feedbackForm.uploading`:`feedbackForm.addScreenshot`)})]})]})]}),x(f,{className:`bg-bg2 px-3 border-none `,children:[b(p,{children:E(`feedbackForm.contactLabel`)}),b(c,{children:b(u,{className:`!bg-bg1 p-2.5 h-auto rounded-md`,placeholder:E(`feedbackForm.placeholder1_6d0242`),value:j.contact,onChange:e=>B(`contact`,e.target.value)})})]})]})]})}export{O as FeedbackForm};
@@ -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 Image from "next/image";
4
+ import NextImage from "next/image";
5
5
 
6
6
  //#region components/ui/image.d.ts
7
7
  /** BaseImageProps 属性定义。 */
8
- type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof Image>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
8
+ type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof NextImage>, '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$1(props: ImageProps): react_jsx_runtime0.JSX.Element;
30
+ declare function Image(props: ImageProps): react_jsx_runtime0.JSX.Element;
31
31
  //#endregion
32
- export { BaseImageProps, CommonImageProps, Image$1 as Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
32
+ export { BaseImageProps, CommonImageProps, Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };