@funhub/platform 0.1.35 → 0.1.37

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 (136) hide show
  1. package/dist/assets/images/frame.mjs +2 -0
  2. package/dist/biz.d.mts +13 -13
  3. package/dist/biz.mjs +1 -1
  4. package/dist/components/biz/basics/logo/variants/basic-logo/runtime/client.mjs +1 -1
  5. package/dist/components/biz/business/channel-list/client.mjs +1 -1
  6. package/dist/components/biz/business/detail/detail-operate.mjs +1 -1
  7. package/dist/components/biz/business/detail/materials/editor-preview.mjs +2 -0
  8. package/dist/components/biz/business/detail/materials/video-detail-actions/client.mjs +1 -1
  9. package/dist/components/biz/business/detail/materials/video-detail-info/client.d.mts +1 -1
  10. package/dist/components/biz/business/detail/materials/video-detail-info/client.mjs +1 -1
  11. package/dist/components/biz/business/detail/materials/video-detail-info/material.mjs +1 -1
  12. package/dist/components/biz/business/detail/materials/video-detail-info/schema.d.mts +2 -2
  13. package/dist/components/biz/business/detail/materials/video-detail-info/server.d.mts +1 -1
  14. package/dist/components/biz/business/detail/materials/video-detail-info-title/client.d.mts +1 -1
  15. package/dist/components/biz/business/detail/materials/video-detail-info-title/client.mjs +1 -1
  16. package/dist/components/biz/business/detail/materials/video-detail-info-title/material.mjs +1 -1
  17. package/dist/components/biz/business/detail/materials/video-detail-info-title/schema.d.mts +2 -2
  18. package/dist/components/biz/business/detail/materials/video-detail-info-title/server.d.mts +1 -1
  19. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.d.mts +1 -1
  20. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.mjs +1 -1
  21. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/material.mjs +1 -1
  22. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/schema.d.mts +2 -2
  23. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/server.d.mts +1 -1
  24. package/dist/components/biz/business/detail/materials/video-detail-player/client.mjs +1 -1
  25. package/dist/components/biz/business/detail/materials/video-detail-recommend/client.mjs +1 -1
  26. package/dist/components/biz/business/detail/materials/video-detail-recommend/material.mjs +1 -1
  27. package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.mjs +1 -1
  28. package/dist/components/biz/business/detail/video-hero.mjs +1 -1
  29. package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
  30. package/dist/components/biz/business/home-recommend/shared/home-recommend-preview.mjs +2 -0
  31. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.d.mts +4 -0
  32. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.mjs +1 -1
  33. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.d.mts +2 -0
  34. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.mjs +1 -1
  35. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/client.mjs +1 -1
  36. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/schema/component.mjs +1 -1
  37. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/server.mjs +1 -1
  38. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/defaults/default-props.d.mts +1 -3
  39. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/defaults/default-props.mjs +1 -1
  40. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.d.mts +4 -2
  41. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.mjs +1 -1
  42. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.d.mts +2 -1
  43. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.mjs +1 -1
  44. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.mjs +1 -1
  45. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/component.mjs +1 -1
  46. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/props.schema.mjs +1 -1
  47. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/server.mjs +1 -1
  48. package/dist/components/biz/business/index.d.mts +12 -12
  49. package/dist/components/biz/business/index.mjs +1 -1
  50. package/dist/components/biz/business/large-feature-grid/client.mjs +1 -1
  51. package/dist/components/biz/business/large-feature-grid/material.d.mts +4 -3
  52. package/dist/components/biz/business/large-feature-grid/material.mjs +1 -1
  53. package/dist/components/biz/business/large-feature-grid/schema.mjs +1 -1
  54. package/dist/components/biz/business/marquee/client.d.mts +7 -9
  55. package/dist/components/biz/business/marquee/client.mjs +1 -1
  56. package/dist/components/biz/business/marquee/index.d.mts +2 -2
  57. package/dist/components/biz/business/marquee/material.d.mts +15 -6
  58. package/dist/components/biz/business/marquee/schema.d.mts +23 -28
  59. package/dist/components/biz/business/marquee/schema.mjs +1 -1
  60. package/dist/components/biz/business/marquee/server.d.mts +1 -1
  61. package/dist/components/biz/business/nav-bar/variants/basic-nav-bar/runtime/client.mjs +1 -1
  62. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.mjs +1 -1
  63. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/server.mjs +1 -1
  64. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.mjs +1 -1
  65. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/server.mjs +1 -1
  66. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +1 -1
  67. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/server.mjs +1 -1
  68. package/dist/components/biz/business/search-history/client.d.mts +10 -12
  69. package/dist/components/biz/business/search-history/client.mjs +1 -1
  70. package/dist/components/biz/business/search-history/index.d.mts +2 -2
  71. package/dist/components/biz/business/search-history/material.d.mts +1 -1
  72. package/dist/components/biz/business/search-history/schema.d.mts +7 -15
  73. package/dist/components/biz/business/search-history/schema.mjs +1 -1
  74. package/dist/components/biz/business/search-history/server.d.mts +6 -2
  75. package/dist/components/biz/business/search-input/client.d.mts +11 -9
  76. package/dist/components/biz/business/search-input/client.mjs +1 -1
  77. package/dist/components/biz/business/search-input/index.d.mts +2 -2
  78. package/dist/components/biz/business/search-input/schema.d.mts +6 -10
  79. package/dist/components/biz/business/search-input/schema.mjs +1 -1
  80. package/dist/components/biz/business/search-input/server.d.mts +1 -1
  81. package/dist/components/biz/business/shortcut-grid/material.d.mts +1 -1
  82. package/dist/components/biz/business/shortcut-grid/schema.d.mts +1 -1
  83. package/dist/components/biz/business/shortcut-grid/schema.mjs +1 -1
  84. package/dist/components/biz/business/tab-bar/client.d.mts +6 -5
  85. package/dist/components/biz/business/tab-bar/client.mjs +1 -1
  86. package/dist/components/biz/business/tab-bar/index.d.mts +2 -2
  87. package/dist/components/biz/business/tab-bar/schema.d.mts +10 -18
  88. package/dist/components/biz/business/tab-bar/schema.mjs +1 -1
  89. package/dist/components/biz/business/tab-bar/server.d.mts +1 -1
  90. package/dist/components/biz/business/text-recommend/client.d.mts +10 -14
  91. package/dist/components/biz/business/text-recommend/client.mjs +1 -1
  92. package/dist/components/biz/business/text-recommend/index.d.mts +2 -2
  93. package/dist/components/biz/business/text-recommend/material.d.mts +4 -1
  94. package/dist/components/biz/business/text-recommend/schema.d.mts +9 -12
  95. package/dist/components/biz/business/text-recommend/schema.mjs +1 -1
  96. package/dist/components/biz/business/text-recommend/server.d.mts +1 -1
  97. package/dist/components/biz/business/text-recommend/server.mjs +1 -1
  98. package/dist/components/biz/business/video-horizontal-list/client.d.mts +5 -2
  99. package/dist/components/biz/business/video-horizontal-list/client.mjs +1 -1
  100. package/dist/components/biz/business/video-horizontal-list/index.d.mts +2 -2
  101. package/dist/components/biz/business/video-horizontal-list/material.d.mts +19 -8
  102. package/dist/components/biz/business/video-horizontal-list/schema.d.mts +20 -24
  103. package/dist/components/biz/business/video-horizontal-list/schema.mjs +1 -1
  104. package/dist/components/biz/business/video-horizontal-list/server.d.mts +1 -1
  105. package/dist/components/common/delete-confirm-dialog/delete-confirm-dialog.mjs +1 -1
  106. package/dist/components/common/list/collection-list/collection-list-item.d.mts +1 -0
  107. package/dist/components/common/list/collection-list/collection-list-item.mjs +1 -1
  108. package/dist/components/common/popup-video/index.mjs +1 -1
  109. package/dist/components/pages/feed-series/feed-series-client.mjs +1 -1
  110. package/dist/components/pages/home/client.mjs +1 -1
  111. package/dist/components/pages/post-detail/post-detail-client.mjs +1 -1
  112. package/dist/components/pages/publish/page-client.mjs +1 -1
  113. package/dist/components/pages/search/hot-recommend.mjs +1 -1
  114. package/dist/components/pages/search/page-client.mjs +1 -1
  115. package/dist/components/pages/search/search-result/search-all.mjs +1 -1
  116. package/dist/components/pages/user-follow/page.mjs +1 -1
  117. package/dist/components/pages/video-detail/page.mjs +1 -1
  118. package/dist/components/pages/video-detail/video-detail-client.mjs +1 -1
  119. package/dist/components/ui/button.d.mts +1 -1
  120. package/dist/components/ui/image.d.mts +4 -4
  121. package/dist/constants/event-key.mjs +1 -1
  122. package/dist/hooks/use-search-history.mjs +1 -1
  123. package/dist/i18n/locales/en.mjs +1 -1
  124. package/dist/i18n/locales/zh-CN.mjs +1 -1
  125. package/dist/utils/schema/index.d.mts +1 -1
  126. package/dist/utils/schema/inspector.d.mts +31 -1
  127. package/dist/utils/schema/material.d.mts +1 -1
  128. package/dist/utils/schema/schema.d.mts +31 -2
  129. package/dist/utils/schema/schema.mjs +1 -1
  130. package/dist/utils.d.mts +2 -2
  131. package/dist/utils.mjs +1 -1
  132. package/package.json +1 -1
  133. package/dist/components/biz/business/large-feature-grid/client.d.mts +0 -15
  134. package/dist/components/biz/business/large-feature-grid/default.mjs +0 -2
  135. package/dist/components/biz/business/large-feature-grid/server.d.mts +0 -13
  136. package/dist/components/biz/business/large-feature-grid/types.d.mts +0 -53
@@ -14,14 +14,23 @@ import * as zod_v4_core0 from "zod/v4/core";
14
14
  declare const marqueeMaterial: DefineMaterialOption<typeof MarqueeServer, typeof MarqueeClient, zod.ZodObject<{
15
15
  contents: zod.ZodArray<zod.ZodObject<{
16
16
  text: zod.ZodString & SchemaHasDefaultValue;
17
- enableClick: zod.ZodBoolean & SchemaHasDefaultValue;
18
- linkType: zod.ZodType<"content" | "content-list" | "url", unknown, zod_v4_core0.$ZodTypeInternals<"content" | "content-list" | "url", unknown>> & SchemaHasDefaultValue;
19
17
  link: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
20
18
  }, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
21
- showClose: zod.ZodBoolean & SchemaHasDefaultValue;
22
- displayStrategy: zod.ZodType<"once" | "daily", unknown, zod_v4_core0.$ZodTypeInternals<"once" | "daily", unknown>> & SchemaHasDefaultValue;
23
- startTime: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
24
- endTime: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
19
+ click: zod.ZodObject<{
20
+ readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
21
+ readonly redirectType: zod.ZodOptional<zod.ZodType<"content" | "link" | "content_list", unknown, zod_v4_core0.$ZodTypeInternals<"content" | "link" | "content_list", unknown>>> & SchemaHasDefaultValue;
22
+ readonly link: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
23
+ }, zod_v4_core0.$strip> & SchemaHasDefaultValue;
24
+ close: zod.ZodObject<{
25
+ readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
26
+ }, zod_v4_core0.$strip> & SchemaHasDefaultValue;
27
+ displayStrategy: zod.ZodObject<{
28
+ readonly rule: zod.ZodType<"once" | "daily", unknown, zod_v4_core0.$ZodTypeInternals<"once" | "daily", unknown>> & SchemaHasDefaultValue;
29
+ readonly period: zod.ZodOptional<zod.ZodObject<{
30
+ readonly start: zod.ZodString;
31
+ readonly end: zod.ZodString;
32
+ }, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
33
+ }, zod_v4_core0.$strip> & SchemaHasDefaultValue;
25
34
  }, zod_v4_core0.$strip>, "marquee">;
26
35
  //#endregion
27
36
  export { marqueeMaterial };
@@ -1,37 +1,32 @@
1
1
 
2
2
  import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
3
  import "../../../../utils.mjs";
4
- import z$1 from "zod";
4
+ import { z } from "zod";
5
5
 
6
6
  //#region components/biz/business/marquee/schema.d.ts
7
7
  /**
8
8
  * 跑马灯物料属性定义
9
9
  */
10
- declare const marqueeInspectorPropsSchema: z$1.ZodObject<{
11
- contents: z$1.ZodArray<z$1.ZodObject<{
12
- text: z$1.ZodString & SchemaHasDefaultValue;
13
- enableClick: z$1.ZodBoolean & SchemaHasDefaultValue;
14
- linkType: z$1.ZodType<"content" | "content-list" | "url", unknown, z$1.core.$ZodTypeInternals<"content" | "content-list" | "url", unknown>> & SchemaHasDefaultValue;
15
- link: z$1.ZodOptional<z$1.ZodString> & SchemaHasDefaultValue;
16
- }, z$1.core.$strip>> & SchemaHasDefaultValue;
17
- showClose: z$1.ZodBoolean & SchemaHasDefaultValue;
18
- displayStrategy: z$1.ZodType<"once" | "daily", unknown, z$1.core.$ZodTypeInternals<"once" | "daily", unknown>> & SchemaHasDefaultValue;
19
- startTime: z$1.ZodOptional<z$1.ZodString> & SchemaHasDefaultValue;
20
- endTime: z$1.ZodOptional<z$1.ZodString> & SchemaHasDefaultValue;
21
- }, z$1.core.$strip>;
22
- declare const marqueeInspectorDefaultProps: {
23
- contents: {
24
- text: string;
25
- enableClick: boolean;
26
- linkType: "content" | "content-list" | "url";
27
- link?: string | undefined;
28
- }[];
29
- showClose: boolean;
30
- displayStrategy: "once" | "daily";
31
- startTime: string;
32
- endTime: string;
33
- };
34
- type MarqueeInspectorProps = z$1.infer<typeof marqueeInspectorPropsSchema>;
35
- type MarqueeProps = MarqueeInspectorProps;
10
+ declare const marqueeInspectorPropsSchema: z.ZodObject<{
11
+ contents: z.ZodArray<z.ZodObject<{
12
+ text: z.ZodString & SchemaHasDefaultValue;
13
+ link: z.ZodOptional<z.ZodString> & SchemaHasDefaultValue;
14
+ }, z.core.$strip>> & SchemaHasDefaultValue;
15
+ click: z.ZodObject<{
16
+ readonly enabled: z.ZodBoolean & SchemaHasDefaultValue;
17
+ readonly redirectType: z.ZodOptional<z.ZodType<"content" | "link" | "content_list", unknown, z.core.$ZodTypeInternals<"content" | "link" | "content_list", unknown>>> & SchemaHasDefaultValue;
18
+ readonly link: z.ZodOptional<z.ZodString> & SchemaHasDefaultValue;
19
+ }, z.core.$strip> & SchemaHasDefaultValue;
20
+ close: z.ZodObject<{
21
+ readonly enabled: z.ZodBoolean & SchemaHasDefaultValue;
22
+ }, z.core.$strip> & SchemaHasDefaultValue;
23
+ displayStrategy: z.ZodObject<{
24
+ readonly rule: z.ZodType<"once" | "daily", unknown, z.core.$ZodTypeInternals<"once" | "daily", unknown>> & SchemaHasDefaultValue;
25
+ readonly period: z.ZodOptional<z.ZodObject<{
26
+ readonly start: z.ZodString;
27
+ readonly end: z.ZodString;
28
+ }, z.core.$strip>> & SchemaHasDefaultValue;
29
+ }, z.core.$strip> & SchemaHasDefaultValue;
30
+ }, z.core.$strip>;
36
31
  //#endregion
