-
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.
Integrate K2 Alpine into Core Mobile (#1846)
- Loading branch information
Showing
33 changed files
with
200 additions
and
191 deletions.
There are no files selected for viewing
Binary file added
BIN
+99.9 KB
packages/core-mobile/android/app/src/main/assets/fonts/Aeonik-Bold.otf
Binary file not shown.
Binary file added
BIN
+98.3 KB
packages/core-mobile/android/app/src/main/assets/fonts/Aeonik-Medium.otf
Binary file not shown.
Binary file added
BIN
+327 KB
packages/core-mobile/android/app/src/main/assets/fonts/DejaVuSansMono.ttf
Binary file not shown.
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
14 changes: 14 additions & 0 deletions
14
packages/core-mobile/app/screens/watchlist/WatchlistTabViewK2Alpine.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,14 @@ | ||
import React from 'react' | ||
import { View, Text } from '@avalabs/k2-alpine' | ||
|
||
const WatchlistTabK2Alpine = (): JSX.Element => { | ||
return ( | ||
<View sx={{ flex: 1, backgroundColor: '$surfacePrimary' }}> | ||
<Text variant="heading1" sx={{ color: '$textPrimary' }}> | ||
Hello from K2 Alpine | ||
</Text> | ||
</View> | ||
) | ||
} | ||
|
||
export default WatchlistTabK2Alpine |
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 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 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,29 @@ | ||
import React from 'react' | ||
import { useSelector } from 'react-redux' | ||
import { selectIsK2AlpineBlocked } from 'store/posthog/slice' | ||
|
||
/** | ||
* This HoC is used to implement a gradual rollout of the new K2 Alpine design. | ||
* | ||
* It does the following: | ||
* - conditionally renders either the old or the new version of a component based on K2 ALPINE feature flag. | ||
* - ensures both the old and new components are interchangeable by enforcing that they accept the same props. | ||
* - ensures that both old and new components are lazily loaded via React.lazy. | ||
* | ||
* Example usage: | ||
* const WatchlistTab = withK2Alpine( | ||
* lazy(() => import('screens/watchlist/WatchlistTabView')), | ||
* lazy(() => import('screens/watchlist/WatchlistTabViewK2Alpine')) | ||
* ) | ||
*/ | ||
export const withK2Alpine = <P extends object>( | ||
OldComponent: React.LazyExoticComponent<React.ComponentType<P>>, | ||
NewComponent: React.LazyExoticComponent<React.ComponentType<P>> | ||
): React.ComponentType<P> => { | ||
return (props: P) => { | ||
const isK2AlpineBlocked = useSelector(selectIsK2AlpineBlocked) | ||
const Component = isK2AlpineBlocked ? OldComponent : NewComponent | ||
// @ts-ignore react lazy doesn't work well with generic typing | ||
return <Component {...props} /> | ||
} | ||
} |
Oops, something went wrong.