🔖 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 = {
Common: {
ERROR: {
variant: 'error',
autoHideDuration: 5000,
preventDuplicate: true
preventDuplicate: true,
action
},
WARNING: {
variant: 'warning',
autoHideDuration: 10000,
preventDuplicate: true
preventDuplicate: true,
action
},
SUCCESS: {
variant: 'success',
autoHideDuration: 1500,
preventDuplicate: true
preventDuplicate: true,
action
},
INFO: {
variant: 'info',
autoHideDuration: 3000,
preventDuplicate: true
preventDuplicate: true,
action
},
NOTICE: {
variant: 'info',
autoHideDuration: 20000,
preventDuplicate: true
preventDuplicate: true,
action
},
COPY: {
variant: 'copy',
persist: true,
preventDuplicate: true,
allowDownload: true
allowDownload: true,
action
}
},
Mobile: {

View File

@ -70,7 +70,7 @@ export default function LogTableRow({ item, userIsAdmin }) {
<TableRow tabIndex={item.id}>
<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 && (
<TableCell>
<Label color="default" variant="outlined">