37
- export { MarqueeInspectorProps, MarqueeProps, marqueeInspectorDefaultProps, marqueeInspectorPropsSchema };
32
+ export { marqueeInspectorPropsSchema };
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineSelectEnumPropSchema as n,defineSwitchPropSchema as r,defineTextPropSchema as i,getSchemaDefaultProps as a}from"../../../../utils/schema/schema.mjs";const o=t({contents:e(t({text:i({label:`消息内容`,defaultValue:`请在这里输入跑马灯消息内容`}),enableClick:r({label:`支持点击`,defaultValue:!1}),linkType:n([`content-list`,`content`,`url`],{label:`跳转指向`,defaultValue:`url`}),link:i({label:`跳转链接`,defaultValue:``,required:!1})}),{label:`跑马灯内容`,defaultValue:[{text:`请在这里输入跑马灯消息内容`,enableClick:!1,linkType:`url`,link:``}]}),showClose:r({label:`支持关闭`,defaultValue:!0}),displayStrategy:n([`once`,`daily`],{label:`展示规则`,defaultValue:`once`,description:`「只展示1次」即当前消息只展示1次;「每天展示1次」即当前消息每天展示1次,0点刷新`}),startTime:i({label:`开始时间`,defaultValue:``,required:!1,description:`格式:YYYY-MM-DD HH:mm:ss`}),endTime:i({label:`结束时间`,defaultValue:``,required:!1,description:`格式:YYYY-MM-DD HH:mm:ss`})}),s=a(o);export{s as marqueeInspectorDefaultProps,o as marqueeInspectorPropsSchema};
2
+ import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineObjectPropSchema as n,defineSelectEnumPropSchema as r,defineSwitchPropSchema as i,defineTextPropSchema as a,defineTimeRangePropSchema as o}from"../../../../utils/schema/schema.mjs";import{z as s}from"zod";const c=t({contents:e(s.object({text:a({label:`文本内容`,defaultValue:``}),link:a({label:`跳转链接`,defaultValue:``,required:!1})}),{label:`消息内容`,defaultValue:[{text:`请输入跑马灯内容`}],description:`支持多条消息循环播放`}),click:n({enabled:i({label:`支持点击`,defaultValue:!0}),redirectType:r([`content_list`,`content`,`link`],{label:`跳转指向`,defaultValue:`link`,required:!1}),link:a({label:`跳转链接`,defaultValue:``,required:!1})},{label:`点击配置`,defaultValue:{enabled:!0,redirectType:`link`,link:``}}),close:n({enabled:i({label:`支持关闭`,defaultValue:!0})},{label:`关闭配置`,defaultValue:{enabled:!0}}),displayStrategy:n({rule:r([`once`,`daily`],{label:`展示规则`,defaultValue:`once`,description:`「只展示1次」即当前消息只展示1次;「每天展示1次」即当前消息每天展示1次,0点刷新`}),period:o({label:`展示周期`,defaultValue:{start:``,end:``},required:!1})},{label:`展示策略`,defaultValue:{rule:`once`,period:{start:``,end:``}}})});export{c as marqueeInspectorPropsSchema};
@@ -1,5 +1,5 @@
1
1
 
