This commit is contained in:
@@ -138,9 +138,9 @@ const DashboardNodesLazyRoute = DashboardNodesLazyRouteImport.update({
|
|||||||
)
|
)
|
||||||
const DashboardWithdrawalIndexLazyRoute =
|
const DashboardWithdrawalIndexLazyRoute =
|
||||||
DashboardWithdrawalIndexLazyRouteImport.update({
|
DashboardWithdrawalIndexLazyRouteImport.update({
|
||||||
id: '/withdrawal/',
|
id: '/',
|
||||||
path: '/withdrawal/',
|
path: '/',
|
||||||
getParentRoute: () => DashboardRouteLazyRoute,
|
getParentRoute: () => DashboardWithdrawalLazyRoute,
|
||||||
} as any).lazy(() =>
|
} as any).lazy(() =>
|
||||||
import('./routes/dashboard/withdrawal/index.lazy').then((d) => d.Route),
|
import('./routes/dashboard/withdrawal/index.lazy').then((d) => d.Route),
|
||||||
)
|
)
|
||||||
@@ -367,7 +367,7 @@ export interface FileRoutesByFullPath {
|
|||||||
'/dashboard': typeof DashboardRouteLazyRouteWithChildren
|
'/dashboard': typeof DashboardRouteLazyRouteWithChildren
|
||||||
'/dashboard/nodes': typeof DashboardNodesLazyRoute
|
'/dashboard/nodes': typeof DashboardNodesLazyRoute
|
||||||
'/dashboard/servers': typeof DashboardServersLazyRoute
|
'/dashboard/servers': typeof DashboardServersLazyRoute
|
||||||
'/dashboard/withdrawal': typeof DashboardWithdrawalLazyRoute
|
'/dashboard/withdrawal': typeof DashboardWithdrawalLazyRouteWithChildren
|
||||||
'/dashboard/': typeof DashboardIndexLazyRoute
|
'/dashboard/': typeof DashboardIndexLazyRoute
|
||||||
'/dashboard/log/balance': typeof DashboardLogBalanceLazyRoute
|
'/dashboard/log/balance': typeof DashboardLogBalanceLazyRoute
|
||||||
'/dashboard/log/commission': typeof DashboardLogCommissionLazyRoute
|
'/dashboard/log/commission': typeof DashboardLogCommissionLazyRoute
|
||||||
@@ -397,13 +397,12 @@ export interface FileRoutesByFullPath {
|
|||||||
'/dashboard/system': typeof DashboardSystemIndexLazyRoute
|
'/dashboard/system': typeof DashboardSystemIndexLazyRoute
|
||||||
'/dashboard/ticket': typeof DashboardTicketIndexLazyRoute
|
'/dashboard/ticket': typeof DashboardTicketIndexLazyRoute
|
||||||
'/dashboard/user': typeof DashboardUserIndexLazyRoute
|
'/dashboard/user': typeof DashboardUserIndexLazyRoute
|
||||||
'/dashboard/withdrawal': typeof DashboardWithdrawalIndexLazyRoute
|
'/dashboard/withdrawal/': typeof DashboardWithdrawalIndexLazyRoute
|
||||||
}
|
}
|
||||||
export interface FileRoutesByTo {
|
export interface FileRoutesByTo {
|
||||||
'/': typeof IndexLazyRoute
|
'/': typeof IndexLazyRoute
|
||||||
'/dashboard/nodes': typeof DashboardNodesLazyRoute
|
'/dashboard/nodes': typeof DashboardNodesLazyRoute
|
||||||
'/dashboard/servers': typeof DashboardServersLazyRoute
|
'/dashboard/servers': typeof DashboardServersLazyRoute
|
||||||
'/dashboard/withdrawal': typeof DashboardWithdrawalLazyRoute
|
|
||||||
'/dashboard': typeof DashboardIndexLazyRoute
|
'/dashboard': typeof DashboardIndexLazyRoute
|
||||||
'/dashboard/log/balance': typeof DashboardLogBalanceLazyRoute
|
'/dashboard/log/balance': typeof DashboardLogBalanceLazyRoute
|
||||||
'/dashboard/log/commission': typeof DashboardLogCommissionLazyRoute
|
'/dashboard/log/commission': typeof DashboardLogCommissionLazyRoute
|
||||||
@@ -441,7 +440,7 @@ export interface FileRoutesById {
|
|||||||
'/dashboard': typeof DashboardRouteLazyRouteWithChildren
|
'/dashboard': typeof DashboardRouteLazyRouteWithChildren
|
||||||
'/dashboard/nodes': typeof DashboardNodesLazyRoute
|
'/dashboard/nodes': typeof DashboardNodesLazyRoute
|
||||||
'/dashboard/servers': typeof DashboardServersLazyRoute
|
'/dashboard/servers': typeof DashboardServersLazyRoute
|
||||||
'/dashboard/withdrawal': typeof DashboardWithdrawalLazyRoute
|
'/dashboard/withdrawal': typeof DashboardWithdrawalLazyRouteWithChildren
|
||||||
'/dashboard/': typeof DashboardIndexLazyRoute
|
'/dashboard/': typeof DashboardIndexLazyRoute
|
||||||
'/dashboard/log/balance': typeof DashboardLogBalanceLazyRoute
|
'/dashboard/log/balance': typeof DashboardLogBalanceLazyRoute
|
||||||
'/dashboard/log/commission': typeof DashboardLogCommissionLazyRoute
|
'/dashboard/log/commission': typeof DashboardLogCommissionLazyRoute
|
||||||
@@ -510,13 +509,12 @@ export interface FileRouteTypes {
|
|||||||
| '/dashboard/system'
|
| '/dashboard/system'
|
||||||
| '/dashboard/ticket'
|
| '/dashboard/ticket'
|
||||||
| '/dashboard/user'
|
| '/dashboard/user'
|
||||||
| '/dashboard/withdrawal'
|
| '/dashboard/withdrawal/'
|
||||||
fileRoutesByTo: FileRoutesByTo
|
fileRoutesByTo: FileRoutesByTo
|
||||||
to:
|
to:
|
||||||
| '/'
|
| '/'
|
||||||
| '/dashboard/nodes'
|
| '/dashboard/nodes'
|
||||||
| '/dashboard/servers'
|
| '/dashboard/servers'
|
||||||
| '/dashboard/withdrawal'
|
|
||||||
| '/dashboard'
|
| '/dashboard'
|
||||||
| '/dashboard/log/balance'
|
| '/dashboard/log/balance'
|
||||||
| '/dashboard/log/commission'
|
| '/dashboard/log/commission'
|
||||||
@@ -637,10 +635,10 @@ declare module '@tanstack/react-router' {
|
|||||||
}
|
}
|
||||||
'/dashboard/withdrawal/': {
|
'/dashboard/withdrawal/': {
|
||||||
id: '/dashboard/withdrawal/'
|
id: '/dashboard/withdrawal/'
|
||||||
path: '/withdrawal'
|
path: '/'
|
||||||
fullPath: '/dashboard/withdrawal'
|
fullPath: '/dashboard/withdrawal/'
|
||||||
preLoaderRoute: typeof DashboardWithdrawalIndexLazyRouteImport
|
preLoaderRoute: typeof DashboardWithdrawalIndexLazyRouteImport
|
||||||
parentRoute: typeof DashboardRouteLazyRoute
|
parentRoute: typeof DashboardWithdrawalLazyRoute
|
||||||
}
|
}
|
||||||
'/dashboard/user/': {
|
'/dashboard/user/': {
|
||||||
id: '/dashboard/user/'
|
id: '/dashboard/user/'
|
||||||
@@ -841,10 +839,24 @@ declare module '@tanstack/react-router' {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface DashboardWithdrawalLazyRouteChildren {
|
||||||
|
DashboardWithdrawalIndexLazyRoute: typeof DashboardWithdrawalIndexLazyRoute
|
||||||
|
}
|
||||||
|
|
||||||
|
const DashboardWithdrawalLazyRouteChildren: DashboardWithdrawalLazyRouteChildren =
|
||||||
|
{
|
||||||
|
DashboardWithdrawalIndexLazyRoute: DashboardWithdrawalIndexLazyRoute,
|
||||||
|
}
|
||||||
|
|
||||||
|
const DashboardWithdrawalLazyRouteWithChildren =
|
||||||
|
DashboardWithdrawalLazyRoute._addFileChildren(
|
||||||
|
DashboardWithdrawalLazyRouteChildren,
|
||||||
|
)
|
||||||
|
|
||||||
interface DashboardRouteLazyRouteChildren {
|
interface DashboardRouteLazyRouteChildren {
|
||||||
DashboardNodesLazyRoute: typeof DashboardNodesLazyRoute
|
DashboardNodesLazyRoute: typeof DashboardNodesLazyRoute
|
||||||
DashboardServersLazyRoute: typeof DashboardServersLazyRoute
|
DashboardServersLazyRoute: typeof DashboardServersLazyRoute
|
||||||
DashboardWithdrawalLazyRoute: typeof DashboardWithdrawalLazyRoute
|
DashboardWithdrawalLazyRoute: typeof DashboardWithdrawalLazyRouteWithChildren
|
||||||
DashboardIndexLazyRoute: typeof DashboardIndexLazyRoute
|
DashboardIndexLazyRoute: typeof DashboardIndexLazyRoute
|
||||||
DashboardLogBalanceLazyRoute: typeof DashboardLogBalanceLazyRoute
|
DashboardLogBalanceLazyRoute: typeof DashboardLogBalanceLazyRoute
|
||||||
DashboardLogCommissionLazyRoute: typeof DashboardLogCommissionLazyRoute
|
DashboardLogCommissionLazyRoute: typeof DashboardLogCommissionLazyRoute
|
||||||
@@ -874,13 +886,12 @@ interface DashboardRouteLazyRouteChildren {
|
|||||||
DashboardSystemIndexLazyRoute: typeof DashboardSystemIndexLazyRoute
|
DashboardSystemIndexLazyRoute: typeof DashboardSystemIndexLazyRoute
|
||||||
DashboardTicketIndexLazyRoute: typeof DashboardTicketIndexLazyRoute
|
DashboardTicketIndexLazyRoute: typeof DashboardTicketIndexLazyRoute
|
||||||
DashboardUserIndexLazyRoute: typeof DashboardUserIndexLazyRoute
|
DashboardUserIndexLazyRoute: typeof DashboardUserIndexLazyRoute
|
||||||
DashboardWithdrawalIndexLazyRoute: typeof DashboardWithdrawalIndexLazyRoute
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const DashboardRouteLazyRouteChildren: DashboardRouteLazyRouteChildren = {
|
const DashboardRouteLazyRouteChildren: DashboardRouteLazyRouteChildren = {
|
||||||
DashboardNodesLazyRoute: DashboardNodesLazyRoute,
|
DashboardNodesLazyRoute: DashboardNodesLazyRoute,
|
||||||
DashboardServersLazyRoute: DashboardServersLazyRoute,
|
DashboardServersLazyRoute: DashboardServersLazyRoute,
|
||||||
DashboardWithdrawalLazyRoute: DashboardWithdrawalLazyRoute,
|
DashboardWithdrawalLazyRoute: DashboardWithdrawalLazyRouteWithChildren,
|
||||||
DashboardIndexLazyRoute: DashboardIndexLazyRoute,
|
DashboardIndexLazyRoute: DashboardIndexLazyRoute,
|
||||||
DashboardLogBalanceLazyRoute: DashboardLogBalanceLazyRoute,
|
DashboardLogBalanceLazyRoute: DashboardLogBalanceLazyRoute,
|
||||||
DashboardLogCommissionLazyRoute: DashboardLogCommissionLazyRoute,
|
DashboardLogCommissionLazyRoute: DashboardLogCommissionLazyRoute,
|
||||||
@@ -910,7 +921,6 @@ const DashboardRouteLazyRouteChildren: DashboardRouteLazyRouteChildren = {
|
|||||||
DashboardSystemIndexLazyRoute: DashboardSystemIndexLazyRoute,
|
DashboardSystemIndexLazyRoute: DashboardSystemIndexLazyRoute,
|
||||||
DashboardTicketIndexLazyRoute: DashboardTicketIndexLazyRoute,
|
DashboardTicketIndexLazyRoute: DashboardTicketIndexLazyRoute,
|
||||||
DashboardUserIndexLazyRoute: DashboardUserIndexLazyRoute,
|
DashboardUserIndexLazyRoute: DashboardUserIndexLazyRoute,
|
||||||
DashboardWithdrawalIndexLazyRoute: DashboardWithdrawalIndexLazyRoute,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const DashboardRouteLazyRouteWithChildren =
|
const DashboardRouteLazyRouteWithChildren =
|
||||||
|
|||||||
@@ -2,7 +2,12 @@ import { Button } from "@workspace/ui/components/button";
|
|||||||
import { Input } from "@workspace/ui/components/input";
|
import { Input } from "@workspace/ui/components/input";
|
||||||
import { Icon } from "@workspace/ui/composed/icon";
|
import { Icon } from "@workspace/ui/composed/icon";
|
||||||
import { generateCaptcha } from "@workspace/ui/services/common/auth";
|
import { generateCaptcha } from "@workspace/ui/services/common/auth";
|
||||||
import { useEffect, useImperativeHandle, useState } from "react";
|
import {
|
||||||
|
type RefObject,
|
||||||
|
useEffect,
|
||||||
|
useImperativeHandle,
|
||||||
|
useState,
|
||||||
|
} from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
export interface LocalCaptchaRef {
|
export interface LocalCaptchaRef {
|
||||||
|
|||||||
@@ -10,7 +10,13 @@ import {
|
|||||||
generateCaptcha,
|
generateCaptcha,
|
||||||
verifyCaptchaSlider,
|
verifyCaptchaSlider,
|
||||||
} from "@workspace/ui/services/common/auth";
|
} from "@workspace/ui/services/common/auth";
|
||||||
import { useCallback, useImperativeHandle, useRef, useState } from "react";
|
import {
|
||||||
|
type RefObject,
|
||||||
|
useCallback,
|
||||||
|
useImperativeHandle,
|
||||||
|
useRef,
|
||||||
|
useState,
|
||||||
|
} from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
export interface SliderCaptchaRef {
|
export interface SliderCaptchaRef {
|
||||||
|
|||||||
@@ -27,23 +27,52 @@ const FormSchema = z.object({
|
|||||||
enable_balance_notify: z.boolean(),
|
enable_balance_notify: z.boolean(),
|
||||||
enable_login_notify: z.boolean(),
|
enable_login_notify: z.boolean(),
|
||||||
enable_subscribe_notify: z.boolean(),
|
enable_subscribe_notify: z.boolean(),
|
||||||
// enable_trade_notify: z.boolean(),
|
enable_trade_notify: z.boolean(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
type NotifyFormValues = z.infer<typeof FormSchema>;
|
||||||
|
|
||||||
|
const notificationFields = [
|
||||||
|
{
|
||||||
|
name: "enable_balance_notify",
|
||||||
|
labelKey: "notify.balanceChange",
|
||||||
|
fallbackLabel: "Balance Change",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "enable_login_notify",
|
||||||
|
labelKey: "notify.login",
|
||||||
|
fallbackLabel: "Login",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "enable_subscribe_notify",
|
||||||
|
labelKey: "notify.subscribe",
|
||||||
|
fallbackLabel: "Subscribe",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "enable_trade_notify",
|
||||||
|
labelKey: "notify.finance",
|
||||||
|
fallbackLabel: "Finance",
|
||||||
|
},
|
||||||
|
] satisfies Array<{
|
||||||
|
name: keyof NotifyFormValues;
|
||||||
|
labelKey: string;
|
||||||
|
fallbackLabel: string;
|
||||||
|
}>;
|
||||||
|
|
||||||
export default function NotifySettings() {
|
export default function NotifySettings() {
|
||||||
const { t } = useTranslation("profile");
|
const { t } = useTranslation("profile");
|
||||||
const { user, getUserInfo } = useGlobalStore();
|
const { user, getUserInfo } = useGlobalStore();
|
||||||
const form = useForm<z.infer<typeof FormSchema>>({
|
const form = useForm<NotifyFormValues>({
|
||||||
resolver: zodResolver(FormSchema),
|
resolver: zodResolver(FormSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
enable_balance_notify: user?.enable_balance_notify ?? false,
|
enable_balance_notify: user?.enable_balance_notify ?? false,
|
||||||
enable_login_notify: user?.enable_login_notify ?? false,
|
enable_login_notify: user?.enable_login_notify ?? false,
|
||||||
enable_subscribe_notify: user?.enable_subscribe_notify ?? false,
|
enable_subscribe_notify: user?.enable_subscribe_notify ?? false,
|
||||||
// enable_trade_notify: user?.enable_trade_notify ?? false,
|
enable_trade_notify: user?.enable_trade_notify ?? false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
async function onSubmit(data: z.infer<typeof FormSchema>) {
|
async function onSubmit(data: NotifyFormValues) {
|
||||||
await updateUserNotify(data);
|
await updateUserNotify(data);
|
||||||
toast.success(t("notify.updateSuccess", "Update Successful"));
|
toast.success(t("notify.updateSuccess", "Update Successful"));
|
||||||
await getUserInfo();
|
await getUserInfo();
|
||||||
@@ -67,32 +96,15 @@ export default function NotifySettings() {
|
|||||||
onSubmit={form.handleSubmit(onSubmit)}
|
onSubmit={form.handleSubmit(onSubmit)}
|
||||||
>
|
>
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
{[
|
{notificationFields.map(({ fallbackLabel, labelKey, name }) => (
|
||||||
{
|
|
||||||
name: "enable_balance_notify",
|
|
||||||
label: t("notify.balanceChange", "Balance Change"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "enable_login_notify",
|
|
||||||
label: t("notify.login", "Login"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "enable_subscribe_notify",
|
|
||||||
label: t("notify.subscribe", "Subscribe"),
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// name: "enable_trade_notify",
|
|
||||||
// label: t("notify.finance", "Finance"),
|
|
||||||
// },
|
|
||||||
].map(({ name, label }) => (
|
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
key={name}
|
key={name}
|
||||||
name={name as any}
|
name={name}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="flex items-center justify-between space-x-4">
|
<FormItem className="flex items-center justify-between space-x-4">
|
||||||
<FormLabel className="text-muted-foreground">
|
<FormLabel className="text-muted-foreground">
|
||||||
{label}
|
{t(labelKey, fallbackLabel)}
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Switch
|
<Switch
|
||||||
|
|||||||
-32
@@ -28,21 +28,6 @@ declare namespace API {
|
|||||||
updated_at: number;
|
updated_at: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type AdminWithdrawalLog = {
|
|
||||||
id: number;
|
|
||||||
user_id: number;
|
|
||||||
amount: number;
|
|
||||||
content: string;
|
|
||||||
status: number;
|
|
||||||
reason?: string;
|
|
||||||
created_at: number;
|
|
||||||
updated_at: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
type ApproveWithdrawalRequest = {
|
|
||||||
withdrawal_id: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
type AnyTLS = {
|
type AnyTLS = {
|
||||||
port: number;
|
port: number;
|
||||||
security_config: SecurityConfig;
|
security_config: SecurityConfig;
|
||||||
@@ -86,18 +71,6 @@ declare namespace API {
|
|||||||
is_default: boolean;
|
is_default: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type GetWithdrawalListParams = {
|
|
||||||
page: number;
|
|
||||||
size: number;
|
|
||||||
user_id?: number;
|
|
||||||
status?: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
type GetWithdrawalListResponse = {
|
|
||||||
list: AdminWithdrawalLog[];
|
|
||||||
total: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
type AppUserSubcbribe = {
|
type AppUserSubcbribe = {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -1801,11 +1774,6 @@ declare namespace API {
|
|||||||
total: number;
|
total: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type RejectWithdrawalRequest = {
|
|
||||||
withdrawal_id: number;
|
|
||||||
reason: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type QuotaTask = {
|
type QuotaTask = {
|
||||||
id: number;
|
id: number;
|
||||||
subscribers: number[];
|
subscribers: number[];
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// @ts-expect-error
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import request from "@workspace/ui/lib/request";
|
import request from "@workspace/ui/lib/request";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// @ts-expect-error
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import request from "@workspace/ui/lib/request";
|
import request from "@workspace/ui/lib/request";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// @ts-expect-error
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import request from "@workspace/ui/lib/request";
|
import request from "@workspace/ui/lib/request";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// @ts-expect-error
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import request from "@workspace/ui/lib/request";
|
import request from "@workspace/ui/lib/request";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// @ts-expect-error
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import request from "@workspace/ui/lib/request";
|
import request from "@workspace/ui/lib/request";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// @ts-expect-error
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import request from "@workspace/ui/lib/request";
|
import request from "@workspace/ui/lib/request";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// @ts-expect-error
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import request from "@workspace/ui/lib/request";
|
import request from "@workspace/ui/lib/request";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// @ts-expect-error
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import request from "@workspace/ui/lib/request";
|
import request from "@workspace/ui/lib/request";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user