@funhub/platform 0.1.37 → 0.1.41

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 (193) hide show
  1. package/README.md +6 -0
  2. package/config/tailwind/index.cjs +4 -0
  3. package/config/tailwind/index.mjs +4 -0
  4. package/dist/assets/images/subscript.mjs +2 -0
  5. package/dist/biz.mjs +1 -1
  6. package/dist/common.d.mts +1 -2
  7. package/dist/common.mjs +1 -1
  8. package/dist/components/biz/business/banner/variants/basic-banner/inspector-schema.d.mts +4 -0
  9. package/dist/components/biz/business/banner/variants/basic-banner/material.d.mts +4 -0
  10. package/dist/components/biz/business/banner/variants/basic-banner/runtime/client.d.mts +6 -1
  11. package/dist/components/biz/business/banner/variants/basic-banner/runtime/client.mjs +1 -1
  12. package/dist/components/biz/business/banner/variants/basic-banner/server.mjs +1 -1
  13. package/dist/components/biz/business/banner-carousel/client.mjs +1 -1
  14. package/dist/components/biz/business/banner-carousel/material.d.mts +4 -0
  15. package/dist/components/biz/business/banner-carousel/schema.d.mts +4 -0
  16. package/dist/components/biz/business/banner-carousel/server.mjs +1 -1
  17. package/dist/components/biz/business/channel-list/client.mjs +1 -1
  18. package/dist/components/biz/business/channel-list/material.d.mts +4 -0
  19. package/dist/components/biz/business/channel-list/schema.d.mts +4 -0
  20. package/dist/components/biz/business/comment/comment-input.mjs +1 -1
  21. package/dist/components/biz/business/detail/detail-operate.mjs +1 -1
  22. package/dist/components/biz/business/detail/materials/registry.d.mts +30 -3
  23. package/dist/components/biz/business/detail/materials/video-detail-actions/client.d.mts +2 -1
  24. package/dist/components/biz/business/detail/materials/video-detail-actions/client.mjs +1 -1
  25. package/dist/components/biz/business/detail/materials/video-detail-actions/material.d.mts +6 -1
  26. package/dist/components/biz/business/detail/materials/video-detail-actions/schema.d.mts +6 -1
  27. package/dist/components/biz/business/detail/materials/video-detail-actions/server.mjs +1 -1
  28. package/dist/components/biz/business/detail/materials/video-detail-info/client.d.mts +2 -1
  29. package/dist/components/biz/business/detail/materials/video-detail-info/client.mjs +1 -1
  30. package/dist/components/biz/business/detail/materials/video-detail-info/material.d.mts +4 -0
  31. package/dist/components/biz/business/detail/materials/video-detail-info/schema.d.mts +4 -0
  32. package/dist/components/biz/business/detail/materials/video-detail-info/server.mjs +1 -1
  33. package/dist/components/biz/business/detail/materials/video-detail-info-title/client.d.mts +2 -1
  34. package/dist/components/biz/business/detail/materials/video-detail-info-title/client.mjs +1 -1
  35. package/dist/components/biz/business/detail/materials/video-detail-info-title/material.d.mts +6 -1
  36. package/dist/components/biz/business/detail/materials/video-detail-info-title/schema.d.mts +6 -1
  37. package/dist/components/biz/business/detail/materials/video-detail-info-title/server.mjs +1 -1
  38. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.d.mts +2 -1
  39. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.mjs +1 -1
  40. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/material.d.mts +4 -0
  41. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/schema.d.mts +4 -0
  42. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/server.mjs +1 -1
  43. package/dist/components/biz/business/detail/materials/video-detail-player/client.d.mts +2 -1
  44. package/dist/components/biz/business/detail/materials/video-detail-player/client.mjs +1 -1
  45. package/dist/components/biz/business/detail/materials/video-detail-player/material.d.mts +6 -1
  46. package/dist/components/biz/business/detail/materials/video-detail-player/schema.d.mts +6 -1
  47. package/dist/components/biz/business/detail/materials/video-detail-player/server.mjs +1 -1
  48. package/dist/components/biz/business/detail/materials/video-detail-recommend/client.d.mts +2 -1
  49. package/dist/components/biz/business/detail/materials/video-detail-recommend/client.mjs +1 -1
  50. package/dist/components/biz/business/detail/materials/video-detail-recommend/material.d.mts +4 -0
  51. package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.d.mts +4 -0
  52. package/dist/components/biz/business/detail/materials/video-detail-recommend/server.mjs +1 -1
  53. package/dist/components/biz/business/detail/video-hero.mjs +1 -1
  54. package/dist/components/biz/business/floating-ball/client.mjs +1 -1
  55. package/dist/components/biz/business/floating-ball/material.d.mts +4 -0
  56. package/dist/components/biz/business/floating-ball/schema.d.mts +4 -0
  57. package/dist/components/biz/business/floating-ball/server.mjs +1 -1
  58. package/dist/components/biz/business/header-search/header-avatar-icon/client.d.mts +3 -1
  59. package/dist/components/biz/business/header-search/header-avatar-icon/client.mjs +1 -1
  60. package/dist/components/biz/business/header-search/header-avatar-icon/material.d.mts +6 -1
  61. package/dist/components/biz/business/header-search/header-avatar-icon/schema.d.mts +6 -1
  62. package/dist/components/biz/business/header-search/header-avatar-icon/server.mjs +1 -1
  63. package/dist/components/biz/business/header-search/header-avatar-logo-search/client.mjs +1 -1
  64. package/dist/components/biz/business/header-search/header-avatar-logo-search/material.d.mts +4 -0
  65. package/dist/components/biz/business/header-search/header-avatar-logo-search/schema.d.mts +4 -0
  66. package/dist/components/biz/business/header-search/header-avatar-logo-search/server.mjs +1 -1
  67. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/client.mjs +1 -1
  68. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/material.d.mts +4 -0
  69. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/schema.d.mts +4 -0
  70. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/server.mjs +1 -1
  71. package/dist/components/biz/business/header-search/header-logo-search/client.mjs +1 -1
  72. package/dist/components/biz/business/header-search/header-logo-search/material.d.mts +4 -0
  73. package/dist/components/biz/business/header-search/header-logo-search/schema.d.mts +4 -0
  74. package/dist/components/biz/business/header-search/header-logo-search/server.mjs +1 -1
  75. package/dist/components/biz/business/header-search/header-search/client.d.mts +3 -1
  76. package/dist/components/biz/business/header-search/header-search/client.mjs +1 -1
  77. package/dist/components/biz/business/header-search/header-search/material.d.mts +6 -1
  78. package/dist/components/biz/business/header-search/header-search/schema.d.mts +6 -1
  79. package/dist/components/biz/business/header-search/header-search/server.mjs +1 -1
  80. package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
  81. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.d.mts +4 -0
  82. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.d.mts +4 -0
  83. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/client.d.mts +8 -1
  84. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/client.mjs +1 -1
  85. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/server.mjs +1 -1
  86. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.d.mts +4 -0
  87. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.d.mts +4 -0
  88. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.d.mts +8 -1
  89. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.mjs +1 -1
  90. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/server.mjs +1 -1
  91. package/dist/components/biz/business/index.mjs +1 -1
  92. package/dist/components/biz/business/large-feature-grid/card-item.mjs +1 -1
  93. package/dist/components/biz/business/large-feature-grid/client.d.mts +15 -0
  94. package/dist/components/biz/business/large-feature-grid/client.mjs +1 -1
  95. package/dist/components/biz/business/large-feature-grid/material.d.mts +34 -4
  96. package/dist/components/biz/business/large-feature-grid/schema.d.mts +42 -0
  97. package/dist/components/biz/business/large-feature-grid/server.d.mts +15 -0
  98. package/dist/components/biz/business/large-feature-grid/server.mjs +1 -1
  99. package/dist/components/biz/business/marquee/client.mjs +1 -1
  100. package/dist/components/biz/business/marquee/material.d.mts +4 -0
  101. package/dist/components/biz/business/marquee/schema.d.mts +4 -0
  102. package/dist/components/biz/business/marquee/server.mjs +1 -1
  103. package/dist/components/biz/business/profile/profile-header/client.d.mts +2 -1
  104. package/dist/components/biz/business/profile/profile-header/client.mjs +1 -1
  105. package/dist/components/biz/business/profile/profile-header/material.d.mts +18 -2
  106. package/dist/components/biz/business/profile/profile-header/material.mjs +1 -1
  107. package/dist/components/biz/business/profile/profile-header/schema.d.mts +7 -2
  108. package/dist/components/biz/business/profile/profile-header/server.d.mts +4 -1
  109. package/dist/components/biz/business/profile/profile-header/server.mjs +1 -1
  110. package/dist/components/biz/business/profile/profile-header/user-profile-cover-background.mjs +1 -1
  111. package/dist/components/biz/business/profile/profile-main/client.d.mts +2 -1
  112. package/dist/components/biz/business/profile/profile-main/client.mjs +1 -1
  113. package/dist/components/biz/business/profile/profile-main/material.d.mts +6 -1
  114. package/dist/components/biz/business/profile/profile-main/material.mjs +1 -1
  115. package/dist/components/biz/business/profile/profile-main/schema.d.mts +7 -2
  116. package/dist/components/biz/business/profile/profile-main/server.mjs +1 -1
  117. package/dist/components/biz/business/profile/profile-main/shell.mjs +1 -1
  118. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.d.mts +5 -0
  119. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.mjs +1 -1
  120. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/server.mjs +1 -1
  121. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.d.mts +5 -0
  122. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.mjs +1 -1
  123. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/server.mjs +1 -1
  124. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.d.mts +5 -0
  125. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +1 -1
  126. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/server.mjs +1 -1
  127. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/client.d.mts +6 -1
  128. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/client.mjs +1 -1
  129. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/server.mjs +1 -1
  130. package/dist/components/biz/business/profile/profile-main/utils.mjs +1 -1
  131. package/dist/components/biz/business/profile/profile-main/variants.d.mts +3 -3
  132. package/dist/components/biz/business/profile/profile-main/variants.mjs +1 -1
  133. package/dist/components/biz/business/search-history/client.mjs +1 -1
  134. package/dist/components/biz/business/search-history/material.d.mts +4 -0
  135. package/dist/components/biz/business/search-history/schema.d.mts +4 -0
  136. package/dist/components/biz/business/search-history/server.mjs +1 -1
  137. package/dist/components/biz/business/search-input/client.mjs +1 -1
  138. package/dist/components/biz/business/search-input/material.d.mts +4 -0
  139. package/dist/components/biz/business/search-input/schema.d.mts +4 -0
  140. package/dist/components/biz/business/search-input/server.mjs +1 -1
  141. package/dist/components/biz/business/shortcut-grid/client.mjs +1 -1
  142. package/dist/components/biz/business/shortcut-grid/material.d.mts +4 -0
  143. package/dist/components/biz/business/shortcut-grid/schema.d.mts +4 -0
  144. package/dist/components/biz/business/shortcut-grid/server.mjs +1 -1
  145. package/dist/components/biz/business/tab-bar/client.mjs +1 -1
  146. package/dist/components/biz/business/tab-bar/material.d.mts +14 -2
  147. package/dist/components/biz/business/tab-bar/schema.d.mts +14 -2
  148. package/dist/components/biz/business/tab-bar/schema.mjs +1 -1
  149. package/dist/components/biz/business/tab-bar/server.mjs +1 -1
  150. package/dist/components/biz/business/text-recommend/client.mjs +1 -1
  151. package/dist/components/biz/business/text-recommend/material.d.mts +4 -0
  152. package/dist/components/biz/business/text-recommend/schema.d.mts +4 -0
  153. package/dist/components/biz/business/text-recommend/server.mjs +1 -1
  154. package/dist/components/biz/business/video-horizontal-list/client.mjs +1 -1
  155. package/dist/components/biz/business/video-horizontal-list/material.d.mts +4 -0
  156. package/dist/components/biz/business/video-horizontal-list/schema.d.mts +4 -0
  157. package/dist/components/biz/business/video-horizontal-list/schema.mjs +1 -1
  158. package/dist/components/biz/business/video-horizontal-list/server.mjs +1 -1
  159. package/dist/components/biz/example/button/client.mjs +1 -1
  160. package/dist/components/biz/example/button/material.d.mts +4 -0
  161. package/dist/components/biz/example/button/schema.d.mts +4 -0
  162. package/dist/components/biz/example/button/server.d.mts +4 -1
  163. package/dist/components/biz/example/button/server.mjs +1 -1
  164. package/dist/components/common/list/post-list/post-list.d.mts +2 -0
  165. package/dist/components/common/list/post-list/post-list.mjs +1 -1
  166. package/dist/components/common/list/video-list/video-list.d.mts +2 -0
  167. package/dist/components/common/list/video-list/video-list.mjs +1 -1
  168. package/dist/components/pages/collection-create/form.mjs +1 -1
  169. package/dist/components/pages/collection-detail/_components/collection-detail-card.mjs +1 -1
  170. package/dist/components/pages/collection-detail/detail.mjs +1 -1
  171. package/dist/components/pages/feedback/_components/feedback-form.mjs +1 -1
  172. package/dist/components/ui/button.d.mts +1 -1
  173. package/dist/hooks.d.mts +1 -4
  174. package/dist/hooks.mjs +1 -1
  175. package/dist/i18n/locales/en.mjs +1 -1
  176. package/dist/i18n/locales/zh-CN.mjs +1 -1
  177. package/dist/utils/schema/index.d.mts +1 -1
  178. package/dist/utils/schema/material.d.mts +3 -2
  179. package/dist/utils/schema/schema.d.mts +18 -3
  180. package/dist/utils/schema/schema.mjs +1 -1
  181. package/dist/utils.d.mts +2 -2
  182. package/package.json +1 -1
  183. package/theme.css +4 -0
  184. package/dist/components/common/app-context/index.d.mts +0 -19
  185. package/dist/components/common/app-context/index.mjs +0 -2
  186. package/dist/components/common/app-context/provider.mjs +0 -2
  187. package/dist/components/common/icons/edit.mjs +0 -2
  188. package/dist/hooks/app-context.d.mts +0 -20
  189. package/dist/hooks/app-context.mjs +0 -2
  190. package/dist/hooks/get-app-context.d.mts +0 -19
  191. package/dist/hooks/get-app-context.mjs +0 -2
  192. package/dist/hooks/use-app-context/index.d.mts +0 -14
  193. package/dist/hooks/use-app-context/index.mjs +0 -2
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pUserUploadUserBgImage as t}from"../../../../../service/generated/client.mjs";import{uploadFile as n}from"../../../../../utils/upload-file.mjs";import{Image as r}from"../../../../ui/image.mjs";import{Box as i}from"../../../../ui/box.mjs";import{Input as a}from"../../../../ui/input.mjs";import{useDeleteRequest as o}from"../../../../../hooks/query/use-query.mjs";import{BackgroundPreviewModal as s}from"../../../../common/background-preview-modal/background-preview-modal.mjs";import{showImageCrop as c}from"../../../../common/image-crop/show-image-crop.mjs";import{useEffect as l,useRef as u,useState as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{toast as h}from"sonner";const g=[`image/jpeg`,`image/png`];function _(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return g.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function v({isMine:g,enableCustomBackground:v=!0,src:y,onUnauthorizedClick:b}){let x=`/images/mine/img_mine_head_bg.png`,S=u(null),{userId:C,setUserInfo:w,userInfo:T}=e(),E=o(),[D,O]=d(!1),[k,A]=d(!1),j=v&&(!!g||typeof b==`function`);l(()=>{v||A(!1)},[v]);let M=()=>{if(v){if(g){D||A(!0);return}b?.()}},N=()=>{A(!1)};function P(){D||S.current?.click()}async function F(e){let r=e.target.files?.[0];if(e.target&&(e.target.value=``),r)try{if(!_(r)){h.error(`仅支持 JPG/JPEG/PNG 格式`);return}O(!0);let e=await n(await c(r,{aspectRatio:430/256,cropShape:`rect`,quality:.92,maxWidth:1920,maxHeight:1920}),1);await t({user_id:String(C),bg_image:e.objectKey}),w({...T,bg_image:e.objectKey}),E([`user-profile`,`mine`]),A(!1),h.success(`更换完成`)}catch(e){console.error(`上传背景图失败`,e),e instanceof Error&&e.message!==`用户取消`&&h.error(`背景图上传失败,请稍后再试`)}finally{O(!1)}}return m(f,{children:[p(i,{className:v?`h-33.75`:`h-16`,children:v?p(i,{className:`relative h-full w-full`,onClick:j?M:void 0,children:p(r,{alt:`cover background`,fill:!0,objectFit:`cover`,className:`pointer-events-none`,src:y||x})}):p(i,{className:`h-full w-full bg-bg1`})}),v&&m(f,{children:[p(s,{open:k,onClose:N,bgUrl:y||x,onUpload:P}),p(a,{ref:S,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:F})]})]})}export{v as UserProfileCoverBackground};
2
+ "use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pUserUploadUserBgImage as t}from"../../../../../service/generated/client.mjs";import{uploadFile as n}from"../../../../../utils/upload-file.mjs";import{Image as r}from"../../../../ui/image.mjs";import{Box as i}from"../../../../ui/box.mjs";import{Input as a}from"../../../../ui/input.mjs";import{useDeleteRequest as o}from"../../../../../hooks/query/use-query.mjs";import{BackgroundPreviewModal as s}from"../../../../common/background-preview-modal/background-preview-modal.mjs";import{showImageCrop as c}from"../../../../common/image-crop/show-image-crop.mjs";import{useEffect as l,useRef as u,useState as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{toast as h}from"sonner";const g=[`image/jpeg`,`image/png`];function _(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return g.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function v({isMine:g,enableCustomBackground:v=!0,src:y,onUnauthorizedClick:b}){let x=`/images/mine/img_mine_head_bg.png`,S=u(null),{userId:C,setUserInfo:w,userInfo:T}=e(),E=o(),[D,O]=d(!1),[k,A]=d(!1),j=v&&(!!g||typeof b==`function`);l(()=>{v||A(!1)},[v]);let M=()=>{if(v){if(g){D||A(!0);return}b?.()}},N=()=>{A(!1)};function P(){D||S.current?.click()}async function F(e){let r=e.target.files?.[0];if(e.target&&(e.target.value=``),r)try{if(!_(r)){h.error(`仅支持 JPG/JPEG/PNG 格式`);return}O(!0);let e=await n(await c(r,{aspectRatio:430/256,cropShape:`rect`,quality:.92,maxWidth:1920,maxHeight:1920}),1);await t({user_id:String(C),bg_image:e.objectKey}),w({...T,bg_image:e.objectKey}),E([`user-profile`,`mine`]),A(!1),h.success(`更换完成`)}catch(e){console.error(`上传背景图失败`,e),e instanceof Error&&e.message!==`用户取消`&&h.error(`背景图上传失败,请稍后再试`)}finally{O(!1)}}return m(f,{children:[p(i,{className:v?`h-33.75`:`h-24`,children:v?p(i,{className:`relative h-full w-full`,onClick:j?M:void 0,children:p(r,{alt:`cover background`,fill:!0,objectFit:`cover`,className:`pointer-events-none`,src:y||x})}):p(i,{className:`h-full w-full bg-bg1`})}),v&&m(f,{children:[p(s,{open:k,onClose:N,bgUrl:y||x,onUpload:P}),p(a,{ref:S,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:F})]})]})}export{v as UserProfileCoverBackground};
@@ -11,7 +11,8 @@ declare function UserProfileMainClient({
11
11
  className,
12
12
  cookieUserId,
13
13
  currentUserId,
14
- requireLogin
14
+ requireLogin,
15
+ mode
15
16
  }: UserProfileMainProps): react_jsx_runtime0.JSX.Element;
16
17
  //#endregion
17
18
  export { UserProfileMainClient };
@@ -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{UserProfileMainShell as n}from"./shell.mjs";import{jsx as r}from"react/jsx-runtime";function i({id:i,className:a,cookieUserId:o,currentUserId:s,requireLogin:c=!1}){let l=s||o||``,u=i==null||!!l&&i===l;return r(n,{isMine:u,renderMode:c&&u&&!l?`login-required`:`content`,className:a,children:r(e,{className:`py-6 text-center`,children:r(t,{className:`text-sm text-text3`,children:`内容由服务端按当前 Tab 渲染`})})})}export{i as UserProfileMainClient};
2
+ "use client";import{Box as e}from"../../../../ui/box.mjs";import{Text as t}from"../../../../ui/text.mjs";import{UserProfileMainShell as n}from"./shell.mjs";import{jsx as r}from"react/jsx-runtime";function i({id:i,className:a,cookieUserId:o,currentUserId:s,requireLogin:c=!1,mode:l=`renderer`}){let u=l===`editor`?``:s||o||``,d=i==null||!!u&&i===u;return r(n,{isMine:d,renderMode:c&&d&&!u?`login-required`:`content`,className:a,children:r(e,{className:`py-6 text-center`,children:r(t,{className:`text-sm text-text3`,children:`内容由服务端按当前 Tab 渲染`})})})}export{i as UserProfileMainClient};
@@ -6,6 +6,11 @@ import * as zod from "zod";
6
6
  import * as zod_v4_core0 from "zod/v4/core";
7
7
 
8
8
  //#region components/biz/business/profile/profile-main/material.d.ts
9
- declare const profileMainMaterial: DefineMaterialOption<typeof UserProfileMain, typeof UserProfileMainClient, zod.ZodObject<{}, zod_v4_core0.$strip>, "profile-main">;
9
+ declare const profileMainMaterial: DefineMaterialOption<typeof UserProfileMain, typeof UserProfileMainClient, zod.ZodObject<{
10
+ mode: zod.ZodOptional<zod.ZodEnum<{
11
+ renderer: "renderer";
12
+ editor: "editor";
13
+ }>>;
14
+ }, zod_v4_core0.$strip>, "profile-main">;
10
15
  //#endregion
11
16
  export { profileMainMaterial };
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineMaterial as e}from"../../../../../utils/schema/material.mjs";import{UserProfileMainClient as t}from"./client.mjs";import{profileMainInspectorPropsSchema as n}from"./schema.mjs";import{UserProfileMain as r}from"./server.mjs";const i=e({type:`profile-main`,category:`CENTER`,name:`用户行为模块`,icon:`/icon/profile-main.png`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as profileMainMaterial};
2
+ import{defineMaterial as e}from"../../../../../utils/schema/material.mjs";import{UserProfileMainClient as t}from"./client.mjs";import{profileMainInspectorPropsSchema as n}from"./schema.mjs";import{UserProfileMain as r}from"./server.mjs";const i=e({type:`profile-main`,category:`内容组件`,name:`用户行为模块`,icon:`/icon/profile-main.png`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as profileMainMaterial};
@@ -8,7 +8,12 @@ import * as zod_v4_core0 from "zod/v4/core";
8
8
  /**
9
9
  * 用户资料主体物料暂不对外开放 inspector 配置。
10
10
  */
11
- declare const profileMainInspectorPropsSchema: zod.ZodObject<{}, zod_v4_core0.$strip>;
11
+ declare const profileMainInspectorPropsSchema: zod.ZodObject<{
12
+ mode: zod.ZodOptional<zod.ZodEnum<{
13
+ renderer: "renderer";
14
+ editor: "editor";
15
+ }>>;
16
+ }, zod_v4_core0.$strip>;
12
17
  declare const profileMainInspectorDefaultProps: {};
13
18
  type ProfileMainInspectorProps = InferSchemaProps<typeof profileMainInspectorPropsSchema>;
14
19
  interface ProfileMainRuntimeTabProps {
@@ -21,7 +26,7 @@ interface ProfileMainRuntimeTabProps {
21
26
  interface ProfileMainAuthConfig {
22
27
  headers?: Record<string, string>;
23
28
  }
24
- interface UserProfileMainProps extends ProfileMainRuntimeTabProps {
29
+ interface UserProfileMainProps extends ProfileMainInspectorProps, ProfileMainRuntimeTabProps {
25
30
  /** 用户 ID。 */
26
31
  id?: string;
27
32
  /** 是否显示创建入口。 */
@@ -1,2 +1,2 @@
1
1
 
2
- import{gUserViewUserInfo as e}from"../../../../../service/generated/client.mjs";import{getAppContextResolved as t}from"../../../../../hooks/get-app-context.mjs";import{profileMainCollectCollectionTabOptions as n,profileMainCollectTabOptions as r,profileMainHistoryTabOptions as i,profileMainLikeTabOptions as a,profileMainMineTabOptions as o,profileMainProfileTabOptions as s}from"./variants.mjs";import{UserProfileMainShell as c}from"./shell.mjs";import{CollectTabServer as l}from"./tabs/collect-tab/server.mjs";import{HistoryTabServer as u}from"./tabs/history-tab/server.mjs";import{LikeTabServer as d}from"./tabs/like-tab/server.mjs";import{PublishTabServer as f}from"./tabs/publish-tab/server.mjs";import{jsx as p}from"react/jsx-runtime";function m({isMine:e,tab:t}){let n=e?o:s;return t&&n.includes(t)?t:n[0]}function h(e,t,n){return e&&t.includes(e)?e:n}function g(e,t){return e&&(t===`collect`||t===`like`)}function _(e){return p(v,{...e})}async function v({id:o,showCreateAction:s=!1,requireLogin:_=!1,cookieToken:v,cookieUserId:y,className:b,token:x=``,currentUserId:S=``,authConfig:C,tab:w,likeTab:T,historyTab:E,collectTab:D,collectCollectionTab:O}){let k=(await t()).value===`editor`,A=x||v||``,j=S||y||``,M=!!A,N=o==null||!!j&&o===j,P=!N&&!!o,F=N?j:o?String(o):void 0,I=N?[`user-profile`,`mine`]:[`user-profile`,`profile`,o],L=m({isMine:N,tab:w}),R=`content`;if(_&&N&&!M&&(R=`login-required`),!k&&R===`content`&&g(P,L)){let t=(await e({target_user_id:String(o),user_id:j||String(o)},C))?.data??{},n=Number(t.collections_open??1)>0,r=Number(t.like_open??1)>0;L===`collect`&&!n&&(R=`privacy-collect`),L===`like`&&!r&&(R=`privacy-like`)}let z=k?[]:void 0,B=null;if(R===`content`)switch(L){case`publish`:B=p(f,{isMine:N,targetUserId:F,queryKeyPrefix:I,prefetch:z});break;case`like`:B=p(d,{isMine:N,targetUserId:F,queryKeyPrefix:I,resolvedLikeTab:h(T,a,`video`),prefetch:z});break;case`history`:B=p(u,{targetUserId:F,queryKeyPrefix:I,resolvedHistoryTab:h(E,i,`video`),authConfig:C,prefetch:z});break;default:B=p(l,{isMine:N,userId:F,showCreateAction:s&&N,queryKeyPrefix:I,resolvedCollectTab:h(D,r,`video`),resolvedCollectCollectionTab:h(O,n,`created`),authConfig:C,prefetch:z});break}return p(c,{isMine:N,renderMode:R,className:b,children:B})}export{_ as UserProfileMain};
2
+ import{gUserViewUserInfo as e}from"../../../../../service/generated/client.mjs";import{profileMainCollectCollectionTabOptions as t,profileMainCollectTabOptions as n,profileMainHistoryTabOptions as r,profileMainLikeTabOptions as i,profileMainMineTabOptions as a,profileMainProfileTabOptions as o}from"./variants.mjs";import{UserProfileMainShell as s}from"./shell.mjs";import{CollectTabServer as c}from"./tabs/collect-tab/server.mjs";import{HistoryTabServer as l}from"./tabs/history-tab/server.mjs";import{LikeTabServer as u}from"./tabs/like-tab/server.mjs";import{jsx as d}from"react/jsx-runtime";function f({isMine:e,tab:t}){let n=e?a:o;return t&&n.includes(t)?t:n[0]}function p(e,t,n){return e&&t.includes(e)?e:n}function m(e,t){return e&&(t===`collect`||t===`like`)}function h(e){let{mode:t=`renderer`,...n}=e;return d(g,{...n,mode:t})}async function g({mode:a=`renderer`,id:o,showCreateAction:h=!1,requireLogin:g=!1,cookieToken:_,cookieUserId:v,className:y,token:b=``,currentUserId:x=``,authConfig:S,tab:C,likeTab:w,historyTab:T,collectTab:E,collectCollectionTab:D}){let O=a===`editor`,k=b||_||``,A=x||v||``,j=!!k,M=o==null||!!A&&o===A,N=!M&&!!o,P=M?A:o?String(o):void 0,F=M?[`user-profile`,`mine`]:[`user-profile`,`profile`,o],I=f({isMine:M,tab:C}),L=`content`;if(g&&M&&!j&&(L=`login-required`),!O&&L===`content`&&m(N,I)){let t=(await e({target_user_id:String(o),user_id:A||String(o)},S))?.data??{},n=Number(t.collections_open??1)>0,r=Number(t.like_open??1)>0;I===`collect`&&!n&&(L=`privacy-collect`),I===`like`&&!r&&(L=`privacy-like`)}let R=O?[]:void 0,z=null;if(L===`content`)switch(I){case`like`:z=d(u,{mode:a,isMine:M,targetUserId:P,queryKeyPrefix:F,resolvedLikeTab:p(w,i,`video`),prefetch:R});break;case`history`:z=d(l,{mode:a,targetUserId:P,queryKeyPrefix:F,resolvedHistoryTab:p(T,r,`video`),authConfig:S,prefetch:R});break;default:z=d(c,{mode:a,isMine:M,userId:P,showCreateAction:h&&M,queryKeyPrefix:F,resolvedCollectTab:p(E,n,`video`),resolvedCollectCollectionTab:p(D,t,`created`),authConfig:S,prefetch:R});break}return d(s,{isMine:M,renderMode:L,className:y,children:z})}export{h as UserProfileMain};
@@ -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{Box as n}from"../../../../ui/box.mjs";import{EmptyState as r}from"../../../../ui/empty.mjs";import{Tabs as i,TabsList as a,TabsTrigger as o}from"../../../../ui/tabs.mjs";import{Text as s}from"../../../../ui/text.mjs";import{useLoginModalStore as c}from"../../../../../store/modules/login-modal-store.mjs";import{profileMainMineTabOptions as l,profileMainProfileTabOptions as u}from"./variants.mjs";import{useEffect as d,useMemo as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{useTranslations as h}from"next-intl";import{parseAsString as g,useQueryState as _}from"nuqs";function v(e){return e?[...l]:[...u]}function y(e,t){let n=v(t);return n.includes(e)?e:n[0]}function b({isMine:l,renderMode:u,className:b,children:x}){let S=h(`components.pages.profile`),{open:C}=c(),w=v(l),[T,E]=_(`tab`,g.withDefault(`collect`)),D=f(()=>y(T,l),[l,T]);d(()=>{T!==D&&E(D,{shallow:!1})},[D,E,T]);let O={collect:S(`client.collect`),publish:S(`client.publish`),like:S(`client.like`),history:S(`client.history`)},k=x;return u===`login-required`?k=m(n,{className:`flex gap-4 flex-col items-center justify-center py-10 text-center`,children:[p(s,{className:`text-base text-text1`,children:S(`client.loginToView`)}),p(t,{size:`lg`,variant:`secondary`,onClick:C,children:S(`client.loginNow`)})]}):u===`privacy-collect`?k=p(r,{type:`no-content`,text:S(`client.collectionNotPublic`)}):u===`privacy-like`&&(k=p(r,{type:`no-content`,text:S(`client.likeNotPublic`)})),m(n,{className:e(b),children:[p(n,{className:`border-b bg-bg1 sticky z-10 top-0 border-text1/5 h-10`,children:p(i,{value:D,onValueChange:e=>{E(e,{shallow:!1})},className:`w-fit`,children:p(a,{variant:`default`,className:`inline-flex h-9`,children:w.map(e=>p(o,{value:e,className:`p-2.5 !text-base !w-fit data-active:!text-lg data-active:font-bold`,children:O[e]},e))})})}),p(n,{className:`p-2`,children:k})]})}export{b as UserProfileMainShell};
2
+ "use client";import{cn as e}from"../../../../../utils/cn.mjs";import{Button as t}from"../../../../ui/button.mjs";import{Box as n}from"../../../../ui/box.mjs";import{EmptyState as r}from"../../../../ui/empty.mjs";import{Tabs as i,TabsList as a,TabsTrigger as o}from"../../../../ui/tabs.mjs";import{Text as s}from"../../../../ui/text.mjs";import{useLoginModalStore as c}from"../../../../../store/modules/login-modal-store.mjs";import{profileMainMineTabOptions as l,profileMainProfileTabOptions as u}from"./variants.mjs";import{useEffect as d,useMemo as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{useTranslations as h}from"next-intl";import{parseAsString as g,useQueryState as _}from"nuqs";function v(e){return e?[...l]:[...u]}function y(e,t){let n=v(t);return n.includes(e)?e:n[0]}function b({isMine:l,renderMode:u,className:b,children:x}){let S=h(`components.pages.profile`),{open:C}=c(),w=v(l),[T,E]=_(`tab`,g.withDefault(`collect`)),D=f(()=>y(T,l),[l,T]);d(()=>{T!==D&&E(D,{shallow:!1})},[D,E,T]);let O={collect:S(`client.collect`),like:S(`client.like`),history:S(`client.history`)},k=x;return u===`login-required`?k=m(n,{className:`flex gap-4 flex-col items-center justify-center py-10 text-center`,children:[p(s,{className:`text-base text-text1`,children:S(`client.loginToView`)}),p(t,{size:`lg`,variant:`secondary`,onClick:C,children:S(`client.loginNow`)})]}):u===`privacy-collect`?k=p(r,{type:`no-content`,text:S(`client.collectionNotPublic`)}):u===`privacy-like`&&(k=p(r,{type:`no-content`,text:S(`client.likeNotPublic`)})),m(n,{className:e(b),children:[p(n,{className:`border-b bg-bg1 sticky z-10 top-0 border-text1/5 h-10`,children:p(i,{value:D,onValueChange:e=>{E(e,{shallow:!1})},className:`w-fit`,children:p(a,{variant:`default`,className:`inline-flex h-9`,children:w.map(e=>p(o,{value:e,className:`p-2.5 !text-base !w-fit data-active:!text-lg data-active:font-bold`,children:O[e]},e))})})}),p(n,{className:`p-2`,children:k})]})}export{b as UserProfileMainShell};
@@ -1,8 +1,12 @@
1
1
 
2
+ import { MaterialComponentMode } from "../../../../../../../utils/schema/schema.mjs";
3
+ import "../../../../../../../utils/schema/index.mjs";
2
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
5
 
4
6
  //#region components/biz/business/profile/profile-main/tabs/collect-tab/client.d.ts
5
7
  interface CollectTabProps {
8
+ /** 渲染模式。 */
9
+ mode?: MaterialComponentMode;
6
10
  /** 当前用户ID */
7
11
  userId?: string;
8
12
  /** 是否显示创建入口 */
@@ -16,6 +20,7 @@ interface CollectTabProps {
16
20
  * 收藏 Tab
17
21
  */
18
22
  declare function CollectTab({
23
+ mode,
19
24
  userId,
20
25
  showCreateAction,
21
26
  queryKeyPrefix,
@@ -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{gCommunityGetSubscribedCollections as n,gCommunityGetUserCollections as r,gInteractionListCollects as i,pInteractionBatchDeleteCollects as a}from"../../../../../../../service/generated/client.mjs";import{Box as o}from"../../../../../../ui/box.mjs";import{Checkbox as ee}from"../../../../../../ui/checkbox.mjs";import{Tabs as s,TabsList as c,TabsTrigger as l}from"../../../../../../ui/tabs.mjs";import{Text as te}from"../../../../../../ui/text.mjs";import{useMutation as ne,usePaginated as u,useUpdateRequest as re}from"../../../../../../../hooks/query/use-query.mjs";import{useAppContext as ie}from"../../../../../../../hooks/use-app-context/index.mjs";import{AddIcon as ae}from"../../../../../../common/icons/add.mjs";import{CollectionList as oe}from"../../../../../../common/list/collection-list/collection-list.mjs";import{PostList as se}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as ce}from"../../../../../../common/list/video-list/video-list.mjs";import{useEffect as d,useMemo as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{toast as g}from"sonner";import{useTranslations as le}from"next-intl";import _ from"dayjs";import ue from"next/link";import{parseAsString as v,useQueryState as y}from"nuqs";const b={video:1,post:2};function de(e,t){if(!e)return e;let n=0,r=e.pages.map(e=>({page:e,filteredList:(e.data?.list??T).filter(e=>{let r=e?.id??``,i=t.has(r);return i&&(n+=1),!i})}));return{...e,pages:r.map(({page:e,filteredList:t})=>{if(!e.data)return e;let r=typeof e.data.total==`number`?Math.max(0,e.data.total-n):e.data.total;return{...e,data:{...e.data,list:t,total:r}}})}}function x(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 fe(e,t){let n=t[e.content_id||``]?.create_time,r=x(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:_(n).toDate().getTime()}}function pe(e,t){let n=t[e.id||``]?.create_time;return{is_more_link:e.is_more_link,id:e.id||``,title:e.name||``,coverImage:e.img_x||``,duration:Number(e.duration??0),authorName:e.up_user||e.source_username||``,viewCount:e.play_count??0,publishTime:_(n).toDate().getTime()}}function S(e){let t=x(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function C(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function w(e){let t=(e.contents??[]).slice(0,3).map(S),n=e.content_count??t.length;return{id:e.collection_id||``,title:e.title||``,contentCount:n,contents:n===0?C(e.collection_id||`collection`):t}}const T=[],me=[`video`,`post`,`collection`],he=[`created`,`subscribed`];function E({userId:_,showCreateAction:x=!1,queryKeyPrefix:S,isMine:C=!1}){let E=le(`components.pages.profile.components.tabs`),D=ie()===`renderer`,O=S??[],[k,A]=y(`collectTab`,v.withDefault(`video`)),[j,M]=y(`collectCollectionTab`,v.withDefault(`created`)),N=f(()=>me.includes(k)?k:`video`,[k]),P=f(()=>he.includes(j)?j:`created`,[j]),[F,I]=p(!1),[L,R]=p(()=>new Set),{userId:z,userInfo:ge}=t(),B=_||z||ge?.userId||``,_e=re();async function ve(e,t){if(!B)return{data:{list:[],total:0}};let n=await i({user_id:B,folder_id:``,content_type:t,page:e,page_size:10}),r=n.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},a=t===b.video?(n.data?.video_infos??[]).map(e=>pe(e,r)):(n.data?.post_infos??[]).map(e=>fe(e,r));return{data:{list:a,total:n.data?.total??a.length}}}let V=u({key:[...O,`user-collect-video`,B],initialPageParam:1,async queryFn(e){return ve(e,b.video)},options:{staleTime:0,enabled:D},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),H=u({key:[...O,`user-collect-post`,B],initialPageParam:1,options:{staleTime:0,enabled:D},async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}});async function ye(e){if(!B)return{data:{list:[],total:0}};let t=await r({page:e,user_id:_,page_size:10}),n=t.data?.data?.collections??[];return{data:{list:n.map(w),total:t.data?.data?.total??n.length}}}async function be(e){if(!B)return{data:{list:[],total:0}};let t=(await n({page:e,user_id:_,page_size:10})).data?.data,r=t?.collections??[];return{data:{list:r.map(w),total:t?.total??r.length}}}let U=u({key:[...O,`user-collection-created`,B],initialPageParam:1,options:{staleTime:0,enabled:D},async queryFn(e){return ye(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),W=u({key:[...O,`user-collection-subscribed`,B],initialPageParam:1,options:{staleTime:0,enabled:D},async queryFn(e){return be(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),G=f(()=>V.data?.pages.flatMap(e=>e.data?.list??T)??T,[V.data]),K=f(()=>H.data?.pages.flatMap(e=>e.data?.list??T)??T,[H.data]),xe=f(()=>U.data?.pages.flatMap(e=>e.data?.list??T)??T,[U.data]),Se=f(()=>W.data?.pages.flatMap(e=>e.data?.list??T)??T,[W.data]),Ce=N===`video`?G:N===`post`?K:T,q=new Set(Ce.map(e=>e.id)),J=N===`video`?V:H,Y=P===`created`?U:W,we=P===`created`?xe:Se,X=N===`video`,Te=[...O,`user-collect-video`,B],Ee=[...O,`user-collect-post`,B],{mutateAsync:De,isPending:Z}=ne(async e=>await a({app_id:0,user_id:B,folder_id:``,content_type:X?1:2,content_ids:e})),Oe=()=>{I(!F),R(new Set)};d(()=>{R(new Set),N===`collection`&&I(!1)},[N]),d(()=>{k!==N&&A(N)},[N,k,A]),d(()=>{j!==P&&M(P)},[P,j,M]);let Q=e=>{R(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ke=()=>{L.size===q.size&&q.size>0?R(new Set):R(new Set(q))},Ae=async()=>{if(!(L.size===0||Z)){if(!B){g.error(E(`collectTab.pleaseLogin`));return}try{let e=Array.from(L),t=await De(e);if(t.code===0){g.success(E(`collectTab.uncollectedSuccess`));let t=new Set(e);_e(X?Te:Ee,e=>de(e,t)),R(new Set),I(!1)}else g.error(t.message||E(`collectTab.uncollectFailed`))}catch(e){console.error(`取消收藏失败`,e),g.error(E(`collectTab.operationFailed`))}}},$=async()=>{if(D){if(N===`collection`){await Y.fetchNextPage();return}await J.fetchNextPage()}};return h(o,{children:[h(o,{className:`flex justify-between items-center`,children:[m(s,{value:N,onValueChange:e=>{A(e)},children:h(c,{variant:`tag`,children:[m(l,{value:`video`,className:`text-sm`,children:E(`collectTab.video`)}),m(l,{value:`collection`,className:`text-sm`,children:E(`collectTab.collections`)})]})}),N===`collection`?h(o,{className:`flex items-center gap-2 h-6.25`,children:[m(s,{value:P,onValueChange:e=>{M(e)},children:h(c,{variant:`segment`,children:[m(l,{value:`created`,className:`text-sm`,children:E(`collectTab.created`)}),m(l,{value:`subscribed`,className:`text-sm`,children:E(`collectTab.subscribed`)})]})}),x&&m(ue,{href:`/collection/create`,className:`flex items-center justify-center rounded-full bg-bg2 p-1.5`,children:m(ae,{})})]}):C&&m(e,{variant:`ghost`,size:`sm`,className:`h-6.25 px-0 text-sm text-text3`,onClick:Oe,children:E(F?`collectTab.cancel`:`collectTab.edit`)})]}),m(o,{className:`pt-2`,children:N===`video`?m(ce,{list:G,showVideoProgress:!1,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,onToggleSelection:Q}):N===`post`?m(se,{list:K,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,onToggleSelection:Q}):m(oe,{list:we,loading:Y.isFetching,hasMore:Y.hasNextPage??!1,loadMore:$,emptyText:E(P===`created`?`collectTab.noCreatedCollections`:`collectTab.noSubscribedCollections`)})}),F&&N!==`collection`&&h(o,{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:[h(o,{className:`flex items-center gap-2`,children:[m(ee,{checked:L.size===q.size&&q.size>0,onCheckedChange:ke}),m(te,{className:`text-sm text-text1`,children:E(`collectTab.selectAll`)})]}),m(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:L.size>0?`default`:`outline`,disabled:L.size===0||Z,onClick:Ae,children:E(Z?`collectTab.processing`:`collectTab.delete`)})]})]})}export{E as CollectTab};
2
+ "use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{gCommunityGetSubscribedCollections as n,gCommunityGetUserCollections as r,gInteractionListCollects as i,pInteractionBatchDeleteCollects as a}from"../../../../../../../service/generated/client.mjs";import{Box as o}from"../../../../../../ui/box.mjs";import{Checkbox as ee}from"../../../../../../ui/checkbox.mjs";import{Tabs as s,TabsList as c,TabsTrigger as l}from"../../../../../../ui/tabs.mjs";import{Text as te}from"../../../../../../ui/text.mjs";import{useMutation as ne,usePaginated as u,useUpdateRequest as re}from"../../../../../../../hooks/query/use-query.mjs";import{CollectionList as ie}from"../../../../../../common/list/collection-list/collection-list.mjs";import{PostList as ae}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as oe}from"../../../../../../common/list/video-list/video-list.mjs";import{useEffect as d,useMemo as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{toast as g}from"sonner";import{useTranslations as _}from"next-intl";import v from"dayjs";import se from"next/link";import{parseAsString as y,useQueryState as b}from"nuqs";const x={video:1,post:2};function ce(e,t){if(!e)return e;let n=0,r=e.pages.map(e=>({page:e,filteredList:(e.data?.list??T).filter(e=>{let r=e?.id??``,i=t.has(r);return i&&(n+=1),!i})}));return{...e,pages:r.map(({page:e,filteredList:t})=>{if(!e.data)return e;let r=typeof e.data.total==`number`?Math.max(0,e.data.total-n):e.data.total;return{...e,data:{...e.data,list:t,total:r}}})}}function S(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 le(e,t){let n=t[e.content_id||``]?.create_time,r=S(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:v(n).toDate().getTime()}}function ue(e,t){let n=t[e.id||``]?.create_time;return{is_more_link:e.is_more_link,id:e.id||``,title:e.name||``,coverImage:e.img_x||``,duration:Number(e.duration??0),authorName:e.up_user||e.source_username||``,viewCount:e.play_count??0,publishTime:v(n).toDate().getTime()}}function de(e){let t=S(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function C(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function w(e){let t=(e.contents??[]).slice(0,3).map(de),n=e.content_count??t.length;return{id:e.collection_id||``,title:e.title||``,contentCount:n,contents:n===0?C(e.collection_id||`collection`):t}}const T=[],fe=[`video`,`post`,`collection`],pe=[`created`,`subscribed`];function E({mode:v=`renderer`,userId:S,showCreateAction:de=!1,queryKeyPrefix:C,isMine:E=!1}){let me=_(),D=_(`components.pages.profile.components.tabs`),O=v===`renderer`,k=C??[],[A,j]=b(`collectTab`,y.withDefault(`video`)),[M,N]=b(`collectCollectionTab`,y.withDefault(`created`)),P=f(()=>fe.includes(A)?A:`video`,[A]),F=f(()=>pe.includes(M)?M:`created`,[M]),[I,L]=p(!1),[R,z]=p(()=>new Set),{userId:he,userInfo:ge}=t(),B=S||he||ge?.userId||``,_e=re();async function ve(e,t){if(!B)return{data:{list:[],total:0}};let n=await i({user_id:B,folder_id:``,content_type:t,page:e,page_size:10}),r=n.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},a=t===x.video?(n.data?.video_infos??[]).map(e=>ue(e,r)):(n.data?.post_infos??[]).map(e=>le(e,r));return{data:{list:a,total:n.data?.total??a.length}}}let V=u({key:[...k,`user-collect-video`,B],initialPageParam:1,async queryFn(e){return ve(e,x.video)},options:{staleTime:0,enabled:O},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),H=u({key:[...k,`user-collect-post`,B],initialPageParam:1,options:{staleTime:0,enabled:O},async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}});async function ye(e){if(!B)return{data:{list:[],total:0}};let t=await r({page:e,user_id:S,page_size:10}),n=t.data?.data?.collections??[];return{data:{list:n.map(w),total:t.data?.data?.total??n.length}}}async function be(e){if(!B)return{data:{list:[],total:0}};let t=(await n({page:e,user_id:S,page_size:10})).data?.data,r=t?.collections??[];return{data:{list:r.map(w),total:t?.total??r.length}}}let U=u({key:[...k,`user-collection-created`,B],initialPageParam:1,options:{staleTime:0,enabled:O},async queryFn(e){return ye(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),W=u({key:[...k,`user-collection-subscribed`,B],initialPageParam:1,options:{staleTime:0,enabled:O},async queryFn(e){return be(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),G=f(()=>V.data?.pages.flatMap(e=>e.data?.list??T)??T,[V.data]),K=f(()=>H.data?.pages.flatMap(e=>e.data?.list??T)??T,[H.data]),xe=f(()=>U.data?.pages.flatMap(e=>e.data?.list??T)??T,[U.data]),Se=f(()=>W.data?.pages.flatMap(e=>e.data?.list??T)??T,[W.data]),Ce=P===`video`?G:P===`post`?K:T,q=new Set(Ce.map(e=>e.id)),J=P===`video`?V:H,Y=F===`created`?U:W,we=F===`created`?xe:Se,X=P===`video`,Te=[...k,`user-collect-video`,B],Ee=[...k,`user-collect-post`,B],{mutateAsync:De,isPending:Z}=ne(async e=>await a({app_id:0,user_id:B,folder_id:``,content_type:X?1:2,content_ids:e})),Oe=()=>{L(!I),z(new Set)};d(()=>{z(new Set),P===`collection`&&L(!1)},[P]),d(()=>{A!==P&&j(P)},[P,A,j]),d(()=>{M!==F&&N(F)},[F,M,N]);let Q=e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ke=()=>{R.size===q.size&&q.size>0?z(new Set):z(new Set(q))},Ae=async()=>{if(!(R.size===0||Z)){if(!B){g.error(D(`collectTab.pleaseLogin`));return}try{let e=Array.from(R),t=await De(e);if(t.code===0){g.success(D(`collectTab.uncollectedSuccess`));let t=new Set(e);_e(X?Te:Ee,e=>ce(e,t)),z(new Set),L(!1)}else g.error(t.message||D(`collectTab.uncollectFailed`))}catch(e){console.error(`取消收藏失败`,e),g.error(D(`collectTab.operationFailed`))}}},$=async()=>{if(O){if(P===`collection`){await Y.fetchNextPage();return}await J.fetchNextPage()}};return h(o,{children:[h(o,{className:`flex justify-between items-center`,children:[m(s,{value:P,onValueChange:e=>{j(e)},children:h(c,{variant:`tag`,children:[m(l,{value:`video`,className:`text-sm`,children:D(`collectTab.video`)}),m(l,{value:`collection`,className:`text-sm`,children:D(`collectTab.collections`)})]})}),P===`collection`?m(se,{href:`/collection/create`,className:`flex items-center justify-center rounded-full text-text3 text-sm`,children:me(`components.pages.collectionCreate.form.create`)}):E&&m(e,{variant:`ghost`,size:`sm`,className:`h-6.25 px-0 text-sm text-text3`,onClick:Oe,children:D(I?`collectTab.cancel`:`collectTab.edit`)})]}),m(o,{className:`pt-2`,children:P===`video`?m(oe,{list:G,showVideoProgress:!1,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,emptyText:D(`collectTab.emptyContent`),isEditMode:I,selectedIds:R,onToggleSelection:Q}):P===`post`?m(ae,{list:K,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,emptyText:D(`collectTab.emptyContent`),isEditMode:I,selectedIds:R,onToggleSelection:Q}):m(ie,{list:we,loading:Y.isFetching,hasMore:Y.hasNextPage??!1,loadMore:$,emptyText:D(`collectTab.emptyContent`)})}),I&&P!==`collection`&&h(o,{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:[h(o,{className:`flex items-center gap-2`,children:[m(ee,{checked:R.size===q.size&&q.size>0,onCheckedChange:ke}),m(te,{className:`text-sm text-text1`,children:D(`collectTab.selectAll`)})]}),m(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:R.size>0?`default`:`outline`,disabled:R.size===0||Z,onClick:Ae,children:D(Z?`collectTab.processing`:`collectTab.delete`)})]})]})}export{E as CollectTab};
@@ -1,2 +1,2 @@
1
1
 
2
- import{gCommunityGetSubscribedCollections as e,gCommunityGetUserCollections as t,gInteractionListCollects as n}from"../../../../../../../service/generated/client.mjs";import{HydrationBoundary as r}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{defaultPageSize as i}from"../../utils.mjs";import{CollectTab as a}from"./client.mjs";import{jsx as o}from"react/jsx-runtime";import s from"dayjs";function c({queryKeyPrefix:e,targetUserId:t,resolvedCollectTab:n,resolvedCollectCollectionTab:r,authConfig:i}){return t?n===`collection`?[{type:`infinite`,queryKey:r===`subscribed`?[...e,`user-collection-subscribed`,t]:[...e,`user-collection-created`,t],async queryFn(e){return r===`subscribed`?f({targetUserId:t,page:e,authConfig:i}):d({targetUserId:t,page:e,authConfig:i})},initialPageParam:1,getNextPageParam(){}}]:[{type:`infinite`,queryKey:n===`post`?[...e,`user-collect-post`,t]:[...e,`user-collect-video`,t],async queryFn(e){return u({targetUserId:t,page:e,contentType:1,authConfig:i})},initialPageParam:1,getNextPageParam(){}}]:[]}function l({prefetch:e,resolvedCollectTab:t=`video`,resolvedCollectCollectionTab:n=`created`,authConfig:i,...s}){return o(r,{prefetch:e??c({queryKeyPrefix:s.queryKeyPrefix??[],targetUserId:s.userId,resolvedCollectTab:t,resolvedCollectCollectionTab:n,authConfig:i}),children:o(a,{...s})})}async function u({targetUserId:e,page:t,contentType:r,authConfig:a}){let o=await n({user_id:e,folder_id:``,content_type:r,page:t,page_size:i},a),s=o.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},c=r===1?(o.data?.video_infos??[]).map(e=>h(e,s)):(o.data?.post_infos??[]).map(e=>m(e,s));return{data:{list:c,total:o.data?.total??c.length}}}async function d({targetUserId:e,page:n,authConfig:r}){let a=await t({page:n,user_id:e,page_size:i},r),o=a.data?.data?.collections??[];return{data:{list:o.map(v),total:a.data?.data?.total??o.length}}}async function f({targetUserId:t,page:n,authConfig:r}){let a=(await e({page:n,user_id:t,page_size:i},r)).data?.data,o=a?.collections??[];return{data:{list:o.map(v),total:a?.total??o.length}}}function p(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 m(e,t){let n=t[e.content_id||``]?.create_time,r=p(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:s(n).toDate().getTime()}}function h(e,t){let n=t[e.id||``]?.create_time;return{is_more_link:e.is_more_link,id:e.id||``,title:e.name||``,coverImage:e.img_x||``,duration:Number(e.duration??0),authorName:e.up_user||e.source_username||``,viewCount:e.play_count??0,publishTime:s(n).toDate().getTime()}}function g(e){let t=p(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function _(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function v(e){let t=(e.contents??[]).slice(0,3).map(g),n=e.content_count??t.length;return{id:e.collection_id||``,title:e.title||``,contentCount:n,contents:n===0?_(e.collection_id||`collection`):t}}export{l as CollectTabServer,c as buildCollectTabPrefetch};
2
+ import{gCommunityGetSubscribedCollections as e,gCommunityGetUserCollections as t,gInteractionListCollects as n}from"../../../../../../../service/generated/client.mjs";import{HydrationBoundary as r}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{defaultPageSize as i}from"../../utils.mjs";import{CollectTab as a}from"./client.mjs";import{jsx as o}from"react/jsx-runtime";import s from"dayjs";function c({queryKeyPrefix:e,targetUserId:t,resolvedCollectTab:n,resolvedCollectCollectionTab:r,authConfig:i}){return t?n===`collection`?[{type:`infinite`,queryKey:r===`subscribed`?[...e,`user-collection-subscribed`,t]:[...e,`user-collection-created`,t],async queryFn(e){return r===`subscribed`?f({targetUserId:t,page:e,authConfig:i}):d({targetUserId:t,page:e,authConfig:i})},initialPageParam:1,getNextPageParam(){}}]:[{type:`infinite`,queryKey:n===`post`?[...e,`user-collect-post`,t]:[...e,`user-collect-video`,t],async queryFn(e){return u({targetUserId:t,page:e,contentType:1,authConfig:i})},initialPageParam:1,getNextPageParam(){}}]:[]}function l({prefetch:e,resolvedCollectTab:t=`video`,resolvedCollectCollectionTab:n=`created`,authConfig:i,...s}){let{mode:l=`renderer`,...u}=s;return o(r,{prefetch:e??c({queryKeyPrefix:u.queryKeyPrefix??[],targetUserId:u.userId,resolvedCollectTab:t,resolvedCollectCollectionTab:n,authConfig:i}),children:o(a,{...u,mode:l})})}async function u({targetUserId:e,page:t,contentType:r,authConfig:a}){let o=await n({user_id:e,folder_id:``,content_type:r,page:t,page_size:i},a),s=o.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},c=r===1?(o.data?.video_infos??[]).map(e=>h(e,s)):(o.data?.post_infos??[]).map(e=>m(e,s));return{data:{list:c,total:o.data?.total??c.length}}}async function d({targetUserId:e,page:n,authConfig:r}){let a=await t({page:n,user_id:e,page_size:i},r),o=a.data?.data?.collections??[];return{data:{list:o.map(v),total:a.data?.data?.total??o.length}}}async function f({targetUserId:t,page:n,authConfig:r}){let a=(await e({page:n,user_id:t,page_size:i},r)).data?.data,o=a?.collections??[];return{data:{list:o.map(v),total:a?.total??o.length}}}function p(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 m(e,t){let n=t[e.content_id||``]?.create_time,r=p(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:s(n).toDate().getTime()}}function h(e,t){let n=t[e.id||``]?.create_time;return{is_more_link:e.is_more_link,id:e.id||``,title:e.name||``,coverImage:e.img_x||``,duration:Number(e.duration??0),authorName:e.up_user||e.source_username||``,viewCount:e.play_count??0,publishTime:s(n).toDate().getTime()}}function g(e){let t=p(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function _(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function v(e){let t=(e.contents??[]).slice(0,3).map(g),n=e.content_count??t.length;return{id:e.collection_id||``,title:e.title||``,contentCount:n,contents:n===0?_(e.collection_id||`collection`):t}}export{l as CollectTabServer,c as buildCollectTabPrefetch};
@@ -1,8 +1,12 @@
1
1
 
2
+ import { MaterialComponentMode } from "../../../../../../../utils/schema/schema.mjs";
3
+ import "../../../../../../../utils/schema/index.mjs";
2
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
5
 
4
6
  //#region components/biz/business/profile/profile-main/tabs/history-tab/client.d.ts
5
7
  interface HistoryTabProps {
8
+ /** 渲染模式。 */
9
+ mode?: MaterialComponentMode;
6
10
  /** 目标用户 ID。 */
7
11
  targetUserId?: string;
8
12
  /** Query Key 前缀 */
@@ -12,6 +16,7 @@ interface HistoryTabProps {
12
16
  * 浏览历史 Tab
13
17
  */
14
18
  declare function HistoryTab({
19
+ mode,
15
20
  targetUserId,
16
21
  queryKeyPrefix
17
22
  }: HistoryTabProps): react_jsx_runtime0.JSX.Element;
@@ -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{pInteractionBatchClearBrowse 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 te}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as ne}from"../../../../../../common/list/video-list/video-list.mjs";import{getHistoryData 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 b}from"next-intl";import{parseAsString as x,useQueryState as S}from"nuqs";function re(e){let{detail:t}=e,{info:n,publish_time:r}=t;return{id:e.id,title:n.title||n.text||``,coverImage:n.cover_image_thumbnail||n.cover_image||n.cover_horizontal_image_thumbnail||void 0,publishTime:r}}function C(e){let{detail:t,content_play_progress:n}=e,{user_info:r,info:i,statics_cnt:a,publish_time:o,parent_content_info:s}=t;return{is_more_link:i.is_more_link,id:e.id,title:i.title||i.text||i.name||``,coverImage:i.cover_image_thumbnail||i.cover_image||i.cover_horizontal_image_thumbnail||``,duration:Number(i.video_duration??0),progress:n?.percent??0,seriesNum:n?.series_num,authorName:r.name,viewCount:i?.play_count??a?.browse_cnt??0,publishTime:o,type:s?.type}}function w(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}}})}}const T=[`video`,`post`];function E({targetUserId:E,queryKeyPrefix:D}){let O=b(`components.pages.profile.components.tabs`),k=ee()===`renderer`,A=D??[],[j,M]=S(`historyTab`,x.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=d(),B=[...A,`user-history-video`],V=[...A,`user-history-post`],H=u({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(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),U=u({key:V,initialPageParam:1,async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},options:{staleTime:0,enabled:k},getNextPageParam(e,t){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(C))??[],K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(re))??[],q=N===`video`?G:K,J=new Set(q.map(e=>e.id)),Y=N===`video`,{mutateAsync:ie,isPending:X}=l(async e=>await n({app_id:0,user_id:R,content_type:e.contentType,content_ids:e.contentIds})),Z=()=>{F(!P),L(new Set)};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})},ae=()=>{I.size===J.size&&J.size>0?L(new Set):L(new Set(J))},oe=async()=>{if(!(I.size===0||X)){if(!R){y.error(O(`historyTab.pleaseLogin`));return}try{let e=Array.from(I),t=await ie({contentIds:e,contentType:Y?1:2});if(t.code===0){y.success(O(`historyTab.historyDeletedSuccess`));let t=new Set(e);z(Y?B:V,e=>w(e,t,e=>e.id)),L(new Set),F(!1)}else y.error(t.message||O(`historyTab.deleteFailed`))}catch(e){console.error(`删除浏览记录失败`,e),y.error(O(`historyTab.operationFailed`))}}},$=async()=>{k&&await W.fetchNextPage()};return v(r,{children:[v(r,{className:`flex justify-between items-center`,children:[_(a,{value:N,onValueChange:e=>{M(e)},children:_(o,{variant:`tag`,children:_(s,{value:`video`,className:`text-sm`,children:O(`historyTab.video`)})})}),_(e,{variant:`ghost`,size:`sm`,className:`px-0 text-sm text-text3`,onClick:Z,children:O(P?`historyTab.cancel`:`historyTab.edit`)})]}),_(r,{className:`pt-2`,children:N===`video`?_(ne,{showVideoProgress:!0,list:G,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,isEditMode:P,selectedIds:I,onToggleSelection:Q}):_(te,{list:K,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,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:ae}),_(c,{className:`text-sm text-text1`,children:O(`historyTab.selectAll`)})]}),_(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:I.size>0?`default`:`outline`,disabled:I.size===0||X,onClick:oe,children:O(X?`historyTab.processing`:`historyTab.delete`)})]})]})}export{E as HistoryTab};
2
+ "use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionBatchClearBrowse 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{PostList as l}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as u}from"../../../../../../common/list/video-list/video-list.mjs";import{getHistoryData as ee,likeContentType as d}from"../../utils.mjs";import{useEffect as f,useMemo as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{toast as _}from"sonner";import{useTranslations as v}from"next-intl";import{parseAsString as y,useQueryState as b}from"nuqs";function x(e){let{detail:t}=e,{info:n,publish_time:r}=t;return{id:e.id,title:n.title||n.text||``,coverImage:n.cover_image_thumbnail||n.cover_image||n.cover_horizontal_image_thumbnail||void 0,publishTime:r}}function S(e){let{detail:t,content_play_progress:n}=e,{user_info:r,info:i,statics_cnt:a,publish_time:o,parent_content_info:s}=t;return{is_more_link:i.is_more_link,id:e.id,title:i.title||i.text||i.name||``,coverImage:i.cover_image_thumbnail||i.cover_image||i.cover_horizontal_image_thumbnail||``,duration:Number(i.video_duration??0),progress:n?.percent??0,seriesNum:n?.series_num,authorName:r.name,viewCount:i?.play_count??a?.browse_cnt??0,publishTime:o,type:s?.type}}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}}})}}const w=[`video`,`post`];function T({mode:T=`renderer`,targetUserId:E,queryKeyPrefix:D}){let O=v(`components.pages.profile.components.tabs`),k=T===`renderer`,A=D??[],[j,M]=b(`historyTab`,y.withDefault(`video`)),N=p(()=>w.includes(j)?j:`video`,[j]),[P,F]=m(!1),[I,L]=m(()=>new Set),R=t(e=>e.userId),z=c(),B=[...A,`user-history-video`],V=[...A,`user-history-post`],H=s({key:B,initialPageParam:1,async queryFn(e){return ee({targetUserId:E,page:e,contentType:d.video})},options:{staleTime:0,enabled:k},getNextPageParam(e,t){if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),U=s({key:V,initialPageParam:1,async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},options:{staleTime:0,enabled:k},getNextPageParam(e,t){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(S))??[],K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(x))??[],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,content_type:e.contentType,content_ids:e.contentIds}));f(()=>{L(new Set)},[N]),f(()=>{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})},te=()=>{I.size===J.size&&J.size>0?L(new Set):L(new Set(J))},ne=async()=>{if(!(I.size===0||Z)){if(!R){_.error(O(`historyTab.pleaseLogin`));return}try{let e=Array.from(I),t=await X({contentIds:e,contentType:Y?1:2});if(t.code===0){_.success(O(`historyTab.historyDeletedSuccess`));let t=new Set(e);z(Y?B:V,e=>C(e,t,e=>e.id)),L(new Set),F(!1)}else _.error(t.message||O(`historyTab.deleteFailed`))}catch(e){console.error(`删除浏览记录失败`,e),_.error(O(`historyTab.operationFailed`))}}},$=async()=>{k&&await W.fetchNextPage()};return g(r,{children:[h(r,{className:``,children:N===`video`?h(u,{showVideoProgress:!0,list:G,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`historyTab.emptyContent`),isEditMode:P,selectedIds:I,onToggleSelection:Q}):h(l,{list:K,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`historyTab.emptyContent`),isEditMode:P,selectedIds:I,onToggleSelection:Q})}),P&&g(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:[g(r,{className:`flex items-center gap-2`,children:[h(i,{checked:I.size===J.size&&J.size>0,onCheckedChange:te}),h(a,{className:`text-sm text-text1`,children:O(`historyTab.selectAll`)})]}),h(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:I.size>0?`default`:`outline`,disabled:I.size===0||Z,onClick:ne,children:O(Z?`historyTab.processing`:`historyTab.delete`)})]})]})}export{T as HistoryTab};
@@ -1,2 +1,2 @@
1
1
 
2
- import{HydrationBoundary as e}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{getHistoryData as t,likeContentType as n}from"../../utils.mjs";import{HistoryTab as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";function a({queryKeyPrefix:e,targetUserId:r,resolvedHistoryTab:i,authConfig:a}){return r?[{type:`infinite`,queryKey:i===`post`?[...e,`user-history-post`]:[...e,`user-history-video`],async queryFn(e){return t({targetUserId:r,page:e,contentType:n.video,authConfig:a})},initialPageParam:1,getNextPageParam(){}}]:[]}function o({prefetch:t,resolvedHistoryTab:n=`video`,authConfig:o,...s}){return i(e,{prefetch:t??a({queryKeyPrefix:s.queryKeyPrefix??[],targetUserId:s.targetUserId,resolvedHistoryTab:n,authConfig:o}),children:i(r,{...s})})}export{o as HistoryTabServer,a as buildHistoryTabPrefetch};
2
+ import{HydrationBoundary as e}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{getHistoryData as t,likeContentType as n}from"../../utils.mjs";import{HistoryTab as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";function a({queryKeyPrefix:e,targetUserId:r,resolvedHistoryTab:i,authConfig:a}){return r?[{type:`infinite`,queryKey:i===`post`?[...e,`user-history-post`]:[...e,`user-history-video`],async queryFn(e){return t({targetUserId:r,page:e,contentType:n.video,authConfig:a})},initialPageParam:1,getNextPageParam(){}}]:[]}function o({prefetch:t,resolvedHistoryTab:n=`video`,authConfig:o,...s}){let{mode:c=`renderer`,...l}=s;return i(e,{prefetch:t??a({queryKeyPrefix:l.queryKeyPrefix??[],targetUserId:l.targetUserId,resolvedHistoryTab:n,authConfig:o}),children:i(r,{...l,mode:c})})}export{o as HistoryTabServer,a as buildHistoryTabPrefetch};
@@ -1,4 +1,6 @@
1
1
 
2
+ import { MaterialComponentMode } from "../../../../../../../utils/schema/schema.mjs";
3
+ import "../../../../../../../utils/schema/index.mjs";
2
4
  import { CommunityContentInfo } from "../../../../../../../types.mjs";
3
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
6
 
@@ -60,6 +62,8 @@ interface LikeDetailItem {
60
62
  is_more_link?: boolean;
61
63
  }
62
64
  interface LikeTabProps {
65
+ /** 渲染模式。 */
66
+ mode?: MaterialComponentMode;
63
67
  /** 目标用户 ID。 */
64
68
  targetUserId?: string;
65
69
  /** Query Key 前缀 */
@@ -68,6 +72,7 @@ interface LikeTabProps {
68
72
  isMine?: boolean;
69
73
  }
70
74
  declare function LikeTab({
75
+ mode,
71
76
  targetUserId,
72
77
  queryKeyPrefix,
73
78
  isMine
@@ -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 f}from"../../../../../../../hooks/use-app-context/index.mjs";import{PostList as ee}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as p}from"../../../../../../common/list/video-list/video-list.mjs";import{getLikeData as m,likeContentType as h}from"../../utils.mjs";import{useEffect as g,useMemo as te,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 S,useQueryState as ne}from"nuqs";function re(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:O=!1}){let k=x(`components.pages.profile.components.tabs`),A=f()===`renderer`,j=D??[],[M,N]=ne(`likeTab`,S.withDefault(`video`)),P=te(()=>T.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 m({targetUserId:E,page:e,contentType:h.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{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}}),G=P===`video`?U:W,K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(w))??[],q=W.data?.pages.flatMap(e=>(e.data?.list??[]).map(C))??[],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)};g(()=>{R(new Set)},[P]),g(()=>{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=>re(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:v(o,{variant:`tag`,children:v(s,{value:`video`,className:`text-sm`,children:k(`likeTab.video`)})})}),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(p,{list:K,loading:G.isFetching,hasMore:G.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,showVideoProgress:!1,onToggleSelection:Q}):v(ee,{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{E 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{PostList as l}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as u}from"../../../../../../common/list/video-list/video-list.mjs";import{getLikeData as d,likeContentType as f}from"../../utils.mjs";import{useEffect as p,useMemo as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{toast as v}from"sonner";import{useTranslations as y}from"next-intl";import{parseAsString as ee,useQueryState as b}from"nuqs";function x(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 S(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 C(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 w=[`video`,`post`];function T({mode:T=`renderer`,targetUserId:E,queryKeyPrefix:D,isMine:te=!1}){let O=y(`components.pages.profile.components.tabs`),k=T===`renderer`,A=D??[],[j,M]=b(`likeTab`,ee.withDefault(`video`)),N=m(()=>w.includes(j)?j:`video`,[j]),[P,F]=h(!1),[I,L]=h(()=>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 d({targetUserId:E,page:e,contentType:f.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(C))??[],K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(S))??[],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}));p(()=>{L(new Set)},[N]),p(()=>{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){v.error(O(`likeTab.pleaseLogin`));return}try{let e=Array.from(I),t=await X(e);if(t.code===0){v.success(O(`likeTab.unlikedSuccess`));let t=new Set(e);z(Y?B:V,e=>x(e,t,e=>e.id)),L(new Set),F(!1)}else v.error(t.message||O(`likeTab.unlikeFailed`))}catch(e){console.error(`取消点赞失败`,e),v.error(O(`likeTab.operationFailed`))}}},$=async()=>{k&&await W.fetchNextPage()};return _(r,{children:[g(r,{className:``,children:N===`video`?g(u,{list:G,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`likeTab.emptyContent`),isEditMode:P,selectedIds:I,showVideoProgress:!1,onToggleSelection:Q}):g(l,{list:K,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`likeTab.emptyContent`),isEditMode:P,selectedIds:I,onToggleSelection:Q})}),P&&_(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:[_(r,{className:`flex items-center gap-2`,children:[g(i,{checked:I.size===J.size&&J.size>0,onCheckedChange:ne}),g(a,{className:`text-sm text-text1`,children:O(`likeTab.selectAll`)})]}),g(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{T 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}){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};
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}){let{mode:s=`renderer`,...c}=o;return i(e,{prefetch:t??a({queryKeyPrefix:c.queryKeyPrefix??[],targetUserId:c.targetUserId,resolvedLikeTab:n}),children:i(r,{...c,mode:s})})}export{o as LikeTabServer,a as buildLikeTabPrefetch};
@@ -1,4 +1,6 @@
1
1
 
2
+ import { MaterialComponentMode } from "../../../../../../../utils/schema/schema.mjs";
3
+ import "../../../../../../../utils/schema/index.mjs";
2
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
5
 
4
6
  //#region components/biz/business/profile/profile-main/tabs/publish-tab/client.d.ts
@@ -9,6 +11,8 @@ interface PublishTabUserInfo {
9
11
  avatar?: string;
10
12
  }
11
13
  interface PublishTabProps {
14
+ /** 渲染模式。 */
15
+ mode?: MaterialComponentMode;
12
16
  /** 目标用户 ID。 */
13
17
  targetUserId?: string;
14
18
  /** Query Key 前缀 */
@@ -22,7 +26,8 @@ interface PublishTabProps {
22
26
  * 发布内容 Tab 页。
23
27
  */
24
28
  declare function PublishTab({
25
- targetUserId,
29
+ mode,
30
+ targetUserId: _targetUserId,
26
31
  queryKeyPrefix,
27
32
  isMine
28
33
  }: 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{DeleteConfirmDialog as a}from"../../../../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{UserActivityList as o}from"../../../../../../common/list/user-activity-list/user-activity-list.mjs";import{useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{toast as d}from"sonner";import{useTranslations as f}from"next-intl";function p(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 m({mode:m=`renderer`,targetUserId:h,queryKeyPrefix:g,isMine:_=!1}){let v=f(`components.pages.profile.components.tabs`),y=m===`renderer`,b=g??[],x=t(),S=i(),[C,w]=s(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=>p(t,e,e=>e.content_id)),d.success(v(`publishTab.deleteSuccess`)),w(null)}catch(e){console.error(`删除内容失败`,e),d.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 u(c,{children:[l(o,{list:F,loading:O,hasMore:A,loadMore:I,canEdit:_,showGroupHeaders:!1,emptyText:v(`publishTab.emptyText`),onActionSuccess:L,onShareWeChat:R,onShareQQ:z,onShareMoments:B}),l(a,{open:!!C,onOpenChange:e=>!e&&N(),onCancel:N,onConfirm:P,isConfirming:E})]})}export{m 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}){let{mode:o=`renderer`,...s}=a;return n(e,{prefetch:i??r({queryKeyPrefix:s.queryKeyPrefix??[],targetUserId:s.targetUserId}),children:n(t,{...s,mode:o})})}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{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};
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";const h=[`示例历史1`,`示例历史2`,`示例历史3`];function g(g){let{title:_,rows:v=1,clearText:y=`清理`,confirmDescription:b=`确认删除全部搜索历史吗?`,storageKey:x=`guest`,onHistoryClick:S,mode:C=`renderer`}=g,[w,T]=l([]),[E,D]=l(!1),O=p(),k=f(),A=m(),j=`search_history_${x}`,M=o(()=>{let e=localStorage.getItem(j);if(e)try{T(JSON.parse(e))}catch(e){console.error(`Failed to parse search history`,e)}else T([])},[j]);s(()=>{M()},[M]),s(()=>(t.on(i.SEARCH_HISTORY_UPDATE,M),()=>{t.off(i.SEARCH_HISTORY_UPDATE,M)}),[M]);let N=()=>{T([]),localStorage.removeItem(j),D(!1),t.emit(i.SEARCH_HISTORY_UPDATE)},P=c(()=>{let e=w.length>0?w:C===`editor`?h:[],t=v*10;return e.slice(0,t)},[w,C,v]);if(P.length===0)return null;let F=e=>{if(S)S(e);else{let t=new URLSearchParams(A.toString());t.set(`q`,e);let n=k.includes(`/search`)?k:`/search`;O.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:_}),u(e,{variant:`ghost`,size:`sm`,className:`text-text3 text-[12px] p-0 h-auto`,onClick:()=>D(!0),children:y})]}),u(n,{className:`flex flex-wrap gap-2 overflow-hidden`,style:{maxHeight:`${v*40}px`},children:P.map((e,t)=>u(n,{className:`px-3 py-1 bg-bg2 rounded-full cursor-pointer`,onClick:()=>F(e),children:u(r,{className:`text-[14px] text-text2 truncate max-w-[150px]`,children:e})},t))}),u(a,{open:E,onOpenChange:D,onConfirm:()=>{N()},title:``,description:b})]})}export{g as SearchHistoryClient};
@@ -11,6 +11,10 @@ import * as zod_v4_core0 from "zod/v4/core";
11
11
  declare const searchHistoryMaterial: DefineMaterialOption<typeof SearchHistoryServer, typeof SearchHistoryClient, zod.ZodObject<{
12
12
  title: zod.ZodString & SchemaHasDefaultValue;
13
13
  rows: zod.ZodNumber & SchemaHasDefaultValue;
14
+ mode: zod.ZodOptional<zod.ZodEnum<{
15
+ renderer: "renderer";
16
+ editor: "editor";
17
+ }>>;
14
18
  }, zod_v4_core0.$strip>, "search-history">;
15
19
  //#endregion
16
20
  export { searchHistoryMaterial };
@@ -11,6 +11,10 @@ import * as zod_v4_core0 from "zod/v4/core";
11
11
  declare const searchHistoryInspectorPropsSchema: zod.ZodObject<{
12
12
  title: zod.ZodString & SchemaHasDefaultValue;
13
13
  rows: zod.ZodNumber & SchemaHasDefaultValue;
14
+ mode: zod.ZodOptional<zod.ZodEnum<{
15
+ renderer: "renderer";
16
+ editor: "editor";
17
+ }>>;
14
18
  }, zod_v4_core0.$strip>;
15
19
  //#endregion
16
20
  export { searchHistoryInspectorPropsSchema };
@@ -1,2 +1,2 @@
1
1
 
2
- import{SearchHistoryClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";import{getTranslations as n}from"next-intl/server";async function r(r){let i=await n(`components.biz.business.searchHistory`);return t(e,{...r,title:r.title||`搜索历史`,clearText:i(`clear`)||`清理`,confirmDescription:i(`confirmClearDescription`)||`确认删除全部搜索历史吗?`})}export{r as SearchHistoryServer};
2
+ import{SearchHistoryClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";import{getTranslations as n}from"next-intl/server";async function r(r){let{mode:i=`renderer`,...a}=r,o=await n(`components.biz.business.searchHistory`);return t(e,{...a,mode:i,title:a.title||`搜索历史`,clearText:o(`clear`)||`清理`,confirmDescription:o(`confirmClearDescription`)||`确认删除全部搜索历史吗?`})}export{r as SearchHistoryServer};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import e from"../../../../utils/event-bus.mjs";import{Box as t}from"../../../ui/box.mjs";import{Input as n}from"../../../ui/input.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import a from"../../../../assets/icons/left_arrow.mjs";import o from"../../../../assets/icons/search.mjs";import s from"../../../../assets/icons/clear.mjs";import{useCallback as c,useEffect 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";function g(g){let{placeholder:_,defaultPlaceholder:v=`请输入搜索关键词`,searchLabel:y=`搜索`,storageKey:b=`guest`,onSearch:x}=g,[S,C]=u(``),w=m(),T=p(),E=h(),D=`search_history_${b}`,O=c(t=>{if(t.trim()){try{let n=localStorage.getItem(D),r=n?JSON.parse(n):[];r=[t,...r.filter(e=>e!==t)],localStorage.setItem(D,JSON.stringify(r.slice(0,20))),e.emit(i.SEARCH_HISTORY_UPDATE)}catch(e){console.error(`Failed to save search history`,e)}if(x)x(t);else{let e=new URLSearchParams(E.toString());e.set(`q`,t);let n=T.includes(`/search`)?T:`/search`;w.push(`${n}?${e.toString()}`)}}},[D,x,T,w,E]);l(()=>{let e=E.get(`q`);e&&e!==S&&(C(e),O(e))},[E,O,S]),l(()=>{if(S===``){if(E.has(`q`)){let e=new URLSearchParams(E.toString());e.delete(`q`);let t=T.includes(`/search`)?T:`/search`;w.push(`${t}${e.toString()?`?${e.toString()}`:``}`)}e.emit(i.SEARCH_HISTORY_UPDATE)}},[S,T,w,E]);let k=()=>{O(S)};return f(t,{className:`px-3 py-2 bg-bg1 flex items-center gap-3 w-full`,children:[d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{w.back()},children:d(a,{className:`w-4 h-4 text-text1`})}),f(t,{className:`flex-1 flex items-center gap-1 bg-bg2 border border-theme5 rounded-[20px] px-2 py-1.5 overflow-hidden`,children:[d(t,{className:`p-1 shrink-0`,children:d(o,{className:`w-[14px] h-[14px] text-text3`})}),d(n,{className:`flex-1 border-none bg-transparent p-0 h-auto text-[14px] leading-[22px] focus-visible:ring-0 text-text1 placeholder:text-text3`,placeholder:_||v,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>e.key===`Enter`&&k()}),S&&d(s,{className:`w-[15px] h-[15px] text-text3 shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{C(``)}})]}),d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:k,children:d(r,{className:`text-[16px] text-text1 leading-[24px] font-normal`,children:y})})]})}export{g as SearchInputClient};
2
+ "use client";import e from"../../../../utils/event-bus.mjs";import{Box as t}from"../../../ui/box.mjs";import{Input as n}from"../../../ui/input.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import a from"../../../../assets/icons/left_arrow.mjs";import o from"../../../../assets/icons/search.mjs";import s from"../../../../assets/icons/clear.mjs";import{useCallback as c,useEffect 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";function g(g){let{placeholder:_,defaultPlaceholder:v=`请输入搜索关键词`,searchLabel:y=`搜索`,storageKey:b=`guest`,onSearch:x,mode:S=`renderer`}=g,C=S===`editor`,[w,T]=u(``),E=m(),D=p(),O=h(),k=`search_history_${b}`,A=c(t=>{if(!C&&t.trim()){try{let n=localStorage.getItem(k),r=n?JSON.parse(n):[];r=[t,...r.filter(e=>e!==t)],localStorage.setItem(k,JSON.stringify(r.slice(0,20))),e.emit(i.SEARCH_HISTORY_UPDATE)}catch(e){console.error(`Failed to save search history`,e)}if(x)x(t);else{let e=new URLSearchParams(O.toString());e.set(`q`,t);let n=D.includes(`/search`)?D:`/search`;E.push(`${n}?${e.toString()}`)}}},[k,C,x,D,E,O]);l(()=>{let e=O.get(`q`);e&&e!==w&&(T(e),A(e))},[O,A,w]),l(()=>{if(!C&&w===``){if(O.has(`q`)){let e=new URLSearchParams(O.toString());e.delete(`q`);let t=D.includes(`/search`)?D:`/search`;E.push(`${t}${e.toString()?`?${e.toString()}`:``}`)}e.emit(i.SEARCH_HISTORY_UPDATE)}},[C,w,D,E,O]);let j=()=>{A(w)};return f(t,{className:C?`px-3 py-2 bg-bg1 flex items-center gap-3 w-full pointer-events-none`:`px-3 py-2 bg-bg1 flex items-center gap-3 w-full`,children:[d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{C||E.back()},children:d(a,{className:`w-4 h-4 text-text1`})}),f(t,{className:`flex-1 flex items-center gap-1 bg-bg2 border border-theme5 rounded-[20px] px-2 py-1.5 overflow-hidden`,children:[d(t,{className:`p-1 shrink-0`,children:d(o,{className:`w-[14px] h-[14px] text-text3`})}),d(n,{className:`flex-1 border-none bg-transparent p-0 h-auto text-[14px] leading-[22px] focus-visible:ring-0 text-text1 placeholder:text-text3`,placeholder:_||v,value:w,onChange:e=>T(e.target.value),onKeyDown:e=>e.key===`Enter`&&j()}),w&&d(s,{className:`w-[15px] h-[15px] text-text3 shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{T(``)}})]}),d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:j,children:d(r,{className:`text-[16px] text-text1 leading-[24px] font-normal`,children:y})})]})}export{g as SearchInputClient};
@@ -10,6 +10,10 @@ import * as zod_v4_core0 from "zod/v4/core";
10
10
  //#region components/biz/business/search-input/material.d.ts
11
11
  declare const searchInputMaterial: DefineMaterialOption<typeof SearchInputServer, typeof SearchInputClient, zod.ZodObject<{
12
12
  placeholder: zod.ZodString & SchemaHasDefaultValue;
13
+ mode: zod.ZodOptional<zod.ZodEnum<{
14
+ renderer: "renderer";
15
+ editor: "editor";
16
+ }>>;
13
17
  }, zod_v4_core0.$strip>, "search-input">;
14
18
  //#endregion
15
19
  export { searchInputMaterial };
@@ -10,6 +10,10 @@ import * as zod_v4_core0 from "zod/v4/core";
10
10
  */
11
11
  declare const searchInputInspectorPropsSchema: zod.ZodObject<{
12
12
  placeholder: zod.ZodString & SchemaHasDefaultValue;
13
+ mode: zod.ZodOptional<zod.ZodEnum<{
14
+ renderer: "renderer";
15
+ editor: "editor";
16
+ }>>;
13
17
  }, zod_v4_core0.$strip>;
14
18
  //#endregion
15
19
  export { searchInputInspectorPropsSchema };
@@ -1,2 +1,2 @@
1
1
 
2
- import{SearchInputClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";import{getTranslations as n}from"next-intl/server";async function r(r){let i=await n(`components.pages.search`);return t(e,{...r,defaultPlaceholder:i(`topHeader.placeholder`),searchLabel:i(`topHeader.search`)})}export{r as SearchInputServer};
2
+ import{SearchInputClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";import{getTranslations as n}from"next-intl/server";async function r(r){let{mode:i=`renderer`,...a}=r,o=await n(`components.pages.search`);return t(e,{...a,mode:i,defaultPlaceholder:o(`topHeader.placeholder`),searchLabel:o(`topHeader.search`)})}export{r as SearchInputServer};
@@ -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 r from"../../../ui/link.mjs";import{shortcutGridInspectorDefaultProps as i}from"./schema.mjs";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s(s){let{title:c,shortcutCount:l,isShortcutTitle:u,shortcuts:d}={...i,...s},f=(()=>{let e=l??d.length??0;return Math.min(Math.max(e,3),5)})(),p=(d??[]).slice(0,f);return o(t,{as:`section`,className:`p-[12px]`,"aria-label":`金刚区`,children:[c?.trim()?a(n,{as:`h2`,className:`font-bold text-[16px] text-text1`,children:c}):null,a(t,{className:`flex justify-around mt-[8px]`,children:p.map((i,s)=>{let c=o(t,{className:`flex flex-col items-center justify-center gap-[10px] w-[52px]`,children:[a(t,{className:`flex h-[39px] w-[52px] items-center justify-center relative`,"aria-hidden":!i.label,children:a(e,{src:i.icon,alt:i.label||`入口图标`,fill:!0,className:`object-cover`})}),u?a(n,{className:`text-[12px] w-[52px] truncate text-center`,title:u?i.label:void 0,children:i.label}):null]});return a(r,{href:i.href,className:`block`,children:c},s)})})]})}export{s as ShortcutGridClient};
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 r from"../../../ui/link.mjs";import{shortcutGridInspectorDefaultProps as i}from"./schema.mjs";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s(s){let{mode:c=`renderer`,title:l,shortcutCount:u,isShortcutTitle:d,shortcuts:f}={...i,...s},p=c===`editor`,m=(()=>{let e=u??f.length??0;return Math.min(Math.max(e,3),5)})(),h=(f??[]).slice(0,m);return o(t,{as:`section`,className:p?`p-[12px] pointer-events-none`:`p-[12px]`,"aria-label":`金刚区`,children:[l?.trim()?a(n,{as:`h2`,className:`font-bold text-[16px] text-text1`,children:l}):null,a(t,{className:`flex justify-around mt-[8px]`,children:h.map((i,s)=>{let c=o(t,{className:`flex flex-col items-center justify-center gap-[10px] w-[52px]`,children:[a(t,{className:`flex h-[39px] w-[52px] items-center justify-center relative`,"aria-hidden":!i.label,children:a(e,{src:i.icon,alt:i.label||`入口图标`,fill:!0,className:`object-cover`})}),d?a(n,{className:`text-[12px] w-[52px] truncate text-center`,title:d?i.label:void 0,children:i.label}):null]});return a(r,{href:i.href,className:`block`,children:c},s)})})]})}export{s as ShortcutGridClient};
@@ -17,6 +17,10 @@ declare const shortcutGridMaterial: DefineMaterialOption<typeof ShortcutGrid, ty
17
17
  icon: zod.ZodString & SchemaHasDefaultValue;
18
18
  href: zod.ZodString & SchemaHasDefaultValue;
19
19
  }, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
20
+ mode: zod.ZodOptional<zod.ZodEnum<{
21
+ renderer: "renderer";
22
+ editor: "editor";
23
+ }>>;
20
24
  }, zod_v4_core0.$strip>, "shortcut-grid">;
21
25
  //#endregion
22
26
  export { shortcutGridMaterial };
@@ -16,6 +16,10 @@ declare const shortcutGridInspectorPropsSchema: z$1.ZodObject<{
16
16
  icon: z$1.ZodString & SchemaHasDefaultValue;
17
17
  href: z$1.ZodString & SchemaHasDefaultValue;
18
18
  }, z$1.core.$strip>> & SchemaHasDefaultValue;
19
+ mode: z$1.ZodOptional<z$1.ZodEnum<{
20
+ renderer: "renderer";
21
+ editor: "editor";
22
+ }>>;
19
23
  }, z$1.core.$strip>;
20
24
  type ShortcutGridInspectorProps = InferSchemaProps<typeof shortcutGridInspectorPropsSchema>;
21
25
  //#endregion