gitscope
← marzneshin / v0.1.3 / app/dashboard/src/pages/users/dialog/periodic-usage-reset.tsx
https://dev.kronoz.win/r/marzneshin.git
app/dashboard/src/pages/users/dialog/periodic-usage-reset.tsx · TypeScript
Blame Raw
 1import { FormControl, FormLabel, Select } from '@chakra-ui/react';
 2import { Controller } from 'react-hook-form';
 3import { resetStrategy } from 'constants/Settings';
 4import { TFunction } from 'i18next';
 5
 6
 7interface PreiodicUsageResetProps {
 8  form: any;
 9  t: TFunction<'translation', undefined, 'translation'>;
10}
11
12export const PeriodicUsageReset = ({ form, t }: PreiodicUsageResetProps) => {
13  return (
14    <FormControl height="66px">
15      <FormLabel>
16        {t('userDialog.periodicUsageReset')}
17      </FormLabel>
18      <Controller
19        control={form.control}
20        name="data_limit_reset_strategy"
21        render={({ field }) => {
22          return (
23            <Select size="sm" {...field}>
24              {resetStrategy.map((s) => {
25                return (
26                  <option key={s.value} value={s.value}>
27                    {t(
28                      'userDialog.resetStrategy' + s.title
29                    )}
30                  </option>
31                );
32              })}
33            </Select>
34          );
35        }}
36      />
37    </FormControl>
38  )
39}