✨ feat(locales): Replace 'nodeGroupId' with 'groupId' in multiple language files for consistency
This commit is contained in:
@@ -139,7 +139,7 @@ export default function NodeForm<T extends { [x: string]: any }>({
|
||||
name='group_id'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t('form.nodeGroupId')}</FormLabel>
|
||||
<FormLabel>{t('form.groupId')}</FormLabel>
|
||||
<FormControl>
|
||||
<Combobox<number, false>
|
||||
placeholder={t('form.selectNodeGroup')}
|
||||
@@ -148,6 +148,9 @@ export default function NodeForm<T extends { [x: string]: any }>({
|
||||
value: item.id,
|
||||
label: item.name,
|
||||
}))}
|
||||
onChange={(value) => {
|
||||
form.setValue(field.name, value || 0);
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
||||
@@ -135,7 +135,7 @@ export default function NodeTable() {
|
||||
accessorKey: 'speed_limit',
|
||||
header: t('speedLimit'),
|
||||
cell: ({ row }) => (
|
||||
<Display type='traffic' value={row.getValue('speed_limit')} unlimited />
|
||||
<Display type='trafficSpeed' value={row.getValue('speed_limit')} unlimited />
|
||||
),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -219,13 +219,13 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
||||
name='group_id'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t('form.subscribeGroup')}</FormLabel>
|
||||
<FormLabel>{t('form.groupId')}</FormLabel>
|
||||
<FormControl>
|
||||
<Combobox<number, false>
|
||||
placeholder={t('form.selectSubscribeGroup')}
|
||||
{...field}
|
||||
onChange={(value) => {
|
||||
form.setValue(field.name, value);
|
||||
form.setValue(field.name, value || 0);
|
||||
}}
|
||||
options={group?.map((item) => ({
|
||||
label: item.name,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import { Display } from '@/components/display';
|
||||
import { ProTable, ProTableActions } from '@/components/pro-table';
|
||||
import { createUser, deleteUser, getUserList, updateUser } from '@/services/admin/user';
|
||||
import { Button } from '@workspace/ui/components/button';
|
||||
import { Switch } from '@workspace/ui/components/switch';
|
||||
import { ConfirmButton } from '@workspace/ui/custom-components/confirm-button';
|
||||
import { formatDate, unitConversion } from '@workspace/ui/utils';
|
||||
import { formatDate } from '@workspace/ui/utils';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useRef, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
@@ -77,7 +78,22 @@ export default function Page() {
|
||||
{
|
||||
accessorKey: 'balance',
|
||||
header: t('balance'),
|
||||
cell: ({ row }) => unitConversion('centsToDollars', row.getValue('balance')),
|
||||
cell: ({ row }) => <Display type='currency' value={row.getValue('balance')} />,
|
||||
},
|
||||
{
|
||||
accessorKey: 'gift_amount',
|
||||
header: t('giftAmount'),
|
||||
cell: ({ row }) => <Display type='currency' value={row.getValue('gift_amount')} />,
|
||||
},
|
||||
{
|
||||
accessorKey: 'commission',
|
||||
header: t('commission'),
|
||||
cell: ({ row }) => <Display type='currency' value={row.getValue('commission')} />,
|
||||
},
|
||||
{
|
||||
accessorKey: 'refer_code',
|
||||
header: t('inviteCode'),
|
||||
cell: ({ row }) => row.getValue('refer_code') || '--',
|
||||
},
|
||||
{
|
||||
accessorKey: 'referer_id',
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
'use client';
|
||||
|
||||
import { Display } from '@/components/display';
|
||||
import { getUserDetail } from '@/services/admin/user';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { Button } from '@workspace/ui/components/button';
|
||||
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@workspace/ui/components/hover-card';
|
||||
import { formatDate, unitConversion } from '@workspace/ui/utils';
|
||||
import { formatDate } from '@workspace/ui/utils';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useState } from 'react';
|
||||
|
||||
@@ -43,7 +44,21 @@ export function UserDetail({ id }: { id: number }) {
|
||||
</li>
|
||||
<li className='flex items-center justify-between font-semibold'>
|
||||
<span className='text-muted-foreground'>{t('balance')}</span>
|
||||
<span>{unitConversion('centsToDollars', data?.balance)}</span>
|
||||
<span>
|
||||
<Display type='currency' value={data?.balance} />
|
||||
</span>
|
||||
</li>
|
||||
<li className='flex items-center justify-between'>
|
||||
<span className='text-muted-foreground'>{t('giftAmount')}</span>
|
||||
<span>
|
||||
<Display type='currency' value={data?.gift_amount} />
|
||||
</span>
|
||||
</li>
|
||||
<li className='flex items-center justify-between'>
|
||||
<span className='text-muted-foreground'>{t('commission')}</span>
|
||||
<span>
|
||||
<Display type='currency' value={data?.commission} />
|
||||
</span>
|
||||
</li>
|
||||
<li className='flex items-center justify-between'>
|
||||
<span className='text-muted-foreground'>{t('createdAt')}</span>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import useGlobalStore from '@/config/use-global';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { Icon } from '@iconify/react';
|
||||
import { Button } from '@workspace/ui/components/button';
|
||||
@@ -43,8 +44,10 @@ export default function UserForm<T extends Record<string, any>>({
|
||||
loading,
|
||||
trigger,
|
||||
title,
|
||||
}: UserFormProps<T>) {
|
||||
}: Readonly<UserFormProps<T>>) {
|
||||
const t = useTranslations('user');
|
||||
const { common } = useGlobalStore();
|
||||
const { currency } = common;
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
const formSchema = z.object({
|
||||
@@ -54,6 +57,8 @@ export default function UserForm<T extends Record<string, any>>({
|
||||
refer_code: z.string().optional(),
|
||||
is_admin: z.boolean().optional(),
|
||||
balance: z.number().optional(),
|
||||
gift_amount: z.number().optional(),
|
||||
commission: z.number().optional(),
|
||||
});
|
||||
const form = useForm({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -176,7 +181,7 @@ export default function UserForm<T extends Record<string, any>>({
|
||||
<FormLabel>{t('form.balance')}</FormLabel>
|
||||
<FormControl>
|
||||
<EnhancedInput
|
||||
prefix='¥'
|
||||
prefix={currency?.currency_symbol ?? '$'}
|
||||
placeholder={t('form.balancePlaceholder')}
|
||||
type='number'
|
||||
{...field}
|
||||
@@ -192,6 +197,54 @@ export default function UserForm<T extends Record<string, any>>({
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name='gift_amount'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t('form.giftAmount')}</FormLabel>
|
||||
<FormControl>
|
||||
<EnhancedInput
|
||||
prefix={currency?.currency_symbol ?? '$'}
|
||||
placeholder={t('form.giftAmountPlaceholder')}
|
||||
type='number'
|
||||
{...field}
|
||||
formatInput={(value) => unitConversion('centsToDollars', value)}
|
||||
formatOutput={(value) => unitConversion('dollarsToCents', value)}
|
||||
onValueChange={(value) => {
|
||||
form.setValue(field.name, value);
|
||||
}}
|
||||
min={0}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name='commission'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t('form.commission')}</FormLabel>
|
||||
<FormControl>
|
||||
<EnhancedInput
|
||||
prefix={currency?.currency_symbol ?? '$'}
|
||||
placeholder={t('form.commissionPlaceholder')}
|
||||
type='number'
|
||||
{...field}
|
||||
formatInput={(value) => unitConversion('centsToDollars', value)}
|
||||
formatOutput={(value) => unitConversion('dollarsToCents', value)}
|
||||
onValueChange={(value) => {
|
||||
form.setValue(field.name, value);
|
||||
}}
|
||||
min={0}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name='is_admin'
|
||||
|
||||
Reference in New Issue
Block a user