mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-18 10:15:41 +00:00
feat: dismiss login alert
This commit is contained in:
parent
dcf66b8301
commit
34f01a0019
@ -75,8 +75,9 @@ export default function App(): React.ReactElement {
|
||||
const [sidebarCollapsed, setSidebarCollapsed] = useState(false)
|
||||
const [isAuthenticated, setIsAuthenticated] = useState<boolean | undefined>(undefined)
|
||||
const [configuration, setConfiguration] = useState<InstanceConfig | undefined>(undefined)
|
||||
|
||||
const [darkMode, setDarkMode] = useState(false)
|
||||
const [dismissLoginAlert, setDismissLoginAlert] = useState(() => localStorage.getItem('dismiss-login-alert') === 'true')
|
||||
|
||||
const windowQuery = window.matchMedia('(prefers-color-scheme:dark)')
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
|
||||
@ -101,6 +102,8 @@ export default function App(): React.ReactElement {
|
||||
}
|
||||
}, [windowQuery, darkModeChange])
|
||||
|
||||
useEffect(() => localStorage.setItem('dismiss-login-alert', dismissLoginAlert.toString()), [dismissLoginAlert])
|
||||
|
||||
useEffect(() => {
|
||||
setDarkMode(windowQuery.matches)
|
||||
getConfiguration().then(configuration => {
|
||||
@ -126,11 +129,12 @@ export default function App(): React.ReactElement {
|
||||
>
|
||||
<ConfigurationContext.Provider value={configContextValue}>
|
||||
<AuthenticatedContext.Provider value={authContextValue}>
|
||||
{(configuration?.registerEnabled || configuration?.ssoLogin) && isAuthenticated === false && !['/login', '/home'].includes(location.pathname) &&
|
||||
{!dismissLoginAlert && (configuration?.registerEnabled || configuration?.ssoLogin) && isAuthenticated === false && !['/login'].includes(location.pathname) &&
|
||||
<Alert
|
||||
type="warning"
|
||||
message={t`Please log in to access all features, monitor domains, and manage your Connectors.`}
|
||||
action={<Link to='/login'><Button>{t`Log in`}</Button></Link>}
|
||||
onClose={() => setDismissLoginAlert(true)}
|
||||
banner closable/>
|
||||
}
|
||||
<Layout hasSider style={{minHeight: '100vh'}}>
|
||||
|
||||
@ -3,48 +3,48 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n!=1);\n"
|
||||
|
||||
#: assets/App.tsx:118
|
||||
#: assets/App.tsx:121
|
||||
msgid "Unable to contact the server, please reload the page."
|
||||
msgstr ""
|
||||
|
||||
#: assets/App.tsx:132
|
||||
#: assets/App.tsx:135
|
||||
msgid ""
|
||||
"Please log in to access all features, monitor domains, and manage your "
|
||||
"Connectors."
|
||||
msgstr ""
|
||||
|
||||
#: assets/App.tsx:133
|
||||
#: assets/App.tsx:136
|
||||
#: assets/components/Sider.tsx:158
|
||||
#: assets/pages/LoginPage.tsx:36
|
||||
#: assets/pages/LoginPage.tsx:50
|
||||
msgid "Log in"
|
||||
msgstr ""
|
||||
|
||||
#: assets/App.tsx:187
|
||||
#: assets/App.tsx:191
|
||||
msgid "TOS"
|
||||
msgstr ""
|
||||
|
||||
#: assets/App.tsx:189
|
||||
#: assets/App.tsx:193
|
||||
msgid "Privacy Policy"
|
||||
msgstr ""
|
||||
|
||||
#: assets/App.tsx:190
|
||||
#: assets/App.tsx:194
|
||||
msgid "FAQ"
|
||||
msgstr ""
|
||||
|
||||
#: assets/App.tsx:194
|
||||
#: assets/App.tsx:198
|
||||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
#: assets/App.tsx:199
|
||||
#: assets/App.tsx:203
|
||||
msgid "Source code"
|
||||
msgstr ""
|
||||
|
||||
#: assets/App.tsx:204
|
||||
#: assets/App.tsx:208
|
||||
msgid "Submit an issue"
|
||||
msgstr ""
|
||||
|
||||
#: assets/App.tsx:208
|
||||
#: assets/App.tsx:212
|
||||
#, javascript-format
|
||||
msgid ""
|
||||
"${ ProjectLink } is an open source project distributed under the ${ "
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user