2
- import { MarqueeProps } from "./schema.mjs";
2
+ import { MarqueeProps } from "./client.mjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region components/biz/business/marquee/server.d.ts
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{mergeStyles as e}from"../../../../../utils/styles/helpers.mjs";import{pxToVw as t}from"../../../../../../../utils/helper.mjs";import{Box as n}from"../../../../../../ui/box.mjs";import r from"../../../../../../ui/link.mjs";import{useSticky as i}from"../../../../../../../hooks/use-sticky.mjs";import a,{loadHiddenChannelIdsFromStorage as o}from"./channel-filter-dialog.mjs";import{urlPrefix as s}from"../../../../../../../constants/url-prefix.mjs";import c from"../../../../../../../assets/icons/search.mjs";import{defaultProps as l}from"../defaults/default-props.mjs";import u from"../../../../../../../assets/icons/filter_dark.mjs";import{clsx as d}from"clsx";import{useEffect as f,useMemo as p,useState as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v={},y={list:[],currentChannelId:null,isFullfeed:!1};function b(e,t){return t===0?`/`:`${s.CHANNEL}/${encodeURIComponent(e.cn_name)}`}function x({props:s=v,styles:x,events:S,data:C=y}){let{searchUrl:w,searchIconSize:T,filterIconSize:E,channelItemHeight:D,channelItemFontSize:O,channelItemActiveFontSize:k,channelItemGap:A}={...l,...s},[j,M]=m(!1),{isSticky:N,ref:P}=i(),[F,I]=m(C.list),L=p(()=>C.currentChannelId??null,[C.currentChannelId]);f(()=>{let e=o();I(C.list.filter(t=>!e.includes(t.id)))},[C.list]);let R=e=>{I(e)},z=(e,t)=>{S?.onChannelChange?.(e,t)},B=()=>{M(!0),S?.onFilterClick?.()},V=()=>{S?.onSearchClick?.()},H=x?e(x,{}):void 0,U=N?E+T+24:E+16;return _(h,{children:[N&&g(n,{className:`w-full`,style:{height:t(44)}}),g(n,{as:`nav`,ref:P,className:d(`w-full transition-all duration-200`,!C.isFullfeed&&N&&`fixed top-0 left-0 right-0 z-50`,C.isFullfeed&&`fixed top-[54px] left-0 z-10 w-full`,!C.isFullfeed&&`bg-bg1`),style:H,children:_(n,{className:`relative flex items-center h-[44px]`,children:[g(n,{className:`flex-1 overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:hidden`,style:{scrollbarWidth:`none`,msOverflowStyle:`none`,WebkitOverflowScrolling:`touch`},children:g(n,{className:`flex items-center h-full`,style:{paddingLeft:t(16),paddingRight:t(U+16),gap:t(A)},children:F.map((e,n)=>{let i=L===e.id||L===null&&n===0;return g(r,{href:b(e,n),className:d(`whitespace-nowrap cursor-pointer transition-all duration-200`,`flex items-center justify-center`),style:{height:t(D),fontSize:t(i?k:O),fontWeight:i?`bold`:`normal`,color:i?`var(--color-theme5)`:`var(--color-text2)`},onClick:()=>z(e,n),children:e.cn_name},e.id||`channel-${n}`)})})}),_(n,{className:`flex items-center gap-[12px] px-[8px]`,children:[g(n,{className:`flex items-center justify-center cursor-pointer`,style:{width:t(E+8),height:t(E+8)},onClick:B,children:g(u,{width:t(E),height:t(E),style:{color:`var(--color-text1)`}})}),N&&g(r,{href:w,onClick:V,children:g(n,{className:`flex items-center justify-center cursor-pointer`,style:{width:t(T+8),height:t(T+8)},children:g(c,{width:t(T),height:t(T),style:{color:`var(--color-text1)`}})})})]})]})}),g(a,{open:j,onOpenChange:M,channels:C.list,currentChannelId:L,onChannelClick:z,onChannelsChange:R})]})}export{x as default};
2
+ "use client";import{mergeStyles as e}from"../../../../../utils/styles/helpers.mjs";import{pxToVw as t}from"../../../../../../../utils/helper.mjs";import{Box as n}from"../../../../../../ui/box.mjs";import r from"../../../../../../ui/link.mjs";import{urlPrefix as i}from"../../../../../../../constants/url-prefix.mjs";import{useSticky as a}from"../../../../../../../hooks/use-sticky.mjs";import o,{loadHiddenChannelIdsFromStorage as s}from"./channel-filter-dialog.mjs";import c from"../../../../../../../assets/icons/search.mjs";import{defaultProps as l}from"../defaults/default-props.mjs";import u from"../../../../../../../assets/icons/filter_dark.mjs";import{clsx as d}from"clsx";import{useEffect as f,useMemo as p,useState as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v={},y={list:[],currentChannelId:null,isFullfeed:!1};function b(e,t){return t===0?`/`:`${i.CHANNEL}/${encodeURIComponent(e.cn_name)}`}function x({props:i=v,styles:x,events:S,data:C=y}){let{searchUrl:w,searchIconSize:T,filterIconSize:E,channelItemHeight:D,channelItemFontSize:O,channelItemActiveFontSize:k,channelItemGap:A}={...l,...i},[j,M]=m(!1),{isSticky:N,ref:P}=a(),[F,I]=m(C.list),L=p(()=>C.currentChannelId??null,[C.currentChannelId]);f(()=>{let e=s();I(C.list.filter(t=>!e.includes(t.id)))},[C.list]);let R=e=>{I(e)},z=(e,t)=>{S?.onChannelChange?.(e,t)},B=()=>{M(!0),S?.onFilterClick?.()},V=()=>{S?.onSearchClick?.()},H=x?e(x,{}):void 0,U=N?E+T+24:E+16;return _(h,{children:[N&&g(n,{className:`w-full`,style:{height:t(44)}}),g(n,{as:`nav`,ref:P,className:d(`w-full transition-all duration-200`,!C.isFullfeed&&N&&`fixed top-0 left-0 right-0 z-50`,C.isFullfeed&&`fixed top-[54px] left-0 z-10 w-full`,!C.isFullfeed&&`bg-bg1`),style:H,children:_(n,{className:`relative flex items-center h-[44px]`,children:[g(n,{className:`flex-1 overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:hidden`,style:{scrollbarWidth:`none`,msOverflowStyle:`none`,WebkitOverflowScrolling:`touch`},children:g(n,{className:`flex items-center h-full`,style:{paddingLeft:t(16),paddingRight:t(U+16),gap:t(A)},children:F.map((e,n)=>{let i=L===e.id||L===null&&n===0;return g(r,{href:b(e,n),className:d(`whitespace-nowrap cursor-pointer transition-all duration-200`,`flex items-center justify-center`),style:{height:t(D),fontSize:t(i?k:O),fontWeight:i?`bold`:`normal`,color:i?`var(--color-theme5)`:`var(--color-text2)`},onClick:()=>z(e,n),children:e.cn_name},e.id||`channel-${n}`)})})}),_(n,{className:`flex items-center gap-[12px] px-[8px]`,children:[g(n,{className:`flex items-center justify-center cursor-pointer`,style:{width:t(E+8),height:t(E+8)},onClick:B,children:g(u,{width:t(E),height:t(E),style:{color:`var(--color-text1)`}})}),N&&g(r,{href:w,onClick:V,children:g(n,{className:`flex items-center justify-center cursor-pointer`,style:{width:t(T+8),height:t(T+8)},children:g(c,{width:t(T),height:t(T),style:{color:`var(--color-text1)`}})})})]})]})}),g(o,{open:j,onOpenChange:M,channels:C.list,currentChannelId:L,onChannelClick:z,onChannelsChange:R})]})}export{x as default};
@@ -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??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};
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};
@@ -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}){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};
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};
@@ -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 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};
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};
@@ -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,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}){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};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionUnifiedBatchLikeDislike as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Tabs as a,TabsList as o,TabsTrigger as s}from"../../../../../../ui/tabs.mjs";import{Text as c}from"../../../../../../ui/text.mjs";import{useMutation as l,usePaginated as u,useUpdateRequest as d}from"../../../../../../../hooks/query/use-query.mjs";import{useAppContext as ee}from"../../../../../../../hooks/use-app-context/index.mjs";import{PostList as f}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as te}from"../../../../../../common/list/video-list/video-list.mjs";import{getLikeData as p,likeContentType as m}from"../../utils.mjs";import{useEffect as h,useMemo as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{toast as b}from"sonner";import{useTranslations as x}from"next-intl";import{parseAsString as ne,useQueryState as S}from"nuqs";function C(e,t,n){if(!e)return e;let r=0,i=e.pages.map(e=>({page:e,filteredList:(e.data?.list??[]).filter(e=>{let i=n(e)??``,a=t.has(i);return a&&(r+=1),!a})}));return{...e,pages:i.map(({page:e,filteredList:t})=>{if(!e.data)return e;let n=typeof e.data.total==`number`?Math.max(0,e.data.total-r):e.data.total;return{...e,data:{...e.data,list:t,total:n}}})}}function w(e){let{detail:t}=e,{info:n,publish_time:r}=t;return{id:e.id,title:n?.name||n?.text||n?.content||``,coverImage:n?.cover_image_thumbnail||n?.cover_image||n?.cover_horizontal_image_thumbnail||``,publishTime:r??0}}function T(e){let{detail:t}=e,{user_info:n,info:r,statics_cnt:i,publish_time:a,parent_content_info:o}=t;return{id:e.id,is_more_link:r?.is_more_link||!1,title:r?.name||r?.text||r?.content||``,coverImage:r?.cover_image_thumbnail||r?.cover_image||r?.cover_horizontal_image_thumbnail||``,duration:Number(r?.video_duration??0),progress:e.content_play_progress?.percent??0,seriesNum:e.content_play_progress?.series_num,authorName:n?.name||``,viewCount:r?.play_count??i?.browse_cnt??0,publishTime:a??0,type:o?.type}}const E=[`video`,`post`];function D({targetUserId:D,queryKeyPrefix:re,isMine:O=!1}){let k=x(`components.pages.profile.components.tabs`),A=ee()===`renderer`,j=re??[],[M,N]=S(`likeTab`,ne.withDefault(`video`)),P=g(()=>E.includes(M)?M:`video`,[M]),[F,I]=_(!1),[L,R]=_(()=>new Set),z=t(e=>e.userId),B=d(),V=[...j,`user-like-video`],H=[...j,`user-like-post`],U=u({key:V,initialPageParam:1,async queryFn(e){return p({targetUserId:D,page:e,contentType:m.video})},options:{staleTime:0,enabled:A},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),W=u({key:H,options:{staleTime:0,enabled:A},initialPageParam:1,async queryFn(e){return p({targetUserId:D,page:e,contentType:m.post})},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),G=P===`video`?U:W,K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(T))??[],q=W.data?.pages.flatMap(e=>(e.data?.list??[]).map(w))??[],J=P===`video`?K:q,Y=new Set(J.map(e=>e.id)),X=P===`video`,{mutateAsync:ie,isPending:Z}=l(async e=>await n({app_id:0,user_id:z,action:`cancel_like`,content_ids:e,content_type:X?1:2})),ae=()=>{I(!F),R(new Set)};h(()=>{R(new Set)},[P]),h(()=>{M!==P&&N(P)},[P,M,N]);let Q=e=>{R(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},oe=()=>{L.size===Y.size&&Y.size>0?R(new Set):R(new Set(Y))},se=async()=>{if(!(L.size===0||Z)){if(!z){b.error(k(`likeTab.pleaseLogin`));return}try{let e=Array.from(L),t=await ie(e);if(t.code===0){b.success(k(`likeTab.unlikedSuccess`));let t=new Set(e);B(X?V:H,e=>C(e,t,e=>e.id)),R(new Set),I(!1)}else b.error(t.message||k(`likeTab.unlikeFailed`))}catch(e){console.error(`取消点赞失败`,e),b.error(k(`likeTab.operationFailed`))}}},$=async()=>{A&&await G.fetchNextPage()};return y(r,{children:[y(r,{className:`flex justify-between items-center`,children:[v(a,{value:P,onValueChange:e=>{N(e)},children:y(o,{variant:`tag`,children:[v(s,{value:`video`,className:`text-sm`,children:k(`likeTab.video`)}),v(s,{value:`post`,className:`text-sm`,children:k(`likeTab.posts`)})]})}),O&&v(e,{variant:`ghost`,size:`sm`,className:`h-6.25 px-0 text-sm text-text3`,onClick:ae,children:k(F?`likeTab.cancel`:`likeTab.edit`)})]}),v(r,{className:`pt-2`,children:P===`video`?v(te,{list:K,loading:G.isFetching,hasMore:G.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,showVideoProgress:!1,onToggleSelection:Q}):v(f,{list:q,loading:G.isFetching,hasMore:G.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,onToggleSelection:Q})}),F&&y(r,{style:{bottom:`calc(56px + env(safe-area-inset-bottom, 0px))`},className:`flex fixed z-10 left-0 w-full items-center justify-between px-3 py-2 bg-bg1 `,children:[y(r,{className:`flex items-center gap-2`,children:[v(i,{checked:L.size===Y.size&&Y.size>0,onCheckedChange:oe}),v(c,{className:`text-sm text-text1`,children:k(`likeTab.selectAll`)})]}),v(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:L.size>0?`default`:`outline`,disabled:L.size===0||Z,onClick:se,children:k(Z?`likeTab.processing`:`likeTab.delete`)})]})]})}export{D as LikeTab};
2
+ "use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionUnifiedBatchLikeDislike as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{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};
@@ -1,2 +1,2 @@
1
1
 
2
- import{HydrationBoundary as e}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{getLikeData as t,likeContentType as n}from"../../utils.mjs";import{LikeTab as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";function a({queryKeyPrefix:e,targetUserId:r,resolvedLikeTab:i}){if(!r)return[];let a=i===`post`;return[{type:`infinite`,queryKey:a?[...e,`user-like-post`]:[...e,`user-like-video`],async queryFn(e){return t({targetUserId:r,page:e,contentType:a?n.post:n.video})},initialPageParam:1,getNextPageParam(){}}]}function o({prefetch:t,resolvedLikeTab:n=`video`,...o}){return i(e,{prefetch:t??a({queryKeyPrefix:o.queryKeyPrefix??[],targetUserId:o.targetUserId,resolvedLikeTab:n}),children:i(r,{...o})})}export{o as LikeTabServer,a as buildLikeTabPrefetch};
2
+ import{HydrationBoundary as e}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{getLikeData as t,likeContentType as n}from"../../utils.mjs";import{LikeTab as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";function a({queryKeyPrefix:e,targetUserId:r,resolvedLikeTab:i}){return r?[{type:`infinite`,queryKey:i===`post`?[...e,`user-like-post`]:[...e,`user-like-video`],async queryFn(e){return t({targetUserId:r,page:e,contentType:n.video})},initialPageParam:1,getNextPageParam(){}}]:[]}function o({prefetch:t,resolvedLikeTab:n=`video`,...o}){return i(e,{prefetch:t??a({queryKeyPrefix:o.queryKeyPrefix??[],targetUserId:o.targetUserId,resolvedLikeTab:n}),children:i(r,{...o})})}export{o as LikeTabServer,a as buildLikeTabPrefetch};
@@ -1,22 +1,20 @@
1
1
 
2
- import { SearchHistoryProps } from "./schema.mjs";
2
+ import { InferSchemaProps } from "../../../../utils/schema/schema.mjs";
3
+ import "../../../../utils/schema/index.mjs";
4
+ import { searchHistoryInspectorPropsSchema } from "./schema.mjs";
3
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
6
 
5
7
  //#region components/biz/business/search-history/client.d.ts
6
- interface SearchHistoryClientProps extends SearchHistoryProps {
8
+ type SearchHistoryProps = InferSchemaProps<typeof searchHistoryInspectorPropsSchema>;
9
+ interface ClientProps extends SearchHistoryProps {
7
10
  clearText?: string;
8
11
  confirmDescription?: string;
12
+ storageKey?: string;
13
+ onHistoryClick?: (keyword: string) => void;
9
14
  }
10
15
  /**
11
- * 搜索历史物料组件 - 客户端交互部分
16
+ * 搜索历史物料组件 (search-history) - 客户端交互部分
12
17
  */
13
- declare function SearchHistoryClient({
14
- rows,
15
- title,
16
- clearText,
17
- confirmDescription,
18
- storageKey,
19
- onHistoryClick
20
- }: SearchHistoryClientProps): react_jsx_runtime0.JSX.Element | null;
18
+ declare function SearchHistoryClient(props: ClientProps): react_jsx_runtime0.JSX.Element | null;
21
19
  //#endregion
22
- export { SearchHistoryClient };
20
+ export { SearchHistoryClient, SearchHistoryProps };
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{updateUrlParams as e}from"../../../../utils/common.mjs";import{useUserStore as t}from"../../../../store/modules/user-store.mjs";import{useSearchHistory as n}from"../../../../hooks/use-search-history.mjs";import{DeleteConfirmDialog as r}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{useState as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{useRouter as s}from"next/navigation";function c({rows:c,title:l,clearText:u=`清理`,confirmDescription:d=`确认删除全部搜索历史吗?`,storageKey:f,onHistoryClick:p}){let{userInfo:m}=t(),h=f||m?.user_id||`guest`,g=s(),[_,v]=i(!1),{history:y,clearHistory:b}=n({storageKey:h});return y.length===0?null:o(`div`,{className:`w-full bg-transparent pt-[12px] px-[12px] relative z-0`,children:[o(`div`,{className:`w-full flex items-center justify-between mb-[12px]`,children:[a(`span`,{className:`text-[16px] font-bold text-text1`,children:l}),o(`div`,{onClick:()=>v(!0),className:`cursor-pointer flex items-center gap-[4px]`,children:[a(`span`,{className:`text-text2 text-[14px] font-normal leading-[22px] text-right`,style:{fontFamily:`"Source Code Pro"`},children:u}),a(`svg`,{className:`w-[12px] h-[12px] text-text3`,viewBox:`0 0 12 12`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:a(`path`,{d:`M4.8295 0C4.71306 0 4.60139 0.0511359 4.51905 0.142158C4.43671 0.233181 4.39046 0.356633 4.39046 0.485358V2.5889H0.439046C0.322604 2.5889 0.210931 2.64004 0.128594 2.73106C0.0462565 2.82208 0 2.94553 0 3.07426V5.66316C0 5.79189 0.0462565 5.91534 0.128594 6.00636C0.210931 6.09738 0.322604 6.14852 0.439046 6.14852H0.878092V11.5146C0.878092 11.6434 0.924348 11.7668 1.00669 11.8578C1.08902 11.9489 1.2007 12 1.31714 12H10.6829C10.7993 12 10.911 11.9489 10.9933 11.8578C11.0757 11.7668 11.1219 11.6434 11.1219 11.5146V6.14852H11.561C11.6774 6.14852 11.7891 6.09738 11.8714 6.00636C11.9537 5.91534 12 5.79189 12 5.66316V3.07426C12 2.94553 11.9537 2.82208 11.8714 2.73106C11.7891 2.64004 11.6774 2.5889 11.561 2.5889H7.60954V0.485358C7.60954 0.356633 7.56328 0.233181 7.48095 0.142158C7.39861 0.0511359 7.28694 0 7.1705 0H4.8295ZM10.2438 11.0293H8.78092V9.54603C8.78092 9.4173 8.73466 9.29385 8.65232 9.20283C8.56999 9.1118 8.45831 9.06067 8.34187 9.06067C8.22543 9.06067 8.11376 9.1118 8.03142 9.20283C7.94908 9.29385 7.90282 9.4173 7.90282 9.54603V11.0293H6.43905V9.54117C6.43905 9.41245 6.39279 9.289 6.31045 9.19797C6.22812 9.10695 6.11644 9.05582 6 9.05582C5.88356 9.05582 5.77188 9.10695 5.68955 9.19797C5.60721 9.289 5.56095 9.41245 5.56095 9.54117V11.0303H4.09718V9.547C4.09718 9.41827 4.05092 9.29482 3.96858 9.2038C3.88624 9.11278 3.77457 9.06164 3.65813 9.06164C3.54169 9.06164 3.43001 9.11278 3.34768 9.2038C3.26534 9.29482 3.21908 9.41827 3.21908 9.547V11.0303H1.75618V6.17667H10.2438V11.0303V11.0293ZM5.26855 3.07426V0.970717H6.73145V3.07426C6.73145 3.20298 6.77771 3.32644 6.86004 3.41746C6.94238 3.50848 7.05405 3.55962 7.1705 3.55962H11.1219V5.1778H0.878092V3.55962H4.8295C4.94595 3.55962 5.05762 3.50848 5.13996 3.41746C5.22229 3.32644 5.26855 3.20298 5.26855 3.07426Z`,fill:`currentColor`})})]})]}),a(`div`,{className:`w-full overflow-hidden ${c===`1`?`h-[30px]`:c===`2`?`h-[72px]`:`h-[114px]`}`,children:a(`ul`,{className:`list-none m-0 p-0 w-full flex flex-wrap gap-[12px]`,children:y.map((t,n)=>a(`li`,{className:`h-[30px] px-[12px] bg-bg2 rounded-[4px] flex items-center justify-center cursor-pointer`,onClick:()=>{p?p(t):(e({q:t}),g.push(`${window.location.pathname}?q=${encodeURIComponent(t)}`))},children:a(`div`,{className:`text-text1 text-[14px] max-w-[124px] truncate`,children:t.length>8?`${t.slice(0,8)}...`:t})},`${t}-${n}`))})}),a(r,{open:_,onOpenChange:v,onConfirm:()=>{b(),v(!1)},title:``,description:d})]})}export{c as SearchHistoryClient};
2
+ "use client";import{Button as e}from"../../../ui/button.mjs";import t from"../../../../utils/event-bus.mjs";import{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import{useAppContext as i}from"../../../../hooks/use-app-context/index.mjs";import{eventKey as a}from"../../../../constants/event-key.mjs";import{DeleteConfirmDialog as o}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{useCallback as s,useEffect as c,useMemo as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{usePathname as p,useRouter as m,useSearchParams as h}from"next/navigation";const g=[`示例历史1`,`示例历史2`,`示例历史3`];function _(_){let{title:v,rows:y=1,clearText:b=`清理`,confirmDescription:x=`确认删除全部搜索历史吗?`,storageKey:S=`guest`,onHistoryClick:C}=_,w=i(),[T,E]=u([]),[D,O]=u(!1),k=m(),A=p(),j=h(),M=`search_history_${S}`,N=s(()=>{let e=localStorage.getItem(M);if(e)try{E(JSON.parse(e))}catch(e){console.error(`Failed to parse search history`,e)}else E([])},[M]);c(()=>{N()},[N]),c(()=>(t.on(a.SEARCH_HISTORY_UPDATE,N),()=>{t.off(a.SEARCH_HISTORY_UPDATE,N)}),[N]);let P=()=>{E([]),localStorage.removeItem(M),O(!1),t.emit(a.SEARCH_HISTORY_UPDATE)},F=l(()=>{let e=T.length>0?T:w===`editor`?g:[],t=y*10;return e.slice(0,t)},[T,y,w]);if(F.length===0)return null;let I=e=>{if(C)C(e);else{let t=new URLSearchParams(j.toString());t.set(`q`,e);let n=A.includes(`/search`)?A:`/search`;k.push(`${n}?${t.toString()}`)}};return f(n,{className:`px-4 py-2`,children:[f(n,{className:`flex justify-between items-center mb-2`,children:[d(r,{className:`text-[16px] font-bold text-text1`,children:v}),d(e,{variant:`ghost`,size:`sm`,className:`text-text3 text-[12px] p-0 h-auto`,onClick:()=>O(!0),children:b})]}),d(n,{className:`flex flex-wrap gap-2 overflow-hidden`,style:{maxHeight:`${y*40}px`},children:F.map((e,t)=>d(n,{className:`px-3 py-1 bg-bg2 rounded-full cursor-pointer`,onClick:()=>I(e),children:d(r,{className:`text-[14px] text-text2 truncate max-w-[150px]`,children:e})},t))}),d(o,{open:D,onOpenChange:O,onConfirm:()=>{P()},title:``,description:x})]})}export{_ as SearchHistoryClient};
@@ -1,5 +1,5 @@
1
1
 
2
- import { SearchHistoryInspectorProps, SearchHistoryProps, searchHistoryInspectorDefaultProps, searchHistoryInspectorPropsSchema } from "./schema.mjs";
3
- import { SearchHistoryClient } from "./client.mjs";
2
+ import { searchHistoryInspectorPropsSchema } from "./schema.mjs";
3
+ import { SearchHistoryClient, SearchHistoryProps } from "./client.mjs";
4
4
  import { SearchHistoryServer } from "./server.mjs";
5
5
  import { searchHistoryMaterial } from "./material.mjs";
@@ -10,7 +10,7 @@ import * as zod_v4_core0 from "zod/v4/core";
10
10
  //#region components/biz/business/search-history/material.d.ts
11
11
  declare const searchHistoryMaterial: DefineMaterialOption<typeof SearchHistoryServer, typeof SearchHistoryClient, zod.ZodObject<{
12
12
  title: zod.ZodString & SchemaHasDefaultValue;
13
- rows: zod.ZodType<"2" | "1" | "3", unknown, zod_v4_core0.$ZodTypeInternals<"2" | "1" | "3", unknown>> & SchemaHasDefaultValue;
13
+ rows: zod.ZodNumber & SchemaHasDefaultValue;
14
14
  }, zod_v4_core0.$strip>, "search-history">;
15
15
  //#endregion
16
16
  export { searchHistoryMaterial };
@@ -1,24 +1,16 @@
1
1
 
2
2
  import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
3
  import "../../../../utils.mjs";
4
- import z$1 from "zod";
4
+ import * as zod from "zod";
5
+ import * as zod_v4_core0 from "zod/v4/core";
5
6
 
6
7
  //#region components/biz/business/search-history/schema.d.ts
7
8
  /**
8
9
  * 搜索历史物料属性定义
9
10
  */
10
- declare const searchHistoryInspectorPropsSchema: z$1.ZodObject<{
11
- title: z$1.ZodString & SchemaHasDefaultValue;
12
- rows: z$1.ZodType<"2" | "1" | "3", unknown, z$1.core.$ZodTypeInternals<"2" | "1" | "3", unknown>> & SchemaHasDefaultValue;
13
- }, z$1.core.$strip>;
14
- declare const searchHistoryInspectorDefaultProps: {
15
- title: string;
16
- rows: "2" | "1" | "3";
17
- };
18
- type SearchHistoryInspectorProps = z$1.infer<typeof searchHistoryInspectorPropsSchema>;
19
- type SearchHistoryProps = SearchHistoryInspectorProps & {
20
- storageKey?: string;
21
- onHistoryClick?: (keyword: string) => void;
22
- };
11
+ declare const searchHistoryInspectorPropsSchema: zod.ZodObject<{
12
+ title: zod.ZodString & SchemaHasDefaultValue;
13
+ rows: zod.ZodNumber & SchemaHasDefaultValue;
14
+ }, zod_v4_core0.$strip>;
23
15
  //#endregion
24
- export { SearchHistoryInspectorProps, SearchHistoryProps, searchHistoryInspectorDefaultProps, searchHistoryInspectorPropsSchema };
16
+ export { searchHistoryInspectorPropsSchema };
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineComponentPropsSchema as e,defineSelectEnumPropSchema as t,defineTextPropSchema as n,getSchemaDefaultProps as r}from"../../../../utils/schema/schema.mjs";const i=e({title:n({label:`标题名称`,defaultValue:`搜索历史`}),rows:t([`1`,`2`,`3`],{label:`展示行数`,defaultValue:`1`})}),a=r(i);export{a as searchHistoryInspectorDefaultProps,i as searchHistoryInspectorPropsSchema};
2
+ import{defineComponentPropsSchema as e,defineNumberPropSchema as t,defineTextPropSchema as n}from"../../../../utils/schema/schema.mjs";const r=e({title:n({label:`标题名称`,defaultValue:`搜索历史`,description:`支持输入,中/英/数/符,6个字符`}),rows:t({label:`展示行数`,defaultValue:1})});export{r as searchHistoryInspectorPropsSchema};
@@ -1,11 +1,15 @@
1
1
 
2
- import { SearchHistoryProps } from "./schema.mjs";
2
+ import { SearchHistoryProps } from "./client.mjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region components/biz/business/search-history/server.d.ts
6
+ interface ServerProps extends SearchHistoryProps {
7
+ storageKey?: string;
8
+ onHistoryClick?: (keyword: string) => void;
9
+ }
6
10
  /**
7
11
  * 搜索历史物料组件 (search-history) - 服务端部分
8
12
  */
9
- declare function SearchHistoryServer(props: SearchHistoryProps): Promise<react_jsx_runtime0.JSX.Element>;
13
+ declare function SearchHistoryServer(props: ServerProps): Promise<react_jsx_runtime0.JSX.Element>;
10
14
  //#endregion
11
15
  export { SearchHistoryServer };
@@ -1,19 +1,21 @@
1
1
 
2
+ import { InferSchemaProps } from "../../../../utils/schema/schema.mjs";
3
+ import "../../../../utils/schema/index.mjs";
4
+ import { searchInputInspectorPropsSchema } from "./schema.mjs";
2
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
6
 
4
7
  //#region components/biz/business/search-input/client.d.ts
5
- interface SearchInputClientProps {
6
- placeholder?: string;
8
+ type SearchInputProps = InferSchemaProps<typeof searchInputInspectorPropsSchema>;
9
+ interface ClientProps extends SearchInputProps {
7
10
  defaultPlaceholder?: string;
8
11
  searchLabel?: string;
12
+ storageKey?: string;
13
+ onSearch?: (keyword: string) => void;
9
14
  }
10
15
  /**
11
- * 搜索输入框物料组件 - 客户端交互部分
16
+ * 搜索输入框物料组件 (SearchInput) - 客户端交互部分
17
+ * 适配 Figma 设计稿布局:包含返回按钮、带边框的输入框、外部搜索按钮
12
18
  */
13
- declare function SearchInputClient({
14
- placeholder,
15
- defaultPlaceholder,
16
- searchLabel
17
- }: SearchInputClientProps): react_jsx_runtime0.JSX.Element;
19
+ declare function SearchInputClient(props: ClientProps): react_jsx_runtime0.JSX.Element;
18
20
  //#endregion
19
- export { SearchInputClient };
21
+ export { SearchInputClient, SearchInputProps };
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{updateUrlParams as e}from"../../../../utils/common.mjs";import{useUserStore as t}from"../../../../store/modules/user-store.mjs";import{Input as n}from"../../../ui/input.mjs";import{useSearchHistory as r}from"../../../../hooks/use-search-history.mjs";import{isPCEnv as i}from"../../../../utils/tools.mjs";import{HeaderNav as a}from"../../../common/header-nav/client.mjs";import o from"../../../../assets/icons/search.mjs";import s from"../../../../assets/icons/clear.mjs";import c from"../../../pages/search/style.module.mjs";import{useCallback as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{useRouter as p}from"next/navigation";function m({placeholder:m,defaultPlaceholder:h=`搜索视频`,searchLabel:g=`搜索`}){let[_,v]=u(``),y=p(),{userInfo:b}=t(),{addHistory:x}=r({storageKey:b?.user_id||`guest`}),S=l(t=>{let n=t||_||h;n.trim()&&(x(n),e({q:n}),y.push(`${window.location.pathname}?q=${encodeURIComponent(n)}`))},[_,h,y,x]);return d(a,{className:`h-[55px]`,rightChild:d(`div`,{className:`cursor-pointer w-[52px] flex items-center justify-center`,onClick:()=>S(_),children:d(`span`,{className:`text-[16px] text-text1`,children:g})}),centerChild:f(`header`,{className:`w-[calc(100%-52px-48px)] ml-[-15px] h-[35px] rounded-[20px] flex items-center justify-center relative overflow-hidden border-line1 border-[1px]`,children:[d(`div`,{className:`absolute left-0 top-0 w-full h-full bg-bg2 opacity-50`}),d(o,{className:`w-[16px] h-[16px] text-text3 absolute left-[12px] top-[9px] z-[1]`}),d(n,{id:`search-input-field`,placeholder:m||h,maxLength:20,value:_,className:c.searchInput,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S(_))}}),_&&d(s,{className:`w-[15px] h-[15px] text-text3 z-10 absolute right-[12px] cursor-pointer`,onClick:()=>{i()||(v(``),e({q:``}),y.push(window.location.pathname))}})]})})}export{m 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}=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};
@@ -1,5 +1,5 @@
1
1
 
2
- import { SearchInputClient } from "./client.mjs";
3
- import { SearchInputInspectorProps, SearchInputProps, searchInputInspectorDefaultProps, searchInputInspectorPropsSchema } from "./schema.mjs";
2
+ import { searchInputInspectorPropsSchema } from "./schema.mjs";
3
+ import { SearchInputClient, SearchInputProps } from "./client.mjs";
4
4
  import { SearchInputServer } from "./server.mjs";
5
5
  import { searchInputMaterial } from "./material.mjs";
@@ -1,19 +1,15 @@
1
1
 
2
2
  import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
3
  import "../../../../utils.mjs";
4
- import z$1 from "zod";
4
+ import * as zod from "zod";
5
+ import * as zod_v4_core0 from "zod/v4/core";
5
6
 
6
7
  //#region components/biz/business/search-input/schema.d.ts
7
8
  /**
8
9
  * 搜索输入框物料属性定义
9
10
  */
10
- declare const searchInputInspectorPropsSchema: z$1.ZodObject<{
11
- placeholder: z$1.ZodString & SchemaHasDefaultValue;
12
- }, z$1.core.$strip>;
13
- declare const searchInputInspectorDefaultProps: {
14
- placeholder: string;
15
- };
16
- type SearchInputInspectorProps = z$1.infer<typeof searchInputInspectorPropsSchema>;
17
- type SearchInputProps = SearchInputInspectorProps;
11
+ declare const searchInputInspectorPropsSchema: zod.ZodObject<{
12
+ placeholder: zod.ZodString & SchemaHasDefaultValue;
13
+ }, zod_v4_core0.$strip>;
18
14
  //#endregion
19
- export { SearchInputInspectorProps, SearchInputProps, searchInputInspectorDefaultProps, searchInputInspectorPropsSchema };
15
+ export { searchInputInspectorPropsSchema };
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineComponentPropsSchema as e,defineTextPropSchema as t,getSchemaDefaultProps as n}from"../../../../utils/schema/schema.mjs";const r=e({placeholder:t({label:`占位文本`,defaultValue:`搜索关键词`})}),i=n(r);export{i as searchInputInspectorDefaultProps,r as searchInputInspectorPropsSchema};
2
+ import{defineComponentPropsSchema as e,defineTextPropSchema as t}from"../../../../utils/schema/schema.mjs";const n=e({placeholder:t({label:`占位文本`,defaultValue:`搜索关键词`})});export{n as searchInputInspectorPropsSchema};
@@ -1,5 +1,5 @@
1
1
 
2
- import { SearchInputProps } from "./schema.mjs";
2
+ import { SearchInputProps } from "./client.mjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region components/biz/business/search-input/server.d.ts
@@ -9,7 +9,7 @@ import * as zod_v4_core0 from "zod/v4/core";
9
9
 
10
10
  //#region components/biz/business/shortcut-grid/material.d.ts
11
11
  declare const shortcutGridMaterial: DefineMaterialOption<typeof ShortcutGrid, typeof ShortcutGridClient, zod.ZodObject<{
12
- title: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
12
+ title: zod.ZodString & SchemaHasDefaultValue;
13
13
  shortcutCount: zod.ZodNumber & SchemaHasDefaultValue;
14
14
  isShortcutTitle: zod.ZodBoolean & SchemaHasDefaultValue;
15
15
  shortcuts: zod.ZodArray<zod.ZodObject<{
@@ -8,7 +8,7 @@ import z$1 from "zod";
8
8
  * 金刚区物料可配置字段:
9
9
  */
10
10
  declare const shortcutGridInspectorPropsSchema: z$1.ZodObject<{
11
- title: z$1.ZodOptional<z$1.ZodString> & SchemaHasDefaultValue;
11
+ title: z$1.ZodString & SchemaHasDefaultValue;
12
12
  shortcutCount: z$1.ZodNumber & SchemaHasDefaultValue;
13
13
  isShortcutTitle: z$1.ZodBoolean & SchemaHasDefaultValue;
14
14
  shortcuts: z$1.ZodArray<z$1.ZodObject<{
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineSwitchPropSchema as r,defineTextPropSchema as i,getSchemaDefaultProps as a}from"../../../../utils/schema/schema.mjs";import o from"zod";const s=t({title:i({label:`推荐位名称`,required:!1,defaultValue:`推荐列表`}),shortcutCount:n({label:`入口数量`,required:!0,defaultValue:4}).refine(e=>e>=3&&e<=5,`入口数量必须为 3-5`),isShortcutTitle:r({label:`是否显示入口标题`,required:!0,defaultValue:!0}),shortcuts:e(o.object({label:i({label:`入口标题`,required:!1,defaultValue:`最新`}),icon:i({label:`图标`,required:!0,defaultValue:``}),href:i({label:`跳转指向`,required:!0,defaultValue:``})}),{label:`推荐列表`,required:!0,defaultValue:[{label:`热门`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`},{label:`新上架`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`},{label:`排行榜`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`},{label:`筛选`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`}]})}),c=a(s);export{c as shortcutGridInspectorDefaultProps,s as shortcutGridInspectorPropsSchema};
2
+ import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineSwitchPropSchema as r,defineTextPropSchema as i,getSchemaDefaultProps as a}from"../../../../utils/schema/schema.mjs";import o from"zod";const s=t({title:i({label:`推荐位名称`,required:!0,defaultValue:`推荐列表`}),shortcutCount:n({label:`入口数量`,required:!0,defaultValue:4}).refine(e=>e>=3&&e<=5,`入口数量必须为 3-5`),isShortcutTitle:r({label:`是否显示入口标题`,required:!0,defaultValue:!0}),shortcuts:e(o.object({label:i({label:`入口标题`,required:!1,defaultValue:`最新`}),icon:i({label:`图标`,required:!0,defaultValue:``}),href:i({label:`跳转指向`,required:!0,defaultValue:``})}),{label:`推荐列表`,required:!0,defaultValue:[{label:`热门`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`},{label:`新上架`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`},{label:`排行榜`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`},{label:`筛选`,icon:`/images/2026/01/21/6967aec2d806ed47d5238861/fce0a95c-1e8f-4872-ab69-86212435e1bc.jpegxxx`,href:`/video-list?title=穷小伙刚离婚,找了他3年的女总裁蒙着面纱出现了,一身红嫁衣当众求嫁,前妻嘲笑她是丑八怪,下秒揭开面纱后全场沉默了&tags=动作`}]})}),c=a(s);export{c as shortcutGridInspectorDefaultProps,s as shortcutGridInspectorPropsSchema};
@@ -1,13 +1,14 @@
1
1
 
2
- import { TabBarProps } from "./schema.mjs";
2
+ import { InferSchemaProps } from "../../../../utils/schema/schema.mjs";
3
+ import "../../../../utils/schema/index.mjs";
4
+ import { tabBarInspectorPropsSchema } from "./schema.mjs";
3
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
6
 
5
7
  //#region components/biz/business/tab-bar/client.d.ts
8
+ type TabBarProps = InferSchemaProps<typeof tabBarInspectorPropsSchema>;
6
9
  /**
7
10
  * TabBar 物料组件 - 客户端交互部分
8
11
  */
9
- declare function TabBarClient({
10
- items
11
- }: TabBarProps): react_jsx_runtime0.JSX.Element | null;
12
+ declare function TabBarClient(props: TabBarProps): react_jsx_runtime0.JSX.Element | null;
12
13
  //#endregion
13
- export { TabBarClient };
14
+ export { TabBarClient, TabBarProps };