mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add <YesNoUndefinedButton>
This commit is contained in:
parent
16f56eab5c
commit
fc36f0bcde
@ -1,5 +1,5 @@
|
||||
import { t } from '@lingui/macro';
|
||||
import { Badge } from '@mantine/core';
|
||||
import { Badge, Skeleton } from '@mantine/core';
|
||||
|
||||
import { isTrue } from '../../functions/conversion';
|
||||
|
||||
@ -32,3 +32,11 @@ export function PassFailButton({
|
||||
export function YesNoButton({ value }: { value: any }) {
|
||||
return <PassFailButton value={value} passText={t`Yes`} failText={t`No`} />;
|
||||
}
|
||||
|
||||
export function YesNoUndefinedButton({ value }: { value?: boolean }) {
|
||||
if (value === undefined) {
|
||||
return <Skeleton height={15} width={32} />;
|
||||
} else {
|
||||
return <YesNoButton value={value} />;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { Trans, t } from '@lingui/macro';
|
||||
import { ActionIcon, Group, Stack, Table, Title, Tooltip } from '@mantine/core';
|
||||
import { IconDots, IconEdit, IconKey, IconUser } from '@tabler/icons-react';
|
||||
import { Group, Stack, Table, Title } from '@mantine/core';
|
||||
import { IconDots, IconKey, IconUser } from '@tabler/icons-react';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import { YesNoButton } from '../../../../components/buttons/YesNoButton';
|
||||
import { YesNoUndefinedButton } from '../../../../components/buttons/YesNoButton';
|
||||
import { ApiFormFieldSet } from '../../../../components/forms/fields/ApiFormField';
|
||||
import { ActionDropdown } from '../../../../components/items/ActionDropdown';
|
||||
import { ApiEndpoints } from '../../../../enums/ApiEndpoints';
|
||||
@ -59,6 +59,7 @@ export function AccountDetailPanel() {
|
||||
]}
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Table>
|
||||
<Table.Tr>
|
||||
<Table.Td>
|
||||
@ -83,7 +84,7 @@ export function AccountDetailPanel() {
|
||||
<Trans>Staff Access</Trans>
|
||||
</Table.Td>
|
||||
<Table.Td>
|
||||
<YesNoButton value={user?.is_staff} />
|
||||
<YesNoUndefinedButton value={user?.is_staff} />
|
||||
</Table.Td>
|
||||
</Table.Tr>
|
||||
<Table.Tr>
|
||||
@ -91,7 +92,7 @@ export function AccountDetailPanel() {
|
||||
<Trans>Superuser</Trans>
|
||||
</Table.Td>
|
||||
<Table.Td>
|
||||
<YesNoButton value={user?.is_superuser} />
|
||||
<YesNoUndefinedButton value={user?.is_superuser} />
|
||||
</Table.Td>
|
||||
</Table.Tr>
|
||||
</Table>
|
||||
|
Loading…
Reference in New Issue
Block a user