@funhub/platform 0.1.28 → 0.1.29

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 (202) hide show
  1. package/dist/biz.d.mts +28 -10
  2. package/dist/biz.mjs +1 -1
  3. package/dist/components/biz/business/banner/variants/basic-banner/inspector-schema.d.mts +11 -11
  4. package/dist/components/biz/business/banner/variants/basic-banner/material.d.mts +1 -1
  5. package/dist/components/biz/business/banner-carousel/client.mjs +2 -0
  6. package/dist/components/biz/business/banner-carousel/default-props.mjs +2 -0
  7. package/dist/components/biz/business/banner-carousel/material.d.mts +22 -0
  8. package/dist/components/biz/business/banner-carousel/material.mjs +2 -0
  9. package/dist/components/biz/business/banner-carousel/schema.d.mts +23 -0
  10. package/dist/components/biz/business/banner-carousel/schema.mjs +2 -0
  11. package/dist/components/biz/business/banner-carousel/server.d.mts +18 -0
  12. package/dist/components/biz/business/banner-carousel/server.mjs +2 -0
  13. package/dist/components/biz/business/channel-list/channel-filter-dialog.mjs +1 -1
  14. package/dist/components/biz/business/channel-list/client.mjs +1 -1
  15. package/dist/components/biz/business/channel-list/material.d.mts +4 -2
  16. package/dist/components/biz/business/channel-list/schema.d.mts +9 -7
  17. package/dist/components/biz/business/channel-list/schema.mjs +1 -1
  18. package/dist/components/biz/business/detail/materials/registry.d.mts +34 -28
  19. package/dist/components/biz/business/detail/materials/video-detail-actions/client.d.mts +1 -1
  20. package/dist/components/biz/business/detail/materials/video-detail-actions/client.mjs +1 -1
  21. package/dist/components/biz/business/detail/materials/video-detail-actions/index.d.mts +2 -2
  22. package/dist/components/biz/business/detail/materials/video-detail-actions/material.d.mts +2 -1
  23. package/dist/components/biz/business/detail/materials/video-detail-actions/material.mjs +1 -1
  24. package/dist/components/biz/business/detail/materials/video-detail-actions/server.d.mts +10 -2
  25. package/dist/components/biz/business/detail/materials/video-detail-info/client.d.mts +1 -1
  26. package/dist/components/biz/business/detail/materials/video-detail-info/client.mjs +1 -1
  27. package/dist/components/biz/business/detail/materials/video-detail-info/index.d.mts +2 -2
  28. package/dist/components/biz/business/detail/materials/video-detail-info/material.d.mts +2 -1
  29. package/dist/components/biz/business/detail/materials/video-detail-info/server.d.mts +10 -2
  30. package/dist/components/biz/business/detail/materials/video-detail-info-title/client.mjs +1 -1
  31. package/dist/components/biz/business/detail/materials/video-detail-info-title/index.d.mts +2 -2
  32. package/dist/components/biz/business/detail/materials/video-detail-info-title/material.d.mts +2 -1
  33. package/dist/components/biz/business/detail/materials/video-detail-info-title/server.d.mts +10 -2
  34. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.mjs +1 -1
  35. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/index.d.mts +2 -2
  36. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/material.d.mts +2 -1
  37. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/server.d.mts +10 -2
  38. package/dist/components/biz/business/detail/materials/video-detail-player/client.d.mts +1 -1
  39. package/dist/components/biz/business/detail/materials/video-detail-player/client.mjs +1 -1
  40. package/dist/components/biz/business/detail/materials/video-detail-player/index.d.mts +2 -2
  41. package/dist/components/biz/business/detail/materials/video-detail-player/material.d.mts +2 -1
  42. package/dist/components/biz/business/detail/materials/video-detail-player/material.mjs +1 -1
  43. package/dist/components/biz/business/detail/materials/video-detail-player/server.d.mts +10 -2
  44. package/dist/components/biz/business/detail/materials/video-detail-recommend/client.mjs +1 -1
  45. package/dist/components/biz/business/detail/materials/video-detail-recommend/index.d.mts +2 -2
  46. package/dist/components/biz/business/detail/materials/video-detail-recommend/material.d.mts +2 -1
  47. package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.d.mts +23 -23
  48. package/dist/components/biz/business/detail/materials/video-detail-recommend/server.d.mts +10 -2
  49. package/dist/components/biz/business/floating-ball/client.d.mts +1 -1
  50. package/dist/components/biz/business/floating-ball/material.d.mts +2 -1
  51. package/dist/components/biz/business/floating-ball/server.d.mts +11 -0
  52. package/dist/components/biz/business/header-search/header-avatar-icon/index.d.mts +2 -2
  53. package/dist/components/biz/business/header-search/header-avatar-icon/material.d.mts +2 -1
  54. package/dist/components/biz/business/header-search/header-avatar-icon/material.mjs +1 -1
  55. package/dist/components/biz/business/header-search/header-avatar-icon/server.d.mts +10 -2
  56. package/dist/components/biz/business/header-search/header-avatar-logo-search/index.d.mts +2 -2
  57. package/dist/components/biz/business/header-search/header-avatar-logo-search/material.d.mts +2 -1
  58. package/dist/components/biz/business/header-search/header-avatar-logo-search/material.mjs +1 -1
  59. package/dist/components/biz/business/header-search/header-avatar-logo-search/server.d.mts +10 -2
  60. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/index.d.mts +2 -2
  61. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/material.d.mts +2 -1
  62. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/material.mjs +1 -1
  63. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/server.d.mts +10 -2
  64. package/dist/components/biz/business/header-search/header-logo-search/index.d.mts +2 -2
  65. package/dist/components/biz/business/header-search/header-logo-search/material.d.mts +2 -1
  66. package/dist/components/biz/business/header-search/header-logo-search/material.mjs +1 -1
  67. package/dist/components/biz/business/header-search/header-logo-search/server.d.mts +10 -2
  68. package/dist/components/biz/business/header-search/header-search/index.d.mts +2 -2
  69. package/dist/components/biz/business/header-search/header-search/material.d.mts +2 -1
  70. package/dist/components/biz/business/header-search/header-search/material.mjs +1 -1
  71. package/dist/components/biz/business/header-search/header-search/server.d.mts +10 -2
  72. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.d.mts +5 -5
  73. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.mjs +1 -1
  74. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.d.mts +1 -1
  75. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.mjs +1 -1
  76. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/client.mjs +1 -1
  77. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/schema/component.mjs +1 -1
  78. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.d.mts +5 -5
  79. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.d.mts +1 -1
  80. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.mjs +1 -1
  81. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.mjs +1 -1
  82. package/dist/components/biz/business/index.d.mts +27 -8
  83. package/dist/components/biz/business/index.mjs +1 -1
  84. package/dist/components/biz/business/large-feature-grid/client.d.mts +1 -1
  85. package/dist/components/biz/business/large-feature-grid/material.d.mts +2 -1
  86. package/dist/components/biz/business/large-feature-grid/server.d.mts +11 -0
  87. package/dist/components/biz/business/marquee/index.d.mts +2 -2
  88. package/dist/components/biz/business/marquee/material.d.mts +2 -1
  89. package/dist/components/biz/business/marquee/material.mjs +1 -1
  90. package/dist/components/biz/business/marquee/schema.d.mts +14 -14
  91. package/dist/components/biz/business/profile/index.d.mts +21 -0
  92. package/dist/components/biz/business/profile/profile-header/client.d.mts +19 -0
  93. package/dist/components/biz/business/profile/profile-header/client.mjs +2 -0
  94. package/dist/components/biz/business/profile/profile-header/index.d.mts +5 -0
  95. package/dist/components/biz/business/profile/profile-header/material.d.mts +9 -1
  96. package/dist/components/biz/business/profile/profile-header/material.mjs +1 -1
  97. package/dist/components/biz/business/profile/profile-header/schema.d.mts +40 -0
  98. package/dist/components/biz/business/profile/profile-header/schema.mjs +2 -0
  99. package/dist/components/biz/business/profile/profile-header/server.d.mts +33 -0
  100. package/dist/components/{pages/profile/_components/user-profile-header → biz/business/profile/profile-header}/server.mjs +1 -1
  101. package/dist/components/biz/business/profile/profile-header/user-profile-avatar.mjs +2 -0
  102. package/dist/components/biz/business/profile/profile-header/user-profile-cover-background.mjs +2 -0
  103. package/dist/components/biz/business/profile/profile-main/client.d.mts +17 -0
  104. package/dist/components/biz/business/profile/profile-main/client.mjs +2 -0
  105. package/dist/components/biz/business/profile/profile-main/index.d.mts +16 -0
  106. package/dist/components/biz/business/profile/profile-main/material.d.mts +14 -1
  107. package/dist/components/biz/business/profile/profile-main/material.mjs +1 -1
  108. package/dist/components/biz/business/profile/profile-main/schema.d.mts +55 -0
  109. package/dist/components/biz/business/profile/profile-main/schema.mjs +2 -0
  110. package/dist/components/biz/business/profile/profile-main/server.d.mts +11 -0
  111. package/dist/components/biz/business/profile/profile-main/server.mjs +2 -0
  112. package/dist/components/biz/business/profile/profile-main/shell.d.mts +25 -0
  113. package/dist/components/biz/business/profile/profile-main/shell.mjs +2 -0
  114. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.d.mts +25 -0
  115. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.mjs +2 -0
  116. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/index.d.mts +3 -0
  117. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/server.d.mts +54 -0
  118. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/server.mjs +2 -0
  119. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.d.mts +19 -0
  120. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.mjs +2 -0
  121. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/index.d.mts +3 -0
  122. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/server.d.mts +48 -0
  123. package/dist/components/{pages/profile/_components → biz/business/profile/profile-main}/tabs/history-tab/server.mjs +1 -1
  124. package/dist/components/biz/business/profile/profile-main/tabs/index.d.mts +13 -0
  125. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.d.mts +76 -0
  126. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +2 -0
  127. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/index.d.mts +3 -0
  128. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/server.d.mts +39 -0
  129. package/dist/components/{pages/profile/_components → biz/business/profile/profile-main}/tabs/like-tab/server.mjs +1 -1
  130. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/client.d.mts +30 -0
  131. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/client.mjs +2 -0
  132. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/index.d.mts +3 -0
  133. package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/server.d.mts +33 -0
  134. package/dist/components/{pages/profile/_components → biz/business/profile/profile-main}/tabs/publish-tab/server.mjs +1 -1
  135. package/dist/components/biz/business/profile/profile-main/utils.mjs +2 -0
  136. package/dist/components/biz/business/profile/profile-main/variants.d.mts +32 -0
  137. package/dist/components/biz/business/profile/profile-main/variants.mjs +2 -0
  138. package/dist/components/biz/business/search-history/client.d.mts +7 -7
  139. package/dist/components/biz/business/search-history/client.mjs +1 -1
  140. package/dist/components/biz/business/search-history/index.d.mts +4 -4
  141. package/dist/components/biz/business/search-history/material.d.mts +3 -2
  142. package/dist/components/biz/business/search-history/material.mjs +1 -1
  143. package/dist/components/biz/business/search-history/schema.d.mts +8 -8
  144. package/dist/components/biz/business/search-history/server.d.mts +4 -4
  145. package/dist/components/biz/business/search-history/server.mjs +1 -1
  146. package/dist/components/biz/business/search-input/client.d.mts +2 -2
  147. package/dist/components/biz/business/search-input/client.mjs +1 -1
  148. package/dist/components/biz/business/search-input/index.d.mts +2 -2
  149. package/dist/components/biz/business/search-input/material.d.mts +2 -1
  150. package/dist/components/biz/business/search-input/material.mjs +1 -1
  151. package/dist/components/biz/business/search-input/schema.d.mts +5 -5
  152. package/dist/components/biz/business/shortcut-grid/client.d.mts +1 -1
  153. package/dist/components/biz/business/shortcut-grid/material.d.mts +2 -1
  154. package/dist/components/biz/business/shortcut-grid/schema.d.mts +11 -11
  155. package/dist/components/biz/business/shortcut-grid/server.d.mts +11 -0
  156. package/dist/components/biz/business/tab-bar/index.d.mts +2 -2
  157. package/dist/components/biz/business/tab-bar/material.d.mts +2 -1
  158. package/dist/components/biz/business/tab-bar/material.mjs +1 -1
  159. package/dist/components/biz/business/tab-bar/schema.d.mts +9 -9
  160. package/dist/components/biz/business/text-recommend/client.d.mts +2 -2
  161. package/dist/components/biz/business/text-recommend/client.mjs +1 -1
  162. package/dist/components/biz/business/text-recommend/index.d.mts +2 -2
  163. package/dist/components/biz/business/text-recommend/material.d.mts +2 -1
  164. package/dist/components/biz/business/text-recommend/material.mjs +1 -1
  165. package/dist/components/biz/business/text-recommend/schema.d.mts +6 -6
  166. package/dist/components/biz/business/video-horizontal-list/client.d.mts +5 -14
  167. package/dist/components/biz/business/video-horizontal-list/client.mjs +1 -1
  168. package/dist/components/biz/business/video-horizontal-list/index.d.mts +2 -2
  169. package/dist/components/biz/business/video-horizontal-list/material.d.mts +12 -2
  170. package/dist/components/biz/business/video-horizontal-list/material.mjs +1 -1
  171. package/dist/components/biz/business/video-horizontal-list/schema.d.mts +21 -3
  172. package/dist/components/biz/business/video-horizontal-list/schema.mjs +1 -1
  173. package/dist/components/biz/business/video-horizontal-list/server.d.mts +1 -1
  174. package/dist/components/biz/business/video-horizontal-list/server.mjs +1 -1
  175. package/dist/components/biz/example/button/index.d.mts +2 -2
  176. package/dist/components/biz/example/button/material.d.mts +2 -1
  177. package/dist/components/biz/example/button/schema.d.mts +14 -14
  178. package/dist/components/biz/renderer/renderer.d.mts +3 -3
  179. package/dist/components/biz/renderer/renderer.mjs +1 -1
  180. package/dist/components/pages/profile/page.mjs +1 -1
  181. package/dist/components/pages/search/page-client.mjs +1 -1
  182. package/dist/components/ui/button.d.mts +1 -1
  183. package/dist/materials.d.mts +4 -4
  184. package/dist/materials.mjs +1 -1
  185. package/dist/utils/schema/inspector.d.mts +111 -111
  186. package/dist/utils/schema/material.d.mts +13 -11
  187. package/dist/utils/schema/schema.d.mts +26 -26
  188. package/dist/utils/schema/utils.d.mts +1 -1
  189. package/dist/utils.mjs +1 -1
  190. package/package.json +1 -1
  191. package/dist/assets/images/Frame.mjs +0 -2
  192. package/dist/components/pages/profile/_components/tabs/collect-tab/client.mjs +0 -2
  193. package/dist/components/pages/profile/_components/tabs/collect-tab/server.mjs +0 -2
  194. package/dist/components/pages/profile/_components/tabs/history-tab/client.mjs +0 -2
  195. package/dist/components/pages/profile/_components/tabs/like-tab/client.mjs +0 -2
  196. package/dist/components/pages/profile/_components/tabs/publish-tab/client.mjs +0 -2
  197. package/dist/components/pages/profile/_components/user-profile-header/client.mjs +0 -2
  198. package/dist/components/pages/profile/_components/user-profile-header/user-profile-avatar.mjs +0 -2
  199. package/dist/components/pages/profile/_components/user-profile-header/user-profile-cover-background.mjs +0 -2
  200. package/dist/components/pages/profile/_components/user-profile-main/server.mjs +0 -2
  201. package/dist/components/pages/profile/_components/user-profile-main/shell.mjs +0 -2
  202. package/dist/components/pages/profile/utils.mjs +0 -2
