-
Notifications
You must be signed in to change notification settings - Fork 7.5k
fix(front): settings skeleton, app-detail header & empty favorites #21209
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 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1db0b04
fix(settings): align loading skeleton with the rounded-card layout
FelixMalfait 7a78cab
fix(settings): use a plain title on the application detail pages
FelixMalfait 776d0af
fix(navigation): hide the Favorites section when there are no favorites
FelixMalfait 6fb5a15
chore(settings): remove SettingsSkeletonLoader doc comment
FelixMalfait 406713c
chore: remove remaining inline comments per review
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
105 changes: 67 additions & 38 deletions
105
packages/twenty-front/src/modules/settings/components/SettingsSkeletonLoader.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 |
|---|---|---|
| @@ -1,54 +1,83 @@ | ||
| import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader'; | ||
| import { PageBody } from '@/ui/layout/page/components/PageBody'; | ||
| import { PageHeader } from '@/ui/layout/page/components/PageHeader'; | ||
| import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer'; | ||
| import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader'; | ||
| import { SettingsPageHeader } from '@/settings/components/layout/SettingsPageHeader'; | ||
| import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; | ||
| import { styled } from '@linaria/react'; | ||
| import { useContext } from 'react'; | ||
| import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'; | ||
| import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants'; | ||
|
|
||
| const StyledContainer = styled.div` | ||
| // Full-page settings loading state: the rounded-card chrome (header + body) | ||
| // wrapped around the shared SettingsSectionSkeletonLoader. | ||
| // | ||
| // Use this only when no settings chrome is on screen yet — the route-level | ||
| // Suspense fallback, or a page that must load its data (and its data-dependent | ||
| // title/breadcrumb) before it can render SettingsPageLayout. When the chrome is | ||
| // already rendered above (e.g. a tab inside an already-rendered page), render | ||
| // SettingsSectionSkeletonLoader directly so the body matches without nesting a | ||
| // second card. | ||
| // | ||
| // The card is re-created here rather than reusing SettingsPageLayout to keep the | ||
| // skeleton free of the layout's page-level side effects (command-menu hotkeys, | ||
| // the desktop side panel and the information banner). | ||
| const StyledRoot = styled.div<{ isMobile: boolean }>` | ||
| display: flex; | ||
| flex-direction: column; | ||
| width: 100%; | ||
| flex: 1; | ||
| min-height: 0; | ||
| min-width: 0; | ||
| padding: ${({ isMobile }) => | ||
| isMobile ? themeCssVariables.spacing[1] : themeCssVariables.spacing[2]}; | ||
| `; | ||
|
|
||
| const StyledTitleLoaderContainer = styled.div` | ||
| margin: ${themeCssVariables.spacing[8]} ${themeCssVariables.spacing[8]} | ||
| ${themeCssVariables.spacing[2]}; | ||
| 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%; | ||
| `; | ||
|
|
||
| export const SettingsSkeletonLoader = () => { | ||
| const isMobile = useIsMobile(); | ||
| const { theme } = useContext(ThemeContext); | ||
|
|
||
| return ( | ||
| <StyledContainer> | ||
| <PageHeader | ||
| title={ | ||
| <SkeletonTheme | ||
| baseColor={theme.background.tertiary} | ||
| highlightColor={theme.background.transparent.lighter} | ||
| borderRadius={4} | ||
| > | ||
| <Skeleton | ||
| height={SKELETON_LOADER_HEIGHT_SIZES.standard.m} | ||
| width={120} | ||
| />{' '} | ||
| </SkeletonTheme> | ||
| } | ||
| /> | ||
| <PageBody> | ||
| <StyledTitleLoaderContainer> | ||
| <SkeletonTheme | ||
| baseColor={theme.background.tertiary} | ||
| highlightColor={theme.background.transparent.lighter} | ||
| borderRadius={4} | ||
| > | ||
| <Skeleton | ||
| height={SKELETON_LOADER_HEIGHT_SIZES.standard.m} | ||
| width={200} | ||
| /> | ||
| </SkeletonTheme> | ||
| </StyledTitleLoaderContainer> | ||
| </PageBody> | ||
| </StyledContainer> | ||
| <StyledRoot isMobile={isMobile}> | ||
| <StyledCard> | ||
| <SkeletonTheme | ||
| baseColor={theme.background.tertiary} | ||
| highlightColor={theme.background.transparent.lighter} | ||
| borderRadius={4} | ||
| > | ||
| <SettingsPageHeader | ||
| links={[ | ||
| { | ||
| children: ( | ||
| <Skeleton | ||
| width={64} | ||
| height={SKELETON_LOADER_HEIGHT_SIZES.standard.s} | ||
| /> | ||
| ), | ||
| }, | ||
| ]} | ||
| title={ | ||
| <Skeleton | ||
| width={120} | ||
| height={SKELETON_LOADER_HEIGHT_SIZES.standard.s} | ||
| /> | ||
| } | ||
| /> | ||
| <SettingsPageContainer> | ||
| <SettingsSectionSkeletonLoader /> | ||
| </SettingsPageContainer> | ||
| </SkeletonTheme> | ||
| </StyledCard> | ||
| </StyledRoot> | ||
| ); | ||
| }; | ||
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.