@funhub/platform 0.1.38 → 0.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/common.d.mts +1 -2
- package/dist/common.mjs +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/inspector-schema.d.mts +4 -0
- package/dist/components/biz/business/banner/variants/basic-banner/material.d.mts +4 -0
- package/dist/components/biz/business/banner/variants/basic-banner/runtime/client.d.mts +6 -1
- package/dist/components/biz/business/banner/variants/basic-banner/runtime/client.mjs +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/server.mjs +1 -1
- package/dist/components/biz/business/banner-carousel/client.mjs +1 -1
- package/dist/components/biz/business/banner-carousel/material.d.mts +4 -0
- package/dist/components/biz/business/banner-carousel/schema.d.mts +4 -0
- package/dist/components/biz/business/banner-carousel/server.mjs +1 -1
- package/dist/components/biz/business/channel-list/client.mjs +1 -1
- package/dist/components/biz/business/channel-list/material.d.mts +4 -0
- package/dist/components/biz/business/channel-list/schema.d.mts +4 -0
- package/dist/components/biz/business/detail/detail-operate.mjs +1 -1
- package/dist/components/biz/business/detail/materials/registry.d.mts +30 -3
- package/dist/components/biz/business/detail/materials/video-detail-actions/client.d.mts +2 -1
- package/dist/components/biz/business/detail/materials/video-detail-actions/client.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-actions/material.d.mts +6 -1
- package/dist/components/biz/business/detail/materials/video-detail-actions/schema.d.mts +6 -1
- package/dist/components/biz/business/detail/materials/video-detail-actions/server.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info/client.d.mts +2 -1
- package/dist/components/biz/business/detail/materials/video-detail-info/client.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info/material.d.mts +4 -0
- package/dist/components/biz/business/detail/materials/video-detail-info/schema.d.mts +4 -0
- package/dist/components/biz/business/detail/materials/video-detail-info/server.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title/client.d.mts +2 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title/client.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title/material.d.mts +6 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title/schema.d.mts +6 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title/server.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.d.mts +2 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/material.d.mts +4 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/schema.d.mts +4 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/server.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-player/client.d.mts +2 -1
- package/dist/components/biz/business/detail/materials/video-detail-player/client.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-player/material.d.mts +6 -1
- package/dist/components/biz/business/detail/materials/video-detail-player/schema.d.mts +6 -1
- package/dist/components/biz/business/detail/materials/video-detail-player/server.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-recommend/client.d.mts +2 -1
- package/dist/components/biz/business/detail/materials/video-detail-recommend/client.mjs +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-recommend/material.d.mts +4 -0
- package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.d.mts +4 -0
- package/dist/components/biz/business/detail/materials/video-detail-recommend/server.mjs +1 -1
- package/dist/components/biz/business/detail/video-hero.mjs +1 -1
- package/dist/components/biz/business/floating-ball/client.mjs +1 -1
- package/dist/components/biz/business/floating-ball/material.d.mts +4 -0
- package/dist/components/biz/business/floating-ball/schema.d.mts +4 -0
- package/dist/components/biz/business/floating-ball/server.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-icon/client.d.mts +3 -1
- package/dist/components/biz/business/header-search/header-avatar-icon/client.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-icon/material.d.mts +6 -1
- package/dist/components/biz/business/header-search/header-avatar-icon/schema.d.mts +6 -1
- package/dist/components/biz/business/header-search/header-avatar-icon/server.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search/client.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search/material.d.mts +4 -0
- package/dist/components/biz/business/header-search/header-avatar-logo-search/schema.d.mts +4 -0
- package/dist/components/biz/business/header-search/header-avatar-logo-search/server.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/client.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/material.d.mts +4 -0
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/schema.d.mts +4 -0
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/server.mjs +1 -1
- package/dist/components/biz/business/header-search/header-logo-search/client.mjs +1 -1
- package/dist/components/biz/business/header-search/header-logo-search/material.d.mts +4 -0
- package/dist/components/biz/business/header-search/header-logo-search/schema.d.mts +4 -0
- package/dist/components/biz/business/header-search/header-logo-search/server.mjs +1 -1
- package/dist/components/biz/business/header-search/header-search/client.d.mts +3 -1
- package/dist/components/biz/business/header-search/header-search/client.mjs +1 -1
- package/dist/components/biz/business/header-search/header-search/material.d.mts +6 -1
- package/dist/components/biz/business/header-search/header-search/schema.d.mts +6 -1
- package/dist/components/biz/business/header-search/header-search/server.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.d.mts +4 -0
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.d.mts +4 -0
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/client.d.mts +8 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/client.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/server.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.d.mts +4 -0
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.d.mts +4 -0
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.d.mts +8 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.mjs +1 -1
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/server.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/card-item.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/client.d.mts +15 -0
- package/dist/components/biz/business/large-feature-grid/client.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/material.d.mts +34 -4
- package/dist/components/biz/business/large-feature-grid/schema.d.mts +42 -0
- package/dist/components/biz/business/large-feature-grid/server.d.mts +15 -0
- package/dist/components/biz/business/large-feature-grid/server.mjs +1 -1
- package/dist/components/biz/business/marquee/client.mjs +1 -1
- package/dist/components/biz/business/marquee/material.d.mts +4 -0
- package/dist/components/biz/business/marquee/schema.d.mts +4 -0
- package/dist/components/biz/business/marquee/server.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/client.d.mts +2 -1
- package/dist/components/biz/business/profile/profile-header/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/material.d.mts +18 -2
- package/dist/components/biz/business/profile/profile-header/material.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/schema.d.mts +7 -2
- package/dist/components/biz/business/profile/profile-header/server.d.mts +4 -1
- package/dist/components/biz/business/profile/profile-header/server.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/user-profile-cover-background.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/client.d.mts +2 -1
- package/dist/components/biz/business/profile/profile-main/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/material.d.mts +6 -1
- package/dist/components/biz/business/profile/profile-main/material.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/schema.d.mts +7 -2
- package/dist/components/biz/business/profile/profile-main/server.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.d.mts +5 -0
- package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/server.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.d.mts +5 -0
- package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/history-tab/server.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.d.mts +5 -0
- package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/like-tab/server.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/client.d.mts +5 -0
- package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/server.mjs +1 -1
- package/dist/components/biz/business/search-history/client.mjs +1 -1
- package/dist/components/biz/business/search-history/material.d.mts +4 -0
- package/dist/components/biz/business/search-history/schema.d.mts +4 -0
- package/dist/components/biz/business/search-history/server.mjs +1 -1
- package/dist/components/biz/business/search-input/client.mjs +1 -1
- package/dist/components/biz/business/search-input/material.d.mts +4 -0
- package/dist/components/biz/business/search-input/schema.d.mts +4 -0
- package/dist/components/biz/business/search-input/server.mjs +1 -1
- package/dist/components/biz/business/shortcut-grid/client.mjs +1 -1
- package/dist/components/biz/business/shortcut-grid/material.d.mts +4 -0
- package/dist/components/biz/business/shortcut-grid/schema.d.mts +4 -0
- package/dist/components/biz/business/shortcut-grid/server.mjs +1 -1
- package/dist/components/biz/business/tab-bar/client.mjs +1 -1
- package/dist/components/biz/business/tab-bar/material.d.mts +9 -1
- package/dist/components/biz/business/tab-bar/schema.d.mts +9 -1
- package/dist/components/biz/business/tab-bar/server.mjs +1 -1
- package/dist/components/biz/business/text-recommend/client.mjs +1 -1
- package/dist/components/biz/business/text-recommend/material.d.mts +4 -0
- package/dist/components/biz/business/text-recommend/schema.d.mts +4 -0
- package/dist/components/biz/business/text-recommend/server.mjs +1 -1
- package/dist/components/biz/business/video-horizontal-list/client.mjs +1 -1
- package/dist/components/biz/business/video-horizontal-list/material.d.mts +4 -0
- package/dist/components/biz/business/video-horizontal-list/schema.d.mts +4 -0
- package/dist/components/biz/business/video-horizontal-list/server.mjs +1 -1
- package/dist/components/biz/example/button/client.mjs +1 -1
- package/dist/components/biz/example/button/material.d.mts +4 -0
- package/dist/components/biz/example/button/schema.d.mts +4 -0
- package/dist/components/biz/example/button/server.d.mts +4 -1
- package/dist/components/biz/example/button/server.mjs +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button.d.mts +2 -2
- package/dist/components/ui/image.d.mts +4 -4
- package/dist/hooks.d.mts +1 -4
- package/dist/hooks.mjs +1 -1
- package/dist/utils/schema/index.d.mts +1 -1
- package/dist/utils/schema/material.d.mts +3 -2
- package/dist/utils/schema/schema.d.mts +18 -3
- package/dist/utils/schema/schema.mjs +1 -1
- package/dist/utils.d.mts +2 -2
- package/package.json +1 -1
- package/dist/components/common/app-context/index.d.mts +0 -19
- package/dist/components/common/app-context/index.mjs +0 -2
- package/dist/components/common/app-context/provider.mjs +0 -2
- package/dist/hooks/app-context.d.mts +0 -20
- package/dist/hooks/app-context.mjs +0 -2
- package/dist/hooks/get-app-context.d.mts +0 -19
- package/dist/hooks/get-app-context.mjs +0 -2
- package/dist/hooks/use-app-context/index.d.mts +0 -14
- package/dist/hooks/use-app-context/index.mjs +0 -2
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
|
|
2
|
+
import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
2
3
|
import { DefineMaterialOption } from "../../../../utils/schema/material.mjs";
|
|
3
|
-
import
|
|
4
|
+
import "../../../../utils/schema/index.mjs";
|
|
5
|
+
import { LargeFeatureGridClient } from "./client.mjs";
|
|
6
|
+
import { LargeFeatureGrid } from "./server.mjs";
|
|
4
7
|
import * as zod from "zod";
|
|
5
8
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
6
9
|
|
|
7
10
|
//#region components/biz/business/large-feature-grid/material.d.ts
|
|
8
|
-
declare const largeFeatureGridMaterial: DefineMaterialOption<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
declare const largeFeatureGridMaterial: DefineMaterialOption<typeof LargeFeatureGrid, typeof LargeFeatureGridClient, zod.ZodObject<{
|
|
12
|
+
data: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
13
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
14
|
+
moreUrl: zod.ZodOptional<zod.ZodString>;
|
|
15
|
+
moreLinkType: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
16
|
+
recommendMode: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
17
|
+
items: zod.ZodObject<{
|
|
18
|
+
id: zod.ZodString;
|
|
19
|
+
cover: zod.ZodString;
|
|
20
|
+
tag: zod.ZodOptional<zod.ZodString>;
|
|
21
|
+
playCount: zod.ZodOptional<zod.ZodString>;
|
|
22
|
+
playCountDelta: zod.ZodOptional<zod.ZodNumber> & SchemaHasDefaultValue;
|
|
23
|
+
showPlayCount: zod.ZodOptional<zod.ZodBoolean> & SchemaHasDefaultValue;
|
|
24
|
+
duration: zod.ZodOptional<zod.ZodString>;
|
|
25
|
+
showEpisode: zod.ZodOptional<zod.ZodBoolean> & SchemaHasDefaultValue;
|
|
26
|
+
useContentCover: zod.ZodOptional<zod.ZodBoolean> & SchemaHasDefaultValue;
|
|
27
|
+
title: zod.ZodString;
|
|
28
|
+
desc: zod.ZodOptional<zod.ZodString>;
|
|
29
|
+
tagImageUrl: zod.ZodOptional<zod.ZodString>;
|
|
30
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
31
|
+
renderer: "renderer";
|
|
32
|
+
editor: "editor";
|
|
33
|
+
}>>;
|
|
34
|
+
}, zod_v4_core0.$strip>;
|
|
35
|
+
}, zod_v4_core0.$strip>>> & SchemaHasDefaultValue;
|
|
36
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
37
|
+
renderer: "renderer";
|
|
38
|
+
editor: "editor";
|
|
39
|
+
}>>;
|
|
40
|
+
}, zod_v4_core0.$strip>, "large-feature-grid">;
|
|
11
41
|
//#endregion
|
|
12
42
|
export { largeFeatureGridMaterial };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
import { InferSchemaProps, SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
3
|
+
import "../../../../utils/schema/index.mjs";
|
|
4
|
+
import z$1 from "zod";
|
|
5
|
+
|
|
6
|
+
//#region components/biz/business/large-feature-grid/schema.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* 大图推荐物料 schema
|
|
9
|
+
*/
|
|
10
|
+
declare const largeFeatureGridInspectorPropsSchema: z$1.ZodObject<{
|
|
11
|
+
data: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
12
|
+
title: z$1.ZodOptional<z$1.ZodString>;
|
|
13
|
+
moreUrl: z$1.ZodOptional<z$1.ZodString>;
|
|
14
|
+
moreLinkType: z$1.ZodOptional<z$1.ZodString> & SchemaHasDefaultValue;
|
|
15
|
+
recommendMode: z$1.ZodOptional<z$1.ZodString> & SchemaHasDefaultValue;
|
|
16
|
+
items: z$1.ZodObject<{
|
|
17
|
+
id: z$1.ZodString;
|
|
18
|
+
cover: z$1.ZodString;
|
|
19
|
+
tag: z$1.ZodOptional<z$1.ZodString>;
|
|
20
|
+
playCount: z$1.ZodOptional<z$1.ZodString>;
|
|
21
|
+
playCountDelta: z$1.ZodOptional<z$1.ZodNumber> & SchemaHasDefaultValue;
|
|
22
|
+
showPlayCount: z$1.ZodOptional<z$1.ZodBoolean> & SchemaHasDefaultValue;
|
|
23
|
+
duration: z$1.ZodOptional<z$1.ZodString>;
|
|
24
|
+
showEpisode: z$1.ZodOptional<z$1.ZodBoolean> & SchemaHasDefaultValue;
|
|
25
|
+
useContentCover: z$1.ZodOptional<z$1.ZodBoolean> & SchemaHasDefaultValue;
|
|
26
|
+
title: z$1.ZodString;
|
|
27
|
+
desc: z$1.ZodOptional<z$1.ZodString>;
|
|
28
|
+
tagImageUrl: z$1.ZodOptional<z$1.ZodString>;
|
|
29
|
+
mode: z$1.ZodOptional<z$1.ZodEnum<{
|
|
30
|
+
renderer: "renderer";
|
|
31
|
+
editor: "editor";
|
|
32
|
+
}>>;
|
|
33
|
+
}, z$1.core.$strip>;
|
|
34
|
+
}, z$1.core.$strip>>> & SchemaHasDefaultValue;
|
|
35
|
+
mode: z$1.ZodOptional<z$1.ZodEnum<{
|
|
36
|
+
renderer: "renderer";
|
|
37
|
+
editor: "editor";
|
|
38
|
+
}>>;
|
|
39
|
+
}, z$1.core.$strip>;
|
|
40
|
+
type LargeFeatureGridInspectorProps = InferSchemaProps<typeof largeFeatureGridInspectorPropsSchema>;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { LargeFeatureGridInspectorProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { LargeFeatureGridInspectorProps } from "./schema.mjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region components/biz/business/large-feature-grid/server.d.ts
|
|
6
|
+
type LargeFeatureGridProps = LargeFeatureGridInspectorProps;
|
|
7
|
+
/**
|
|
8
|
+
* 大图推荐服务端组件,直接渲染客户端组件。
|
|
9
|
+
*/
|
|
10
|
+
declare function LargeFeatureGrid({
|
|
11
|
+
mode,
|
|
12
|
+
...props
|
|
13
|
+
}: LargeFeatureGridProps): react_jsx_runtime0.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { LargeFeatureGrid };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{LargeFeatureGridClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";function n(n){return t(e,{...n})}export{n as LargeFeatureGrid};
|
|
2
|
+
import{LargeFeatureGridClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";function n({mode:n=`renderer`,...r}){return t(e,{...r,mode:n})}export{n as LargeFeatureGrid};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import r from"../../../../assets/icons/clear.mjs";import i from"../../../../assets/icons/right_arrow.mjs";import a from"../../../../assets/images/marquee.mjs";import{useEffect as o,useMemo as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{useRouter as d}from"next/navigation";const f=[];function p(p){let{contents:m=f,click:h,close:g,displayStrategy:_}=p,v=d(),[
|
|
2
|
+
"use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import r from"../../../../assets/icons/clear.mjs";import i from"../../../../assets/icons/right_arrow.mjs";import a from"../../../../assets/images/marquee.mjs";import{useEffect as o,useMemo as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{useRouter as d}from"next/navigation";const f=[];function p(p){let{contents:m=f,click:h,close:g,displayStrategy:_,mode:v=`renderer`}=p,y=v===`editor`,b=d(),[x,S]=c(!0),[C,w]=c(0),[T,E]=c(!1);o(()=>{E(!0)},[]);let D=s(()=>{let e=_?.period?.start,t=_?.period?.end;if(!e&&!t)return!0;let n=Date.now(),r=e?new Date(e).getTime():0,i=t?new Date(t).getTime():2**53-1;return n>=r&&n<=i},[_?.period]);if(o(()=>{if(!T||!_?.rule)return;let e=`marquee_closed_${_.rule}`,t=localStorage.getItem(e);t&&(_.rule===`once`||_.rule===`daily`&&new Date(Number(t)).toLocaleDateString()===new Date().toLocaleDateString())&&S(!1)},[T,_?.rule]),o(()=>{if(!m||m.length<=1)return;let e=setInterval(()=>{w(e=>(e+1)%m.length)},3e3);return()=>clearInterval(e)},[m]),!T||!x||!D||!m||m.length===0)return null;let O=m[C],k=h?.enabled,A=h?.link||O.link,j=k&&!!A;return l(t,{className:y?`px-[12px] py-[8px] w-full bg-bg1 pointer-events-none`:`px-[12px] py-[8px] w-full bg-bg1`,children:u(t,{className:`flex items-center pl-[2px] pr-[12px] py-[2px] rounded-[8px] w-full cursor-pointer relative overflow-hidden`,style:{backgroundImage:`linear-gradient(154deg, rgba(255, 228, 133, 0.2) 9.14%, rgba(207, 129, 37, 0.05) 90.86%)`},onClick:()=>{y||j&&A&&b.push(A)},children:[l(t,{className:`relative shrink-0 w-[36px] h-[36px]`,children:l(e,{src:typeof a==`string`?a:a.src,alt:`notice`,fill:!0,className:`object-cover`,unoptimized:!0})}),l(t,{className:`flex-1 overflow-hidden relative h-[22px] ml-1`,children:l(t,{className:`absolute inset-0 flex items-center transition-transform duration-500 ease-in-out`,style:{transform:`translateY(0)`},children:l(n,{className:`text-[14px] text-[#f59e0b] leading-[22px] truncate w-full font-medium`,children:O.text})})}),u(t,{className:`flex items-center gap-[12px] shrink-0 ml-[4px]`,children:[j&&l(i,{className:`w-[16px] h-[16px] text-[#f59e0b]`}),g?.enabled&&l(t,{className:`opacity-30 hover:opacity-100 transition-opacity p-1`,onClick:e=>{if(e.stopPropagation(),S(!1),_?.rule){let e=`marquee_closed_${_.rule}`;localStorage.setItem(e,Date.now().toString())}},children:l(r,{className:`w-[12px] h-[12px] text-[#999]`})})]})]})})}export{p as MarqueeClient};
|
|
@@ -31,6 +31,10 @@ declare const marqueeMaterial: DefineMaterialOption<typeof MarqueeServer, typeof
|
|
|
31
31
|
readonly end: zod.ZodString;
|
|
32
32
|
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
33
33
|
}, zod_v4_core0.$strip> & SchemaHasDefaultValue;
|
|
34
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
35
|
+
renderer: "renderer";
|
|
36
|
+
editor: "editor";
|
|
37
|
+
}>>;
|
|
34
38
|
}, zod_v4_core0.$strip>, "marquee">;
|
|
35
39
|
//#endregion
|
|
36
40
|
export { marqueeMaterial };
|
|
@@ -27,6 +27,10 @@ declare const marqueeInspectorPropsSchema: z.ZodObject<{
|
|
|
27
27
|
readonly end: z.ZodString;
|
|
28
28
|
}, z.core.$strip>> & SchemaHasDefaultValue;
|
|
29
29
|
}, z.core.$strip> & SchemaHasDefaultValue;
|
|
30
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
31
|
+
renderer: "renderer";
|
|
32
|
+
editor: "editor";
|
|
33
|
+
}>>;
|
|
30
34
|
}, z.core.$strip>;
|
|
31
35
|
//#endregion
|
|
32
36
|
export { marqueeInspectorPropsSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{MarqueeClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";async function n(n){return t(e,{...
|
|
2
|
+
import{MarqueeClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";async function n(n){let{mode:r=`renderer`,...i}=n;return t(e,{...i,mode:r})}export{n as MarqueeServer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../../../utils/cn.mjs";import{Button as t}from"../../../../ui/button.mjs";import{useUserStore as n}from"../../../../../store/modules/user-store.mjs";import{gUserGetUserInfo as r,gUserViewUserInfo as i,pInteractionFollow as a,pInteractionUnfollow as o}from"../../../../../service/generated/client.mjs";import{Box as s}from"../../../../ui/box.mjs";import{Text as c}from"../../../../ui/text.mjs";import{useDeleteRequest as l,useMutation as u,useRequest as d,useUpdateRequest as f}from"../../../../../hooks/query/use-query.mjs";import{
|
|
2
|
+
"use client";import{cn as e}from"../../../../../utils/cn.mjs";import{Button as t}from"../../../../ui/button.mjs";import{useUserStore as n}from"../../../../../store/modules/user-store.mjs";import{gUserGetUserInfo as r,gUserViewUserInfo as i,pInteractionFollow as a,pInteractionUnfollow as o}from"../../../../../service/generated/client.mjs";import{Box as s}from"../../../../ui/box.mjs";import{Text as c}from"../../../../ui/text.mjs";import{useDeleteRequest as l,useMutation as u,useRequest as d,useUpdateRequest as f}from"../../../../../hooks/query/use-query.mjs";import{useLoginModalStore as p}from"../../../../../store/modules/login-modal-store.mjs";import{LeftArrowIcon as m}from"../../../../common/icons/left-arrow.mjs";import{SettingIcon as h}from"../../../../common/icons/setting.mjs";import{UserProfileAvatar as g}from"./user-profile-avatar.mjs";import{UserProfileCoverBackground as _}from"./user-profile-cover-background.mjs";import{useEffect as v,useMemo as y,useState as b}from"react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{toast as C}from"sonner";import{useTranslations as w}from"next-intl";import T from"next/link";import{useRouter as ee}from"next/navigation";const E=n.persist,D=`https://guadd-sg-ccs-sing-dev.s3.ap-southeast-1.amazonaws.com/default/default_avatar.png`,O=`/images/mine/img_mine_head_bg.png`;function te({userId:e,currentUserId:n,isFollowing:r}){let i=w(`components.pages.profile`),{open:s}=p(),c=l(),d=f(),{mutateAsync:m,isPending:h}=u(async e=>a(e)),{mutateAsync:g,isPending:_}=u(async e=>o(e)),v=h||_;async function y(){if(!v){if(!n){s();return}try{if(r){let t=await g({app_id:0,follower_id:n,followee_id:e});t.code===0?(C.success(i(`client.unfollowSuccess`)),b(!1),c([`check-follow`,e]),c([`user-profile`,`profile`,e])):C.error(t.message||i(`client.unfollowFailed`))}else{let t=await m({app_id:0,follower_id:n,followee_id:e});t.code===0?(C.success(i(`client.followSuccess`)),b(!0),c([`check-follow`,e]),c([`user-profile`,`profile`,e])):C.error(t.message||i(`client.followFailed`))}}catch(e){console.error(`关注操作失败`,e),C.error(i(`client.operationFailed`))}}}function b(t){d([`user-profile`,`profile`,e],e=>!e||!e.data?e:{...e,data:{...e.data,is_following:t}})}return x(t,{variant:r?`outline`:`default`,className:`rounded-full disabled:opacity-100`,onClick:y,disabled:v,children:i(v?`client.processing`:r?`client.followed`:`client.follow`)})}function k({id:a,enableCustomBackground:o=!0,showBackButton:l=!0,requireLogin:u=!1,cookieToken:f,cookieUserId:C,isEditorPreview:k=!1,className:A,mode:j=`renderer`}){let M=w(`components.pages.profile`);w(`components.pages.profile.components`);let N=k||j===`editor`,ne=!N,re=ee(),{open:ie}=p(),{isLogin:ae,userId:P,token:F}=n(),[I,L]=b(!1);v(()=>{if(!E){L(!0);return}L(E.hasHydrated());let e=E.onHydrate(()=>{L(!1)}),t=E.onFinishHydration(()=>{L(!0)});return()=>{e(),t()}},[]);let R=N?!1:I?ae&&!!P&&!!F:!!C&&!!f,z=N?``:I?P:P||C,B=z,V=a==null||!!a&&!!B&&a===B,oe=!V&&!!a,H=V?[`user-profile`,`mine`]:[`user-profile`,`profile`,a],{data:U}=d(N?[`editor-preview`,...H]:H,()=>a?i({target_user_id:a,user_id:z||a}):r({user_id:a||z||``}),{staleTime:0,enabled:ne&&(!!a||!!z)}),W=y(()=>{let e=U?U.data:void 0;return e?{userId:e.user_id,isFollowing:e.is_following||!1,name:e.nick_name||`User${a??``}`,avatar:e.avatar||D,followingCnt:e.following_count??0,followersCnt:e.follower_count??0,likeCnt:e.like_count??0,signature:e.signature||``,background:e.bg_image||O}:{}},[a,U]),G=u&&V&&!R,K=!R&&oe,q=V&&R&&!G,J=!R,se=o&&q,ce=o&&J,le={name:M(`client.welcomeToPlanet`),description:M(`client.exploreAdventures`),avatar:D,followingCnt:0,followersCnt:0,likeCnt:0,background:O};function Y(){ie()}function X(){re.back()}let ue=G?x(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:M(`client.loginNow`)}):K?x(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:M(`client.follow`)}):R?V?x(T,{href:`/edit`,children:x(t,{variant:`outline`,className:`rounded-full`,children:M(`client.editProfile`)})}):x(te,{userId:a||``,currentUserId:z,isFollowing:W?.isFollowing}):x(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:M(`client.loginNow`)}),Z=G?le:W,Q=Z.name||``,$=Z.description||Z.signature||``;Z.followingCnt,Z.followersCnt,Z.likeCnt;let de=Z.avatar||``;return S(s,{className:e(`flex flex-col relative`,A),children:[S(s,{className:`absolute top-0 p-3 z-10 flex items-center justify-between w-full`,children:[x(t,{variant:`ghost`,size:`icon-xs`,onClick:X,className:e(`h-4 w-4 p-0 hover:bg-transparent`,{invisible:!l}),children:x(m,{className:`w-4 h-4`})}),x(T,{href:`/settings`,className:e({invisible:!V}),children:x(h,{})})]}),x(_,{isMine:se,enableCustomBackground:o,src:Z.background,onUnauthorizedClick:ce?Y:void 0}),S(s,{className:`flex-1 px-3`,children:[S(s,{className:`relative flex justify-end`,children:[x(g,{isMine:q,src:de,alt:Q||`avatar`,onUnauthorizedClick:J?Y:void 0}),x(s,{className:`flex divide-x divide-text1/5 py-4 h-12`})]}),S(s,{className:`flex items-center justify-between gap-1`,children:[x(c,{as:`p`,className:`text-text1 text-xl line-clamp-2 font-bold`,children:Q}),ue]}),$&&x(c,{as:`p`,className:`text-sm py-1 line-clamp-3 text-text1/66`,children:$})]})]})}export{k as UserProfileHeaderClient};
|
|
@@ -7,7 +7,23 @@ import * as zod from "zod";
|
|
|
7
7
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
8
8
|
|
|
9
9
|
//#region components/biz/business/profile/profile-header/material.d.ts
|
|
10
|
-
declare const profileHeaderMaterial: DefineMaterialOption<typeof UserProfileHeader, typeof UserProfileHeaderClient, zod.ZodObject<{
|
|
11
|
-
|
|
10
|
+
declare const profileHeaderMaterial: DefineMaterialOption<typeof UserProfileHeader, typeof UserProfileHeaderClient, zod.ZodObject<{
|
|
11
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
12
|
+
renderer: "renderer";
|
|
13
|
+
editor: "editor";
|
|
14
|
+
}>>;
|
|
15
|
+
}, zod_v4_core0.$strip>, "profile-header">;
|
|
16
|
+
declare const profileHeaderMaterialWithDisabledBackground: DefineMaterialOption<({
|
|
17
|
+
mode,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof UserProfileHeader>) => react_jsx_runtime0.JSX.Element, ({
|
|
20
|
+
mode,
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof UserProfileHeaderClient>) => react_jsx_runtime0.JSX.Element, zod.ZodObject<{
|
|
23
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
24
|
+
renderer: "renderer";
|
|
25
|
+
editor: "editor";
|
|
26
|
+
}>>;
|
|
27
|
+
}, zod_v4_core0.$strip>, "profile-header-with-disabled-background">;
|
|
12
28
|
//#endregion
|
|
13
29
|
export { profileHeaderMaterial, profileHeaderMaterialWithDisabledBackground };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{defineMaterial as e}from"../../../../../utils/schema/material.mjs";import{UserProfileHeaderClient as t}from"./client.mjs";import{profileHeaderInspectorPropsSchema as n}from"./schema.mjs";import{UserProfileHeader as r}from"./server.mjs";import{jsx as i}from"react/jsx-runtime";const a=e({type:`profile-header`,category:`内容组件`,name:`用户信息模块(有背景图)`,icon:`/static/components-thumb/user_profile_with_background.png`,serverComponent:r,clientComponent:t,propsSchema:n}),o=e({type:`profile-header-with-disabled-background`,category:`内容组件`,name:`用户信息模块(无背景图)`,icon:`/static/components-thumb/user_profile_plain.png`,serverComponent:e=>i(r,{...e,enableCustomBackground:!1}),clientComponent:e=>i(t,{...e,enableCustomBackground:!1}),propsSchema:n});export{a as profileHeaderMaterial,o as profileHeaderMaterialWithDisabledBackground};
|
|
2
|
+
import{defineMaterial as e}from"../../../../../utils/schema/material.mjs";import{UserProfileHeaderClient as t}from"./client.mjs";import{profileHeaderInspectorPropsSchema as n}from"./schema.mjs";import{UserProfileHeader as r}from"./server.mjs";import{jsx as i}from"react/jsx-runtime";const a=e({type:`profile-header`,category:`内容组件`,name:`用户信息模块(有背景图)`,icon:`/static/components-thumb/user_profile_with_background.png`,serverComponent:r,clientComponent:t,propsSchema:n}),o=e({type:`profile-header-with-disabled-background`,category:`内容组件`,name:`用户信息模块(无背景图)`,icon:`/static/components-thumb/user_profile_plain.png`,serverComponent:({mode:e=`renderer`,...t})=>i(r,{...t,mode:e,enableCustomBackground:!1}),clientComponent:({mode:e=`renderer`,...n})=>i(t,{...n,mode:e,enableCustomBackground:!1}),propsSchema:n});export{a as profileHeaderMaterial,o as profileHeaderMaterialWithDisabledBackground};
|
|
@@ -8,13 +8,18 @@ import * as zod_v4_core0 from "zod/v4/core";
|
|
|
8
8
|
/**
|
|
9
9
|
* 用户资料头部物料 inspector 配置。
|
|
10
10
|
*/
|
|
11
|
-
declare const profileHeaderInspectorPropsSchema: zod.ZodObject<{
|
|
11
|
+
declare const profileHeaderInspectorPropsSchema: zod.ZodObject<{
|
|
12
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
13
|
+
renderer: "renderer";
|
|
14
|
+
editor: "editor";
|
|
15
|
+
}>>;
|
|
16
|
+
}, zod_v4_core0.$strip>;
|
|
12
17
|
declare const profileHeaderInspectorDefaultProps: {};
|
|
13
18
|
type ProfileHeaderInspectorProps = InferSchemaProps<typeof profileHeaderInspectorPropsSchema>;
|
|
14
19
|
interface UserProfileHeaderAuthConfig {
|
|
15
20
|
headers?: Record<string, string>;
|
|
16
21
|
}
|
|
17
|
-
interface UserProfileHeaderClientProps {
|
|
22
|
+
interface UserProfileHeaderClientProps extends ProfileHeaderInspectorProps {
|
|
18
23
|
/** 用户 ID。 */
|
|
19
24
|
id?: string;
|
|
20
25
|
/** 是否允许自定义背景图。 */
|
|
@@ -28,6 +28,9 @@ type UserProfileHeaderProps = UserProfileHeaderClientProps;
|
|
|
28
28
|
/**
|
|
29
29
|
* 用户资料头部服务端组件(用于物料注册),内部包含预取逻辑。
|
|
30
30
|
*/
|
|
31
|
-
declare function UserProfileHeader(
|
|
31
|
+
declare function UserProfileHeader({
|
|
32
|
+
mode,
|
|
33
|
+
...props
|
|
34
|
+
}: UserProfileHeaderProps): react_jsx_runtime0.JSX.Element;
|
|
32
35
|
//#endregion
|
|
33
36
|
export { BuildUserProfileHeaderPrefetchParams, UserProfileHeader, UserProfileHeaderProps, buildUserProfileHeaderPrefetch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{gUserGetUserInfo as e,gUserViewUserInfo as t}from"../../../../../service/generated/client.mjs";import{
|
|
2
|
+
import{gUserGetUserInfo as e,gUserViewUserInfo as t}from"../../../../../service/generated/client.mjs";import{HydrationBoundary as n}from"../../../../../hooks/query/hydration-boundary.mjs";import{UserProfileHeaderClient as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";function a({id:n,currentUserId:r,token:i,authConfig:a}){return n||r&&i?[{queryKey:n==null||r&&n===r?[`user-profile`,`mine`]:[`user-profile`,`profile`,n],async queryFn(){return n==null?e({user_id:r},a):t({target_user_id:n,user_id:r||n},a)}}]:[]}function o({mode:e=`renderer`,...t}){return i(s,{...t,mode:e})}function s({mode:e=`renderer`,token:t=``,currentUserId:o=``,authConfig:s,...c}){if(e===`editor`)return i(r,{...c,mode:e,isEditorPreview:!0});let l=a({id:c.id,currentUserId:o,token:t,authConfig:s});return l.length===0?i(r,{...c,mode:e}):i(n,{prefetch:l,children:i(r,{...c,mode:e})})}export{o as UserProfileHeader,a as buildUserProfileHeaderPrefetch};
|
package/dist/components/biz/business/profile/profile-header/user-profile-cover-background.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pUserUploadUserBgImage as t}from"../../../../../service/generated/client.mjs";import{uploadFile as n}from"../../../../../utils/upload-file.mjs";import{Image as r}from"../../../../ui/image.mjs";import{Box as i}from"../../../../ui/box.mjs";import{Input as a}from"../../../../ui/input.mjs";import{useDeleteRequest as o}from"../../../../../hooks/query/use-query.mjs";import{BackgroundPreviewModal as s}from"../../../../common/background-preview-modal/background-preview-modal.mjs";import{showImageCrop as c}from"../../../../common/image-crop/show-image-crop.mjs";import{useEffect as l,useRef as u,useState as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{toast as h}from"sonner";const g=[`image/jpeg`,`image/png`];function _(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return g.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function v({isMine:g,enableCustomBackground:v=!0,src:y,onUnauthorizedClick:b}){let x=`/images/mine/img_mine_head_bg.png`,S=u(null),{userId:C,setUserInfo:w,userInfo:T}=e(),E=o(),[D,O]=d(!1),[k,A]=d(!1),j=v&&(!!g||typeof b==`function`);l(()=>{v||A(!1)},[v]);let M=()=>{if(v){if(g){D||A(!0);return}b?.()}},N=()=>{A(!1)};function P(){D||S.current?.click()}async function F(e){let r=e.target.files?.[0];if(e.target&&(e.target.value=``),r)try{if(!_(r)){h.error(`仅支持 JPG/JPEG/PNG 格式`);return}O(!0);let e=await n(await c(r,{aspectRatio:430/256,cropShape:`rect`,quality:.92,maxWidth:1920,maxHeight:1920}),1);await t({user_id:String(C),bg_image:e.objectKey}),w({...T,bg_image:e.objectKey}),E([`user-profile`,`mine`]),A(!1),h.success(`更换完成`)}catch(e){console.error(`上传背景图失败`,e),e instanceof Error&&e.message!==`用户取消`&&h.error(`背景图上传失败,请稍后再试`)}finally{O(!1)}}return m(f,{children:[p(i,{className:v?`h-33.75`:`h-
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pUserUploadUserBgImage as t}from"../../../../../service/generated/client.mjs";import{uploadFile as n}from"../../../../../utils/upload-file.mjs";import{Image as r}from"../../../../ui/image.mjs";import{Box as i}from"../../../../ui/box.mjs";import{Input as a}from"../../../../ui/input.mjs";import{useDeleteRequest as o}from"../../../../../hooks/query/use-query.mjs";import{BackgroundPreviewModal as s}from"../../../../common/background-preview-modal/background-preview-modal.mjs";import{showImageCrop as c}from"../../../../common/image-crop/show-image-crop.mjs";import{useEffect as l,useRef as u,useState as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{toast as h}from"sonner";const g=[`image/jpeg`,`image/png`];function _(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return g.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function v({isMine:g,enableCustomBackground:v=!0,src:y,onUnauthorizedClick:b}){let x=`/images/mine/img_mine_head_bg.png`,S=u(null),{userId:C,setUserInfo:w,userInfo:T}=e(),E=o(),[D,O]=d(!1),[k,A]=d(!1),j=v&&(!!g||typeof b==`function`);l(()=>{v||A(!1)},[v]);let M=()=>{if(v){if(g){D||A(!0);return}b?.()}},N=()=>{A(!1)};function P(){D||S.current?.click()}async function F(e){let r=e.target.files?.[0];if(e.target&&(e.target.value=``),r)try{if(!_(r)){h.error(`仅支持 JPG/JPEG/PNG 格式`);return}O(!0);let e=await n(await c(r,{aspectRatio:430/256,cropShape:`rect`,quality:.92,maxWidth:1920,maxHeight:1920}),1);await t({user_id:String(C),bg_image:e.objectKey}),w({...T,bg_image:e.objectKey}),E([`user-profile`,`mine`]),A(!1),h.success(`更换完成`)}catch(e){console.error(`上传背景图失败`,e),e instanceof Error&&e.message!==`用户取消`&&h.error(`背景图上传失败,请稍后再试`)}finally{O(!1)}}return m(f,{children:[p(i,{className:v?`h-33.75`:`h-24`,children:v?p(i,{className:`relative h-full w-full`,onClick:j?M:void 0,children:p(r,{alt:`cover background`,fill:!0,objectFit:`cover`,className:`pointer-events-none`,src:y||x})}):p(i,{className:`h-full w-full bg-bg1`})}),v&&m(f,{children:[p(s,{open:k,onClose:N,bgUrl:y||x,onUpload:P}),p(a,{ref:S,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:F})]})]})}export{v as UserProfileCoverBackground};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Box as e}from"../../../../ui/box.mjs";import{Text as t}from"../../../../ui/text.mjs";import{UserProfileMainShell as n}from"./shell.mjs";import{jsx as r}from"react/jsx-runtime";function i({id:i,className:a,cookieUserId:o,currentUserId:s,requireLogin:c=!1}){let l
|
|
2
|
+
"use client";import{Box as e}from"../../../../ui/box.mjs";import{Text as t}from"../../../../ui/text.mjs";import{UserProfileMainShell as n}from"./shell.mjs";import{jsx as r}from"react/jsx-runtime";function i({id:i,className:a,cookieUserId:o,currentUserId:s,requireLogin:c=!1,mode:l=`renderer`}){let u=l===`editor`?``:s||o||``,d=i==null||!!u&&i===u;return r(n,{isMine:d,renderMode:c&&d&&!u?`login-required`:`content`,className:a,children:r(e,{className:`py-6 text-center`,children:r(t,{className:`text-sm text-text3`,children:`内容由服务端按当前 Tab 渲染`})})})}export{i as UserProfileMainClient};
|
|
@@ -6,6 +6,11 @@ import * as zod from "zod";
|
|
|
6
6
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
7
|
|
|
8
8
|
//#region components/biz/business/profile/profile-main/material.d.ts
|
|
9
|
-
declare const profileMainMaterial: DefineMaterialOption<typeof UserProfileMain, typeof UserProfileMainClient, zod.ZodObject<{
|
|
9
|
+
declare const profileMainMaterial: DefineMaterialOption<typeof UserProfileMain, typeof UserProfileMainClient, zod.ZodObject<{
|
|
10
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
11
|
+
renderer: "renderer";
|
|
12
|
+
editor: "editor";
|
|
13
|
+
}>>;
|
|
14
|
+
}, zod_v4_core0.$strip>, "profile-main">;
|
|
10
15
|
//#endregion
|
|
11
16
|
export { profileMainMaterial };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{defineMaterial as e}from"../../../../../utils/schema/material.mjs";import{UserProfileMainClient as t}from"./client.mjs";import{profileMainInspectorPropsSchema as n}from"./schema.mjs";import{UserProfileMain as r}from"./server.mjs";const i=e({type:`profile-main`,category:`内容组件`,name:`用户行为模块`,icon:`/
|
|
2
|
+
import{defineMaterial as e}from"../../../../../utils/schema/material.mjs";import{UserProfileMainClient as t}from"./client.mjs";import{profileMainInspectorPropsSchema as n}from"./schema.mjs";import{UserProfileMain as r}from"./server.mjs";const i=e({type:`profile-main`,category:`内容组件`,name:`用户行为模块`,icon:`/static/components-thumb/user_profile_action.png`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as profileMainMaterial};
|
|
@@ -8,7 +8,12 @@ import * as zod_v4_core0 from "zod/v4/core";
|
|
|
8
8
|
/**
|
|
9
9
|
* 用户资料主体物料暂不对外开放 inspector 配置。
|
|
10
10
|
*/
|
|
11
|
-
declare const profileMainInspectorPropsSchema: zod.ZodObject<{
|
|
11
|
+
declare const profileMainInspectorPropsSchema: zod.ZodObject<{
|
|
12
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
13
|
+
renderer: "renderer";
|
|
14
|
+
editor: "editor";
|
|
15
|
+
}>>;
|
|
16
|
+
}, zod_v4_core0.$strip>;
|
|
12
17
|
declare const profileMainInspectorDefaultProps: {};
|
|
13
18
|
type ProfileMainInspectorProps = InferSchemaProps<typeof profileMainInspectorPropsSchema>;
|
|
14
19
|
interface ProfileMainRuntimeTabProps {
|
|
@@ -21,7 +26,7 @@ interface ProfileMainRuntimeTabProps {
|
|
|
21
26
|
interface ProfileMainAuthConfig {
|
|
22
27
|
headers?: Record<string, string>;
|
|
23
28
|
}
|
|
24
|
-
interface UserProfileMainProps extends ProfileMainRuntimeTabProps {
|
|
29
|
+
interface UserProfileMainProps extends ProfileMainInspectorProps, ProfileMainRuntimeTabProps {
|
|
25
30
|
/** 用户 ID。 */
|
|
26
31
|
id?: string;
|
|
27
32
|
/** 是否显示创建入口。 */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{gUserViewUserInfo as e}from"../../../../../service/generated/client.mjs";import{
|
|
2
|
+
import{gUserViewUserInfo as e}from"../../../../../service/generated/client.mjs";import{profileMainCollectCollectionTabOptions as t,profileMainCollectTabOptions as n,profileMainHistoryTabOptions as r,profileMainLikeTabOptions as i,profileMainMineTabOptions as a,profileMainProfileTabOptions as o}from"./variants.mjs";import{UserProfileMainShell as s}from"./shell.mjs";import{CollectTabServer as c}from"./tabs/collect-tab/server.mjs";import{HistoryTabServer as l}from"./tabs/history-tab/server.mjs";import{LikeTabServer as u}from"./tabs/like-tab/server.mjs";import{jsx as d}from"react/jsx-runtime";function f({isMine:e,tab:t}){let n=e?a:o;return t&&n.includes(t)?t:n[0]}function p(e,t,n){return e&&t.includes(e)?e:n}function m(e,t){return e&&(t===`collect`||t===`like`)}function h(e){let{mode:t=`renderer`,...n}=e;return d(g,{...n,mode:t})}async function g({mode:a=`renderer`,id:o,showCreateAction:h=!1,requireLogin:g=!1,cookieToken:_,cookieUserId:v,className:y,token:b=``,currentUserId:x=``,authConfig:S,tab:C,likeTab:w,historyTab:T,collectTab:E,collectCollectionTab:D}){let O=a===`editor`,k=b||_||``,A=x||v||``,j=!!k,M=o==null||!!A&&o===A,N=!M&&!!o,P=M?A:o?String(o):void 0,F=M?[`user-profile`,`mine`]:[`user-profile`,`profile`,o],I=f({isMine:M,tab:C}),L=`content`;if(g&&M&&!j&&(L=`login-required`),!O&&L===`content`&&m(N,I)){let t=(await e({target_user_id:String(o),user_id:A||String(o)},S))?.data??{},n=Number(t.collections_open??1)>0,r=Number(t.like_open??1)>0;I===`collect`&&!n&&(L=`privacy-collect`),I===`like`&&!r&&(L=`privacy-like`)}let R=O?[]:void 0,z=null;if(L===`content`)switch(I){case`like`:z=d(u,{mode:a,isMine:M,targetUserId:P,queryKeyPrefix:F,resolvedLikeTab:p(w,i,`video`),prefetch:R});break;case`history`:z=d(l,{mode:a,targetUserId:P,queryKeyPrefix:F,resolvedHistoryTab:p(T,r,`video`),authConfig:S,prefetch:R});break;default:z=d(c,{mode:a,isMine:M,userId:P,showCreateAction:h&&M,queryKeyPrefix:F,resolvedCollectTab:p(E,n,`video`),resolvedCollectCollectionTab:p(D,t,`created`),authConfig:S,prefetch:R});break}return d(s,{isMine:M,renderMode:L,className:y,children:z})}export{h as UserProfileMain};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
import { MaterialComponentMode } from "../../../../../../../utils/schema/schema.mjs";
|
|
3
|
+
import "../../../../../../../utils/schema/index.mjs";
|
|
2
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
5
|
|
|
4
6
|
//#region components/biz/business/profile/profile-main/tabs/collect-tab/client.d.ts
|
|
5
7
|
interface CollectTabProps {
|
|
8
|
+
/** 渲染模式。 */
|
|
9
|
+
mode?: MaterialComponentMode;
|
|
6
10
|
/** 当前用户ID */
|
|
7
11
|
userId?: string;
|
|
8
12
|
/** 是否显示创建入口 */
|
|
@@ -16,6 +20,7 @@ interface CollectTabProps {
|
|
|
16
20
|
* 收藏 Tab
|
|
17
21
|
*/
|
|
18
22
|
declare function CollectTab({
|
|
23
|
+
mode,
|
|
19
24
|
userId,
|
|
20
25
|
showCreateAction,
|
|
21
26
|
queryKeyPrefix,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{gCommunityGetSubscribedCollections as n,gCommunityGetUserCollections as r,gInteractionListCollects as i,pInteractionBatchDeleteCollects as a}from"../../../../../../../service/generated/client.mjs";import{Box as o}from"../../../../../../ui/box.mjs";import{Checkbox as ee}from"../../../../../../ui/checkbox.mjs";import{Tabs as s,TabsList as
|
|
2
|
+
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{gCommunityGetSubscribedCollections as n,gCommunityGetUserCollections as r,gInteractionListCollects as i,pInteractionBatchDeleteCollects as a}from"../../../../../../../service/generated/client.mjs";import{Box as o}from"../../../../../../ui/box.mjs";import{Checkbox as ee}from"../../../../../../ui/checkbox.mjs";import{Tabs as s,TabsList as c,TabsTrigger as l}from"../../../../../../ui/tabs.mjs";import{Text as te}from"../../../../../../ui/text.mjs";import{useMutation as ne,usePaginated as u,useUpdateRequest as re}from"../../../../../../../hooks/query/use-query.mjs";import{CollectionList as ie}from"../../../../../../common/list/collection-list/collection-list.mjs";import{PostList as ae}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as oe}from"../../../../../../common/list/video-list/video-list.mjs";import{useEffect as d,useMemo as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{toast as g}from"sonner";import{useTranslations as _}from"next-intl";import v from"dayjs";import se from"next/link";import{parseAsString as y,useQueryState as b}from"nuqs";const x={video:1,post:2};function ce(e,t){if(!e)return e;let n=0,r=e.pages.map(e=>({page:e,filteredList:(e.data?.list??T).filter(e=>{let r=e?.id??``,i=t.has(r);return i&&(n+=1),!i})}));return{...e,pages:r.map(({page:e,filteredList:t})=>{if(!e.data)return e;let r=typeof e.data.total==`number`?Math.max(0,e.data.total-n):e.data.total;return{...e,data:{...e.data,list:t,total:r}}})}}function S(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function le(e,t){let n=t[e.content_id||``]?.create_time,r=S(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:v(n).toDate().getTime()}}function ue(e,t){let n=t[e.id||``]?.create_time;return{is_more_link:e.is_more_link,id:e.id||``,title:e.name||``,coverImage:e.img_x||``,duration:Number(e.duration??0),authorName:e.up_user||e.source_username||``,viewCount:e.play_count??0,publishTime:v(n).toDate().getTime()}}function de(e){let t=S(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function C(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function w(e){let t=(e.contents??[]).slice(0,3).map(de),n=e.content_count??t.length;return{id:e.collection_id||``,title:e.title||``,contentCount:n,contents:n===0?C(e.collection_id||`collection`):t}}const T=[],fe=[`video`,`post`,`collection`],pe=[`created`,`subscribed`];function E({mode:v=`renderer`,userId:S,showCreateAction:de=!1,queryKeyPrefix:C,isMine:E=!1}){let me=_(),D=_(`components.pages.profile.components.tabs`),O=v===`renderer`,k=C??[],[A,j]=b(`collectTab`,y.withDefault(`video`)),[M,N]=b(`collectCollectionTab`,y.withDefault(`created`)),P=f(()=>fe.includes(A)?A:`video`,[A]),F=f(()=>pe.includes(M)?M:`created`,[M]),[I,L]=p(!1),[R,z]=p(()=>new Set),{userId:he,userInfo:ge}=t(),B=S||he||ge?.userId||``,_e=re();async function ve(e,t){if(!B)return{data:{list:[],total:0}};let n=await i({user_id:B,folder_id:``,content_type:t,page:e,page_size:10}),r=n.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},a=t===x.video?(n.data?.video_infos??[]).map(e=>ue(e,r)):(n.data?.post_infos??[]).map(e=>le(e,r));return{data:{list:a,total:n.data?.total??a.length}}}let V=u({key:[...k,`user-collect-video`,B],initialPageParam:1,async queryFn(e){return ve(e,x.video)},options:{staleTime:0,enabled:O},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),H=u({key:[...k,`user-collect-post`,B],initialPageParam:1,options:{staleTime:0,enabled:O},async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}});async function ye(e){if(!B)return{data:{list:[],total:0}};let t=await r({page:e,user_id:S,page_size:10}),n=t.data?.data?.collections??[];return{data:{list:n.map(w),total:t.data?.data?.total??n.length}}}async function be(e){if(!B)return{data:{list:[],total:0}};let t=(await n({page:e,user_id:S,page_size:10})).data?.data,r=t?.collections??[];return{data:{list:r.map(w),total:t?.total??r.length}}}let U=u({key:[...k,`user-collection-created`,B],initialPageParam:1,options:{staleTime:0,enabled:O},async queryFn(e){return ye(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),W=u({key:[...k,`user-collection-subscribed`,B],initialPageParam:1,options:{staleTime:0,enabled:O},async queryFn(e){return be(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),G=f(()=>V.data?.pages.flatMap(e=>e.data?.list??T)??T,[V.data]),K=f(()=>H.data?.pages.flatMap(e=>e.data?.list??T)??T,[H.data]),xe=f(()=>U.data?.pages.flatMap(e=>e.data?.list??T)??T,[U.data]),Se=f(()=>W.data?.pages.flatMap(e=>e.data?.list??T)??T,[W.data]),Ce=P===`video`?G:P===`post`?K:T,q=new Set(Ce.map(e=>e.id)),J=P===`video`?V:H,Y=F===`created`?U:W,we=F===`created`?xe:Se,X=P===`video`,Te=[...k,`user-collect-video`,B],Ee=[...k,`user-collect-post`,B],{mutateAsync:De,isPending:Z}=ne(async e=>await a({app_id:0,user_id:B,folder_id:``,content_type:X?1:2,content_ids:e})),Oe=()=>{L(!I),z(new Set)};d(()=>{z(new Set),P===`collection`&&L(!1)},[P]),d(()=>{A!==P&&j(P)},[P,A,j]),d(()=>{M!==F&&N(F)},[F,M,N]);let Q=e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ke=()=>{R.size===q.size&&q.size>0?z(new Set):z(new Set(q))},Ae=async()=>{if(!(R.size===0||Z)){if(!B){g.error(D(`collectTab.pleaseLogin`));return}try{let e=Array.from(R),t=await De(e);if(t.code===0){g.success(D(`collectTab.uncollectedSuccess`));let t=new Set(e);_e(X?Te:Ee,e=>ce(e,t)),z(new Set),L(!1)}else g.error(t.message||D(`collectTab.uncollectFailed`))}catch(e){console.error(`取消收藏失败`,e),g.error(D(`collectTab.operationFailed`))}}},$=async()=>{if(O){if(P===`collection`){await Y.fetchNextPage();return}await J.fetchNextPage()}};return h(o,{children:[h(o,{className:`flex justify-between items-center`,children:[m(s,{value:P,onValueChange:e=>{j(e)},children:h(c,{variant:`tag`,children:[m(l,{value:`video`,className:`text-sm`,children:D(`collectTab.video`)}),m(l,{value:`collection`,className:`text-sm`,children:D(`collectTab.collections`)})]})}),P===`collection`?m(se,{href:`/collection/create`,className:`flex items-center justify-center rounded-full text-text3 text-sm`,children:me(`components.pages.collectionCreate.form.create`)}):E&&m(e,{variant:`ghost`,size:`sm`,className:`h-6.25 px-0 text-sm text-text3`,onClick:Oe,children:D(I?`collectTab.cancel`:`collectTab.edit`)})]}),m(o,{className:`pt-2`,children:P===`video`?m(oe,{list:G,showVideoProgress:!1,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,emptyText:D(`collectTab.emptyContent`),isEditMode:I,selectedIds:R,onToggleSelection:Q}):P===`post`?m(ae,{list:K,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,emptyText:D(`collectTab.emptyContent`),isEditMode:I,selectedIds:R,onToggleSelection:Q}):m(ie,{list:we,loading:Y.isFetching,hasMore:Y.hasNextPage??!1,loadMore:$,emptyText:D(`collectTab.emptyContent`)})}),I&&P!==`collection`&&h(o,{style:{bottom:`calc(56px + env(safe-area-inset-bottom, 0px))`},className:`flex fixed z-10 left-0 w-full items-center justify-between px-3 py-2 bg-bg1 `,children:[h(o,{className:`flex items-center gap-2`,children:[m(ee,{checked:R.size===q.size&&q.size>0,onCheckedChange:ke}),m(te,{className:`text-sm text-text1`,children:D(`collectTab.selectAll`)})]}),m(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:R.size>0?`default`:`outline`,disabled:R.size===0||Z,onClick:Ae,children:D(Z?`collectTab.processing`:`collectTab.delete`)})]})]})}export{E as CollectTab};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{gCommunityGetSubscribedCollections as e,gCommunityGetUserCollections as t,gInteractionListCollects as n}from"../../../../../../../service/generated/client.mjs";import{HydrationBoundary as r}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{defaultPageSize as i}from"../../utils.mjs";import{CollectTab as a}from"./client.mjs";import{jsx as o}from"react/jsx-runtime";import s from"dayjs";function c({queryKeyPrefix:e,targetUserId:t,resolvedCollectTab:n,resolvedCollectCollectionTab:r,authConfig:i}){return t?n===`collection`?[{type:`infinite`,queryKey:r===`subscribed`?[...e,`user-collection-subscribed`,t]:[...e,`user-collection-created`,t],async queryFn(e){return r===`subscribed`?f({targetUserId:t,page:e,authConfig:i}):d({targetUserId:t,page:e,authConfig:i})},initialPageParam:1,getNextPageParam(){}}]:[{type:`infinite`,queryKey:n===`post`?[...e,`user-collect-post`,t]:[...e,`user-collect-video`,t],async queryFn(e){return u({targetUserId:t,page:e,contentType:1,authConfig:i})},initialPageParam:1,getNextPageParam(){}}]:[]}function l({prefetch:e,resolvedCollectTab:t=`video`,resolvedCollectCollectionTab:n=`created`,authConfig:i,...s}){return o(r,{prefetch:e??c({queryKeyPrefix:
|
|
2
|
+
import{gCommunityGetSubscribedCollections as e,gCommunityGetUserCollections as t,gInteractionListCollects as n}from"../../../../../../../service/generated/client.mjs";import{HydrationBoundary as r}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{defaultPageSize as i}from"../../utils.mjs";import{CollectTab as a}from"./client.mjs";import{jsx as o}from"react/jsx-runtime";import s from"dayjs";function c({queryKeyPrefix:e,targetUserId:t,resolvedCollectTab:n,resolvedCollectCollectionTab:r,authConfig:i}){return t?n===`collection`?[{type:`infinite`,queryKey:r===`subscribed`?[...e,`user-collection-subscribed`,t]:[...e,`user-collection-created`,t],async queryFn(e){return r===`subscribed`?f({targetUserId:t,page:e,authConfig:i}):d({targetUserId:t,page:e,authConfig:i})},initialPageParam:1,getNextPageParam(){}}]:[{type:`infinite`,queryKey:n===`post`?[...e,`user-collect-post`,t]:[...e,`user-collect-video`,t],async queryFn(e){return u({targetUserId:t,page:e,contentType:1,authConfig:i})},initialPageParam:1,getNextPageParam(){}}]:[]}function l({prefetch:e,resolvedCollectTab:t=`video`,resolvedCollectCollectionTab:n=`created`,authConfig:i,...s}){let{mode:l=`renderer`,...u}=s;return o(r,{prefetch:e??c({queryKeyPrefix:u.queryKeyPrefix??[],targetUserId:u.userId,resolvedCollectTab:t,resolvedCollectCollectionTab:n,authConfig:i}),children:o(a,{...u,mode:l})})}async function u({targetUserId:e,page:t,contentType:r,authConfig:a}){let o=await n({user_id:e,folder_id:``,content_type:r,page:t,page_size:i},a),s=o.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},c=r===1?(o.data?.video_infos??[]).map(e=>h(e,s)):(o.data?.post_infos??[]).map(e=>m(e,s));return{data:{list:c,total:o.data?.total??c.length}}}async function d({targetUserId:e,page:n,authConfig:r}){let a=await t({page:n,user_id:e,page_size:i},r),o=a.data?.data?.collections??[];return{data:{list:o.map(v),total:a.data?.data?.total??o.length}}}async function f({targetUserId:t,page:n,authConfig:r}){let a=(await e({page:n,user_id:t,page_size:i},r)).data?.data,o=a?.collections??[];return{data:{list:o.map(v),total:a?.total??o.length}}}function p(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function m(e,t){let n=t[e.content_id||``]?.create_time,r=p(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:s(n).toDate().getTime()}}function h(e,t){let n=t[e.id||``]?.create_time;return{is_more_link:e.is_more_link,id:e.id||``,title:e.name||``,coverImage:e.img_x||``,duration:Number(e.duration??0),authorName:e.up_user||e.source_username||``,viewCount:e.play_count??0,publishTime:s(n).toDate().getTime()}}function g(e){let t=p(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function _(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function v(e){let t=(e.contents??[]).slice(0,3).map(g),n=e.content_count??t.length;return{id:e.collection_id||``,title:e.title||``,contentCount:n,contents:n===0?_(e.collection_id||`collection`):t}}export{l as CollectTabServer,c as buildCollectTabPrefetch};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
import { MaterialComponentMode } from "../../../../../../../utils/schema/schema.mjs";
|
|
3
|
+
import "../../../../../../../utils/schema/index.mjs";
|
|
2
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
5
|
|
|
4
6
|
//#region components/biz/business/profile/profile-main/tabs/history-tab/client.d.ts
|
|
5
7
|
interface HistoryTabProps {
|
|
8
|
+
/** 渲染模式。 */
|
|
9
|
+
mode?: MaterialComponentMode;
|
|
6
10
|
/** 目标用户 ID。 */
|
|
7
11
|
targetUserId?: string;
|
|
8
12
|
/** Query Key 前缀 */
|
|
@@ -12,6 +16,7 @@ interface HistoryTabProps {
|
|
|
12
16
|
* 浏览历史 Tab
|
|
13
17
|
*/
|
|
14
18
|
declare function HistoryTab({
|
|
19
|
+
mode,
|
|
15
20
|
targetUserId,
|
|
16
21
|
queryKeyPrefix
|
|
17
22
|
}: HistoryTabProps): react_jsx_runtime0.JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionBatchClearBrowse as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as
|
|
2
|
+
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionBatchClearBrowse as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as c}from"../../../../../../../hooks/query/use-query.mjs";import{PostList as l}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as u}from"../../../../../../common/list/video-list/video-list.mjs";import{getHistoryData as ee,likeContentType as d}from"../../utils.mjs";import{useEffect as f,useMemo as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{toast as _}from"sonner";import{useTranslations as v}from"next-intl";import{parseAsString as y,useQueryState as b}from"nuqs";function x(e){let{detail:t}=e,{info:n,publish_time:r}=t;return{id:e.id,title:n.title||n.text||``,coverImage:n.cover_image_thumbnail||n.cover_image||n.cover_horizontal_image_thumbnail||void 0,publishTime:r}}function S(e){let{detail:t,content_play_progress:n}=e,{user_info:r,info:i,statics_cnt:a,publish_time:o,parent_content_info:s}=t;return{is_more_link:i.is_more_link,id:e.id,title:i.title||i.text||i.name||``,coverImage:i.cover_image_thumbnail||i.cover_image||i.cover_horizontal_image_thumbnail||``,duration:Number(i.video_duration??0),progress:n?.percent??0,seriesNum:n?.series_num,authorName:r.name,viewCount:i?.play_count??a?.browse_cnt??0,publishTime:o,type:s?.type}}function C(e,t,n){if(!e)return e;let r=0,i=e.pages.map(e=>({page:e,filteredList:(e.data?.list??[]).filter(e=>{let i=n(e)??``,a=t.has(i);return a&&(r+=1),!a})}));return{...e,pages:i.map(({page:e,filteredList:t})=>{if(!e.data)return e;let n=typeof e.data.total==`number`?Math.max(0,e.data.total-r):e.data.total;return{...e,data:{...e.data,list:t,total:n}}})}}const w=[`video`,`post`];function T({mode:T=`renderer`,targetUserId:E,queryKeyPrefix:D}){let O=v(`components.pages.profile.components.tabs`),k=T===`renderer`,A=D??[],[j,M]=b(`historyTab`,y.withDefault(`video`)),N=p(()=>w.includes(j)?j:`video`,[j]),[P,F]=m(!1),[I,L]=m(()=>new Set),R=t(e=>e.userId),z=c(),B=[...A,`user-history-video`],V=[...A,`user-history-post`],H=s({key:B,initialPageParam:1,async queryFn(e){return ee({targetUserId:E,page:e,contentType:d.video})},options:{staleTime:0,enabled:k},getNextPageParam(e,t){if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),U=s({key:V,initialPageParam:1,async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},options:{staleTime:0,enabled:k},getNextPageParam(e,t){if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),W=N===`video`?H:U,G=H.data?.pages.flatMap(e=>(e.data?.list??[]).map(S))??[],K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(x))??[],q=N===`video`?G:K,J=new Set(q.map(e=>e.id)),Y=N===`video`,{mutateAsync:X,isPending:Z}=o(async e=>await n({app_id:0,user_id:R,content_type:e.contentType,content_ids:e.contentIds}));f(()=>{L(new Set)},[N]),f(()=>{j!==N&&M(N)},[N,j,M]);let Q=e=>{L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},te=()=>{I.size===J.size&&J.size>0?L(new Set):L(new Set(J))},ne=async()=>{if(!(I.size===0||Z)){if(!R){_.error(O(`historyTab.pleaseLogin`));return}try{let e=Array.from(I),t=await X({contentIds:e,contentType:Y?1:2});if(t.code===0){_.success(O(`historyTab.historyDeletedSuccess`));let t=new Set(e);z(Y?B:V,e=>C(e,t,e=>e.id)),L(new Set),F(!1)}else _.error(t.message||O(`historyTab.deleteFailed`))}catch(e){console.error(`删除浏览记录失败`,e),_.error(O(`historyTab.operationFailed`))}}},$=async()=>{k&&await W.fetchNextPage()};return g(r,{children:[h(r,{className:``,children:N===`video`?h(u,{showVideoProgress:!0,list:G,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`historyTab.emptyContent`),isEditMode:P,selectedIds:I,onToggleSelection:Q}):h(l,{list:K,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`historyTab.emptyContent`),isEditMode:P,selectedIds:I,onToggleSelection:Q})}),P&&g(r,{style:{bottom:`calc(56px + env(safe-area-inset-bottom, 0px))`},className:`flex fixed z-10 left-0 w-full items-center justify-between px-3 py-2 bg-bg1 `,children:[g(r,{className:`flex items-center gap-2`,children:[h(i,{checked:I.size===J.size&&J.size>0,onCheckedChange:te}),h(a,{className:`text-sm text-text1`,children:O(`historyTab.selectAll`)})]}),h(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:I.size>0?`default`:`outline`,disabled:I.size===0||Z,onClick:ne,children:O(Z?`historyTab.processing`:`historyTab.delete`)})]})]})}export{T as HistoryTab};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{HydrationBoundary as e}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{getHistoryData as t,likeContentType as n}from"../../utils.mjs";import{HistoryTab as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";function a({queryKeyPrefix:e,targetUserId:r,resolvedHistoryTab:i,authConfig:a}){return r?[{type:`infinite`,queryKey:i===`post`?[...e,`user-history-post`]:[...e,`user-history-video`],async queryFn(e){return t({targetUserId:r,page:e,contentType:n.video,authConfig:a})},initialPageParam:1,getNextPageParam(){}}]:[]}function o({prefetch:t,resolvedHistoryTab:n=`video`,authConfig:o,...s}){return i(e,{prefetch:t??a({queryKeyPrefix:
|
|
2
|
+
import{HydrationBoundary as e}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{getHistoryData as t,likeContentType as n}from"../../utils.mjs";import{HistoryTab as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";function a({queryKeyPrefix:e,targetUserId:r,resolvedHistoryTab:i,authConfig:a}){return r?[{type:`infinite`,queryKey:i===`post`?[...e,`user-history-post`]:[...e,`user-history-video`],async queryFn(e){return t({targetUserId:r,page:e,contentType:n.video,authConfig:a})},initialPageParam:1,getNextPageParam(){}}]:[]}function o({prefetch:t,resolvedHistoryTab:n=`video`,authConfig:o,...s}){let{mode:c=`renderer`,...l}=s;return i(e,{prefetch:t??a({queryKeyPrefix:l.queryKeyPrefix??[],targetUserId:l.targetUserId,resolvedHistoryTab:n,authConfig:o}),children:i(r,{...l,mode:c})})}export{o as HistoryTabServer,a as buildHistoryTabPrefetch};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
|
|
2
|
+
import { MaterialComponentMode } from "../../../../../../../utils/schema/schema.mjs";
|
|
3
|
+
import "../../../../../../../utils/schema/index.mjs";
|
|
2
4
|
import { CommunityContentInfo } from "../../../../../../../types.mjs";
|
|
3
5
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
6
|
|
|
@@ -60,6 +62,8 @@ interface LikeDetailItem {
|
|
|
60
62
|
is_more_link?: boolean;
|
|
61
63
|
}
|
|
62
64
|
interface LikeTabProps {
|
|
65
|
+
/** 渲染模式。 */
|
|
66
|
+
mode?: MaterialComponentMode;
|
|
63
67
|
/** 目标用户 ID。 */
|
|
64
68
|
targetUserId?: string;
|
|
65
69
|
/** Query Key 前缀 */
|
|
@@ -68,6 +72,7 @@ interface LikeTabProps {
|
|
|
68
72
|
isMine?: boolean;
|
|
69
73
|
}
|
|
70
74
|
declare function LikeTab({
|
|
75
|
+
mode,
|
|
71
76
|
targetUserId,
|
|
72
77
|
queryKeyPrefix,
|
|
73
78
|
isMine
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionUnifiedBatchLikeDislike as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as c}from"../../../../../../../hooks/query/use-query.mjs";import{
|
|
2
|
+
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionUnifiedBatchLikeDislike as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as c}from"../../../../../../../hooks/query/use-query.mjs";import{PostList as l}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as u}from"../../../../../../common/list/video-list/video-list.mjs";import{getLikeData as d,likeContentType as f}from"../../utils.mjs";import{useEffect as p,useMemo as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{toast as v}from"sonner";import{useTranslations as y}from"next-intl";import{parseAsString as ee,useQueryState as b}from"nuqs";function x(e,t,n){if(!e)return e;let r=0,i=e.pages.map(e=>({page:e,filteredList:(e.data?.list??[]).filter(e=>{let i=n(e)??``,a=t.has(i);return a&&(r+=1),!a})}));return{...e,pages:i.map(({page:e,filteredList:t})=>{if(!e.data)return e;let n=typeof e.data.total==`number`?Math.max(0,e.data.total-r):e.data.total;return{...e,data:{...e.data,list:t,total:n}}})}}function S(e){let{detail:t}=e,{info:n,publish_time:r}=t;return{id:e.id,title:n?.name||n?.text||n?.content||``,coverImage:n?.cover_image_thumbnail||n?.cover_image||n?.cover_horizontal_image_thumbnail||``,publishTime:r??0}}function C(e){let{detail:t}=e,{user_info:n,info:r,statics_cnt:i,publish_time:a,parent_content_info:o}=t;return{id:e.id,is_more_link:r?.is_more_link||!1,title:r?.name||r?.text||r?.content||``,coverImage:r?.cover_image_thumbnail||r?.cover_image||r?.cover_horizontal_image_thumbnail||``,duration:Number(r?.video_duration??0),progress:e.content_play_progress?.percent??0,seriesNum:e.content_play_progress?.series_num,authorName:n?.name||``,viewCount:r?.play_count??i?.browse_cnt??0,publishTime:a??0,type:o?.type}}const w=[`video`,`post`];function T({mode:T=`renderer`,targetUserId:E,queryKeyPrefix:D,isMine:te=!1}){let O=y(`components.pages.profile.components.tabs`),k=T===`renderer`,A=D??[],[j,M]=b(`likeTab`,ee.withDefault(`video`)),N=m(()=>w.includes(j)?j:`video`,[j]),[P,F]=h(!1),[I,L]=h(()=>new Set),R=t(e=>e.userId),z=c(),B=[...A,`user-like-video`],V=[...A,`user-like-post`],H=s({key:B,initialPageParam:1,async queryFn(e){return d({targetUserId:E,page:e,contentType:f.video})},options:{staleTime:0,enabled:k},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}});console.log({videoData:H});let U=s({key:V,options:{staleTime:0,enabled:k},initialPageParam:1,async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),W=N===`video`?H:U,G=H.data?.pages.flatMap(e=>(e.data?.list??[]).map(C))??[],K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(S))??[],q=N===`video`?G:K,J=new Set(q.map(e=>e.id)),Y=N===`video`,{mutateAsync:X,isPending:Z}=o(async e=>await n({app_id:0,user_id:R,action:`cancel_like`,content_ids:e,content_type:Y?1:2}));p(()=>{L(new Set)},[N]),p(()=>{j!==N&&M(N)},[N,j,M]);let Q=e=>{L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ne=()=>{I.size===J.size&&J.size>0?L(new Set):L(new Set(J))},re=async()=>{if(!(I.size===0||Z)){if(!R){v.error(O(`likeTab.pleaseLogin`));return}try{let e=Array.from(I),t=await X(e);if(t.code===0){v.success(O(`likeTab.unlikedSuccess`));let t=new Set(e);z(Y?B:V,e=>x(e,t,e=>e.id)),L(new Set),F(!1)}else v.error(t.message||O(`likeTab.unlikeFailed`))}catch(e){console.error(`取消点赞失败`,e),v.error(O(`likeTab.operationFailed`))}}},$=async()=>{k&&await W.fetchNextPage()};return _(r,{children:[g(r,{className:``,children:N===`video`?g(u,{list:G,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`likeTab.emptyContent`),isEditMode:P,selectedIds:I,showVideoProgress:!1,onToggleSelection:Q}):g(l,{list:K,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`likeTab.emptyContent`),isEditMode:P,selectedIds:I,onToggleSelection:Q})}),P&&_(r,{style:{bottom:`calc(56px + env(safe-area-inset-bottom, 0px))`},className:`flex fixed z-10 left-0 w-full items-center justify-between px-3 py-2 bg-bg1 `,children:[_(r,{className:`flex items-center gap-2`,children:[g(i,{checked:I.size===J.size&&J.size>0,onCheckedChange:ne}),g(a,{className:`text-sm text-text1`,children:O(`likeTab.selectAll`)})]}),g(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:I.size>0?`default`:`outline`,disabled:I.size===0||Z,onClick:re,children:O(Z?`likeTab.processing`:`likeTab.delete`)})]})]})}export{T as LikeTab};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{HydrationBoundary as e}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{getLikeData as t,likeContentType as n}from"../../utils.mjs";import{LikeTab as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";function a({queryKeyPrefix:e,targetUserId:r,resolvedLikeTab:i}){return r?[{type:`infinite`,queryKey:i===`post`?[...e,`user-like-post`]:[...e,`user-like-video`],async queryFn(e){return t({targetUserId:r,page:e,contentType:n.video})},initialPageParam:1,getNextPageParam(){}}]:[]}function o({prefetch:t,resolvedLikeTab:n=`video`,...o}){return i(e,{prefetch:t??a({queryKeyPrefix:
|
|
2
|
+
import{HydrationBoundary as e}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{getLikeData as t,likeContentType as n}from"../../utils.mjs";import{LikeTab as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";function a({queryKeyPrefix:e,targetUserId:r,resolvedLikeTab:i}){return r?[{type:`infinite`,queryKey:i===`post`?[...e,`user-like-post`]:[...e,`user-like-video`],async queryFn(e){return t({targetUserId:r,page:e,contentType:n.video})},initialPageParam:1,getNextPageParam(){}}]:[]}function o({prefetch:t,resolvedLikeTab:n=`video`,...o}){let{mode:s=`renderer`,...c}=o;return i(e,{prefetch:t??a({queryKeyPrefix:c.queryKeyPrefix??[],targetUserId:c.targetUserId,resolvedLikeTab:n}),children:i(r,{...c,mode:s})})}export{o as LikeTabServer,a as buildLikeTabPrefetch};
|