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