-
Notifications
You must be signed in to change notification settings - Fork 7.4k
feat(settings): move settings chrome into a single rounded card #21131
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
cd15d10
feat(settings): move settings chrome into a single rounded card
FelixMalfait abf0a4e
feat(settings): move Security into a tab of the General page
FelixMalfait f408a59
refactor(settings): align settings IA — General naming + foldered pages
FelixMalfait c189cc9
fix(settings): point seeded command-menu items at consolidated settin…
FelixMalfait 49a3475
fix(settings): keep header/step-bar title centered; wizard Finish in …
FelixMalfait 6cd8c60
fix(settings): sit the active tab underline on the secondary bar's bo…
FelixMalfait fa5f79f
feat(settings): rename Updates page to Community with partner + Disco…
FelixMalfait 36bf99c
refactor(settings): drop dead layout props and collapse community lin…
FelixMalfait 78fa82e
fix(settings): make the Emails/Calendar tabs the connected accounts
FelixMalfait 50273f0
chore(settings): trim PR comments to the essential
FelixMalfait fb31b72
fix(settings): align the page header with the side panel top bar
FelixMalfait aa6a3db
fix(settings): address PR review — tab resolution, security redirect,…
FelixMalfait d2a0f17
refactor(settings): make SettingsTabBar presentational, drop the eage…
FelixMalfait 5781298
fix(settings): put the body scrollbar at the card edge, not the conte…
FelixMalfait 99036ef
fix(settings): prefer URL hash in tab resolver, memoize account channels
FelixMalfait b3c9ae5
fix(settings): drop the self-referencing Workspace breadcrumb link on…
FelixMalfait 6b5a516
fix(settings): use the tab resolver on the remaining tabbed pages
FelixMalfait 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
85 changes: 85 additions & 0 deletions
85
packages/twenty-front/src/modules/settings/components/layout/SettingsPageHeader.tsx
This file contains hidden or 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,85 @@ | ||
| import { useNavigationDrawerExpanded } from '@/navigation/hooks/useNavigationDrawerExpanded'; | ||
| import { | ||
| Breadcrumb, | ||
| type BreadcrumbProps, | ||
| } from '@/ui/navigation/bread-crumb/components/Breadcrumb'; | ||
| import { NavigationDrawerCollapseButton } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton'; | ||
| import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; | ||
| import { styled } from '@linaria/react'; | ||
| import { type ReactNode } from 'react'; | ||
| import { isDefined } from 'twenty-shared/utils'; | ||
| import { themeCssVariables } from 'twenty-ui/theme-constants'; | ||
|
|
||
| type SettingsPageHeaderProps = { | ||
| links: BreadcrumbProps['links']; | ||
| title?: ReactNode; | ||
| tag?: ReactNode; | ||
| actionButton?: ReactNode; | ||
| }; | ||
|
|
||
| // Header row inside the settings card. Symmetric padding + 1fr / auto / 1fr grid | ||
| // keep the title centered on the same vertical axis as the tabs and body content. | ||
| const StyledHeader = styled.div` | ||
| align-items: center; | ||
| box-sizing: border-box; | ||
| display: grid; | ||
| gap: ${themeCssVariables.spacing[2]}; | ||
| grid-template-columns: 1fr auto 1fr; | ||
| padding: ${themeCssVariables.spacing[3]}; | ||
| width: 100%; | ||
| `; | ||
|
|
||
| const StyledLeft = styled.div` | ||
| align-items: center; | ||
| display: flex; | ||
| gap: ${themeCssVariables.spacing[1]}; | ||
| justify-self: start; | ||
| min-width: 0; | ||
| overflow: hidden; | ||
| `; | ||
|
|
||
| const StyledTitle = styled.div` | ||
| align-items: center; | ||
| color: ${themeCssVariables.font.color.primary}; | ||
| display: flex; | ||
| font-size: ${themeCssVariables.font.size.md}; | ||
| font-weight: ${themeCssVariables.font.weight.semiBold}; | ||
| gap: ${themeCssVariables.spacing[2]}; | ||
| min-width: 0; | ||
| text-align: center; | ||
| `; | ||
|
|
||
| const StyledRight = styled.div` | ||
| align-items: center; | ||
| display: flex; | ||
| gap: ${themeCssVariables.spacing[2]}; | ||
| justify-content: flex-end; | ||
| justify-self: end; | ||
| min-width: 0; | ||
| `; | ||
|
|
||
| export const SettingsPageHeader = ({ | ||
| links, | ||
| title, | ||
| tag, | ||
| actionButton, | ||
| }: SettingsPageHeaderProps) => { | ||
| const isMobile = useIsMobile(); | ||
| const isNavigationDrawerExpanded = useNavigationDrawerExpanded(); | ||
|
|
||
| return ( | ||
| <StyledHeader> | ||
| <StyledLeft> | ||
| {!isNavigationDrawerExpanded && ( | ||
| <NavigationDrawerCollapseButton direction="right" /> | ||
| )} | ||
| <Breadcrumb links={links} /> | ||
| </StyledLeft> | ||
| <StyledTitle> | ||
| {!isMobile && isDefined(title) && title} | ||
| {!isMobile && tag} | ||
| </StyledTitle> | ||
| <StyledRight>{actionButton}</StyledRight> | ||
| </StyledHeader> | ||
| ); | ||
| }; | ||
106 changes: 106 additions & 0 deletions
106
packages/twenty-front/src/modules/settings/components/layout/SettingsPageLayout.tsx
This file contains hidden or 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,106 @@ | ||
| import { CommandMenuForMobile } from '@/command-menu/components/CommandMenuForMobile'; | ||
| import { useCommandMenuHotKeys } from '@/command-menu/hooks/useCommandMenuHotKeys'; | ||
| import { InformationBannerWrapper } from '@/information-banner/components/InformationBannerWrapper'; | ||
| import { SettingsPageHeader } from '@/settings/components/layout/SettingsPageHeader'; | ||
| import { SettingsSecondaryBar } from '@/settings/components/layout/SettingsSecondaryBar'; | ||
| import { SidePanelForDesktop } from '@/side-panel/components/SidePanelForDesktop'; | ||
| import { type BreadcrumbProps } from '@/ui/navigation/bread-crumb/components/Breadcrumb'; | ||
| import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; | ||
| import { styled } from '@linaria/react'; | ||
| import { type JSX, type ReactNode } from 'react'; | ||
| import { isDefined } from 'twenty-shared/utils'; | ||
| import { themeCssVariables } from 'twenty-ui/theme-constants'; | ||
|
|
||
| const SETTINGS_CONTENT_MAX_WIDTH = 760; | ||
|
|
||
| type SettingsPageLayoutProps = { | ||
| links: BreadcrumbProps['links']; | ||
| title?: ReactNode; | ||
| actionButton?: ReactNode; | ||
| secondaryBar?: ReactNode; | ||
| children: ReactNode; | ||
| // className styles the root; tag renders beside the centered title. | ||
| className?: string; | ||
| tag?: JSX.Element; | ||
| }; | ||
|
|
||
| const StyledRoot = styled.div<{ isMobile: boolean }>` | ||
| display: flex; | ||
| flex: 1; | ||
| flex-direction: row; | ||
| min-height: 0; | ||
| min-width: 0; | ||
| padding: ${({ isMobile }) => | ||
| isMobile ? themeCssVariables.spacing[1] : themeCssVariables.spacing[2]}; | ||
| `; | ||
|
|
||
| const StyledMainCardWrapper = styled.div` | ||
| display: flex; | ||
| flex: 1 1 0; | ||
| min-width: 0; | ||
| width: 0; | ||
| `; | ||
|
|
||
| // The single rounded card that bounds the whole settings chrome: header, secondary | ||
| // bar and body all live inside it, against the noisy background that shows in the gap. | ||
| const StyledCard = styled.div` | ||
| background: ${themeCssVariables.background.primary}; | ||
| border: 1px solid ${themeCssVariables.border.color.medium}; | ||
| border-radius: ${themeCssVariables.border.radius.md}; | ||
| box-sizing: border-box; | ||
| display: flex; | ||
| flex: 1; | ||
| flex-direction: column; | ||
| min-height: 0; | ||
| overflow: hidden; | ||
| width: 100%; | ||
| `; | ||
|
|
||
| // flex: 1 + min-height: 0 keep this in the card's overflow chain so the scroll | ||
| // happens inside the body rather than collapsing to content height. | ||
| const StyledBodyContent = styled.div` | ||
| display: flex; | ||
| flex: 1; | ||
| flex-direction: column; | ||
| margin: 0 auto; | ||
| max-width: ${SETTINGS_CONTENT_MAX_WIDTH}px; | ||
| min-height: 0; | ||
| width: 100%; | ||
| `; | ||
|
|
||
| export const SettingsPageLayout = ({ | ||
| links, | ||
| title, | ||
| actionButton, | ||
| secondaryBar, | ||
| children, | ||
| tag, | ||
| className, | ||
| }: SettingsPageLayoutProps) => { | ||
| const isMobile = useIsMobile(); | ||
|
|
||
| useCommandMenuHotKeys(); | ||
|
|
||
| return ( | ||
| <StyledRoot isMobile={isMobile} className={className}> | ||
| <StyledMainCardWrapper> | ||
| <StyledCard> | ||
| <SettingsPageHeader | ||
| links={links} | ||
| title={title} | ||
| tag={tag} | ||
| actionButton={actionButton} | ||
| /> | ||
| {isDefined(secondaryBar) && ( | ||
| <SettingsSecondaryBar>{secondaryBar}</SettingsSecondaryBar> | ||
| )} | ||
| <StyledBodyContent> | ||
| <InformationBannerWrapper /> | ||
| {children} | ||
| </StyledBodyContent> | ||
| </StyledCard> | ||
| </StyledMainCardWrapper> | ||
| {isMobile ? <CommandMenuForMobile /> : <SidePanelForDesktop />} | ||
| </StyledRoot> | ||
| ); | ||
| }; |
21 changes: 21 additions & 0 deletions
21
packages/twenty-front/src/modules/settings/components/layout/SettingsSecondaryBar.tsx
This file contains hidden or 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,21 @@ | ||
| import { styled } from '@linaria/react'; | ||
| import { type ReactNode } from 'react'; | ||
| import { themeCssVariables } from 'twenty-ui/theme-constants'; | ||
|
|
||
| // The secondary row that sits between the header and the body, bracketed by a | ||
| // top + bottom border. Holds either <SettingsTabBar/> or <SettingsWizardStepBar/>. | ||
| const StyledSecondaryBar = styled.div` | ||
| align-items: center; | ||
| border-bottom: 1px solid ${themeCssVariables.border.color.light}; | ||
| border-top: 1px solid ${themeCssVariables.border.color.light}; | ||
| box-sizing: border-box; | ||
| display: flex; | ||
| flex-shrink: 0; | ||
| min-height: ${themeCssVariables.spacing[10]}; | ||
| padding: 0 ${themeCssVariables.spacing[3]}; | ||
| width: 100%; | ||
| `; | ||
|
|
||
| export const SettingsSecondaryBar = ({ children }: { children: ReactNode }) => ( | ||
| <StyledSecondaryBar>{children}</StyledSecondaryBar> | ||
| ); |
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.
Uh oh!
There was an error while loading. Please reload this page.