@funhub/platform 0.1.13 → 0.1.15
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/dist/assets/icons/detail/check-ok.mjs +2 -0
- package/dist/assets/icons/share/share-link.mjs +2 -0
- package/dist/biz.d.mts +9 -1
- package/dist/biz.mjs +1 -1
- package/dist/common.d.mts +3 -1
- package/dist/common.mjs +1 -1
- package/dist/components/biz/business/banner/index.d.mts +3 -0
- package/dist/components/biz/business/banner/variants/basic-banner/defaults/default-props.mjs +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/defaults/mock-data.mjs +2 -0
- package/dist/components/biz/business/banner/variants/basic-banner/index.d.mts +4 -1
- package/dist/components/biz/business/banner/variants/basic-banner/index.mjs +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/inspector-schema.d.mts +32 -0
- package/dist/components/biz/business/banner/variants/basic-banner/inspector-schema.mjs +2 -0
- package/dist/components/biz/business/banner/variants/basic-banner/material.d.mts +21 -0
- package/dist/components/biz/business/banner/variants/basic-banner/material.mjs +2 -0
- package/dist/components/biz/business/banner/variants/basic-banner/server.d.mts +19 -0
- package/dist/components/biz/business/banner/variants/basic-banner/server.mjs +2 -0
- package/dist/components/biz/business/comment/comment-input.mjs +1 -1
- package/dist/components/biz/business/detail/detail-info-tags.mjs +2 -0
- package/dist/components/biz/business/detail/detail-info-title.mjs +2 -0
- package/dist/components/biz/business/detail/detail-introduction.mjs +1 -1
- package/dist/components/biz/business/detail/detail-operate.mjs +1 -1
- package/dist/components/biz/business/detail/materials/registry.d.mts +61 -0
- package/dist/components/biz/business/detail/materials/registry.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-actions/client.d.mts +14 -0
- package/dist/components/biz/business/detail/materials/video-detail-actions/client.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-actions/index.d.mts +5 -0
- package/dist/components/biz/business/detail/materials/video-detail-actions/material.d.mts +4 -0
- package/dist/components/biz/business/detail/materials/video-detail-actions/material.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-actions/schema.d.mts +14 -0
- package/dist/components/biz/business/detail/materials/video-detail-actions/schema.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-actions/server.d.mts +11 -0
- package/dist/components/biz/business/detail/materials/video-detail-actions/server.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-info/client.d.mts +18 -0
- package/dist/components/biz/business/detail/materials/video-detail-info/client.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-info/index.d.mts +5 -0
- package/dist/components/biz/business/detail/materials/video-detail-info/material.d.mts +5 -0
- package/dist/components/biz/business/detail/materials/video-detail-info/material.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-info/schema.d.mts +17 -0
- package/dist/components/biz/business/detail/materials/video-detail-info/schema.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-info/server.d.mts +11 -0
- package/dist/components/biz/business/detail/materials/video-detail-info/server.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title/client.d.mts +12 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title/client.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title/index.d.mts +5 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title/material.d.mts +4 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title/material.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title/schema.d.mts +14 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title/schema.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title/server.d.mts +11 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title/server.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.d.mts +16 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/index.d.mts +5 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/material.d.mts +5 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/material.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/schema.d.mts +17 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/schema.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/server.d.mts +11 -0
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/server.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-player/client.d.mts +16 -0
- package/dist/components/biz/business/detail/materials/video-detail-player/client.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-player/index.d.mts +5 -0
- package/dist/components/biz/business/detail/materials/video-detail-player/material.d.mts +4 -0
- package/dist/components/biz/business/detail/materials/video-detail-player/material.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-player/schema.d.mts +14 -0
- package/dist/components/biz/business/detail/materials/video-detail-player/schema.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-player/server.d.mts +11 -0
- package/dist/components/biz/business/detail/materials/video-detail-player/server.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-recommend/client.d.mts +11 -0
- package/dist/components/biz/business/detail/materials/video-detail-recommend/client.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-recommend/index.d.mts +5 -0
- package/dist/components/biz/business/detail/materials/video-detail-recommend/material.d.mts +5 -0
- package/dist/components/biz/business/detail/materials/video-detail-recommend/material.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.d.mts +36 -0
- package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-recommend/server.d.mts +11 -0
- package/dist/components/biz/business/detail/materials/video-detail-recommend/server.mjs +2 -0
- package/dist/components/biz/business/detail/materials/video-detail-recommend/utils.mjs +2 -0
- package/dist/components/biz/business/index.d.mts +3 -0
- package/dist/components/biz/business/index.mjs +1 -1
- package/dist/components/biz/example/button/client.d.mts +8 -0
- package/dist/components/biz/example/button/client.mjs +2 -0
- package/dist/components/biz/example/button/index.d.mts +5 -0
- package/dist/components/biz/example/button/material.d.mts +22 -0
- package/dist/components/biz/example/button/material.mjs +2 -0
- package/dist/components/biz/example/button/schema.d.mts +38 -0
- package/dist/components/biz/example/button/schema.mjs +2 -0
- package/dist/components/biz/example/button/server.d.mts +8 -0
- package/dist/components/biz/example/button/server.mjs +2 -0
- package/dist/components/biz/example/button/variants.mjs +2 -0
- package/dist/components/biz/utils/transformers/data.d.mts +3 -3
- package/dist/components/common/app-context/index.d.mts +19 -0
- package/dist/components/common/app-context/index.mjs +2 -0
- package/dist/components/common/app-context/provider.mjs +2 -0
- package/dist/components/common/cards/mini-three-card.d.mts +4 -1
- package/dist/components/common/cards/mini-three-card.mjs +1 -1
- package/dist/components/common/collection-popup/collection-create-modal.mjs +2 -0
- package/dist/components/common/collection-popup/index.mjs +1 -1
- package/dist/components/common/image-crop-modal/image-crop-modal.mjs +2 -2
- package/dist/components/common/intl-provider.d.mts +25 -0
- package/dist/components/common/intl-provider.mjs +2 -0
- package/dist/components/common/list/post-list/post-list.mjs +1 -1
- package/dist/components/common/list/video-list/video-list.mjs +1 -1
- package/dist/components/common/picker/gender-picker/gender-picker.d.mts +8 -2
- package/dist/components/common/picker/gender-picker/gender-picker.mjs +1 -1
- package/dist/components/common/picker/picker-drawer/picker-drawer.mjs +1 -1
- package/dist/components/common/share-popup/share-popup.d.mts +42 -0
- package/dist/components/common/share-popup/share-popup.mjs +1 -1
- package/dist/components/pages/edit/page.mjs +1 -1
- package/dist/components/pages/feedback/_components/feedback-form.mjs +1 -1
- package/dist/components/pages/login/agreement-dialog.mjs +2 -0
- package/dist/components/pages/login/forgot.mjs +1 -1
- package/dist/components/pages/login/login-client.mjs +1 -1
- package/dist/components/pages/login/password.mjs +1 -1
- package/dist/components/pages/login/register.mjs +1 -1
- package/dist/components/pages/login/reset-password.mjs +1 -1
- package/dist/components/pages/login/verify.mjs +2 -2
- package/dist/components/pages/profile/_components/tabs/collect-tab/client.mjs +2 -0
- package/dist/components/pages/profile/_components/tabs/collect-tab/server.mjs +2 -0
- package/dist/components/pages/profile/_components/tabs/history-tab/client.mjs +2 -0
- package/dist/components/pages/profile/_components/tabs/history-tab/server.mjs +2 -0
- package/dist/components/pages/profile/_components/tabs/like-tab/client.mjs +2 -0
- package/dist/components/pages/profile/_components/tabs/like-tab/server.mjs +2 -0
- package/dist/components/pages/profile/_components/tabs/publish-tab/client.mjs +2 -0
- package/dist/components/pages/profile/_components/tabs/publish-tab/server.mjs +2 -0
- package/dist/components/pages/profile/_components/user-profile-container/client.mjs +2 -0
- package/dist/components/pages/profile/_components/user-profile-header/client.mjs +2 -0
- package/dist/components/pages/profile/_components/user-profile-header/server.mjs +2 -0
- package/dist/components/pages/profile/_components/user-profile-header/user-profile-avatar.mjs +2 -0
- package/dist/components/pages/profile/_components/user-profile-header/user-profile-cover-background.mjs +2 -0
- package/dist/components/pages/profile/_components/user-profile-main/server.mjs +2 -0
- package/dist/components/pages/profile/_components/user-profile-main/shell.mjs +2 -0
- package/dist/components/pages/profile/{client.d.mts → layout.d.mts} +4 -3
- package/dist/components/pages/profile/layout.mjs +2 -0
- package/dist/components/pages/profile/page.d.mts +3 -3
- package/dist/components/pages/profile/page.mjs +1 -1
- package/dist/components/pages/profile/utils.mjs +1 -1
- package/dist/components/pages/settings/_components/reset-password-drawer.mjs +1 -1
- package/dist/components/pages/settings/_components/settings.mjs +1 -1
- package/dist/components/pages/video-detail/index.d.mts +1 -0
- package/dist/components/pages/video-detail/page.d.mts +4 -1
- package/dist/components/pages/video-detail/page.mjs +1 -1
- package/dist/components/pages/video-detail/video-detail-client.d.mts +13 -0
- package/dist/components/pages/video-detail/video-detail-client.mjs +1 -1
- package/dist/components/ui/alert-dialog.mjs +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button.d.mts +1 -1
- package/dist/components/ui/image.d.mts +4 -4
- package/dist/components/ui/popup.mjs +1 -1
- package/dist/components/ui/sheet.d.mts +7 -1
- package/dist/components/ui/sheet.mjs +1 -1
- package/dist/hooks/app-context.d.mts +20 -0
- package/dist/hooks/app-context.mjs +2 -0
- package/dist/hooks/get-app-context.d.mts +19 -0
- package/dist/hooks/get-app-context.mjs +2 -0
- package/dist/hooks/use-app-context/index.d.mts +14 -0
- package/dist/hooks/use-app-context/index.mjs +2 -0
- package/dist/hooks/use-content-operate.mjs +1 -1
- package/dist/hooks.d.mts +4 -1
- package/dist/hooks.mjs +1 -1
- package/dist/i18n/locales/en.mjs +1 -1
- package/dist/i18n/locales/zh-CN.mjs +1 -1
- package/dist/i18n.d.mts +5 -1
- package/dist/i18n.mjs +1 -1
- package/dist/materials.d.mts +4 -0
- package/dist/materials.mjs +2 -0
- package/dist/pages.d.mts +2 -1
- package/dist/service/generated/client.d.mts +1 -1
- package/dist/service/generated/tanstack.d.mts +1 -1
- package/dist/utils/schema/index.d.mts +4 -0
- package/dist/utils/schema/inspector.d.mts +117 -0
- package/dist/utils/schema/material.d.mts +46 -0
- package/dist/utils/schema/material.mjs +2 -0
- package/dist/utils/schema/schema.d.mts +105 -0
- package/dist/utils/schema/schema.mjs +2 -0
- package/dist/utils/schema/utils.d.mts +17 -0
- package/dist/utils/schema/utils.mjs +2 -0
- package/dist/utils/share-manager.mjs +1 -1
- package/dist/utils.d.mts +6 -2
- package/dist/utils.mjs +1 -1
- package/package.json +5 -1
- package/dist/assets/icons/share/share-collect-sel.mjs +0 -2
- package/dist/assets/icons/share/share-collect.mjs +0 -2
- package/dist/assets/icons/share/share-qq.mjs +0 -2
- package/dist/assets/icons/share/share-wechat.mjs +0 -2
- package/dist/assets/icons/share/share-wecircle.mjs +0 -2
- package/dist/components/biz/business/detail/detail-guess-like.mjs +0 -2
- package/dist/components/biz/business/detail/detail-popular-comments.mjs +0 -2
- package/dist/components/biz/business/detail/detail-tabs.mjs +0 -2
- package/dist/components/pages/profile/_components/tabs/collect-tab/collect-tab.mjs +0 -2
- package/dist/components/pages/profile/_components/tabs/history-tab/history-tab.mjs +0 -2
- package/dist/components/pages/profile/_components/tabs/like-tab/like-tab.mjs +0 -2
- package/dist/components/pages/profile/_components/tabs/publish-tab/publish-tab.mjs +0 -2
- package/dist/components/pages/profile/_components/user-profile-cover-background.mjs +0 -2
- package/dist/components/pages/profile/_components/user-profile-header.mjs +0 -2
- package/dist/components/pages/profile/_components/user-profile-main.mjs +0 -2
- package/dist/components/pages/profile/client.mjs +0 -2
- package/dist/components/ui/legacy/avatar.mjs +0 -2
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
4
|
//#region components/biz/utils/transformers/data.d.ts
|
|
5
|
-
declare enum ComponentType {
|
|
5
|
+
declare enum ComponentType$1 {
|
|
6
6
|
Banner = 1,
|
|
7
7
|
CardGrid = 2,
|
|
8
8
|
FeatureGrid = 3,
|
|
9
9
|
RecommendedUsers = 4
|
|
10
10
|
}
|
|
11
11
|
interface ContentBlockItem {
|
|
12
|
-
type: ComponentType;
|
|
12
|
+
type: ComponentType$1;
|
|
13
13
|
data: Record<string, any>;
|
|
14
14
|
id: string;
|
|
15
15
|
cn_name: string;
|
|
@@ -37,4 +37,4 @@ interface ExtractedDataItem {
|
|
|
37
37
|
*/
|
|
38
38
|
declare function extractDataByComponentType(contentBlocks: ContentBlockItem[], isPGC: boolean): ExtractedDataItem[];
|
|
39
39
|
//#endregion
|
|
40
|
-
export { ComponentType, ContentBlockItem, ExtractedDataItem, extractDataByComponentType };
|
|
40
|
+
export { ComponentType$1 as ComponentType, ContentBlockItem, ExtractedDataItem, extractDataByComponentType };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { AppContextValue } from "../../../hooks/app-context.mjs";
|
|
3
|
+
import { PropsWithChildren } from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region components/common/app-context/index.d.ts
|
|
7
|
+
type AppContextProps = PropsWithChildren<{
|
|
8
|
+
value: AppContextValue;
|
|
9
|
+
context?: never;
|
|
10
|
+
} | {
|
|
11
|
+
value?: never;
|
|
12
|
+
context: AppContextValue;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* 应用上下文入口,仅建议在页面根部使用。
|
|
16
|
+
*/
|
|
17
|
+
declare function AppContext(props: AppContextProps): react_jsx_runtime0.JSX.Element;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { AppContext, AppContextProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{defaultAppContextValue as e}from"../../../hooks/app-context.mjs";import{provideAppContext as t}from"../../../hooks/get-app-context.mjs";import{AppContextClientProvider as n}from"./provider.mjs";import{jsx as r}from"react/jsx-runtime";function i(i){let{children:a}=i,o=(`value`in i?i.value:i.context)??e;return t(o),r(n,{value:o,children:a})}export{i as AppContext};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{appContextCookieKey as e,lockAppContext as t,normalizeAppContextValue as n}from"../../../hooks/app-context.mjs";import{AppModeContext as r}from"../../../hooks/use-app-context/index.mjs";import{createContext as i,use as a,useEffect as o}from"react";import{Fragment as s,jsx as c}from"react/jsx-runtime";const l=i(!1);function u(t){typeof document>`u`||(document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=31536000; samesite=lax`)}function d(e){let{children:i,value:d}=e,f=n(d);t(f);let p=a(l);return o(()=>{u(f)},[f]),p?c(s,{children:i}):c(l,{value:!0,children:c(r,{value:f,children:i})})}export{d as AppContextClientProvider};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { ReactNode } from "react";
|
|
2
|
+
import { CSSProperties, ReactNode } from "react";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region components/common/cards/mini-three-card.d.ts
|
|
@@ -12,6 +12,7 @@ declare function MiniThreeCard({
|
|
|
12
12
|
showText,
|
|
13
13
|
imagePriority,
|
|
14
14
|
className,
|
|
15
|
+
style,
|
|
15
16
|
textChild,
|
|
16
17
|
topChild,
|
|
17
18
|
bottomChild,
|
|
@@ -29,6 +30,8 @@ interface MiniThreeCardProps {
|
|
|
29
30
|
text?: string;
|
|
30
31
|
/** 根节点追加类名。 */
|
|
31
32
|
className?: string;
|
|
33
|
+
/** 自定义样式。 */
|
|
34
|
+
style?: CSSProperties;
|
|
32
35
|
/** 是否展示标题区域。 */
|
|
33
36
|
showText?: boolean;
|
|
34
37
|
/** 是否启用 Next Image 优先加载。 */
|
|
@@ -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 n from"./style.module.mjs";import{jsx as r,jsxs as i}from"react/jsx-runtime";import a from"next/link";function o({url:o,text:s,showText:c=!0,imagePriority:l=!1,className:u,
|
|
2
|
+
"use client";import{Image as e}from"../../ui/image.mjs";import{Box as t}from"../../ui/box.mjs";import n from"./style.module.mjs";import{jsx as r,jsxs as i}from"react/jsx-runtime";import a from"next/link";function o({url:o,text:s,showText:c=!0,imagePriority:l=!1,className:u,style:d,textChild:f,topChild:p,bottomChild:m,topLeftChild:h,topRightChild:g,bottomLeftChild:_,bottomRightChild:v,linkPath:y=``,onClick:b}){return i(a,{href:y||`javascript:void(0)`,className:`w-[33.333333%] mb-[16px] ${n.miniThreeCard} ${u||``}`,style:d,suppressHydrationWarning:!0,onClick:e=>{y||e.preventDefault(),b?.()},children:[i(t,{className:`w-full pb-[134.62%] bg-bg2 relative rounded-[8px] flex flex-col items-start justify-between overflow-hidden`,children:[r(e,{src:o,fill:!0,alt:s||``,objectFit:`cover`,priority:l}),p||(h||g)&&i(t,{className:`w-full flex items-center justify-between absolute top-0 left-0 z-[1]`,children:[h||r(t,{}),g||r(t,{})]}),m||(_||v)&&i(t,{className:`w-full h-[28px] flex items-center justify-between absolute bottom-0 left-0 z-[1]`,style:{background:`linear-gradient( 360deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%)`},children:[_||r(t,{}),v||r(t,{})]})]}),c&&(f||r(`h3`,{className:`text-text1 text-[16px] h-[24px] leading-[24px] mt-[4px] line-clamp-1`,children:s||``}))]})}export{o as MiniThreeCard};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{pCommunityCreateCollection as t}from"../../../service/generated/client.mjs";import{InputGroup as n,InputGroupAddon as r,InputGroupInput as i}from"../../ui/input-group.mjs";import{useDeleteRequest as a}from"../../../hooks/query/use-query.mjs";import o from"../../ui/popup.mjs";import{useCallback as s,useEffect as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{toast as f}from"sonner";import{useTranslations as p}from"next-intl";function m({visible:m,onClose:h,onCreated:g}){let _=p(`components.pages.collectionCreate`),v=p(`components.common.collectionPopup`),{userId:y}=e(),b=a(),[x,S]=l(!1),[C,w]=l({title:``}),T=typeof document>`u`?void 0:document.body;c(()=>{m&&w({title:``})},[m]);let E=s((e,t)=>{w(n=>({...n,[e]:t}))},[]);function D(e){e||h?.()}async function O(){if(x)return;let e=C.title.trim();if(!e){f.error(_(`form.titleRequired`));return}try{S(!0);let n=await t({title:e,cover_image:``});if(n.code===0){f.success(_(`form.createSuccess`)),y&&b([`user-profile`,`mine`,y,`user-collection-created`,y]),g?.();return}f.error(n.message||_(`form.createFailed`))}catch(e){console.error(`创建收藏夹失败`,e),f.error(_(`form.createFailed`))}finally{S(!1)}}return u(o,{open:m,onOpenChange:D,showCloseButton:!1,className:`!z-[1210] h-[260px] rounded-t-[16px] bg-bg1 p-0 text-text1`,overlayClassName:`!z-[1200] bg-black/30`,overlayForceRender:!0,portalContainer:T,children:d(`div`,{className:`bg-bg1 h-[260px] flex flex-col`,children:[u(`div`,{className:`w-full px-[20px]`,children:d(`div`,{className:`w-full h-[56px] flex items-center justify-between`,children:[u(`div`,{className:`text-[18px] text-text1 font-medium`,children:v(`createModalTitle`)}),u(`button`,{type:`button`,className:`h-[56px] text-[16px] text-theme5 font-semibold disabled:text-text3`,onClick:O,disabled:x,children:x?_(`form.creating`):v(`createModalAction`)})]})}),u(`div`,{className:`w-full px-[20px] pt-[12px]`,children:d(n,{className:`!bg-bg2 h-[48px] rounded-[8px] px-[16px]`,children:[u(r,{className:`!text-text1 text-[16px] font-semibold pl-0 pr-2`,align:`inline-start`,children:_(`form.label`)}),u(i,{maxLength:50,className:`!text-text2 text-[16px] text-right placeholder:!text-text3`,placeholder:_(`form.titlePlaceholder`),value:C.title,onChange:e=>E(`title`,e.target.value)})]})})]})})}export{m as CollectionCreateModal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{createStore as e}from"../../../store/create-store.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetUserCollections as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{InfiniteScroll as i}from"../../ui/infinite-scroll.mjs";import a from"../../../assets/icons/close.mjs";import o from"../../../assets/icons/common/right_arrow.mjs";import s from"../../../assets/icons/detail/min-collection.mjs";import c from"../../../assets/icons/empty/img-empty-nodata.mjs";import l from"
|
|
2
|
+
"use client";import{createStore as e}from"../../../store/create-store.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetUserCollections as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{InfiniteScroll as i}from"../../ui/infinite-scroll.mjs";import a from"../../../assets/icons/close.mjs";import o from"../../../assets/icons/common/right_arrow.mjs";import s from"../../../assets/icons/detail/min-collection.mjs";import c from"../../../assets/icons/empty/img-empty-nodata.mjs";import l from"../../ui/popup.mjs";import{CollectionCreateModal as u}from"./collection-create-modal.mjs";import d from"../page-loading/index.mjs";import{useCallback as f,useEffect as p,useMemo as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useTranslations as b}from"next-intl";const x=e(e=>({isOpen:!1,options:null,open:t=>e(e=>({...e,isOpen:!0,options:t})),close:()=>e(e=>({...e,isOpen:!1,options:null}))}),{name:`collection-popup-store`,persist:!1});function S(e){return{id:String(e?.collection_id||``),cover:e?.cover_image||``,title:e?.title||``,contentCount:Number(e?.content_count||0)}}function C(e){let x=b(`components.common.collectionPopup`),{visible:C,mode:w=`favorite`,onClose:T,toCreateCollection:E,onCollect:D}=e,{userInfo:O,userId:k}=t(),[A,j]=h(!0),[M,N]=h([]),[P,F]=h(!0),[I,L]=h(1),[R,z]=h(!1),B=m(()=>String(k||O?.userId||`0`),[k,O?.userId]),V=f(async e=>{if(!B||!e?.reset&&(!P||A&&M.length>0))return;let t=e?.nextPage??I;j(!0);try{let e=await n({page:t,page_size:10});if(e.code!==0){F(!1);return}let r=(e.data?.data?.collections??[]).map(S);N(e=>t===1?r:[...e,...r]),e.data?.data?.has_more===!1||r.length<10?F(!1):(F(!0),L(t+1))}catch(e){console.error(`获取合集列表失败:`,e),F(!1)}finally{j(!1)}},[M.length,P,A,I,10,B]);p(()=>{C&&V()},[V,C]);let[H,U]=h(!0);p(()=>{U(!A&&M.length===0)},[M.length,A]);function W(e){e||T?.()}function G(){if(w===`select`){z(!0);return}E?.()}function K(e){D?.(e),w===`favorite`&&y.message(x(`collectSuccess`))}function q(e){return function(){K(e)}}function J(){return V()}let Y=f(()=>{F(!0),L(1),N([]),V({nextPage:1,reset:!0})},[V]);return v(l,{open:C,onOpenChange:W,showCloseButton:!1,className:`z-[1000] h-[450px] rounded-t-[16px] bg-bg1 p-0 text-text1`,children:[v(`div`,{className:`bg-bg1 h-[450px] pb-[24px] flex flex-col`,children:[v(`div`,{className:`w-full px-[16px] relative`,children:[v(`div`,{className:`w-full h-[60px] flex items-center justify-center`,children:[_(`button`,{type:`button`,className:`cursor-pointer absolute w-[48px] h-[60px] left-0 top-0 flex items-center justify-center focus:outline-none`,onClick:T,children:_(a,{className:`w-[16px] h-[16px] text-text1`})}),_(`div`,{className:`text-[18px] text-text1 font-semibold`,children:x(w===`select`?`selectTitle`:`favoriteToCollectionTitle`)}),w===`select`&&_(`button`,{type:`button`,className:`absolute right-0 top-0 h-[60px] px-[16px] text-[14px] text-theme5 font-semibold`,onClick:G,children:x(`newCollection`)})]}),w===`favorite`&&v(`button`,{type:`button`,className:`cursor-pointer w-full h-[48px] rounded-[16px] px-[12px] border border-solid border-line1 flex items-center justify-between`,onClick:G,children:[v(`div`,{className:`flex items-center`,children:[_(s,{className:`w-[24px] h-[24px]`}),_(`span`,{className:`ml-[8px] text-text1 text-[14px] font-semibold leading-[18px]`,children:x(`createCollection`)})]}),_(o,{className:`text-text2 w-[12px] h-[12px]`})]})]}),_(`div`,{className:`w-full px-[16px] flex-1 h-[0] overflow-y-auto`,children:A?_(d,{}):H?v(`div`,{className:`flex flex-col items-center justify-center py-[48px] text-text2`,children:[_(c,{className:`w-[120px] h-[120px]`}),v(`span`,{className:`mt-[16px] text-[14px]`,children:[x(`noCollections`),`,`,x(`createCollectionHint`)]})]}):v(g,{children:[M.map((e,t)=>v(`button`,{type:`button`,className:`cursor-pointer w-full h-[92px] flex items-center text-left`,onClick:q(e.id),children:[_(`div`,{className:`w-[60px] h-[60px] bg-bg2 rounded-[8px] overflow-hidden relative`,children:e.cover&&_(r,{src:e.cover,fill:!0,objectFit:`cover`,alt:x(`coverAlt`)})}),v(`div`,{className:`ml-[12px] flex flex-col justify-center`,children:[_(`span`,{className:`max-w-[200px] text-text1 text-[18px] leading-[24px] font-semibold line-clamp-1`,children:e.title||``}),v(`span`,{className:`mt-[3px] text-text2 text-[14px]`,children:[e.contentCount||0,x(`postsCountSuffix`)]})]})]},e.id||`collection-${t}`)),M.length>0&&_(i,{loadMore:J,hasMore:P})]})})]}),_(u,{visible:R,onClose:()=>z(!1),onCreated:()=>{z(!1),Y()}})]})}function w(){let{isOpen:e,options:t,close:n}=x();return e?_(C,{visible:e,mode:t?.mode,onClose:()=>{n(),t?.onClose?.()},toCreateCollection:()=>{n(),t?.toCreateCollection?.()},onCollect:e=>{n(),t?.onCollect?.(e)}}):null}var T=class{static show(e){x.getState().open(e)}static clear(){x.getState().close()}};export{w as CollectionPopupHost,T as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../utils/cn.mjs";import{Dialog as t,DialogContent as n}from"../../ui/dialog.mjs";import{getCroppedImg as r}from"../../../utils/image-crop.mjs";import{useCallback as i,useState as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{useTranslations as c}from"next-intl";import l from"react-easy-crop";function u({open:u,onClose:d,imageSrc:f,onConfirm:p}){let
|
|
2
|
+
"use client";import{cn as e}from"../../../utils/cn.mjs";import{Dialog as t,DialogContent as n}from"../../ui/dialog.mjs";import{getCroppedImg as r}from"../../../utils/image-crop.mjs";import{useCallback as i,useState as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{useTranslations as c}from"next-intl";import l from"react-easy-crop";function u({open:u,onClose:d,imageSrc:f,onConfirm:p,cropShape:m=`round`}){let h=c(`components.common`),[g,_]=a({x:0,y:0}),[v,y]=a(1),[b,x]=a(null),[S,C]=a(!1),w=i((e,t)=>{x(t)},[]);async function T(){if(b)try{C(!0),p(await r(f,b,{circular:m===`round`,maxWidth:800,maxHeight:800})),E()}catch(e){console.error(`裁剪图片失败`,e)}finally{C(!1)}}function E(){_({x:0,y:0}),y(1),x(null),d()}return o(t,{open:u,onOpenChange:E,children:o(n,{showCloseButton:!1,className:`bg-black/90 !m-0 !p-0 !fixed !inset-0 !w-screen !h-screen !max-w-none !rounded-none !top-0 !left-0 !translate-x-0 !translate-y-0 !transform-none z-[9999] !pointer-events-auto`,children:s(`div`,{className:`relative flex h-full w-full flex-col`,children:[o(`div`,{className:`relative flex-1 overflow-hidden bg-black`,children:o(l,{image:f,crop:g,zoom:v,aspect:1,cropShape:m,onCropChange:_,onZoomChange:y,onCropComplete:w})}),o(`div`,{className:`absolute bottom-28 left-0 right-0 px-8`,children:s(`div`,{className:`mx-auto max-w-md`,children:[o(`input`,{type:`range`,min:1,max:3,step:.1,value:v,onChange:e=>y(Number(e.target.value)),className:`w-full appearance-none bg-tra nsparent cursor-pointer focus-within:outline-none`,style:{WebkitAppearance:`none`,background:`rgba(255, 255, 255, 0.3)`,height:`4px`,borderRadius:`2px`}}),o(`style`,{children:`
|
|
3
3
|
input[type="range"] {
|
|
4
4
|
outline: none;
|
|
5
5
|
}
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
input[type="range"]::-moz-range-thumb:focus {
|
|
32
32
|
outline: none;
|
|
33
33
|
}
|
|
34
|
-
`})]})}),o(`div`,{className:`absolute bottom-8 left-0 right-0 px-8`,children:s(`div`,{className:`mx-auto flex max-w-md gap-4`,children:[o(`button`,{type:`button`,onClick:
|
|
34
|
+
`})]})}),o(`div`,{className:`absolute bottom-8 left-0 right-0 px-8`,children:s(`div`,{className:`mx-auto flex max-w-md gap-4`,children:[o(`button`,{type:`button`,onClick:E,disabled:S,className:e(`flex-1 rounded-full py-3 text-base font-medium transition-colors`,`bg-bg1 text-text1 hover:bg-bg1/90`,`disabled:opacity-50 disabled:cursor-not-allowed`),children:h(`imageCropModal.cancel`)}),o(`button`,{type:`button`,onClick:T,disabled:S,className:e(`flex-1 rounded-full py-3 text-base font-medium transition-colors`,`bg-primary text-primary-foreground hover:bg-primary/80`,`disabled:opacity-50 disabled:cursor-not-allowed`),children:h(S?`imageCropModal.processing`:`imageCropModal.confirm`)})]})})]})})})}export{u as ImageCropModal};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import { PropsWithChildren } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
import { AbstractIntlMessages } from "next-intl";
|
|
5
|
+
|
|
6
|
+
//#region components/common/intl-provider.d.ts
|
|
7
|
+
interface IntlProviderProps extends PropsWithChildren {
|
|
8
|
+
/** 当前语言。 */
|
|
9
|
+
locale: string;
|
|
10
|
+
/** 语言包。 */
|
|
11
|
+
messages: AbstractIntlMessages;
|
|
12
|
+
/** 时区配置,未传入时使用默认时区。 */
|
|
13
|
+
timeZone?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 统一的国际化 Provider(保持与平台组件的 next-intl 实例一致)。
|
|
17
|
+
*/
|
|
18
|
+
declare function IntlProvider({
|
|
19
|
+
locale,
|
|
20
|
+
messages,
|
|
21
|
+
timeZone,
|
|
22
|
+
children
|
|
23
|
+
}: IntlProviderProps): react_jsx_runtime0.JSX.Element;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { IntlProvider, IntlProviderProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{defaultTimeZone as e}from"../../i18n.mjs";import{jsx as t}from"react/jsx-runtime";import{NextIntlClientProvider as n}from"next-intl";function r({locale:r,messages:i,timeZone:a,children:o}){return t(n,{locale:r,messages:i,timeZone:a??e,children:o})}export{r as IntlProvider};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{
|
|
2
|
+
"use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{Text as n}from"../../../ui/text.mjs";import{normalizeTimeToMilliseconds as r}from"../../../ui/time.mjs";import{PostListItemSkeleton as i}from"../../skeleton/post-list-item-skeleton.mjs";import{PostListItem as a}from"./post-list-item.mjs";import{useIsClient as o}from"foxact/use-is-client";import{useMemo as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";import f from"next/link";import{orderBy as p}from"lodash-es";function m(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function h(r){let h=d(`components.ui.list`),g=o(),{list:_,loading:v,hasMore:y=!1,loadMore:b,isEditMode:x,selectedIds:S,onToggleSelection:C}=r,w=s(()=>p(_,[`publishTime`],[`desc`]),[_]),{todayList:T,earlierList:E}=s(()=>{if(!g)return{todayList:[],earlierList:w};let e=[],t=[];for(let n of _)m(n.publishTime)?e.push(n):t.push(n);return{todayList:p(e,[`publishTime`],[`desc`]),earlierList:p(t,[`publishTime`],[`desc`])}},[g,_,w]),D=!!v&&_.length===0,O=g;return D?l(e,{className:`bg-bg1`,children:Array.from({length:6}).map((e,t)=>l(i,{isEditMode:x},`post-list-item-skeleton-${t}`))}):u(t,{loading:v,loadMore:b,hasMore:y,empty:`no-content`,emptyText:h(`postList.empty`),children:[O&&T.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`postList.today`)})}),T.map(e=>x?l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)},e.id):l(f,{href:`/post/${e.id}`,children:l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)})},e.id))]}),E.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`postList.earlier`)})}),E.map(e=>x?l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)},e.id):l(f,{href:`/post/${e.id}`,children:l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)})},e.id))]})]})}export{h as PostList};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{
|
|
2
|
+
"use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{Text as n}from"../../../ui/text.mjs";import{normalizeTimeToMilliseconds as r}from"../../../ui/time.mjs";import{VideoListItemSkeleton as i}from"../../skeleton/video-list-item-skeleton.mjs";import{VideoListItem as a}from"./video-list-item.mjs";import{useIsClient as o}from"foxact/use-is-client";import{useMemo as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";import f from"next/link";import{orderBy as p}from"lodash-es";function m(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function h(r){let h=d(`components.ui.list`),g=o(),{list:_,showVideoProgress:v,loading:y,hasMore:b=!1,loadMore:x,isEditMode:S,selectedIds:C,onToggleSelection:w}=r,T=s(()=>p(_,[`publishTime`],[`desc`]),[_]),{todayList:E,earlierList:D}=s(()=>{if(!g)return{todayList:[],earlierList:T};let e=[],t=[];for(let n of _)m(n.publishTime)?e.push(n):t.push(n);return{todayList:p(e,[`publishTime`],[`desc`]),earlierList:p(t,[`publishTime`],[`desc`])}},[g,_,T]),O=!!y&&_.length===0,k=g;return O?l(e,{className:`bg-bg1`,children:Array.from({length:6}).map((e,t)=>l(i,{isEditMode:S,showVideoProgress:v},`video-list-item-skeleton-${t}`))}):u(t,{loading:y,loadMore:x,hasMore:b,empty:`no-content`,emptyText:h(`videoList.empty`),children:[k&&E.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`videoList.today`)})}),E.map(e=>S?l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id):l(f,{href:`/video/${e.id}/${e.title}`,children:l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id)},e.id))]}),D.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`videoList.earlier`)})}),D.map(e=>S?l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id):l(f,{href:`/video/${e.id}/${e.title}`,children:l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id)},e.id))]})]})}export{h as VideoList};
|
|
@@ -16,7 +16,9 @@ interface GenderPickerProps {
|
|
|
16
16
|
/** 当前选中的值 */
|
|
17
17
|
value?: string;
|
|
18
18
|
/** 确认选择回调 */
|
|
19
|
-
onConfirm: (value: string) => void
|
|
19
|
+
onConfirm: (value: string) => void | boolean | Promise<void | boolean>;
|
|
20
|
+
/** 选择值变化回调 */
|
|
21
|
+
onValueChange?: (value: string) => void;
|
|
20
22
|
/** 选项列表 */
|
|
21
23
|
options?: GenderPickerOption[];
|
|
22
24
|
/** 标题 */
|
|
@@ -25,16 +27,20 @@ interface GenderPickerProps {
|
|
|
25
27
|
confirmText?: string;
|
|
26
28
|
/** 取消按钮文本 */
|
|
27
29
|
cancelText?: string;
|
|
30
|
+
/** 是否禁用确认按钮 */
|
|
31
|
+
confirmDisabled?: boolean;
|
|
28
32
|
}
|
|
29
33
|
declare function GenderPicker({
|
|
30
34
|
open,
|
|
31
35
|
onClose,
|
|
32
36
|
value,
|
|
33
37
|
onConfirm,
|
|
38
|
+
onValueChange: onSelectionChange,
|
|
34
39
|
options,
|
|
35
40
|
title,
|
|
36
41
|
confirmText,
|
|
37
|
-
cancelText
|
|
42
|
+
cancelText,
|
|
43
|
+
confirmDisabled
|
|
38
44
|
}: GenderPickerProps): react_jsx_runtime0.JSX.Element;
|
|
39
45
|
//#endregion
|
|
40
46
|
export { GenderPicker, GenderPickerOption, GenderPickerProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Box as e}from"../../../ui/box.mjs";import{WheelPicker as t,WheelPickerWrapper as n}from"../../../ui/wheel-picker.mjs";import{PickerDrawer as r}from"../picker-drawer/picker-drawer.mjs";import{useMemo as i}from"react";import{jsx as a}from"react/jsx-runtime";import{useTranslations as o}from"next-intl";function s({open:s,onClose:c,value:l,onConfirm:u,
|
|
2
|
+
"use client";import{Box as e}from"../../../ui/box.mjs";import{WheelPicker as t,WheelPickerWrapper as n}from"../../../ui/wheel-picker.mjs";import{PickerDrawer as r}from"../picker-drawer/picker-drawer.mjs";import{useMemo as i}from"react";import{jsx as a}from"react/jsx-runtime";import{useTranslations as o}from"next-intl";function s({open:s,onClose:c,value:l,onConfirm:u,onValueChange:d,options:f,title:p,confirmText:m,cancelText:h,confirmDisabled:g}){let _=o(`components.common.picker.genderPicker`),v=i(()=>f??[{label:_(`options.male`),value:`male`},{label:_(`options.female`),value:`female`},{label:_(`options.secret`),value:`secret`}],[f,_]),y=p??_(`title`),b=m??_(`confirm`),x=h??_(`cancel`),S=i(()=>{let e=v.findIndex(e=>e.value===l);return e>=0?e:0},[l,v]);return a(r,{open:s,onClose:c,title:y,confirmText:b,cancelText:x,onConfirm:u,confirmDisabled:g,children:({onValueChange:r})=>a(e,{className:`flex items-center justify-center `,children:a(n,{children:a(t,{defaultValue:v[S]?.value??``,options:v.map(e=>({label:e.label,value:e.value})),onValueChange:e=>{if(e){let t=String(e);r(t),d?.(t)}},optionItemHeight:40},s?String(S):`closed`)})})})}export{s as GenderPicker};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../ui/button.mjs";import{Box as t}from"../../../ui/box.mjs";import{Drawer as n,DrawerContent as r,DrawerTitle as i}from"../../../ui/drawer.mjs";import{Text as a}from"../../../ui/text.mjs";import{useState as
|
|
2
|
+
"use client";import{Button as e}from"../../../ui/button.mjs";import{Box as t}from"../../../ui/box.mjs";import{Drawer as n,DrawerContent as r,DrawerTitle as i}from"../../../ui/drawer.mjs";import{Text as a}from"../../../ui/text.mjs";import{useEffect as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{useTranslations as u}from"next-intl";function d({open:d,onClose:f,title:p,confirmText:m,cancelText:h,onConfirm:g,confirmDisabled:_=!1,children:v}){let y=u(`components.common.picker.pickerDrawer`),[b,x]=s(null),S=p??y(`title`),C=m??y(`confirm`),w=h??y(`cancel`);return o(()=>{d||x(null)},[d]),l(n,{open:d,handleOnly:!0,onOpenChange:e=>!e&&f(),children:[c(i,{title:S}),c(r,{className:`rounded-t-2xl`,onDragStartCapture:e=>{e.preventDefault(),e.stopPropagation()},children:l(t,{className:`flex flex-col`,children:[l(t,{className:`flex items-center justify-between border-b border-border px-4 py-3`,children:[c(e,{variant:`ghost`,size:`sm`,onClick:f,children:w}),c(a,{className:`text-base font-medium`,children:S}),c(e,{variant:`ghost`,size:`sm`,onClick:async()=>{if(b===null){f();return}try{await g(b)!==!1&&f()}catch(e){console.error(`PickerDrawer confirm failed`,e)}},disabled:_,children:C})]}),v({onValueChange:e=>{x(e)},open:d})]})})]})}export{d as PickerDrawer};
|
|
@@ -56,6 +56,48 @@ interface SharePopupProps {
|
|
|
56
56
|
* 默认分享平台列表。
|
|
57
57
|
*/
|
|
58
58
|
declare const defaultPlatforms: SharePlatform[];
|
|
59
|
+
/**
|
|
60
|
+
* 多平台分享入口(暂时注释,后续扩展时恢复)。
|
|
61
|
+
*
|
|
62
|
+
* const defaultPlatforms: SharePlatform[] = [
|
|
63
|
+
* {
|
|
64
|
+
* id: SharePlatformEnum.WECHAT,
|
|
65
|
+
* name: '',
|
|
66
|
+
* icon: <ShareWechatIcon className='w-full h-full' />,
|
|
67
|
+
* onClick: (data: ShareDataType) => {
|
|
68
|
+
* ShareManager.showSharePopup({
|
|
69
|
+
* type: SharePlatformEnum.WECHAT,
|
|
70
|
+
* data,
|
|
71
|
+
* copyUrl: currentConfigCopyUrl,
|
|
72
|
+
* });
|
|
73
|
+
* },
|
|
74
|
+
* },
|
|
75
|
+
* {
|
|
76
|
+
* id: SharePlatformEnum.QQ,
|
|
77
|
+
* name: 'QQ',
|
|
78
|
+
* icon: <ShareQQIcon className='w-full h-full' />,
|
|
79
|
+
* onClick: (data: ShareDataType) => {
|
|
80
|
+
* ShareManager.showSharePopup({
|
|
81
|
+
* type: SharePlatformEnum.QQ,
|
|
82
|
+
* data,
|
|
83
|
+
* copyUrl: currentConfigCopyUrl,
|
|
84
|
+
* });
|
|
85
|
+
* },
|
|
86
|
+
* },
|
|
87
|
+
* {
|
|
88
|
+
* id: SharePlatformEnum.WECHAT_MOMENTS,
|
|
89
|
+
* name: '',
|
|
90
|
+
* icon: <ShareWecircleIcon className='w-full h-full' />,
|
|
91
|
+
* onClick: (data: ShareDataType) => {
|
|
92
|
+
* ShareManager.showSharePopup({
|
|
93
|
+
* type: SharePlatformEnum.WECHAT_MOMENTS,
|
|
94
|
+
* data,
|
|
95
|
+
* copyUrl: currentConfigCopyUrl,
|
|
96
|
+
* });
|
|
97
|
+
* },
|
|
98
|
+
* },
|
|
99
|
+
* ];
|
|
100
|
+
*/
|
|
59
101
|
/**
|
|
60
102
|
* 默认操作按钮列表。
|
|
61
103
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import e from"../../ui/popup.mjs";import t from"../../../assets/icons/share/share-
|
|
2
|
+
"use client";import e from"../../ui/popup.mjs";import t from"../../../assets/icons/share/share-link.mjs";import{defaultLocale as n,getMessages as r,isValidLocale as i}from"../../../i18n.mjs";import{IntlProvider as a}from"../intl-provider.mjs";import{SharePlatformEnum as o}from"../../../types/share.mjs";import s from"../../../utils/share-manager.mjs";import{useEffect as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{useTranslations as f}from"next-intl";import{createRoot as p}from"react-dom/client";let m=``;const h=[{id:o.SHARE_LINK,name:``,icon:u(t,{className:`w-full h-full`}),onClick:e=>{s.showSharePopup({type:o.SHARE_LINK,data:e,copyUrl:m})}}],g=[],_={id:``,isCollect:!1};function v(t){let n=f(`components.common.sharePopup`),{visible:r,onClose:i,onCollect:a,data:s=_,platforms:p=h,actions:m=g,cancelText:v,maskClosable:y=!0}=t,[b,x]=l(s.isCollect),S=v??n(`shareDrawer.cancel`);c(()=>{x(s.isCollect)},[s.isCollect]);function C(e){return e.name?e.name:e.id===o.SHARE_LINK?n(`shareContent.copyShareLink`):``}function w(e){window.sensors?.track?.(`detail_share_click`,{object_id:s.id,channel:e.id}),e.onClick(s),i?.()}function T(e){!e&&y&&i?.()}function E(e){return function(){w(e)}}return u(e,{side:`bottom`,open:r,onOpenChange:T,showCloseButton:!1,className:`z-[2000] !gap-0 rounded-t-[16px] bg-bg2 p-0 text-text1`,children:d(`div`,{className:`bg-bg2`,children:[p.length>0&&u(`div`,{className:`p-[24px]`,children:u(`div`,{className:`w-full h-[72px] overflow-hidden`,children:u(`div`,{className:`w-full g-scroll-box-x flex items-center`,style:{height:`calc(100% + 60px)`,paddingBottom:`60px`},children:p.map((e,t)=>d(`div`,{className:`cursor-pointer h-[100%] flex flex-col items-center justify-between ${t>0?`ml-[32px]`:``}`,onClick:E(e),children:[u(`span`,{className:`w-[48px] h-[48px] flex items-center justify-center`,children:e.icon}),u(`span`,{className:`text-text1 text-[12px] leading-[12px]`,children:C(e)})]},e.id))})})}),u(`div`,{className:`bg-bg1 mt-[4px] flex items-center justify-center`,onClick:i,children:u(`span`,{className:`text-text1 text-[16px] leading-[60px]`,children:S})})]})})}function y(){if(typeof document>`u`)return n;let e=document.documentElement?.lang||``;return i(e)?e:n}function b(e){let t=y();return u(a,{locale:t,messages:r(t),children:u(v,{...e})})}let x=null,S=null,C=null;var w=class e{static async show(t){let n=await s.initShareConfig(),r=t.initPlatforms||h.filter(e=>n[e.id]),i=t.initActions||g,{data:a,...o}=t,c={platforms:r,actions:i,maskClosable:!0,...o};C={supportActions:i,supportPlatforms:r};let l=typeof window<`u`?window.location.href:``;m=t.copyUrl||t.shareUrl||l,x||(x=document.createElement(`div`),x.style.zIndex=`2001`,document.body.appendChild(x),S=p(x)),S?.render(u(b,{visible:!1,data:a,onClose:()=>{e.clear(),c.onClose?.()},...c})),requestAnimationFrame(()=>{S?.render(u(b,{visible:!0,data:a,onClose:()=>{e.clear(),c.onClose?.()},...c}))})}static clear(){S&&x&&(S.render(u(b,{visible:!1,data:{},platforms:C?.supportPlatforms,actions:C?.supportActions,maskClosable:!0})),setTimeout(()=>{S?.unmount(),S=null,x?.parentNode&&x.parentNode.removeChild(x),x=null},300))}};export{v as SharePopupComponent,w as default,g as defaultActions,h as defaultPlatforms};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{gUserGetUserEditInfo as t,gUserGetUserInfo as n,pUserEditUserInfo as ee}from"../../../service/generated/client.mjs";import{uploadFile as te}from"../../../utils/upload-file.mjs";import{Avatar as ne,AvatarFallback as re,AvatarImage as ie}from"../../ui/avatar.mjs";import{Box as r}from"../../ui/box.mjs";import{InputGroup as i,InputGroupAddon as a,InputGroupTextarea as ae}from"../../ui/input-group.mjs";import{Field as o,FieldLabel as s}from"../../ui/field.mjs";import{Text as c}from"../../ui/text.mjs";import{useDeleteRequest as oe,useMutation as se,useRequest as ce}from"../../../hooks/query/use-query.mjs";import{HeaderNav as le}from"../../common/header-nav/client.mjs";import{PickerDrawer as l}from"../../common/picker/picker-drawer/picker-drawer.mjs";import{GenderPicker as ue}from"../../common/picker/gender-picker/gender-picker.mjs";import{ImageCropModal as de}from"../../common/image-crop-modal/image-crop-modal.mjs";import{useEffect as u,useRef as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{toast as h}from"sonner";import{useTranslations as fe}from"next-intl";import{produce as pe}from"immer";const g={0:`secret`,1:`male`,2:`female`},_={male:1,female:2,secret:0},v=[`image/jpeg`,`image/png`],me=/^[\u4E00-\u9FFF\w.-]+$/;function he(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return v.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function y(e){return e?_[e]===void 0?g[e]??`secret`:e:`secret`}function b(e){if(!e)return;if(_[e]!==void 0)return _[e];let t=Number(e);return Number.isNaN(t)?void 0:t}function x(e){return{nickname:e?.nick_name??``,gender:y(e?.gender?.toString()),signature:e?.signature??``,avatar:e?.avatar??``}}function S({id:g}){let _=fe(`components.pages.edit`),{userId:v,userInfo:y,setUserInfo:S}=e(),C=g??v,w=oe(),ge={male:_(`page.genderMale`),female:_(`page.genderFemale`),secret:_(`page.genderSecret`)},T=d(null),E=d(null),D=d(null),[O,k]=f(()=>x()),[A,j]=f(!1),[_e,ve]=f(!1),[M,N]=f(``),[P,F]=f(!1),[I,L]=f(``),[ye,R]=f(!1),[z,B]=f(`secret`),[V,H]=f(!1),[U,W]=f(``),be={code:0,message:``,data:{}},xe={code:0,message:``,data:{}},{data:G,isLoading:K}=ce([`user-edit-info`,C],()=>C?t({user_id:C}):Promise.resolve(be)),{data:Se}=ce([`user-info-basic`,C],()=>C?n({user_id:C}):Promise.resolve(xe)),{mutateAsync:Ce,isPending:we}=se(async e=>ee(e)),q=K||we,Te=Se?.data?.display_id||y?.display_id||`--`,J=O.gender||`secret`,Y=q||I.trim()===O.nickname,Ee=q||z===J,X=q||U===O.signature;u(()=>{let e=G?.data;e&&k(x(e))},[G]),u(()=>{if(!P)return;let e=window.setTimeout(()=>{E.current?.focus()},250);return()=>{window.clearTimeout(e)}},[P]),u(()=>{if(!V)return;let e=window.setTimeout(()=>{D.current?.focus()},250);return()=>{window.clearTimeout(e)}},[V]),u(()=>()=>{M&&URL.revokeObjectURL(M)},[M]);function Z(e,t){k(pe(n=>{n[e]=t}))}function De(){M&&(URL.revokeObjectURL(M),N(``))}function Oe(){C&&(w([`user-edit-info`,C]),w([`user-info-basic`,C]),w([`user-profile`,`mine`]),w([`user-profile`,`mine`,C]),w([`user-profile`,`profile`,C]))}function Q(e){!C||C!==v||S({...y,user_id:C,...e})}function ke(e){return{nick_name:e.nickname||void 0,avatar:e.avatar||void 0,signature:e.signature||void 0,gender:b(e.gender)}}async function $(e){if(!C)return h.error(_(`page.userNotFound`)),!1;let t=ke({...O,...e});try{return await Ce({user_id:C,...t}),Oe(),!0}catch(e){return console.error(`更新用户信息失败`,e),h.error(_(`page.updateFailed`)),!1}}function Ae(){q||A||T.current?.click()}function je(e){let t=e.target.files?.[0];if(t){if(!he(t)){h.error(_(`page.imageTypeInvalid`)),e.target&&(e.target.value=``);return}N(URL.createObjectURL(t)),ve(!0),e.target&&(e.target.value=``)}}async function Me(e){try{j(!0);let t=await te(new File([e],`avatar.jpg`,{type:`image/jpeg`}),1);if(!await $({avatar:t.objectKey}))return;Z(`avatar`,t.objectKey),Q({avatar:t.objectKey}),Ne(),h.success(_(`page.avatarUpdateSuccess`))}catch(e){console.error(`上传头像失败`,e),h.error(_(`page.avatarUploadFailed`))}finally{j(!1)}}function Ne(){ve(!1),De()}function Pe(){q||(L(O.nickname),F(!0))}function Fe(e){let t=e.target.value;t.length>24||L(t)}function Ie(e){return e?e.length<2?_(`page.nicknameTooShort`):me.test(e)?``:_(`page.nicknameInvalidChars`):_(`page.nicknameRequired`)}async function Le(e){if(Y)return!1;let t=e.trim(),n=Ie(t);return n?(h.error(n),!1):await $({nickname:t})?(Z(`nickname`,t),Q({nick_name:t}),L(t),h.success(_(`page.nicknameUpdateSuccess`)),!0):!1}function Re(){q||(B(J),R(!0))}function ze(){R(!1)}function Be(e){B(e)}async function Ve(e){let t=e||z||`secret`;if(t===J||!await $({gender:t}))return!1;let n=b(t);return Z(`gender`,t),Q({gender:n}),B(t),h.success(_(`page.genderUpdateSuccess`)),!0}function He(){q||(W(O.signature),H(!0))}function Ue(e){let t=e.target.value;t.length>100||W(t)}function We(e){let t=e.trim();return t.length>0&&t.length<2?_(`page.signatureTooShort`):``}async function Ge(e){if(X)return!1;let t=We(e);return t?(h.error(t),!1):await $({signature:e})?(Z(`signature`,e),Q({signature:e}),W(e),h.success(_(`page.signatureUpdateSuccess`)),!0):!1}return m(r,{className:`bg-bg2 !min-h-screen`,children:[p(le,{className:`!bg-bg2`,title:_(`page.title`)}),m(r,{onClick:Ae,className:`flex bg-bg2 flex-col py-3 items-center justify-center gap-3`,children:[p(`input`,{ref:T,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:je}),m(ne,{className:`w-21 h-21`,children:[p(ie,{src:O.avatar}),p(re,{})]}),p(c,{className:`text-sm text-text2`,children:K?_(`page.loading`):A?_(`page.avatarUploading`):`${Te}`})]}),m(r,{className:`pb-3`,children:[p(o,{className:`bg-bg2 px-3 cursor-pointer`,onClick:Pe,children:m(`div`,{className:`flex items-center justify-between gap-3`,children:[p(s,{children:_(`page.label`)}),p(c,{className:`text-text2 text-sm text-right max-w-[65%] line-clamp-1`,children:O.nickname||_(`page.nicknamePlaceholder`)})]})}),p(o,{className:`!bg-bg2 px-3 border-none cursor-pointer`,onClick:Re,children:m(`div`,{className:`flex items-center justify-between gap-3`,children:[p(s,{children:_(`page.genderLabel`)}),p(c,{className:`text-text2 text-sm`,children:ge[J]||_(`page.genderSecret`)})]})}),p(`div`,{className:`h-2 bg-bg1`}),p(o,{className:`border-none px-3 bg-bg2! mt-2 cursor-pointer`,onClick:He,children:m(`div`,{className:`flex items-center justify-between gap-3`,children:[p(s,{children:_(`page.signatureLabel`)}),p(c,{className:`text-text2 text-sm text-right max-w-[65%] line-clamp-1`,children:O.signature||_(`page.signaturePlaceholder`)})]})})]}),p(l,{open:P,onClose:()=>F(!1),title:_(`page.label`),confirmText:_(`page.submit`),onConfirm:e=>Le(String(e)),confirmDisabled:Y,children:({onValueChange:e})=>p(r,{className:`px-4 py-4 min-h-[230px]`,children:m(i,{children:[p(ae,{ref:E,className:`!bg-bg1 p-2.5`,rows:4,maxLength:24,placeholder:_(`page.nicknamePlaceholder`),value:I,onChange:t=>{Fe(t),e(t.target.value)},disabled:q}),p(a,{className:`!bg-bg1`,align:`block-end`,children:p(`div`,{className:`text-right w-full`,children:m(`span`,{className:`text-xs`,children:[I.length,`/`,24]})})})]})})}),p(ue,{open:ye,onClose:ze,value:z,onValueChange:Be,onConfirm:Ve,confirmDisabled:Ee}),p(l,{open:V,onClose:()=>H(!1),title:_(`page.signatureLabel`),confirmText:_(`page.submit`),onConfirm:e=>Ge(String(e)),confirmDisabled:X,children:({onValueChange:e})=>p(r,{className:`px-4 py-4 min-h-[230px]`,children:m(i,{children:[p(ae,{ref:D,className:`!bg-bg1 p-2.5`,rows:4,maxLength:100,placeholder:_(`page.signaturePlaceholder`),value:U,onChange:t=>{Ue(t),e(t.target.value)},disabled:q}),p(a,{className:`!bg-bg1`,align:`block-end`,children:p(`div`,{className:`text-right w-full`,children:m(`span`,{className:`text-xs`,children:[U.length,`/`,100]})})})]})})}),p(de,{open:_e,onClose:Ne,imageSrc:M,onConfirm:Me,cropShape:`round`})]})}export{S as EditClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{Button as t}from"../../../ui/button.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserUserFeedback as r}from"../../../../service/generated/client.mjs";import{compressImage as i}from"../../../../utils/image-compression.mjs";import{uploadFile as a}from"../../../../utils/upload-file.mjs";import{Image as o}from"../../../ui/image.mjs";import{Box as s}from"../../../ui/box.mjs";import{InputGroup as c,InputGroupAddon as l,InputGroupInput as u,InputGroupTextarea as d}from"../../../ui/input-group.mjs";import{Field as f,FieldLabel as p}from"../../../ui/field.mjs";import{Text as m}from"../../../ui/text.mjs";import{HeaderNav as h}from"../../../common/header-nav/client.mjs";import{AddIcon as g}from"../../../common/icons/add.mjs";import{useRef as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{toast as x}from"sonner";import{useTranslations as S}from"next-intl";
|
|
2
|
+
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{Button as t}from"../../../ui/button.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserUserFeedback as r}from"../../../../service/generated/client.mjs";import{compressImage as i}from"../../../../utils/image-compression.mjs";import{uploadFile as a}from"../../../../utils/upload-file.mjs";import{Image as o}from"../../../ui/image.mjs";import{Box as s}from"../../../ui/box.mjs";import{InputGroup as c,InputGroupAddon as l,InputGroupInput as u,InputGroupTextarea as d}from"../../../ui/input-group.mjs";import{Field as f,FieldLabel as p}from"../../../ui/field.mjs";import{Text as m}from"../../../ui/text.mjs";import{HeaderNav as h}from"../../../common/header-nav/client.mjs";import{AddIcon as g}from"../../../common/icons/add.mjs";import{useRef as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{toast as x}from"sonner";import{useTranslations as S}from"next-intl";import{useRouter as C}from"next/navigation";const w=new Set([`image/jpeg`,`image/jpg`,`image/png`]),T=new Set([`jpg`,`jpeg`,`png`]);function E(e){let t=e.type.toLowerCase(),n=e.name.split(`.`).pop()?.toLowerCase()||``;return t?w.has(t):T.has(n)}function D({className:w}={}){let T=S(`components.pages.feedback.components`),D=C(),{userId:O}=n(),k=_(null),[A,j]=v({content:``,contact:``}),[M,N]=v(``),[P,F]=v(!1),[I,L]=v(!1),R=!A.content.trim();function z(e,t){j(n=>({...n,[e]:t}))}function B(){I||P||k.current?.click()}async function V(e){let t=e.target.files?.[0];if(t){if(!E(t)){x.error(T(`feedbackForm.imageTypeInvalid`)),e.target&&(e.target.value=``);return}try{L(!0),N((await a(await i(t),1)).objectKey)}catch(e){console.error(`上传截图失败`,e),x.error(T(`feedbackForm.screenshotUploadFailed`))}finally{L(!1),e.target&&(e.target.value=``)}}}function H(){I||P||N(``)}async function U(){let e=A.content.trim(),t=A.contact.trim();if(!e){x.error(T(`feedbackForm.missingFeedback`));return}if(e.length<4){x.error(T(`feedbackForm.contentMinLength`));return}if(!M){x.error(T(`feedbackForm.missingScreenshot`));return}if(P)return;let n=x.loading(T(`feedbackForm.loading`));try{F(!0);let i=await r({user_id:O,feedback_content:e,feedback_screenshot:M||void 0,contact_info:t||void 0});if(i.code===0){j({content:``,contact:``}),N(``),D.push(`/settings`),x.success(T(`feedbackForm.submitsuccess`),{id:n});return}x.error(i.message||T(`feedbackForm.message`),{id:n})}catch(e){console.error(`提交反馈失败`,e),x.error(e.message||T(`feedbackForm.message`),{id:n})}finally{F(!1)}}return b(s,{className:e(`min-h-screen bg-bg2`,w),children:[y(h,{title:T(`feedbackForm.title`),className:`!bg-bg2`,rightChild:y(t,{onClick:U,disabled:P||I||R,children:T(P?`feedbackForm.loading`:`feedbackForm.submit`)})}),b(s,{className:`pb-3`,children:[b(f,{className:`bg-bg2 px-3 border-none`,children:[y(p,{required:!0,children:T(`feedbackForm.label`)}),b(c,{children:[y(d,{className:`!bg-bg1 p-2.5`,maxLength:500,placeholder:T(`feedbackForm.placeholder`),value:A.content,onChange:e=>z(`content`,e.target.value)}),y(l,{className:`!bg-bg1`,align:`block-end`,children:y(`div`,{className:`text-right w-full`,children:b(`span`,{className:`text-xs`,children:[A.content.length,`/500`]})})})]})]}),b(f,{className:`bg-bg2 px-3 border-none`,children:[y(p,{required:!0,children:T(`feedbackForm.screenshotLabel`)}),y(`input`,{ref:k,type:`file`,accept:`image/jpeg,image/jpg,image/png,.jpg,.jpeg,.png`,className:`hidden`,onChange:V}),M?b(s,{className:`relative mt-2 overflow-hidden rounded-lg border border-line1 !bg-bg1`,children:[y(s,{className:`relative aspect-video`,children:y(o,{src:M,alt:T(`feedbackForm.alt`),fill:!0,className:`object-cover`})}),y(t,{size:`sm`,variant:`secondary`,className:`absolute right-2 top-2 h-auto rounded-full px-3 py-1 text-xs`,onClick:H,children:T(`feedbackForm.delete`)})]}):b(s,{className:`mt-2 flex flex-col aspect-video items-center justify-center gap-2 rounded-lg border border-dashed border-text1/10 !bg-bg1 py-6`,onClick:B,children:[y(g,{}),y(m,{className:`text-xs text-text3`,children:T(I?`feedbackForm.uploading`:`feedbackForm.addScreenshot`)})]})]}),b(f,{className:`bg-bg2 px-3 border-none`,children:[y(p,{children:T(`feedbackForm.contactLabel`)}),b(c,{children:[y(u,{className:`!bg-bg1 p-2.5`,placeholder:T(`feedbackForm.placeholder1_6d0242`),value:A.contact,onChange:e=>z(`contact`,e.target.value)}),y(l,{className:`!bg-bg1`,align:`block-end`,children:y(`div`,{className:`text-right w-full`,children:b(`span`,{className:`text-xs`,children:[A.contact.length,`/100`]})})})]})]})]})]})}export{D as FeedbackForm};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{Box as e}from"../../ui/box.mjs";import{Dialog as t,DialogContent as n,DialogHeader as r,DialogTitle as i}from"../../ui/dialog.mjs";import{Text as a}from"../../ui/text.mjs";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{useTranslations as c}from"next-intl";const l=[`欢迎使用我们平台(以下简称"平台")。在使用我们的服务之前,请仔细阅读以下条款。本协议(以下简称"本协议")构成您与平台之间的法律协议。`,`1. 接受条款`,`通过访问或使用平台,您同意遵守本协议的所有条款。如果您不同意本协议的条款,请不要使用平台。`,`2. 用户账户`,`您同意在注册时提供真实、准确和完整的个人信息,并及时更新这些信息。`,`您有责任确保您的账户信息和密码的保密性,并对所有通过您的账户进行的活动负责。`,`3. 用户行为`,`您同意在使用平台时遵守以下行为规范:`,`(1)不得上传或发布任何违法、侵犯他人权利、恶意或不当的内容;`,`(2)不得干扰或破坏平台的正常运作;`,`(3)不得未经授权访问其他用户的账户或信息。`,`4. 服务内容`,`平台将提供视频内容、社交功能、用户交互等服务。我们有权根据需要对服务进行修改或暂停,恕不另行通知。`,`5. 知识产权`,`平台提供的所有内容(包括但不限于文本、图片、视频、软件等)都受到版权法和相关知识产权法的保护。未经授权,您不得复制、修改、传播或以其他方式使用平台的任何内容。`,`6. 免责声明`,`平台不对因网络故障、系统问题或其他不可抗力因素导致的服务中断或信息丢失负责。`,`7. 隐私政策`,`您使用平台时,您的个人信息将根据我们的隐私政策进行收集、存储和使用。请仔细阅读隐私政策以了解我们如何处理您的信息。`,`8. 终止服务`,`我们有权在您违反本协议条款的情况下,暂停或终止您的账户及服务。`,`9. 适用法律与争议解决`,`本协议适用法律。如果发生争议,您同意首先通过友好协商解决;如协商无果,您同意将争议提交至指定法院。`,`10. 协议修改`,`平台有权随时修改本协议。修改后的条款将通过平台公告或电子邮件通知您。您继续使用平台即表示您接受修改后的协议。`],u=`感谢您使用我们平台(以下简称"我们"或"平台")。本隐私政策旨在帮助您了解我们如何收集、使用、存储和保护您的个人信息。在使用我们的服务之前,请仔细阅读以下内容。,1. 我们收集的信息,我们可能会收集以下类型的个人信息:,(1)注册信息:包括您的电子邮件地址、密码等。,(2)使用信息:包括您访问平台的方式、时间、IP地址、设备信息、浏览记录等。,2. 我们如何使用您的信息,我们收集的个人信息将用于以下目的:,(1)提供和改进平台的服务;,(2)向您提供定制化的推荐内容;,(3)与您联系并提供相关服务或通知;,(4)遵守法律法规的要求。,3. 我们如何保护您的信息,我们采取合理的技术和组织措施来保护您的个人信息免遭未经授权的访问、修改、披露或销毁。但是,无法保证任何数据传输或存储是绝对安全的。,4. 与第三方共享信息,我们不会将您的个人信息出售或租赁给第三方,但在以下情况下,我们可能会共享您的信息:,法律要求:根据法律规定或政府要求提供您的信息;,服务提供商:为提供服务而与第三方共享(例如,支付处理、数据存储等)。,5. 您的权利,根据适用的法律,您可能有权:,查看、更新或删除您的个人信息;,撤销您同意的任何数据处理活动;,选择不接收营销信息。,6. 儿童隐私,我们不主动收集13岁以下儿童的个人信息。如果我们发现未成年人提供了个人信息,我们将立即删除这些信息。,7. 隐私政策的更改,我们可能会不定期更新本隐私政策。更新内容会通过平台公告或电子邮件通知您。请定期查阅本隐私政策。`.split(`,`);function d(d){let{type:f,onClose:p}=d,m=c(`components.pages.login`),h=f===`terms`?l:f===`privacy`?u:[],g=f===`terms`?m(`loginClient.userAgreement`):f===`privacy`?m(`loginClient.privacyPolicy`):null;return o(t,{open:f!==null,onOpenChange:e=>!e&&p?.(),children:s(n,{className:`!fixed !inset-0 !w-screen !h-screen !max-w-none !max-h-none !rounded-none flex flex-col bg-bg1 text-text1 p-6`,showCloseButton:!0,children:[o(r,{className:`flex-shrink-0`,children:o(i,{className:`text-[18px] font-bold`,children:g})}),o(e,{className:`flex-1 min-h-0 overflow-y-auto -mx-1 px-1`,children:o(e,{className:`text-text2 text-base leading-relaxed space-y-2`,children:h.map((e,t)=>o(a,{as:`p`,className:`py-0.5`,children:e},t))})})]})})}export{d as AgreementDialog};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import{pUserSendForgetEmailCode as t}from"../../../service/generated/client.mjs";import{Box as n}from"../../ui/box.mjs";import{Input as r}from"../../ui/input.mjs";import{Text as i}from"../../ui/text.mjs";import{useLoginModalStore as a}from"../../../store/modules/login-modal-store.mjs";import{LeftArrowIcon as o}from"../../../assets/icons/left-arrow-icon.mjs";import{useMemo as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";function f(f){let p=d(`components.pages.login`),{onClose:m,onLogin:h,onVerify:g}=f,{setVerifyStep:_}=a(),[v,y]=c(``),[b,x]=c(!1),[S,C]=c(``),w=s(()=>v.trim().length>0&&!b,[v,b]);function T(e){y(e),S&&C(``)}function E(e){e.preventDefault(),D()}async function D(){if(w)try{x(!0),C(``),await t({email:v.trim()}),_(`forgot-password`),g?.(v.trim())}catch(e){C(e.message??p(`forgot.sendFailed`))}finally{x(!1)}}return u(n,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,children:[u(n,{className:`flex justify-between items-center h-[60px] px-[16px]`,children:[l(e,{type:`button`,onClick:m,"aria-label":p(`forgot.back`),className:`cursor-pointer bg-transparent !p-0 !px-0 !py-0`,children:l(o,{className:`w-[16px] h-[16px] text-text1/80`,"aria-hidden":`true`,focusable:`false`})}),l(i,{className:`text-[14px] text-text2`})]}),u(n,{className:`px-[24px] flex flex-col mt-[15px]`,children:[u(n,{className:`flex flex-col`,children:[l(i,{className:`text-[24px] leading-[32px] font-bold`,children:p(`forgot.title`)}),u(i,{className:`text-[14px] leading-[22px] mt-[12px] text-text1/80`,children:[p(`forgot.or`),l(e,{type:`button`,onClick:h,className:`cursor-pointer text-theme5 hover:opacity-90 bg-transparent !p-0 !px-0 !py-0`,children:p(`forgot.loginLink`)})]})]}),u(`form`,{className:`mt-[38px]`,autoComplete:`off`,onSubmit:E,children:[l(n,{className:`flex items-center px-[28px] rounded-[50px] h-[66px] bg-line1 border border-line1`,children:l(r,{placeholder:p(`forgot.emailPlaceholder`),type:`email`,name:`funhub-forgot-email`,value:v,onChange:e=>T(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`!bg-transparent !px-0 !py-0 !rounded-none !text-text1 placeholder:!text-text3 leading-[26px] text-[18px]`})}),l(n,{className:`h-[22px] mt-[16px] mb-[22px] ml-[12px] text-[14px] text-theme5`,children:S}),l(e,{type:`submit`,disabled:!w,className:`w-full h-[60px] !rounded-[30px] !text-[18px] font-bold leading-[26px] bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:p(b?`forgot.sending`:`forgot.getCode`)})]})]})]})}export{f as Forgot};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import{ensureGuestIdentity as t}from"../../../store/modules/user-store.mjs";import{Box as n}from"../../ui/box.mjs";import{Checkbox as r}from"../../ui/checkbox.mjs";import{Input as i}from"../../ui/input.mjs";import{Text as a}from"../../ui/text.mjs";import{CloseIcon as o}from"../../../assets/icons/close-icon.mjs";import{EyeIcon as s}from"../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as c}from"../../../assets/icons/eye-off-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{useCallback as u,useMemo as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{useTranslations as h}from"next-intl";function g(g){let _=h(`components.pages.login`),{onClose:v,onForgotPassword:y,onRegister:b,onSubmit:x,errorText:S}=g,[C,w]=f(``),[T,E]=f(``),[D,O]=f(!1),[k,A]=f(!1),[j,M]=f(!1),[N,P]=f(null),F=d(()=>C.trim().length>0&&T.length>0&&j&&!k,[C,T,j,k]),I=u(()=>{t(!0),b?.()},[b]);async function L(){if(F)try{A(!0),await x?.({email:C.trim(),password:T})}finally{A(!1)}}return m(n,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,children:[m(n,{className:`flex justify-between items-center h-[60px] px-[16px]`,children:[p(e,{type:`button`,onClick:v,"aria-label":_(`loginClient.close`),className:`cursor-pointer bg-transparent !p-0 !px-0 !py-0`,children:p(o,{className:`w-[16px] h-[16px] text-text1/80`,"aria-hidden":`true`,focusable:`false`})}),p(e,{type:`button`,onClick:y,className:`text-[14px] text-text2 hover:text-text1 bg-transparent !p-0 !px-0 !py-0`,children:_(`loginClient.forgotPassword`)})]}),m(n,{className:`px-[24px] flex flex-1 flex-col mt-[15px]`,children:[m(n,{className:`flex flex-col`,children:[p(a,{className:`text-[24px] leading-[32px] font-bold`,children:_(`loginClient.title`)}),m(a,{className:`text-[14px] leading-[22px] mt-[12px] text-text1/80`,children:[_(`loginClient.noAccount`),`?`,p(e,{type:`button`,onClick:I,className:`cursor-pointer text-theme5 hover:opacity-90 bg-transparent !p-0 !px-0 !py-0`,children:_(`loginClient.registerLink`)})]})]}),m(`form`,{className:`mt-[38px] space-y-[16px]`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),L()},children:[p(n,{className:`flex items-center px-[28px] rounded-[50px] h-[66px] bg-line1 border border-line1`,children:p(i,{placeholder:_(`loginClient.emailPlaceholder`),type:`email`,name:`funhub-login-email`,value:C,onChange:e=>w(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`!bg-transparent !px-0 !py-0 !rounded-none !text-text1 placeholder:!text-text3 leading-[26px] text-[18px]`})}),m(n,{className:`flex items-center justify-between px-[28px] rounded-[50px] h-[66px] bg-line1 border border-line1`,children:[p(i,{placeholder:_(`loginClient.passwordPlaceholder`),type:D?`text`:`password`,name:`funhub-login-password`,value:T,onChange:e=>E(e.target.value),autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`flex-1 !bg-transparent !px-0 !py-0 !rounded-none !text-text1 placeholder:!text-text3 leading-[26px] text-[18px]`}),p(e,{type:`button`,className:`ml-[10px] cursor-pointer select-none bg-transparent !p-0 !px-0 !py-0`,"aria-label":_(D?`loginClient.hidePassword`:`loginClient.showPassword`),onClick:()=>O(e=>!e),children:p(D?s:c,{className:`w-[20px] h-[20px] text-text3`,"aria-hidden":`true`,focusable:`false`})})]})]}),p(n,{className:`h-[22px] mt-[16px] mb-[22px] ml-[12px] text-[14px] text-theme5`,children:S}),m(n,{className:`mt-auto flex flex-col items-center w-full pb-[55px]`,children:[m(n,{className:`flex items-center justify-center gap-2 flex-wrap mb-[16px] w-full`,children:[p(r,{checked:j,onCheckedChange:e=>M(e===!0),"aria-label":_(`loginClient.agreeToTerms`),className:`shrink-0`}),m(a,{as:`span`,className:`text-[14px] text-text2`,children:[_(`loginClient.agreeToTermsPrefix`),m(e,{type:`button`,variant:`link`,className:`inline text-theme6 !p-0 !h-auto font-normal underline-offset-2 hover:underline bg-transparent`,onClick:()=>P(`terms`),children:[`《`,_(`loginClient.userAgreement`),`》`]}),_(`loginClient.and`),m(e,{type:`button`,variant:`link`,className:`inline text-theme6 !p-0 !h-auto font-normal underline-offset-2 hover:underline bg-transparent`,onClick:()=>P(`privacy`),children:[`《`,_(`loginClient.privacyPolicy`),`》`]})]})]}),p(e,{type:`button`,onClick:L,disabled:!F,className:`w-full h-[60px] !rounded-[30px] !text-[18px] font-bold leading-[26px] bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:_(k?`loginClient.loggingIn`:`loginClient.login`)})]})]}),p(l,{type:N,onClose:()=>P(null)})]})}export{g as LoginClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{getCookie as
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import{getCookie as t,hashPassword as n}from"../../../utils/common.mjs";import{pUserRegister as r,pUserResetForgetPassword as i,pUserResetPassword as a}from"../../../service/generated/client.mjs";import{Box as o}from"../../ui/box.mjs";import{Input as s}from"../../ui/input.mjs";import{Text as c}from"../../ui/text.mjs";import{useLoginModalStore as l}from"../../../store/modules/login-modal-store.mjs";import{useSetAuthFields as u,useUserId as d}from"../../../hooks/use-auth.mjs";import{LeftArrowIcon as f}from"../../../assets/icons/left-arrow-icon.mjs";import{EyeIcon as p}from"../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as m}from"../../../assets/icons/eye-off-icon.mjs";import{useCallback 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";function S(S){let C=x(`components.pages.login`),{email:w,onClose:T}=S,E=u(),D=d(),{resolveLogin:O}=l(),[k,A]=_(``),[j,M]=_(``),[N,P]=_(!1),[F,I]=_(!1),[L,R]=_(!1),[z,B]=_(``),{verifyStep:V}=l(),H=h(async()=>{let e=n(k);return V===`reset-password`?await a({user_id:D,password:e}):V===`forgot-password`?await i({email:w,password:e}):await r({email:w,user_id:await t(`guestUserId`),password:e})},[V,D,w,k]),U=g(()=>k.length===0||j.length===0?``:k.length<6?C(`password.passwordTooShort`):k.length>18?C(`password.passwordTooLong`):k===j?``:C(`password.passwordsNotMatch`),[k,j,C]),W=g(()=>k.length>=6&&k.length<=18&&k===j&&!L,[k,j,L]);async function G(){if(W)try{R(!0),B(``);let{data:e}=await H();e?.user_id&&(E({token:e.token,expireTime:e.expire_time,userId:e.user_id}),b.success(C(`password.passwordSetSuccess`))),O(!0)}catch(e){B(e.message??C(`password.submitFailed`))}finally{R(!1)}}let K=C(V===`reset-password`?`password.confirmModify`:V===`forgot-password`?`password.confirmReset`:`password.register`),q=C(V===`reset-password`||V===`forgot-password`?`password.setNewPassword`:`password.setLoginPassword`);return y(o,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,children:[y(o,{className:`flex justify-between items-center h-[60px] px-[16px]`,children:[v(e,{type:`button`,onClick:T,"aria-label":C(`password.back`),className:`cursor-pointer bg-transparent !p-0 !px-0 !py-0`,children:v(f,{className:`w-[16px] h-[16px] text-text1/80`,"aria-hidden":`true`,focusable:`false`})}),v(c,{className:`text-[14px] text-text2`})]}),y(o,{className:`px-[24px] flex flex-col mt-[15px]`,children:[v(o,{className:`flex flex-col`,children:v(c,{className:`text-[24px] leading-[32px] font-bold`,children:q})}),y(`form`,{className:`mt-[58px]`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),G()},children:[y(o,{className:`space-y-[16px]`,children:[y(o,{className:`flex items-center justify-between px-[28px] rounded-[50px] h-[66px] bg-line1 border border-line1`,children:[v(s,{placeholder:C(`password.passwordPlaceholder`),type:N?`text`:`password`,name:`funhub-password`,value:k,onChange:e=>A(e.target.value),autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`flex-1 !bg-transparent !px-0 !py-0 !rounded-none !text-text1 placeholder:!text-text3 leading-[26px] text-[18px]`}),v(e,{type:`button`,onClick:()=>P(!N),className:`ml-[10px] cursor-pointer bg-transparent !p-0 !px-0 !py-0`,children:v(N?p:m,{className:`w-[20px] h-[20px] text-text3`})})]}),y(o,{className:`flex items-center justify-between px-[28px] rounded-[50px] h-[66px] bg-line1 border border-line1`,children:[v(s,{placeholder:C(`password.confirmPasswordPlaceholder`),type:F?`text`:`password`,name:`funhub-confirm-password`,value:j,onChange:e=>M(e.target.value),autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`flex-1 !bg-transparent !px-0 !py-0 !rounded-none !text-text1 placeholder:!text-text3 leading-[26px] text-[18px]`}),v(e,{type:`button`,onClick:()=>I(!F),className:`ml-[10px] cursor-pointer bg-transparent !p-0 !px-0 !py-0`,children:v(F?p:m,{className:`w-[20px] h-[20px] text-text3`})})]})]}),v(o,{className:`h-[22px] mt-[16px] mb-[22px] ml-[12px] text-[14px] text-theme5`,children:U||z}),v(e,{type:`submit`,disabled:!W,className:`w-full h-[60px] !rounded-[30px] !text-[18px] font-bold leading-[26px] bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:L?C(`password.submitting`):K})]})]})]})}export{S as Password};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import{pUserSendEmailCode as t}from"../../../service/generated/client.mjs";import{Box as n}from"../../ui/box.mjs";import{Input as r}from"../../ui/input.mjs";import{Text as i}from"../../ui/text.mjs";import{useLoginModalStore as a}from"../../../store/modules/login-modal-store.mjs";import{LeftArrowIcon as o}from"../../../assets/icons/left-arrow-icon.mjs";import{useMemo as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";function f(f){let p=d(`components.pages.login`),{onClose:m,onLogin:h,onVerify:g}=f,{setVerifyStep:_}=a(),[v,y]=c(``),[b,x]=c(!1),[S,C]=c(``),w=s(()=>v.trim().length>0&&!b,[v,b]);function T(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function E(e){y(e),S&&C(``)}async function D(){if(w)try{x(!0),C(``);let e=v.trim();if(!T(e)){C(p(`register.invalidEmail`));return}await t({email:e}),_(`register-verify`),g?.(e)}catch(e){C(e.message??p(`register.sendFailed`))}finally{x(!1)}}return u(n,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,children:[u(n,{className:`flex justify-between items-center h-[60px] px-[16px]`,children:[l(e,{type:`button`,onClick:m,"aria-label":p(`register.back`),className:`cursor-pointer bg-transparent !p-0 !px-0 !py-0`,children:l(o,{className:`w-[16px] h-[16px] text-text1/80`,"aria-hidden":`true`,focusable:`false`})}),l(i,{className:`text-[14px] text-text2`})]}),u(n,{className:`px-[24px] flex flex-col mt-[15px]`,children:[u(n,{className:`flex flex-col`,children:[l(i,{className:`text-[24px] leading-[32px] font-bold`,children:p(`register.title`)}),u(i,{className:`text-[14px] leading-[22px] mt-[12px] text-text1/80`,children:[p(`register.hasAccount`),`?`,l(e,{type:`button`,onClick:h,className:`cursor-pointer text-theme5 hover:opacity-90 bg-transparent !p-0 !px-0 !py-0`,children:p(`register.loginLink`)})]})]}),u(n,{className:`mt-[38px]`,children:[l(n,{className:`flex items-center px-[28px] rounded-[50px] h-[66px] bg-line1 border border-line1`,children:l(r,{placeholder:p(`register.emailPlaceholder`),type:`email`,name:`funhub-register-email`,value:v,onChange:e=>E(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`!bg-transparent !px-0 !py-0 !rounded-none !text-text1 placeholder:!text-text3 leading-[26px] text-[18px]`})}),l(n,{className:`h-[22px] mt-[16px] mb-[22px] ml-[12px] text-[14px] text-theme5`,children:S}),l(e,{type:`button`,onClick:D,disabled:!w,className:`w-full h-[60px] !rounded-[30px] !text-[18px] font-bold leading-[26px] bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:p(b?`register.sending`:`register.getCode`)})]})]})]})}export{f as Register};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{pUserSendResetPasswordEmailCode as
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import{pUserSendResetPasswordEmailCode as t,pUserVerifyResetPasswordEmailCode as n}from"../../../service/generated/client.mjs";import{Box as r}from"../../ui/box.mjs";import{Input as i}from"../../ui/input.mjs";import{Text as a}from"../../ui/text.mjs";import{useLoginModalStore as o}from"../../../store/modules/login-modal-store.mjs";import{useUserId as s,useUserInfo as c}from"../../../hooks/use-auth.mjs";import{LeftArrowIcon as l}from"../../../assets/icons/left-arrow-icon.mjs";import{useEffect as u,useMemo as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{useTranslations as h}from"next-intl";function g(e){let[t,n]=e.split(`@`);return!t||!n?e:`${t.slice(0,3)}***${t.length>3?t.slice(-1):``}@${n}`}function _(_){let v=h(`components.pages.login`),{onClose:y,onPassword:b}=_,x=s(),S=c(),{setVerifyStep:C}=o(),[w,T]=f(``),[E,D]=f(0),[O,k]=f(!1),[A,j]=f(!1),[M,N]=f(``),P=d(()=>{let e=S;return e?.email||e?.mail||``},[S]),F=d(()=>P?g(P):``,[P]);u(()=>{C(`reset-password`)},[C]),u(()=>{if(E<=0)return;let e=setInterval(()=>{D(e=>e-1)},1e3);return()=>clearInterval(e)},[E]);let I=d(()=>w.trim().length>=6&&!A,[w,A]);function L(e){T(e.replace(/\D/g,``))}function R(e){e.preventDefault(),B()}async function z(){if(!(!x||O||E>0))try{k(!0),N(``),await t({user_id:x}),D(60)}catch(e){N(e.message??v(`resetPassword.sendFailed`))}finally{k(!1)}}async function B(){if(!(!I||!x))try{j(!0),N(``),await n({user_id:x,email_code:w.trim()}),b?.(P)}catch(e){N(e.message??v(`resetPassword.verifyFailed`))}finally{j(!1)}}return m(r,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,children:[m(r,{className:`flex items-center h-[60px] px-[16px]`,children:[p(e,{type:`button`,onClick:y,"aria-label":v(`resetPassword.back`),className:`cursor-pointer bg-transparent !p-0 !px-0 !py-0`,children:p(l,{className:`w-[16px] h-[16px] text-text1/80`,"aria-hidden":`true`,focusable:`false`})}),p(a,{className:`flex-1 text-center text-[16px] font-semibold`,children:v(`resetPassword.title`)}),p(r,{className:`w-[16px]`,"aria-hidden":`true`})]}),m(r,{className:`px-[24px] flex flex-col mt-[24px]`,children:[m(a,{className:`text-[14px] leading-[22px] text-text1/80`,children:[v(`resetPassword.verifyViaEmail`),F?` ${F} `:` `,v(`resetPassword.verifyHint`)]}),m(`form`,{className:`mt-[36px]`,autoComplete:`off`,onSubmit:R,children:[m(r,{className:`flex items-center justify-between px-[20px] rounded-[50px] h-[56px] bg-line1 border border-line1`,children:[p(i,{placeholder:v(`resetPassword.codePlaceholder`),type:`text`,name:`funhub-reset-password-code`,value:w,onChange:e=>L(e.target.value),inputMode:`numeric`,autoComplete:`one-time-code`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`flex-1 !bg-transparent !px-0 !py-0 !rounded-none !text-text1 placeholder:!text-text3 leading-[24px] text-[16px]`}),p(e,{type:`button`,onClick:z,disabled:O||E>0,className:`ml-[12px] cursor-pointer text-theme5 !p-0 !px-0 !py-0 disabled:text-text3`,children:E>0?v(`resetPassword.resend`,{countdown:E}):v(`resetPassword.sendCode`)})]}),p(r,{className:`h-[22px] mt-[16px] mb-[22px] ml-[12px] text-[14px] text-theme5`,children:M}),p(e,{type:`submit`,disabled:!I,className:`w-full h-[60px] !rounded-[30px] !text-[18px] font-bold leading-[26px] bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:v(A?`resetPassword.verifying`:`resetPassword.verifyEmail`)})]})]})]})}export{_ as ResetPassword};
|