@@ -0,0 +1,33 @@
1
+
2
+ import { UserProfileHeaderAuthConfig, UserProfileHeaderClientProps } from "./schema.mjs";
3
+ import { PrefetchItem } from "../../../../../hooks/query/hydration-boundary.mjs";
4
+ import "../../../../../hooks.mjs";
5
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
6
+
7
+ //#region components/biz/business/profile/profile-header/server.d.ts
8
+ interface BuildUserProfileHeaderPrefetchParams {
9
+ /** 路由目标用户 ID。 */
10
+ id?: string;
11
+ /** 当前登录用户 ID。 */
12
+ currentUserId: string;
13
+ /** 当前登录 Token。 */
14
+ token: string;
15
+ /** 服务端请求头。 */
16
+ authConfig?: UserProfileHeaderAuthConfig;
17
+ }
18
+ /**
19
+ * 构建用户资料头部预取任务。
20
+ */
21
+ declare function buildUserProfileHeaderPrefetch({
22
+ id,
23
+ currentUserId,
24
+ token,
25
+ authConfig
26
+ }: BuildUserProfileHeaderPrefetchParams): PrefetchItem[];
27
+ type UserProfileHeaderProps = UserProfileHeaderClientProps;
28
+ /**
29
+ * 用户资料头部服务端组件(用于物料注册),内部包含预取逻辑。
30
+ */
31
+ declare function UserProfileHeader(props: UserProfileHeaderProps): react_jsx_runtime0.JSX.Element;
32
+ //#endregion
33
+ export { BuildUserProfileHeaderPrefetchParams, UserProfileHeader, UserProfileHeaderProps, buildUserProfileHeaderPrefetch };
@@ -1,2 +1,2 @@
1
1
 
