forked from twentyhq/twenty
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prefetch Skeleton Loading on Indexes and Shows (twentyhq#5545)
### Description Prefetch Skeleton Loading on Indexes and Shows ### Refs twentyhq#4458 ### Demo https://jam.dev/c/a1ad04e1-80b6-4b2a-b7df-373f52f4b169 https://jam.dev/c/c5038b97-2f18-4c29-8dee-18c09376e5ee Fixes: twentyhq#4458 --------- Co-authored-by: gitstart-twenty <[email protected]> Co-authored-by: v1b3m <[email protected]> Co-authored-by: Matheus <[email protected]> Co-authored-by: Charles Bochet <[email protected]>
- Loading branch information
1 parent
cfd83d6
commit 9c046dc
Showing
60 changed files
with
490 additions
and
161 deletions.
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
72 changes: 72 additions & 0 deletions
72
packages/twenty-front/src/modules/activities/timeline/components/TimelineSkeletonLoader.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'; | ||
import { useTheme } from '@emotion/react'; | ||
import styled from '@emotion/styled'; | ||
|
||
const StyledSkeletonContainer = styled.div` | ||
align-items: center; | ||
width: 100%; | ||
padding: ${({ theme }) => theme.spacing(8)}; | ||
display: flex; | ||
flex-direction: column; | ||
gap: ${({ theme }) => theme.spacing(4)}; | ||
flex-wrap: wrap; | ||
align-content: flex-start; | ||
`; | ||
|
||
const StyledSkeletonSubSection = styled.div` | ||
display: flex; | ||
gap: ${({ theme }) => theme.spacing(4)}; | ||
`; | ||
|
||
const StyledSkeletonColumn = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: ${({ theme }) => theme.spacing(3)}; | ||
justify-content: center; | ||
`; | ||
|
||
const StyledSkeletonLoader = ({ | ||
isSecondColumn, | ||
}: { | ||
isSecondColumn: boolean; | ||
}) => { | ||
const theme = useTheme(); | ||
return ( | ||
<SkeletonTheme | ||
baseColor={theme.background.tertiary} | ||
highlightColor={theme.background.transparent.lighter} | ||
borderRadius={80} | ||
> | ||
<Skeleton width={24} height={isSecondColumn ? 120 : 84} /> | ||
</SkeletonTheme> | ||
); | ||
}; | ||
|
||
export const TimelineSkeletonLoader = () => { | ||
const theme = useTheme(); | ||
const skeletonItems = Array.from({ length: 3 }).map((_, index) => ({ | ||
id: `skeleton-item-${index}`, | ||
})); | ||
|
||
return ( | ||
<SkeletonTheme | ||
baseColor={theme.background.tertiary} | ||
highlightColor={theme.background.transparent.lighter} | ||
borderRadius={4} | ||
> | ||
<StyledSkeletonContainer> | ||
<Skeleton width={440} height={16} /> | ||
{skeletonItems.map(({ id }, index) => ( | ||
<StyledSkeletonSubSection key={id}> | ||
<StyledSkeletonLoader isSecondColumn={index === 1} /> | ||
<StyledSkeletonColumn> | ||
<Skeleton width={400} height={24} /> | ||
<Skeleton width={400} height={24} /> | ||
{index === 1 && <Skeleton width={400} height={24} />} | ||
</StyledSkeletonColumn> | ||
</StyledSkeletonSubSection> | ||
))} | ||
</StyledSkeletonContainer> | ||
</SkeletonTheme> | ||
); | ||
}; |
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
36 changes: 36 additions & 0 deletions
36
packages/twenty-front/src/modules/favorites/components/FavoritesSkeletonLoader.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'; | ||
import { useTheme } from '@emotion/react'; | ||
import styled from '@emotion/styled'; | ||
|
||
const StyledSkeletonContainer = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: ${({ theme }) => theme.spacing(2)}; | ||
height: 71px; | ||
padding-left: ${({ theme }) => theme.spacing(1)}; | ||
`; | ||
|
||
const StyledSkeletonColumn = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: ${({ theme }) => theme.spacing(1)}; | ||
`; | ||
|
||
export const FavoritesSkeletonLoader = () => { | ||
const theme = useTheme(); | ||
return ( | ||
<SkeletonTheme | ||
baseColor={theme.background.tertiary} | ||
highlightColor={theme.background.transparent.lighter} | ||
borderRadius={4} | ||
> | ||
<StyledSkeletonContainer> | ||
<Skeleton width={56} height={13} /> | ||
<StyledSkeletonColumn> | ||
<Skeleton width={196} height={16} /> | ||
<Skeleton width={196} height={16} /> | ||
</StyledSkeletonColumn> | ||
</StyledSkeletonContainer> | ||
</SkeletonTheme> | ||
); | ||
}; |
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
28 changes: 28 additions & 0 deletions
28
...nty-front/src/modules/object-metadata/components/ObjectMetadataNavItemsSkeletonLoader.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'; | ||
import { useTheme } from '@emotion/react'; | ||
import styled from '@emotion/styled'; | ||
|
||
const StyledSkeletonColumn = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: ${({ theme }) => theme.spacing(1)}; | ||
height: 76px; | ||
padding-left: ${({ theme }) => theme.spacing(1)}; | ||
`; | ||
|
||
export const ObjectMetadataNavItemsSkeletonLoader: React.FC = () => { | ||
const theme = useTheme(); | ||
return ( | ||
<SkeletonTheme | ||
baseColor={theme.background.tertiary} | ||
highlightColor={theme.background.transparent.light} | ||
borderRadius={4} | ||
> | ||
<StyledSkeletonColumn> | ||
<Skeleton width={196} height={16} /> | ||
<Skeleton width={196} height={16} /> | ||
<Skeleton width={196} height={16} /> | ||
</StyledSkeletonColumn> | ||
</SkeletonTheme> | ||
); | ||
}; |
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
31 changes: 31 additions & 0 deletions
31
...es/object-record/record-inline-cell/property-box/components/PropertyBoxSkeletonLoader.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'; | ||
import { useTheme } from '@emotion/react'; | ||
import styled from '@emotion/styled'; | ||
|
||
const StyledSkeletonDiv = styled.div` | ||
align-items: center; | ||
display: flex; | ||
gap: ${({ theme }) => theme.spacing(1)}; | ||
width: 100%; | ||
height: 24px; | ||
`; | ||
export const PropertyBoxSkeletonLoader = () => { | ||
const theme = useTheme(); | ||
const skeletonItems = Array.from({ length: 4 }).map((_, index) => ({ | ||
id: `skeleton-item-${index}`, | ||
})); | ||
return ( | ||
<SkeletonTheme | ||
baseColor={theme.background.tertiary} | ||
highlightColor={theme.background.transparent.lighter} | ||
borderRadius={4} | ||
> | ||
{skeletonItems.map(({ id }) => ( | ||
<StyledSkeletonDiv key={id}> | ||
<Skeleton width={92} height={16} /> | ||
<Skeleton width={154} height={16} /> | ||
</StyledSkeletonDiv> | ||
))} | ||
</SkeletonTheme> | ||
); | ||
}; |
Oops, something went wrong.