mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 07:04:45 -04:00
Adds an info banner to the app (#190)
* added info-banner component to show the banner.text, we got from the backend config. This banner is shown on top of the landing page (intro, history, login/signup and profile) and also on top of the editor and links to `/n/banner` * added banner to backendConfig Redux state * added BannerState to the ApplicationState with that the showing of the banner is globally controlled, the banner text is given to the banner component and the timestamp to acknowledge a banner was read by the user * the timestamp of a dismissed note is saved in the browsers localStorage to determine in the future if the banner should be shown Signed-off-by: Philip Molares <philip.molares@udo.edu> Co-authored-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
75aa8b38af
commit
e014eb36b5
13 changed files with 144 additions and 15 deletions
|
@ -1,6 +1,7 @@
|
|||
import { getBackendConfig } from '../../../api/backend-config'
|
||||
import { getFrontendConfig } from '../../../api/frontend-config'
|
||||
import { setBackendConfig } from '../../../redux/backend-config/methods'
|
||||
import { setBanner } from '../../../redux/banner/methods'
|
||||
import { setFrontendConfig } from '../../../redux/frontend-config/methods'
|
||||
import { getAndSetUser } from '../../../utils/apiUtils'
|
||||
|
||||
|
@ -17,5 +18,14 @@ export const loadAllConfig: (baseUrl: string) => Promise<void> = async (baseUrl)
|
|||
}
|
||||
setBackendConfig(backendConfig)
|
||||
|
||||
const banner = backendConfig.banner
|
||||
if (banner.text !== '') {
|
||||
const lastAcknowledgedTimestamp = window.localStorage.getItem('bannerTimeStamp') || ''
|
||||
setBanner({
|
||||
...banner,
|
||||
show: banner.text !== '' && banner.timestamp !== lastAcknowledgedTimestamp
|
||||
})
|
||||
}
|
||||
|
||||
await getAndSetUser()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue