Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -77,6 +77,7 @@ const defaultValues = {
|
||||
purchase_with_discount: false,
|
||||
reset_cycle: 0,
|
||||
renewal_reset: false,
|
||||
show_original_price: false,
|
||||
deduction_mode: "auto",
|
||||
};
|
||||
|
||||
@@ -837,6 +838,41 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="show_original_price"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="space-y-0.5">
|
||||
<FormLabel>
|
||||
{t(
|
||||
"form.showOriginalPrice",
|
||||
"Show Original Price"
|
||||
)}
|
||||
</FormLabel>
|
||||
<FormDescription>
|
||||
{t(
|
||||
"form.showOriginalPriceDescription",
|
||||
"Display original price in the storefront"
|
||||
)}
|
||||
</FormDescription>
|
||||
</div>
|
||||
<FormControl>
|
||||
<Switch
|
||||
checked={!!field.value}
|
||||
onCheckedChange={(value) =>
|
||||
form.setValue(field.name, value)
|
||||
}
|
||||
/>
|
||||
</FormControl>
|
||||
</div>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="allow_deduction"
|
||||
|
||||
@@ -37,7 +37,7 @@ const verifySchema = z.object({
|
||||
turnstile_secret: z.string().optional(),
|
||||
enable_register_verify: z.boolean().optional(),
|
||||
enable_login_verify: z.boolean().optional(),
|
||||
enable_password_verify: z.boolean().optional(),
|
||||
enable_reset_password_verify: z.boolean().optional(),
|
||||
});
|
||||
|
||||
type VerifyFormData = z.infer<typeof verifySchema>;
|
||||
@@ -63,7 +63,7 @@ export default function VerifyConfig() {
|
||||
turnstile_secret: "",
|
||||
enable_register_verify: false,
|
||||
enable_login_verify: false,
|
||||
enable_password_verify: false,
|
||||
enable_reset_password_verify: false,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -243,7 +243,7 @@ export default function VerifyConfig() {
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="enable_password_verify"
|
||||
name="enable_reset_password_verify"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>
|
||||
|
||||
@@ -69,7 +69,11 @@ export default function User() {
|
||||
action={ref}
|
||||
actions={{
|
||||
render: (row) => [
|
||||
<ProfileSheet key="profile" userId={row.id} />,
|
||||
<ProfileSheet
|
||||
key="profile"
|
||||
onUpdated={() => ref.current?.refresh()}
|
||||
userId={row.id}
|
||||
/>,
|
||||
<SubscriptionSheet key="subscription" userId={row.id} />,
|
||||
<ConfirmButton
|
||||
cancelText={t("cancel", "Cancel")}
|
||||
@@ -308,7 +312,13 @@ export default function User() {
|
||||
);
|
||||
}
|
||||
|
||||
function ProfileSheet({ userId }: { userId: number }) {
|
||||
function ProfileSheet({
|
||||
userId,
|
||||
onUpdated,
|
||||
}: {
|
||||
userId: number;
|
||||
onUpdated?: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation("user");
|
||||
const [open, setOpen] = useState(false);
|
||||
const { data: user, refetch } = useQuery({
|
||||
@@ -319,6 +329,12 @@ function ProfileSheet({ userId }: { userId: number }) {
|
||||
return data.data as API.User;
|
||||
},
|
||||
});
|
||||
|
||||
const refetchAll = async () => {
|
||||
await refetch();
|
||||
onUpdated?.();
|
||||
return Promise.resolve();
|
||||
};
|
||||
return (
|
||||
<Sheet onOpenChange={setOpen} open={open}>
|
||||
<SheetTrigger asChild>
|
||||
@@ -348,13 +364,13 @@ function ProfileSheet({ userId }: { userId: number }) {
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent className="mt-0" value="basic">
|
||||
<BasicInfoForm refetch={refetch as any} user={user} />
|
||||
<BasicInfoForm refetch={refetchAll} user={user} />
|
||||
</TabsContent>
|
||||
<TabsContent className="mt-0" value="notify">
|
||||
<NotifySettingsForm refetch={refetch as any} user={user} />
|
||||
<NotifySettingsForm refetch={refetchAll} user={user} />
|
||||
</TabsContent>
|
||||
<TabsContent className="mt-0" value="auth">
|
||||
<AuthMethodsForm refetch={refetch as any} user={user} />
|
||||
<AuthMethodsForm refetch={refetchAll} user={user} />
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</ScrollArea>
|
||||
|
||||
@@ -21,7 +21,7 @@ export function AuthMethodsForm({
|
||||
refetch,
|
||||
}: {
|
||||
user: API.User;
|
||||
refetch: () => void;
|
||||
refetch: () => Promise<unknown>;
|
||||
}) {
|
||||
const { t } = useTranslation("user");
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ export function BasicInfoForm({
|
||||
refetch,
|
||||
}: {
|
||||
user: API.User;
|
||||
refetch: () => void;
|
||||
refetch: () => Promise<unknown>;
|
||||
}) {
|
||||
const { t } = useTranslation("user");
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export function NotifySettingsForm({
|
||||
refetch,
|
||||
}: {
|
||||
user: API.User;
|
||||
refetch: () => void;
|
||||
refetch: () => Promise<unknown>;
|
||||
}) {
|
||||
const { t } = useTranslation("user");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user