diff --git a/src/frontend/src/pages/Index/Scan.tsx b/src/frontend/src/pages/Index/Scan.tsx index 286a82fb70..a5c6af2452 100644 --- a/src/frontend/src/pages/Index/Scan.tsx +++ b/src/frontend/src/pages/Index/Scan.tsx @@ -18,7 +18,7 @@ import { } from '@tabler/icons-react'; import { useCallback, useEffect, useMemo, useState } from 'react'; -import { showNotification } from '@mantine/notifications'; +import { hideNotification, showNotification } from '@mantine/notifications'; import { api } from '../../App'; import { BarcodeInput } from '../../components/barcodes/BarcodeInput'; import type { BarcodeScanItem } from '../../components/barcodes/BarcodeScanItem'; @@ -55,7 +55,10 @@ export default function Scan() { // Prevent duplicates if (history.find((i) => i.model == item.model && i.pk == item.pk)) { + hideNotification('duplicate-barcode'); + showNotification({ + id: 'duplicate-barcode', title: t`Duplicate`, message: t`Item already scanned`, color: 'orange' diff --git a/src/frontend/src/states/IconState.tsx b/src/frontend/src/states/IconState.tsx index 38976fc873..1f6193e263 100644 --- a/src/frontend/src/states/IconState.tsx +++ b/src/frontend/src/states/IconState.tsx @@ -1,7 +1,7 @@ import { create } from 'zustand'; import { t } from '@lingui/macro'; -import { showNotification } from '@mantine/notifications'; +import { hideNotification, showNotification } from '@mantine/notifications'; import { api } from '../App'; import { ApiEndpoints } from '../enums/ApiEndpoints'; import { generateUrl } from '../functions/urls'; @@ -38,7 +38,11 @@ export const useIconState = create()((set, get) => ({ const packs = await api.get(apiUrl(ApiEndpoints.icons)).catch((_error) => { console.error('ERR: Could not fetch icon packages'); + + hideNotification('icon-fetch-error'); + showNotification({ + id: 'icon-fetch-error', title: t`Error`, message: t`Error loading icon package from server`, color: 'red' @@ -66,7 +70,9 @@ export const useIconState = create()((set, get) => ({ console.error( "ERR: Icon package is missing 'prefix' or 'fonts' field" ); + hideNotification('icon-fetch-error'); showNotification({ + id: 'icon-fetch-error', title: t`Error`, message: t`Error loading icon package from server`, color: 'red' diff --git a/src/frontend/src/tables/InvenTreeTable.tsx b/src/frontend/src/tables/InvenTreeTable.tsx index 9baf8c52e6..0bf89e0ae4 100644 --- a/src/frontend/src/tables/InvenTreeTable.tsx +++ b/src/frontend/src/tables/InvenTreeTable.tsx @@ -12,7 +12,7 @@ import type React from 'react'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; -import { showNotification } from '@mantine/notifications'; +import { hideNotification, showNotification } from '@mantine/notifications'; import { Boundary } from '../components/Boundary'; import type { ApiFormFieldSet } from '../components/forms/fields/ApiFormField'; import { useApi } from '../contexts/ApiContext'; @@ -207,7 +207,9 @@ export function InvenTreeTable>({ return null; }) .catch(() => { + hideNotification('table-options-error'); showNotification({ + id: 'table-options-error', title: t`API Error`, message: t`Failed to load table options`, color: 'red'