2
- import{gUserGetUserInfo as e,gUserViewUserInfo as t}from"../../../../../service/generated/client.mjs";import{getAppContextResolved as n}from"../../../../../hooks/get-app-context.mjs";import{HydrationBoundary as r}from"../../../../../hooks/query/hydration-boundary.mjs";import{UserProfileHeaderClient as i}from"./client.mjs";import{jsx as a}from"react/jsx-runtime";function o({id:n,currentUserId:r,token:i,authConfig:a}){return n||r&&i?[{queryKey:n==null||r&&n===r?[`user-profile`,`mine`]:[`user-profile`,`profile`,n],async queryFn(){return n==null?e({user_id:r},a):t({target_user_id:n,user_id:r||n},a)}}]:[]}async function s({token:e=``,currentUserId:t=``,authConfig:s,...c}){if((await n()).value===`editor`)return a(i,{...c,isEditorPreview:!0});let l=o({id:c.id,currentUserId:t,token:e,authConfig:s});return l.length===0?a(i,{...c}):a(r,{prefetch:l,children:a(i,{...c})})}export{s as UserProfileHeader};
2
+ import{gUserGetUserInfo as e,gUserViewUserInfo as t}from"../../../../../service/generated/client.mjs";import{getAppContextResolved as n}from"../../../../../hooks/get-app-context.mjs";import{HydrationBoundary as r}from"../../../../../hooks/query/hydration-boundary.mjs";import{UserProfileHeaderClient as i}from"./client.mjs";import{jsx as a}from"react/jsx-runtime";function o({id:n,currentUserId:r,token:i,authConfig:a}){return n||r&&i?[{queryKey:n==null||r&&n===r?[`user-profile`,`mine`]:[`user-profile`,`profile`,n],async queryFn(){return n==null?e({user_id:r},a):t({target_user_id:n,user_id:r||n},a)}}]:[]}function s(e){return a(c,{...e})}async function c({token:e=``,currentUserId:t=``,authConfig:s,...c}){if((await n()).value===`editor`)return a(i,{...c,isEditorPreview:!0});let l=o({id:c.id,currentUserId:t,token:e,authConfig:s});return l.length===0?a(i,{...c}):a(r,{prefetch:l,children:a(i,{...c})})}export{s as UserProfileHeader,o as buildUserProfileHeaderPrefetch};
@@ -0,0 +1,2 @@
1
+
2
+ "use client";import{cn as e}from"../../../../../utils/cn.mjs";import{Button as t}from"../../../../ui/button.mjs";import{useUserStore as n}from"../../../../../store/modules/user-store.mjs";import{pUserEditUserInfo as r}from"../../../../../service/generated/client.mjs";import{uploadFile as i}from"../../../../../utils/upload-file.mjs";import{Avatar as a,AvatarFallback as o,AvatarImage as s}from"../../../../ui/avatar.mjs";import{Box as c}from"../../../../ui/box.mjs";import{Input as l}from"../../../../ui/input.mjs";import{Dialog as u,DialogContent as d}from"../../../../ui/dialog.mjs";import{Text as f}from"../../../../ui/text.mjs";import{useDeleteRequest as p}from"../../../../../hooks/query/use-query.mjs";import{ImageCropModal as m}from"../../../../common/image-crop-modal/image-crop-modal.mjs";import{useRef as h,useState as g}from"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{toast as b}from"sonner";const x=`https://guadd-sg-ccs-sing-dev.s3.ap-southeast-1.amazonaws.com/default/default_avatar.png`,S=[`image/jpeg`,`image/png`];function C(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return S.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function w({isMine:S,src:w,alt:T,onUnauthorizedClick:E}){let D=h(null),{userId:O,setUserInfo:k,userInfo:A}=n(),j=p(),[M,N]=g(!1),[P,F]=g(!1),[I,L]=g(``),[R,z]=g(!1);function B(){if(!R){if(S){N(!0);return}E?.()}}function V(){I&&(URL.revokeObjectURL(I),L(``))}function H(){N(!1)}function U(){R||D.current?.click()}function W(e){let t=e.target.files?.[0];if(t){if(!C(t)){b.error(`仅支持 JPG/JPEG/PNG 格式`),e.target&&(e.target.value=``);return}L(URL.createObjectURL(t)),F(!0),e.target&&(e.target.value=``)}}async function G(e){if(!O){b.error(`请先登录后再试`);return}try{z(!0);let t=await i(new File([e],`avatar.jpg`,{type:`image/jpeg`}),1);await r({user_id:String(O),avatar:t.objectKey}),k({...A,avatar:t.objectKey}),j([`user-profile`,`mine`]),j([`user-edit-info`,String(O)]),N(!1),F(!1),b.success(`更换完成`)}catch(e){console.error(`上传头像失败`,e),b.error(`头像上传失败,请稍后再试`)}finally{V(),z(!1)}}function K(){F(!1),V()}return y(_,{children:[S||E?v(t,{variant:`ghost`,size:`icon`,className:`!absolute bottom-3 left-0 h-22 w-22 rounded-full p-0 hover:bg-transparent`,onClick:B,"aria-label":`打开头像预览`,children:y(a,{className:`w-22 h-22`,children:[v(s,{src:w||x,alt:T||`avatar`}),v(o,{})]})}):y(a,{className:`!absolute bottom-3 left-0 w-22 h-22`,children:[v(s,{src:w||x,alt:T||`avatar`}),v(o,{})]}),v(u,{open:M,onOpenChange:H,children:v(d,{showCloseButton:!1,className:`bg-black !m-0 !p-0 !fixed !inset-0 !w-screen !h-screen !max-w-none !rounded-none !top-0 !left-0 !translate-x-0 !translate-y-0 !transform-none z-[9999] !pointer-events-auto`,children:y(c,{className:`relative flex h-full w-full flex-col items-center justify-center`,children:[v(t,{variant:`ghost`,size:`icon`,className:`absolute left-0 top-0 h-14 w-14 text-white hover:bg-transparent hover:text-white/80`,onClick:H,"aria-label":`关闭头像预览`,children:v(`svg`,{className:`w-4 h-4`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,viewBox:`0 0 16 16`,children:v(`path`,{d:`M14.55.2a.889.889 0 0 1 1.25 1.25l-.06.067L9.255 8l6.483 6.482.06.069a.888.888 0 0 1-1.25 1.25l-.067-.062L8 9.256l-6.482 6.483A.888.888 0 1 1 .26 14.482L6.742 8 .26 1.517.2 1.45A.888.888 0 0 1 1.45.2l.067.062 6.482 6.482L14.482.261l.068-.062Z`})})}),y(a,{className:`w-50 h-50`,children:[v(s,{src:w||x,alt:T||`avatar`}),v(o,{})]}),y(t,{variant:`ghost`,className:e(`absolute bottom-8 left-0 right-0 mx-auto flex w-[366px] max-w-[90%] items-center justify-between rounded-3xl bg-white/10 px-3 py-3 transition-colors hover:bg-white/20`,`active:scale-95`),onClick:U,disabled:R,children:[v(f,{as:`span`,className:`text-base font-medium text-white`,children:R?`上传中...`:`更换头像`}),y(`svg`,{className:`w-6 h-6 text-white`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:[v(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z`}),v(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 13a3 3 0 11-6 0 3 3 0 016 0z`})]})]})]})})}),v(l,{ref:D,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:W}),v(m,{open:P,onClose:K,imageSrc:I,onConfirm:G})]})}export{w as UserProfileAvatar};
@@ -0,0 +1,2 @@
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{useRef as l,useState as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import{toast as m}from"sonner";const h=[`image/jpeg`,`image/png`];function g(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return h.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function _({isMine:h,src:_,onUnauthorizedClick:v}){let y=`/images/mine/img_mine_head_bg.png`,b=l(null),{userId:x,setUserInfo:S,userInfo:C}=e(),w=o(),[T,E]=u(!1),[D,O]=u(!1),k=()=>{if(h){T||O(!0);return}v?.()},A=()=>{O(!1)};function j(){T||b.current?.click()}async function M(e){let r=e.target.files?.[0];if(e.target&&(e.target.value=``),r)try{if(!g(r)){m.error(`仅支持 JPG/JPEG/PNG 格式`);return}E(!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(x),bg_image:e.objectKey}),S({...C,bg_image:e.objectKey}),w([`user-profile`,`mine`]),O(!1),m.success(`更换完成`)}catch(e){console.error(`上传背景图失败`,e),e instanceof Error&&e.message!==`用户取消`&&m.error(`背景图上传失败,请稍后再试`)}finally{E(!1)}}return p(d,{children:[f(i,{className:`h-33.75`,children:f(i,{className:`relative h-full w-full`,onClick:k,children:f(r,{alt:`cover background`,fill:!0,objectFit:`cover`,className:`pointer-events-none`,src:_||y})})}),f(s,{open:D,onClose:A,bgUrl:_||y,onUpload:j}),f(a,{ref:b,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:M})]})}export{_ as UserProfileCoverBackground};
@@ -0,0 +1,17 @@
1
+
2
+ import { UserProfileMainProps } from "./schema.mjs";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+
5
+ //#region components/biz/business/profile/profile-main/client.d.ts
6
+ /**
7
+ * 用户资料主体物料客户端组件。
8
+ */
9
+ declare function UserProfileMainClient({
10
+ id,
11
+ className,
12
+ cookieUserId,
13
+ currentUserId,
14
+ requireLogin
15
+ }: UserProfileMainProps): react_jsx_runtime0.JSX.Element;
16
+ //#endregion
17
+ export { UserProfileMainClient };
@@ -0,0 +1,2 @@
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};
@@ -0,0 +1,16 @@
1
+
2
+ import { ProfileMainAuthConfig, ProfileMainInspectorProps, UserProfileMainProps, profileMainInspectorDefaultProps, profileMainInspectorPropsSchema } from "./schema.mjs";
3
+ import { UserProfileMainClient } from "./client.mjs";
4
+ import { UserProfileMain } from "./server.mjs";
5
+ import { profileMainMaterial } from "./material.mjs";
6
+ import { UserProfileMainRenderMode, UserProfileMainShell, UserProfileMainShellProps } from "./shell.mjs";
7
+ import { CollectTab, CollectTabProps } from "./tabs/collect-tab/client.mjs";
8
+ import { BuildCollectTabPrefetchParams, CollectTabAuthConfig, CollectTabServer, buildCollectTabPrefetch } from "./tabs/collect-tab/server.mjs";
9
+ import { HistoryTab, HistoryTabProps } from "./tabs/history-tab/client.mjs";
10
+ import { BuildHistoryTabPrefetchParams, HistoryTabAuthConfig, HistoryTabServer, buildHistoryTabPrefetch } from "./tabs/history-tab/server.mjs";
11
+ import { LikeDetailItem, LikeTab, LikeTabProps } from "./tabs/like-tab/client.mjs";
12
+ import { BuildLikeTabPrefetchParams, LikeTabServer, buildLikeTabPrefetch } from "./tabs/like-tab/server.mjs";
13
+ import { PublishTab, PublishTabProps, PublishTabUserInfo } from "./tabs/publish-tab/client.mjs";
14
+ import { BuildPublishTabPrefetchParams, PublishTabServer, buildPublishTabPrefetch } from "./tabs/publish-tab/server.mjs";
15
+ import "./tabs/index.mjs";
16
+ import { profileMainCollectCollectionTabOptions, profileMainCollectTabOptions, profileMainHistoryTabOptions, profileMainLikeTabOptions, profileMainMineTabOptions, profileMainProfileTabOptions, profileMainTabOptions } from "./variants.mjs";
@@ -1,9 +1,22 @@
1
1
 
