mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-24 03:57:06 -04:00
Add toasts (#1073)
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
0b4a0afa16
commit
a86789dbef
11 changed files with 320 additions and 13 deletions
24
src/components/editor-page/use-notification-test.tsx
Normal file
24
src/components/editor-page/use-notification-test.tsx
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useEffect } from 'react'
|
||||
import { DEFAULT_DURATION_IN_SECONDS, dispatchUiNotification } from '../../redux/ui-notifications/methods'
|
||||
|
||||
const localStorageKey = 'dontshowtestnotification'
|
||||
|
||||
export const useNotificationTest = (): void => {
|
||||
useEffect(() => {
|
||||
if (window.localStorage.getItem(localStorageKey)) {
|
||||
return
|
||||
}
|
||||
console.debug('[Notifications] Dispatched test notification')
|
||||
dispatchUiNotification('Notification-Test!', 'It Works!', DEFAULT_DURATION_IN_SECONDS, 'info-circle', [{
|
||||
label: 'Don\'t show again', onClick: () => {
|
||||
window.localStorage.setItem(localStorageKey, '1')
|
||||
}
|
||||
}])
|
||||
}, [])
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue