🔖 chore: Optimize tips and display the name of the log channel.(#199)

This commit is contained in:
MartialBE 2024-05-21 14:37:34 +08:00
parent df3b197b4b
commit 9bb90df5c1
No known key found for this signature in database
GPG Key ID: 27C0267EC84B0A5C
2 changed files with 28 additions and 7 deletions

View File

@ -1,35 +1,56 @@
import { closeSnackbar } from 'notistack';
import { IconX } from '@tabler/icons-react';
import { IconButton } from '@mui/material';
const action = (snackbarId) => (
<>
<IconButton
onClick={() => {
closeSnackbar(snackbarId);
}}
>
<IconX stroke={1.5} size="1.25rem" />
</IconButton>
</>
);
export const snackbarConstants = { export const snackbarConstants = {
Common: { Common: {
ERROR: { ERROR: {
variant: 'error', variant: 'error',
autoHideDuration: 5000, autoHideDuration: 5000,
preventDuplicate: true preventDuplicate: true,
action
}, },
WARNING: { WARNING: {
variant: 'warning', variant: 'warning',
autoHideDuration: 10000, autoHideDuration: 10000,
preventDuplicate: true preventDuplicate: true,
action
}, },
SUCCESS: { SUCCESS: {
variant: 'success', variant: 'success',
autoHideDuration: 1500, autoHideDuration: 1500,
preventDuplicate: true preventDuplicate: true,
action
}, },
INFO: { INFO: {
variant: 'info', variant: 'info',
autoHideDuration: 3000, autoHideDuration: 3000,
preventDuplicate: true preventDuplicate: true,
action
}, },
NOTICE: { NOTICE: {
variant: 'info', variant: 'info',
autoHideDuration: 20000, autoHideDuration: 20000,
preventDuplicate: true preventDuplicate: true,
action
}, },
COPY: { COPY: {
variant: 'copy', variant: 'copy',
persist: true, persist: true,
preventDuplicate: true, preventDuplicate: true,
allowDownload: true allowDownload: true,
action
} }
}, },
Mobile: { Mobile: {

View File

@ -70,7 +70,7 @@ export default function LogTableRow({ item, userIsAdmin }) {
<TableRow tabIndex={item.id}> <TableRow tabIndex={item.id}>
<TableCell>{timestamp2string(item.created_at)}</TableCell> <TableCell>{timestamp2string(item.created_at)}</TableCell>
{userIsAdmin && <TableCell>{(item.channel_id || '') + '(' + (item.channel?.name || '未知') + ')'}</TableCell>} {userIsAdmin && <TableCell>{(item.channel_id || '') + ' ' + (item.channel?.name ? '(' + item.channel.name + ')' : '')}</TableCell>}
{userIsAdmin && ( {userIsAdmin && (
<TableCell> <TableCell>
<Label color="default" variant="outlined"> <Label color="default" variant="outlined">