2
+ import { SchemaHasDefaultValue } from "../../../../../utils/schema/schema.mjs";
2
3
  import { DefineMaterialOption } from "../../../../../utils/schema/material.mjs";
4
+ import "../../../../../utils/schema/index.mjs";
5
+ import { UserProfileMainClient } from "./client.mjs";
6
+ import { UserProfileMain } from "./server.mjs";
3
7
  import * as zod from "zod";
4
8
  import * as zod_v4_core0 from "zod/v4/core";
5
9
 
6
10
  //#region components/biz/business/profile/profile-main/material.d.ts
7
- declare const profileMainMaterial: DefineMaterialOption<() => string, zod.ZodObject<{}, zod_v4_core0.$strip>, "profile-main">;
11
+ declare const profileMainMaterial: DefineMaterialOption<typeof UserProfileMain, typeof UserProfileMainClient, zod.ZodObject<{
12
+ id: zod.ZodOptional<zod.ZodString>;
13
+ showCreateAction: zod.ZodOptional<zod.ZodBoolean> & SchemaHasDefaultValue;
14
+ requireLogin: zod.ZodOptional<zod.ZodBoolean> & SchemaHasDefaultValue;
15
+ tab: zod.ZodOptional<zod.ZodType<"history" | "collect" | "publish" | "like", unknown, zod_v4_core0.$ZodTypeInternals<"history" | "collect" | "publish" | "like", unknown>>> & SchemaHasDefaultValue;
16
+ likeTab: zod.ZodOptional<zod.ZodType<"video" | "post", unknown, zod_v4_core0.$ZodTypeInternals<"video" | "post", unknown>>> & SchemaHasDefaultValue;
17
+ historyTab: zod.ZodOptional<zod.ZodType<"video" | "post", unknown, zod_v4_core0.$ZodTypeInternals<"video" | "post", unknown>>> & SchemaHasDefaultValue;
18
+ collectTab: zod.ZodOptional<zod.ZodType<"video" | "post" | "collection", unknown, zod_v4_core0.$ZodTypeInternals<"video" | "post" | "collection", unknown>>> & SchemaHasDefaultValue;
19
+ collectCollectionTab: zod.ZodOptional<zod.ZodType<"subscribed" | "created", unknown, zod_v4_core0.$ZodTypeInternals<"subscribed" | "created", unknown>>> & SchemaHasDefaultValue;
20
+ }, zod_v4_core0.$strip>, "profile-main">;
8
21
  //#endregion
