-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(web): Single theme entry point & ensure Mantine singletons #5624
Changes from 2 commits
d8b1ec5
4678b80
bb8066a
6818d9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { ColorSchemeProvider, Loader } from '@mantine/core'; | ||
import { colors } from '@novu/design-system'; | ||
import { colors, ThemeProvider } from '@novu/design-system'; | ||
import { CONTEXT_PATH, SegmentProvider } from '@novu/shared-web'; | ||
import * as Sentry from '@sentry/react'; | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
|
@@ -34,9 +34,6 @@ const fallbackDisplay = ( | |
display: 'grid', | ||
placeItems: 'center', | ||
bg: 'surface.page', | ||
// Root element may not have loaded so rely on OS | ||
_osDark: { bg: 'legacy.BGDark' }, | ||
_osLight: { bg: 'legacy.BGLight' }, | ||
})} | ||
> | ||
<Loader size={64} variant="bars" color={colors.gradientMiddle} /> | ||
|
@@ -48,7 +45,7 @@ const fallbackDisplay = ( | |
*/ | ||
const Providers: React.FC<PropsWithChildren<{}>> = ({ children }) => { | ||
return ( | ||
<ColorSchemeProvider colorScheme={'dark'} toggleColorScheme={() => {}}> | ||
<ThemeProvider> | ||
<SegmentProvider> | ||
<QueryClientProvider client={queryClient}> | ||
<BrowserRouter basename={CONTEXT_PATH}> | ||
|
@@ -60,7 +57,7 @@ const Providers: React.FC<PropsWithChildren<{}>> = ({ children }) => { | |
</BrowserRouter> | ||
</QueryClientProvider> | ||
</SegmentProvider> | ||
</ColorSchemeProvider> | ||
</ThemeProvider> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ThemeProvider now lives at the top of the tree. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💯 |
||
); | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,49 @@ | ||
import React from 'react'; | ||
import { createStyles, Box } from '@mantine/core'; | ||
import { ThemeProvider } from '@novu/design-system'; | ||
import { CONTEXT_PATH } from '../../../config'; | ||
import { Outlet } from 'react-router-dom'; | ||
|
||
export default function AuthLayout({ children }: { children?: React.ReactNode }) { | ||
export default function AuthLayout() { | ||
const { classes } = useStyles(); | ||
|
||
return ( | ||
<ThemeProvider> | ||
<div className={classes.wrapper}> | ||
<div className={classes.bg}> | ||
<div className={classes.wrapper}> | ||
<div className={classes.bg}> | ||
<img | ||
src={CONTEXT_PATH + '/static/images/logo-formerly-dark-bg.png'} | ||
alt="logo" | ||
style={{ alignSelf: 'flex-start', maxWidth: 150, marginTop: 5, marginLeft: 5 }} | ||
/> | ||
<Box | ||
sx={{ | ||
position: 'absolute', | ||
right: '50%', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
transform: 'translate(35%, 7%)', | ||
'@media (max-width: 1200px)': { | ||
display: 'none', | ||
}, | ||
}} | ||
> | ||
<img | ||
src={CONTEXT_PATH + '/static/images/logo-formerly-dark-bg.png'} | ||
src={CONTEXT_PATH + '/static/images/notifications/notification_01.png'} | ||
alt="logo" | ||
style={{ alignSelf: 'flex-start', maxWidth: 150, marginTop: 5, marginLeft: 5 }} | ||
style={{ maxWidth: 400 }} | ||
/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bad diff, there's no changes here. |
||
<Box | ||
sx={{ | ||
position: 'absolute', | ||
right: '50%', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
transform: 'translate(35%, 7%)', | ||
'@media (max-width: 1200px)': { | ||
display: 'none', | ||
}, | ||
}} | ||
> | ||
<img | ||
src={CONTEXT_PATH + '/static/images/notifications/notification_01.png'} | ||
alt="logo" | ||
style={{ maxWidth: 400 }} | ||
/> | ||
<img | ||
src={CONTEXT_PATH + '/static/images/notifications/notification_02.png'} | ||
alt="logo" | ||
style={{ marginTop: -15, marginLeft: 30, maxWidth: 400 }} | ||
/> | ||
<img | ||
src={CONTEXT_PATH + '/static/images/notifications/notification_03.png'} | ||
alt="logo" | ||
style={{ marginTop: -15, maxWidth: 400 }} | ||
/> | ||
</Box>{' '} | ||
</div> | ||
{children} | ||
<img | ||
src={CONTEXT_PATH + '/static/images/notifications/notification_02.png'} | ||
alt="logo" | ||
style={{ marginTop: -15, marginLeft: 30, maxWidth: 400 }} | ||
/> | ||
<img | ||
src={CONTEXT_PATH + '/static/images/notifications/notification_03.png'} | ||
alt="logo" | ||
style={{ marginTop: -15, maxWidth: 400 }} | ||
/> | ||
</Box>{' '} | ||
</div> | ||
</ThemeProvider> | ||
<Outlet /> | ||
</div> | ||
); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap all of these paths with
AuthLayout
with an<Outlet/>
added toAuthLayout
to render children. We now removeAuthLayout
being duplicated in each of these child routes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we call the
AuthLayout
,PublicPageLayout
to make it more clear as Auth layout doesn't tell us if this is for authenticated or unauthenticated context.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great suggestion. I'll change this.