apps/web: reduce message duration

notification: enable stack globally
This commit is contained in:
vchikalkin 2024-03-22 11:54:43 +03:00
parent 907f288815
commit 62043e84f3
2 changed files with 12 additions and 5 deletions

View File

@ -7,16 +7,16 @@ import { Table } from 'ui/elements';
export const PolicyTable = observer(
({
storeSelector,
onSelectRow,
storeSelector,
...props
}: {
columns: typeof columns;
onSelectRow: (row: Row) => void;
storeSelector: StoreSelector;
}) => {
const { $tables, $process } = useStore();
const { getRows, setSelectedKey, getSelectedRow } = storeSelector($tables.elt);
const { $process, $tables } = useStore();
const { getRows, getSelectedRow, setSelectedKey } = storeSelector($tables.elt);
return (
<Table
@ -37,7 +37,11 @@ export const PolicyTable = observer(
$process.add('ELT');
setSelectedKey(record.key);
onSelectRow(record);
message.success({ content: 'Выбранный расчет ЭЛТ применен', key: record.key });
message.success({
content: 'Выбранный расчет ЭЛТ применен',
duration: 1,
key: record.key,
});
$process.delete('ELT');
}
},

View File

@ -7,14 +7,17 @@ import { message as antdMessage, notification as antdNotification } from 'ui/ele
export let message: Readonly<MessageInstance>;
export let notification: Readonly<NotificationInstance>;
export function Notification({ children }: { children: ReactNode }) {
export function Notification({ children }: { readonly children: ReactNode }) {
const [messageApi, messageContextHolder] = antdMessage.useMessage({
duration: 1.2,
maxCount: 3,
top: 70,
});
const [notificationApi, notificationContextHolder] = antdNotification.useNotification({
maxCount: 3,
placement: 'bottomRight',
stack: { threshold: 1 },
});
message = messageApi;