9
22
  export { profileMainMaterial };
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineMaterial as e}from"../../../../../utils/schema/material.mjs";import{defineComponentPropsSchema as t}from"../../../../../utils/schema/schema.mjs";const n=e({type:`profile-main`,category:`内容组件`,name:`用户行为模块`,icon:``,serverComponent:()=>`profile main component server todo`,clientComponent:()=>`profile main component client todo`,propsSchema:t({})});export{n 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:`CENTER`,name:`用户行为模块`,icon:`/icon/profile-main.png`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as profileMainMaterial};
@@ -0,0 +1,55 @@
1
+
2
+ import { SchemaHasDefaultValue } from "../../../../../utils/schema/schema.mjs";
3
+ import "../../../../../utils/schema/index.mjs";
4
+ import z$1 from "zod";
5
+
6
+ //#region components/biz/business/profile/profile-main/schema.d.ts
7
+ /**
8
+ * 用户资料主体可被 inspector 编辑的字段。
9
+ */
10
+ declare const profileMainInspectorPropsSchema: z$1.ZodObject<{
11
+ id: z$1.ZodOptional<z$1.ZodString>;
12
+ showCreateAction: z$1.ZodOptional<z$1.ZodBoolean> & SchemaHasDefaultValue;
13
+ requireLogin: z$1.ZodOptional<z$1.ZodBoolean> & SchemaHasDefaultValue;
14
+ tab: z$1.ZodOptional<z$1.ZodType<"history" | "collect" | "publish" | "like", unknown, z$1.core.$ZodTypeInternals<"history" | "collect" | "publish" | "like", unknown>>> & SchemaHasDefaultValue;
15
+ likeTab: z$1.ZodOptional<z$1.ZodType<"video" | "post", unknown, z$1.core.$ZodTypeInternals<"video" | "post", unknown>>> & SchemaHasDefaultValue;
16
+ historyTab: z$1.ZodOptional<z$1.ZodType<"video" | "post", unknown, z$1.core.$ZodTypeInternals<"video" | "post", unknown>>> & SchemaHasDefaultValue;
17
+ collectTab: z$1.ZodOptional<z$1.ZodType<"video" | "post" | "collection", unknown, z$1.core.$ZodTypeInternals<"video" | "post" | "collection", unknown>>> & SchemaHasDefaultValue;
18
+ collectCollectionTab: z$1.ZodOptional<z$1.ZodType<"subscribed" | "created", unknown, z$1.core.$ZodTypeInternals<"subscribed" | "created", unknown>>> & SchemaHasDefaultValue;
19
+ }, z$1.core.$strip>;
20
+ declare const profileMainInspectorDefaultProps: {
21
+ showCreateAction: boolean;
22
+ requireLogin: boolean;
23
+ tab: "history" | "collect" | "publish" | "like";
24
+ likeTab: "video" | "post";
25
+ historyTab: "video" | "post";
26
+ collectTab: "video" | "post" | "collection";
27
+ collectCollectionTab: "subscribed" | "created";
28
+ };
29
+ type ProfileMainInspectorProps = z$1.infer<typeof profileMainInspectorPropsSchema>;
30
+ interface ProfileMainRuntimeTabProps {
31
+ tab?: string;
32
+ likeTab?: string;
33
+ historyTab?: string;
34
+ collectTab?: string;
35
+ collectCollectionTab?: string;
36
+ }
37
+ interface ProfileMainAuthConfig {
38
+ headers?: Record<string, string>;
39
+ }
40
+ interface UserProfileMainProps extends Omit<ProfileMainInspectorProps, keyof ProfileMainRuntimeTabProps>, ProfileMainRuntimeTabProps {
41
+ /** 服务端透传的登录 Token。 */
42
+ cookieToken?: string;
43
+ /** 服务端透传的当前用户 ID。 */
44
+ cookieUserId?: string;
45
+ /** 主体容器附加类名。 */
46
+ className?: string;
47
+ /** 当前登录 Token。 */
48
+ token?: string;
49
+ /** 当前登录用户 ID。 */
50
+ currentUserId?: string;
51
+ /** 服务端请求头。 */
52
+ authConfig?: ProfileMainAuthConfig;
53
+ }
54
+ //#endregion
55
+ export { ProfileMainAuthConfig, ProfileMainInspectorProps, UserProfileMainProps, profileMainInspectorDefaultProps, profileMainInspectorPropsSchema };
@@ -0,0 +1,2 @@
1
+
2
+ import{defineComponentPropsSchema as e,defineSelectEnumPropSchema as t,defineSwitchPropSchema as n,defineTextPropSchema as r,getSchemaDefaultProps as i}from"../../../../../utils/schema/schema.mjs";import{profileMainCollectCollectionTabOptions as a,profileMainCollectTabOptions as o,profileMainHistoryTabOptions as s,profileMainLikeTabOptions as c,profileMainTabOptions as l}from"./variants.mjs";const u=e({id:r({label:`用户 ID`,required:!1}),showCreateAction:n({label:`显示创建入口`,defaultValue:!1,required:!1}),requireLogin:n({label:`需要登录`,defaultValue:!1,required:!1}),tab:t(l,{label:`主 Tab`,defaultValue:`collect`,required:!1}),likeTab:t(c,{label:`点赞子 Tab`,defaultValue:`video`,required:!1}),historyTab:t(s,{label:`历史子 Tab`,defaultValue:`video`,required:!1}),collectTab:t(o,{label:`收藏子 Tab`,defaultValue:`video`,required:!1}),collectCollectionTab:t(a,{label:`收藏合集子 Tab`,defaultValue:`created`,required:!1})}),d=i(u);export{d as profileMainInspectorDefaultProps,u as profileMainInspectorPropsSchema};
@@ -0,0 +1,11 @@
1
+
2
+ import { UserProfileMainProps } from "./schema.mjs";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+
5
+ //#region components/biz/business/profile/profile-main/server.d.ts
6
+ /**
7
+ * 用户资料主体服务端组件(用于物料注册),内部包含预取逻辑。
8
+ */
9
+ declare function UserProfileMain(props: UserProfileMainProps): react_jsx_runtime0.JSX.Element;
10
+ //#endregion
11
+ export { UserProfileMain };
@@ -0,0 +1,2 @@
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};
@@ -0,0 +1,25 @@
1
+
2
+ import { PropsWithChildren } from "react";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+
5
+ //#region components/biz/business/profile/profile-main/shell.d.ts
6
+ type UserProfileMainRenderMode = 'content' | 'login-required' | 'privacy-collect' | 'privacy-like';
7
+ interface UserProfileMainShellProps extends PropsWithChildren {
8
+ /** 是否为本人视角。 */
9
+ isMine: boolean;
10
+ /** 当前内容区渲染模式。 */
11
+ renderMode: UserProfileMainRenderMode;
12
+ /** 主体容器附加类名。 */
13
+ className?: string;
14
+ }
15
+ /**
16
+ * 用户资料主体客户端壳层,仅负责主 Tab 交互与占位渲染。
17
+ */
18
+ declare function UserProfileMainShell({
19
+ isMine,
20
+ renderMode,
21
+ className,
22
+ children
23
+ }: UserProfileMainShellProps): react_jsx_runtime0.JSX.Element;
24
+ //#endregion
25
+ export { UserProfileMainRenderMode, UserProfileMainShell, UserProfileMainShellProps };
@@ -0,0 +1,2 @@
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};
@@ -0,0 +1,25 @@
1
+
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+
4
+ //#region components/biz/business/profile/profile-main/tabs/collect-tab/client.d.ts
5
+ interface CollectTabProps {
6
+ /** 当前用户ID */
7
+ userId?: string;
8
+ /** 是否显示创建入口 */
9
+ showCreateAction?: boolean;
10
+ /** Query Key 前缀 */
11
+ queryKeyPrefix?: Array<string | number | undefined>;
12
+ /** 是否为本人视角。 */
13
+ isMine?: boolean;
14
+ }
15
+ /**
16
+ * 收藏 Tab
17
+ */
18
+ declare function CollectTab({
19
+ userId,
20
+ showCreateAction,
21
+ queryKeyPrefix,
22
+ isMine
23
+ }: CollectTabProps): react_jsx_runtime0.JSX.Element;
24
+ //#endregion
25
+ export { CollectTab, CollectTabProps };
@@ -0,0 +1,2 @@
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??w).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){let t=(e.contents??[]).slice(0,3).map(S);return{id:e.collection_id||``,title:e.title||``,contentCount:e.content_count??t.length,contents:t}}const w=[],me=[`video`,`post`,`collection`],he=[`created`,`subscribed`];function T({userId:_,showCreateAction:x=!1,queryKeyPrefix:S,isMine:T=!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:ge,userInfo:_e}=t(),z=_||ge||_e?.userId||``,ve=re();async function B(e,t){if(!z)return{data:{list:[],total:0}};let n=await i({user_id:z,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`,z],initialPageParam:1,async queryFn(e){return B(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`,z],initialPageParam:1,options:{staleTime:0,enabled:D},async queryFn(e){return B(e,b.post)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}});async function ye(e){if(!z)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(C),total:t.data?.data?.total??n.length}}}async function be(e){if(!z)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(C),total:t?.total??r.length}}}let U=u({key:[...O,`user-collection-created`,z],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`,z],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??w)??w,[V.data]),K=f(()=>H.data?.pages.flatMap(e=>e.data?.list??w)??w,[H.data]),xe=f(()=>U.data?.pages.flatMap(e=>e.data?.list??w)??w,[U.data]),Se=f(()=>W.data?.pages.flatMap(e=>e.data?.list??w)??w,[W.data]),Ce=N===`video`?G:N===`post`?K:w,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`,z],Ee=[...O,`user-collect-post`,z],{mutateAsync:De,isPending:Z}=ne(async e=>await a({app_id:0,user_id:z,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(!z){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);ve(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:`post`,className:`text-sm`,children:E(`collectTab.posts`)}),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,{})})]}):T&&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{T as CollectTab};
@@ -0,0 +1,3 @@
1
+
2
+ import { CollectTab, CollectTabProps } from "./client.mjs";
3
+ import { BuildCollectTabPrefetchParams, CollectTabAuthConfig, CollectTabServer, buildCollectTabPrefetch } from "./server.mjs";
@@ -0,0 +1,54 @@
1
+
2
+ import { PrefetchItem } from "../../../../../../../hooks/query/hydration-boundary.mjs";
3
+ import "../../../../../../../hooks.mjs";
4
+ import { CollectTabProps } from "./client.mjs";
5
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
6
+
7
+ //#region components/biz/business/profile/profile-main/tabs/collect-tab/server.d.ts
8
+ interface CollectTabAuthConfig {
9
+ headers?: Record<string, string>;
10
+ }
11
+ interface BuildCollectTabPrefetchParams {
12
+ /** Query Key 前缀。 */
13
+ queryKeyPrefix: Array<string | number | undefined>;
14
+ /** 目标用户 ID。 */
15
+ targetUserId?: string;
16
+ /** 当前激活的收藏子 Tab。 */
17
+ resolvedCollectTab: string;
18
+ /** 当前激活的收藏合集子 Tab。 */
19
+ resolvedCollectCollectionTab: string;
20
+ /** 服务端请求头配置。 */
21
+ authConfig?: CollectTabAuthConfig;
22
+ }
23
+ /**
24
+ * 构建收藏 Tab 首屏预取任务。
25
+ */
26
+ declare function buildCollectTabPrefetch({
27
+ queryKeyPrefix,
28
+ targetUserId,
29
+ resolvedCollectTab,
30
+ resolvedCollectCollectionTab,
31
+ authConfig
32
+ }: BuildCollectTabPrefetchParams): PrefetchItem[];
33
+ interface CollectTabServerProps extends CollectTabProps {
34
+ /** 外部透传的预取任务。 */
35
+ prefetch?: PrefetchItem[];
36
+ /** 当前激活的收藏子 Tab。 */
37
+ resolvedCollectTab?: string;
38
+ /** 当前激活的收藏合集子 Tab。 */
39
+ resolvedCollectCollectionTab?: string;
40
+ /** 服务端请求头配置。 */
41
+ authConfig?: CollectTabAuthConfig;
42
+ }
43
+ /**
44
+ * 收藏 Tab 服务端包装组件。
45
+ */
46
+ declare function CollectTabServer({
47
+ prefetch,
48
+ resolvedCollectTab,
49
+ resolvedCollectCollectionTab,
50
+ authConfig,
51
+ ...props
52
+ }: CollectTabServerProps): react_jsx_runtime0.JSX.Element;
53
+ //#endregion
54
+ export { BuildCollectTabPrefetchParams, CollectTabAuthConfig, CollectTabServer, buildCollectTabPrefetch };
@@ -0,0 +1,2 @@
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}){if(!t)return[];if(n===`collection`)return[{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(){}}];let a=n===`post`;return[{type:`infinite`,queryKey:a?[...e,`user-collect-post`,t]:[...e,`user-collect-video`,t],async queryFn(e){return u({targetUserId:t,page:e,contentType:a?2: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(_),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(_),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){let t=(e.contents??[]).slice(0,3).map(g);return{id:e.collection_id||``,title:e.title||``,contentCount:e.content_count??t.length,contents:t}}export{l as CollectTabServer,c as buildCollectTabPrefetch};
@@ -0,0 +1,19 @@
1
+
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+
4
+ //#region components/biz/business/profile/profile-main/tabs/history-tab/client.d.ts
5
+ interface HistoryTabProps {
6
+ /** 目标用户 ID。 */
7
+ targetUserId?: string;
8
+ /** Query Key 前缀 */
9
+ queryKeyPrefix?: Array<string | number | undefined>;
10
+ }
11
+ /**
12
+ * 浏览历史 Tab
13
+ */
14
+ declare function HistoryTab({
15
+ targetUserId,
16
+ queryKeyPrefix
17
+ }: HistoryTabProps): react_jsx_runtime0.JSX.Element;
18
+ //#endregion
19
+ export { HistoryTab, HistoryTabProps };
@@ -0,0 +1,2 @@
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 ee,usePaginated as l,useUpdateRequest as u}from"../../../../../../../hooks/query/use-query.mjs";import{useAppContext as d}from"../../../../../../../hooks/use-app-context/index.mjs";import{PostList as f}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as p}from"../../../../../../common/list/video-list/video-list.mjs";import{getHistoryData 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 C(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 w(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 T(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 E=[`video`,`post`];function D({targetUserId:D,queryKeyPrefix:O}){let k=x(`components.pages.profile.components.tabs`),A=d()===`renderer`,j=O??[],[M,N]=ne(`historyTab`,S.withDefault(`video`)),P=te(()=>E.includes(M)?M:`video`,[M]),[F,I]=_(!1),[L,R]=_(()=>new Set),z=t(e=>e.userId),B=u(),V=[...j,`user-history-video`],H=[...j,`user-history-post`],U=l({key:V,initialPageParam:1,async queryFn(e){return m({targetUserId:D,page:e,contentType:h.video})},options:{staleTime:0,enabled:A},getNextPageParam(e,t){if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),W=l({key:H,initialPageParam:1,async queryFn(e){return m({targetUserId:D,page:e,contentType:h.post})},options:{staleTime:0,enabled:A},getNextPageParam(e,t){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:re,isPending:Z}=ee(async e=>await n({app_id:0,user_id:z,content_type:e.contentType,content_ids:e.contentIds})),ie=()=>{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})},ae=()=>{L.size===Y.size&&Y.size>0?R(new Set):R(new Set(Y))},oe=async()=>{if(!(L.size===0||Z)){if(!z){b.error(k(`historyTab.pleaseLogin`));return}try{let e=Array.from(L),t=await re({contentIds:e,contentType:X?1:2});if(t.code===0){b.success(k(`historyTab.historyDeletedSuccess`));let t=new Set(e);B(X?V:H,e=>T(e,t,e=>e.id)),R(new Set),I(!1)}else b.error(t.message||k(`historyTab.deleteFailed`))}catch(e){console.error(`删除浏览记录失败`,e),b.error(k(`historyTab.operationFailed`))}}},$=async()=>{A&&await G.fetchNextPage()};return y(r,{children:[y(r,{className:`flex justify-between items-center`,children:[v(a,{value:P,onValueChange:e=>{N(e)},children:y(o,{variant:`tag`,children:[v(s,{value:`video`,className:`text-sm`,children:k(`historyTab.video`)}),v(s,{value:`post`,className:`text-sm`,children:k(`historyTab.posts`)})]})}),v(e,{variant:`ghost`,size:`sm`,className:`px-0 text-sm text-text3`,onClick:ie,children:k(F?`historyTab.cancel`:`historyTab.edit`)})]}),v(r,{className:`pt-2`,children:P===`video`?v(p,{showVideoProgress:!0,list:K,loading:G.isFetching,hasMore:G.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,onToggleSelection:Q}):v(f,{list:q,loading:G.isFetching,hasMore:G.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,onToggleSelection:Q})}),F&&y(r,{style:{bottom:`calc(56px + env(safe-area-inset-bottom, 0px))`},className:`flex fixed z-10 left-0 w-full items-center justify-between px-3 py-2 bg-bg1 `,children:[y(r,{className:`flex items-center gap-2`,children:[v(i,{checked:L.size===Y.size&&Y.size>0,onCheckedChange:ae}),v(c,{className:`text-sm text-text1`,children:k(`historyTab.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:oe,children:k(Z?`historyTab.processing`:`historyTab.delete`)})]})]})}export{D as HistoryTab};
@@ -0,0 +1,3 @@
1
+
2
+ import { HistoryTab, HistoryTabProps } from "./client.mjs";
3
+ import { BuildHistoryTabPrefetchParams, HistoryTabAuthConfig, HistoryTabServer, buildHistoryTabPrefetch } from "./server.mjs";
@@ -0,0 +1,48 @@
1
+
2
+ import { PrefetchItem } from "../../../../../../../hooks/query/hydration-boundary.mjs";
3
+ import "../../../../../../../hooks.mjs";
4
+ import { HistoryTabProps } from "./client.mjs";
5
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
6
+
7
+ //#region components/biz/business/profile/profile-main/tabs/history-tab/server.d.ts
8
+ interface HistoryTabAuthConfig {
9
+ headers?: Record<string, string>;
10
+ }
11
+ interface BuildHistoryTabPrefetchParams {
12
+ /** Query Key 前缀。 */
13
+ queryKeyPrefix: Array<string | number | undefined>;
14
+ /** 目标用户 ID。 */
15
+ targetUserId?: string;
16
+ /** 当前激活的历史子 Tab。 */
17
+ resolvedHistoryTab: string;
18
+ /** 服务端请求头配置。 */
19
+ authConfig?: HistoryTabAuthConfig;
20
+ }
21
+ /**
22
+ * 构建历史 Tab 首屏预取任务。
23
+ */
24
+ declare function buildHistoryTabPrefetch({
25
+ queryKeyPrefix,
26
+ targetUserId,
27
+ resolvedHistoryTab,
28
+ authConfig
29
+ }: BuildHistoryTabPrefetchParams): PrefetchItem[];
30
+ interface HistoryTabServerProps extends HistoryTabProps {
31
+ /** 外部透传的预取任务。 */
32
+ prefetch?: PrefetchItem[];
33
+ /** 当前激活的历史子 Tab。 */
34
+ resolvedHistoryTab?: string;
35
+ /** 服务端请求头配置。 */
36
+ authConfig?: HistoryTabAuthConfig;
37
+ }
38
+ /**
39
+ * 历史 Tab 服务端包装组件。
40
+ */
41
+ declare function HistoryTabServer({
42
+ prefetch,
43
+ resolvedHistoryTab,
44
+ authConfig,
45
+ ...props
46
+ }: HistoryTabServerProps): react_jsx_runtime0.JSX.Element;
47
+ //#endregion
48
+ export { BuildHistoryTabPrefetchParams, HistoryTabAuthConfig, HistoryTabServer, buildHistoryTabPrefetch };
@@ -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}){if(!r)return[];let o=i===`post`;return[{type:`infinite`,queryKey:o?[...e,`user-history-post`]:[...e,`user-history-video`],async queryFn(e){return t({targetUserId:r,page:e,contentType:o?n.post: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};
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}){if(!r)return[];let o=i===`post`;return[{type:`infinite`,queryKey:o?[...e,`user-history-post`]:[...e,`user-history-video`],async queryFn(e){return t({targetUserId:r,page:e,contentType:o?n.post: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};
@@ -0,0 +1,13 @@
1
+
2
+ import { CollectTab, CollectTabProps } from "./collect-tab/client.mjs";
3
+ import { BuildCollectTabPrefetchParams, CollectTabAuthConfig, CollectTabServer, buildCollectTabPrefetch } from "./collect-tab/server.mjs";
4
+ import "./collect-tab/index.mjs";
5
+ import { HistoryTab, HistoryTabProps } from "./history-tab/client.mjs";
6
+ import { BuildHistoryTabPrefetchParams, HistoryTabAuthConfig, HistoryTabServer, buildHistoryTabPrefetch } from "./history-tab/server.mjs";
7
+ import "./history-tab/index.mjs";
8
+ import { LikeDetailItem, LikeTab, LikeTabProps } from "./like-tab/client.mjs";
9
+ import { BuildLikeTabPrefetchParams, LikeTabServer, buildLikeTabPrefetch } from "./like-tab/server.mjs";
10
+ import "./like-tab/index.mjs";
11
+ import { PublishTab, PublishTabProps, PublishTabUserInfo } from "./publish-tab/client.mjs";
12
+ import { BuildPublishTabPrefetchParams, PublishTabServer, buildPublishTabPrefetch } from "./publish-tab/server.mjs";
13
+ import "./publish-tab/index.mjs";
@@ -0,0 +1,76 @@
1
+
2
+ import { CommunityContentInfo } from "../../../../../../../types.mjs";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+
5
+ //#region components/biz/business/profile/profile-main/tabs/like-tab/client.d.ts
6
+ /**
7
+ * 内容播放进度
8
+ */
9
+ interface ContentPlayProgress {
10
+ percent: number;
11
+ series_num: number;
12
+ }
13
+ /**
14
+ * 用户信息
15
+ */
16
+ interface DetailUserInfo {
17
+ name?: string;
18
+ avatar?: string;
19
+ }
20
+ /**
21
+ * 静态统计数据
22
+ */
23
+ interface StaticsCount {
24
+ browse_cnt: number;
25
+ }
26
+ /**
27
+ * 父内容信息
28
+ */
29
+ interface ParentContentInfo {
30
+ type?: number;
31
+ }
32
+ /**
33
+ * 扩展的内容信息(包含 video_duration 等运行时字段)
34
+ */
35
+ interface ExtendedContentInfo extends CommunityContentInfo {
36
+ video_duration?: number;
37
+ cover_image_thumbnail?: string;
38
+ cover_horizontal_image_thumbnail?: string;
39
+ name?: string;
40
+ text?: string;
41
+ play_count?: number;
42
+ }
43
+ /**
44
+ * 内容详情
45
+ */
46
+ interface DetailContent {
47
+ user_info?: DetailUserInfo;
48
+ info?: ExtendedContentInfo;
49
+ statics_cnt?: StaticsCount;
50
+ publish_time?: number;
51
+ parent_content_info?: ParentContentInfo;
52
+ }
53
+ /**
54
+ * 点赞内容项(从 API 返回的数据结构)
55
+ */
56
+ interface LikeDetailItem {
57
+ id: string;
58
+ content_play_progress?: ContentPlayProgress;
59
+ detail: DetailContent;
60
+ is_more_link?: boolean;
61
+ }
62
+ interface LikeTabProps {
63
+ /** 目标用户 ID。 */
64
+ targetUserId?: string;
65
+ /** Query Key 前缀 */
66
+ queryKeyPrefix?: Array<string | number | undefined>;
67
+ /** 是否为本人视角。 */
68
+ isMine?: boolean;
69
+ }
70
+ declare function LikeTab({
71
+ targetUserId,
72
+ queryKeyPrefix,
73
+ isMine
74
+ }: LikeTabProps): react_jsx_runtime0.JSX.Element;
75
+ //#endregion
76
+ export { LikeDetailItem, LikeTab, LikeTabProps };
@@ -0,0 +1,2 @@
1
+
2
+ "use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionUnifiedBatchLikeDislike as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Tabs as a,TabsList as o,TabsTrigger as s}from"../../../../../../ui/tabs.mjs";import{Text as c}from"../../../../../../ui/text.mjs";import{useMutation as l,usePaginated as u,useUpdateRequest as d}from"../../../../../../../hooks/query/use-query.mjs";import{useAppContext as ee}from"../../../../../../../hooks/use-app-context/index.mjs";import{PostList as f}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as te}from"../../../../../../common/list/video-list/video-list.mjs";import{getLikeData as p,likeContentType as m}from"../../utils.mjs";import{useEffect as h,useMemo as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{toast as b}from"sonner";import{useTranslations as x}from"next-intl";import{parseAsString as ne,useQueryState as S}from"nuqs";function C(e,t,n){if(!e)return e;let r=0,i=e.pages.map(e=>({page:e,filteredList:(e.data?.list??[]).filter(e=>{let i=n(e)??``,a=t.has(i);return a&&(r+=1),!a})}));return{...e,pages:i.map(({page:e,filteredList:t})=>{if(!e.data)return e;let n=typeof e.data.total==`number`?Math.max(0,e.data.total-r):e.data.total;return{...e,data:{...e.data,list:t,total:n}}})}}function w(e){let{detail:t}=e,{info:n,publish_time:r}=t;return{id:e.id,title:n?.name||n?.text||n?.content||``,coverImage:n?.cover_image_thumbnail||n?.cover_image||n?.cover_horizontal_image_thumbnail||``,publishTime:r??0}}function T(e){let{detail:t}=e,{user_info:n,info:r,statics_cnt:i,publish_time:a,parent_content_info:o}=t;return{id:e.id,is_more_link:r?.is_more_link||!1,title:r?.name||r?.text||r?.content||``,coverImage:r?.cover_image_thumbnail||r?.cover_image||r?.cover_horizontal_image_thumbnail||``,duration:Number(r?.video_duration??0),progress:e.content_play_progress?.percent??0,seriesNum:e.content_play_progress?.series_num,authorName:n?.name||``,viewCount:r?.play_count??i?.browse_cnt??0,publishTime:a??0,type:o?.type}}const E=[`video`,`post`];function D({targetUserId:D,queryKeyPrefix:re,isMine:O=!1}){let k=x(`components.pages.profile.components.tabs`),A=ee()===`renderer`,j=re??[],[M,N]=S(`likeTab`,ne.withDefault(`video`)),P=g(()=>E.includes(M)?M:`video`,[M]),[F,I]=_(!1),[L,R]=_(()=>new Set),z=t(e=>e.userId),B=d(),V=[...j,`user-like-video`],H=[...j,`user-like-post`],U=u({key:V,initialPageParam:1,async queryFn(e){return p({targetUserId:D,page:e,contentType:m.video})},options:{staleTime:0,enabled:A},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),W=u({key:H,options:{staleTime:0,enabled:A},initialPageParam:1,async queryFn(e){return p({targetUserId:D,page:e,contentType:m.post})},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),G=P===`video`?U:W,K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(T))??[],q=W.data?.pages.flatMap(e=>(e.data?.list??[]).map(w))??[],J=P===`video`?K:q,Y=new Set(J.map(e=>e.id)),X=P===`video`,{mutateAsync:ie,isPending:Z}=l(async e=>await n({app_id:0,user_id:z,action:`cancel_like`,content_ids:e,content_type:X?1:2})),ae=()=>{I(!F),R(new Set)};h(()=>{R(new Set)},[P]),h(()=>{M!==P&&N(P)},[P,M,N]);let Q=e=>{R(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},oe=()=>{L.size===Y.size&&Y.size>0?R(new Set):R(new Set(Y))},se=async()=>{if(!(L.size===0||Z)){if(!z){b.error(k(`likeTab.pleaseLogin`));return}try{let e=Array.from(L),t=await ie(e);if(t.code===0){b.success(k(`likeTab.unlikedSuccess`));let t=new Set(e);B(X?V:H,e=>C(e,t,e=>e.id)),R(new Set),I(!1)}else b.error(t.message||k(`likeTab.unlikeFailed`))}catch(e){console.error(`取消点赞失败`,e),b.error(k(`likeTab.operationFailed`))}}},$=async()=>{A&&await G.fetchNextPage()};return y(r,{children:[y(r,{className:`flex justify-between items-center`,children:[v(a,{value:P,onValueChange:e=>{N(e)},children:y(o,{variant:`tag`,children:[v(s,{value:`video`,className:`text-sm`,children:k(`likeTab.video`)}),v(s,{value:`post`,className:`text-sm`,children:k(`likeTab.posts`)})]})}),O&&v(e,{variant:`ghost`,size:`sm`,className:`h-6.25 px-0 text-sm text-text3`,onClick:ae,children:k(F?`likeTab.cancel`:`likeTab.edit`)})]}),v(r,{className:`pt-2`,children:P===`video`?v(te,{list:K,loading:G.isFetching,hasMore:G.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,showVideoProgress:!1,onToggleSelection:Q}):v(f,{list:q,loading:G.isFetching,hasMore:G.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,onToggleSelection:Q})}),F&&y(r,{style:{bottom:`calc(56px + env(safe-area-inset-bottom, 0px))`},className:`flex fixed z-10 left-0 w-full items-center justify-between px-3 py-2 bg-bg1 `,children:[y(r,{className:`flex items-center gap-2`,children:[v(i,{checked:L.size===Y.size&&Y.size>0,onCheckedChange:oe}),v(c,{className:`text-sm text-text1`,children:k(`likeTab.selectAll`)})]}),v(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:L.size>0?`default`:`outline`,disabled:L.size===0||Z,onClick:se,children:k(Z?`likeTab.processing`:`likeTab.delete`)})]})]})}export{D as LikeTab};
@@ -0,0 +1,3 @@
1
+
2
+ import { LikeDetailItem, LikeTab, LikeTabProps } from "./client.mjs";
3
+ import { BuildLikeTabPrefetchParams, LikeTabServer, buildLikeTabPrefetch } from "./server.mjs";