Skip to content

Commit

Permalink
[C-3519] Fix async absolute lottie imports (#6976)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers authored Dec 19, 2023
1 parent 7f78919 commit 2d72cef
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ const AnimatedIconButton = ({
isMatrix={isMatrix}
onClick={onClick || ((e: MouseEvent) => {})}
href={href}
iconLightJSON={() => import(`assets/animations/${light}.json`)}
iconDarkJSON={() => import(`assets/animations/${dark}.json`)}
iconLightJSON={() => import(`../../assets/animations/${light}.json`)}
iconDarkJSON={() => import(`../../assets/animations/${dark}.json`)}
activeClassName={activeClassName}
disabledClassName={disabledClassName}
className={className}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ const ExploreButton = ({
isMatrix={isMatrixMode}
onClick={onClick}
href={href}
iconLightJSON={() => import('assets/animations/iconExploreLight.json')}
iconDarkJSON={() => import('assets/animations/iconExploreDark.json')}
iconLightJSON={() =>
import('../../../assets/animations/iconExploreLight.json')
}
iconDarkJSON={() =>
import('../../../assets/animations/iconExploreDark.json')
}
/>
)
}
Expand Down
8 changes: 6 additions & 2 deletions packages/web/src/components/bottom-bar/buttons/FeedButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ const FeedButton = ({
darkMode={darkMode}
onClick={onClick}
href={href}
iconLightJSON={() => import('assets/animations/iconFeedLight.json')}
iconDarkJSON={() => import('assets/animations/iconFeedDark.json')}
iconLightJSON={() =>
import('../../../assets/animations/iconFeedLight.json')
}
iconDarkJSON={() =>
import('../../../assets/animations/iconFeedDark.json')
}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ const LibraryButton = ({
isMatrix={isMatrixMode}
onClick={onClick}
href={href}
iconLightJSON={() => import('assets/animations/iconFavoriteLight.json')}
iconDarkJSON={() => import('assets/animations/iconFavoriteDark.json')}
iconLightJSON={() =>
import('../../../assets/animations/iconFavoriteLight.json')
}
iconDarkJSON={() =>
import('../../../assets/animations/iconFavoriteDark.json')
}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ const ProfileButton = ({
isMatrix={isMatrixMode}
onClick={onClick}
href={href}
iconLightJSON={() => import('assets/animations/iconProfileLight.json')}
iconDarkJSON={() => import('assets/animations/iconProfileDark.json')}
iconLightJSON={() =>
import('../../../assets/animations/iconProfileLight.json')
}
iconDarkJSON={() =>
import('../../../assets/animations/iconProfileDark.json')
}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ const TrendingButton = ({
isMatrix={isMatrixMode}
onClick={onClick}
href={href}
iconLightJSON={() => import('assets/animations/iconTrendingLight.json')}
iconDarkJSON={() => import('assets/animations/iconTrendingDark.json')}
iconLightJSON={() =>
import('../../../assets/animations/iconTrendingLight.json')
}
iconDarkJSON={() =>
import('../../../assets/animations/iconTrendingDark.json')
}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ const RepeatButtonProvider = ({
} else {
if (!defaultAnimations.current) {
const { default: pbIconRepeatAll } = (await import(
'assets/animations/pbIconRepeatAll.json'
'../../../assets/animations/pbIconRepeatAll.json'
)) as any
const { default: pbIconRepeatSingle } = (await import(
'assets/animations/pbIconRepeatSingle.json'
'../../../assets/animations/pbIconRepeatSingle.json'
)) as any
const { default: pbIconRepeatOff } = (await import(
'assets/animations/pbIconRepeatOff.json'
'../../../assets/animations/pbIconRepeatOff.json'
)) as any
defaultAnimations.current = {
pbIconRepeatAll,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ const ShuffleButtonProvider = ({
if (isMatrix) {
if (!matrixAnimations.current) {
const { default: pbIconShuffleOff } = (await import(
'assets/animations/pbIconShuffleOffMatrix.json'
'../../../assets/animations/pbIconShuffleOffMatrix.json'
)) as any
const { default: pbIconShuffleOn } = (await import(
'assets/animations/pbIconShuffleOnMatrix.json'
'../../../assets/animations/pbIconShuffleOnMatrix.json'
)) as any
matrixAnimations.current = {
pbIconShuffleOff,
Expand All @@ -45,8 +45,8 @@ const ShuffleButtonProvider = ({
setAnimations({ ...matrixAnimations.current })
} else if (darkMode) {
if (!darkAnimations.current) {
const pbIconShuffleOff = require('assets/animations/pbIconShuffleOffDark.json')
const pbIconShuffleOn = require('assets/animations/pbIconShuffleOnDark.json')
const pbIconShuffleOff = require('../../../assets/animations/pbIconShuffleOffDark.json')
const pbIconShuffleOn = require('../../../assets/animations/pbIconShuffleOnDark.json')
darkAnimations.current = {
pbIconShuffleOff,
pbIconShuffleOn
Expand All @@ -56,10 +56,10 @@ const ShuffleButtonProvider = ({
} else {
if (!defaultAnimations.current) {
const { default: pbIconShuffleOff } = (await import(
'assets/animations/pbIconShuffleOff.json'
'../../../assets/animations/pbIconShuffleOff.json'
)) as any
const { default: pbIconShuffleOn } = (await import(
'assets/animations/pbIconShuffleOn.json'
'../../../assets/animations/pbIconShuffleOn.json'
)) as any
defaultAnimations.current = {
pbIconShuffleOff,
Expand Down

0 comments on commit 2d72cef

Please sign in to comment.