-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d8b1ec5
refactor(web): Single theming entry point and pin @types/react to ens…
rifont 4678b80
refactor(theme): remove redundant color scheme code
rifont bb8066a
refactor(routes): rename layout components for clarity
rifont 6818d9d
refactor(auth): simplify conditional rendering in pages
rifont File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { useState } from 'react'; | ||
import * as Sentry from '@sentry/react'; | ||
import { Outlet } from 'react-router-dom'; | ||
import styled from '@emotion/styled'; | ||
|
||
import { HeaderNav } from './HeaderNav'; | ||
import { SideNav } from './SideNav'; | ||
import { IntercomProvider } from 'react-use-intercom'; | ||
import { INTERCOM_APP_ID } from '../../../config/index'; | ||
import { EnsureOnboardingComplete } from '../components/EnsureOnboardingComplete'; | ||
import { SpotLight } from '../../utils/Spotlight'; | ||
import { SpotLightProvider } from '../../providers/SpotlightProvider'; | ||
import { useFeatureFlag } from '@novu/shared-web'; | ||
import { FeatureFlagsKeysEnum } from '@novu/shared'; | ||
import { HeaderNav as HeaderNavNew } from './v2/HeaderNav'; | ||
import { MainNav } from '../../nav/MainNav'; | ||
import { FreeTrialBanner } from './FreeTrialBanner'; | ||
|
||
const AppShell = styled.div` | ||
display: flex; | ||
width: 100vw; | ||
height: 100vh; | ||
min-width: 1024px; | ||
`; | ||
|
||
const ContentShell = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
flex: 1 1 0%; | ||
overflow: hidden; // for appropriate scroll | ||
`; | ||
|
||
export function PrivatePageLayout() { | ||
const [isIntercomOpened, setIsIntercomOpened] = useState(false); | ||
|
||
const isInformationArchitectureEnabled = useFeatureFlag(FeatureFlagsKeysEnum.IS_INFORMATION_ARCHITECTURE_ENABLED); | ||
|
||
return ( | ||
<EnsureOnboardingComplete> | ||
<SpotLightProvider> | ||
<IntercomProvider | ||
appId={INTERCOM_APP_ID} | ||
onShow={() => setIsIntercomOpened(true)} | ||
onHide={() => setIsIntercomOpened(false)} | ||
> | ||
<Sentry.ErrorBoundary | ||
fallback={({ error, resetError, eventId }) => ( | ||
<> | ||
Sorry, but something went wrong. <br /> | ||
Our team has been notified and we are investigating. | ||
<br /> | ||
<code> | ||
<small style={{ color: 'lightGrey' }}> | ||
Event Id: {eventId}. | ||
<br /> | ||
{error.toString()} | ||
</small> | ||
</code> | ||
</> | ||
)} | ||
> | ||
<SpotLight> | ||
<AppShell> | ||
{isInformationArchitectureEnabled ? <MainNav /> : <SideNav />} | ||
<ContentShell> | ||
<FreeTrialBanner /> | ||
{isInformationArchitectureEnabled ? ( | ||
<HeaderNavNew /> | ||
) : ( | ||
<HeaderNav isIntercomOpened={isIntercomOpened} /> | ||
)} | ||
<Outlet /> | ||
</ContentShell> | ||
</AppShell> | ||
</SpotLight> | ||
</Sentry.ErrorBoundary> | ||
</IntercomProvider> | ||
</SpotLightProvider> | ||
</EnsureOnboardingComplete> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...nents/layout/EnsureOnboardingComplete.tsx → ...t/components/EnsureOnboardingComplete.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
ThemeProvider now lives at the top of the tree.
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.
💯