Skip to content

Commit

Permalink
update buttons in onboarding wizard to prefvent dom render issue on web
Browse files Browse the repository at this point in the history
  • Loading branch information
kibagateaux committed Aug 3, 2024
1 parent 7c4fd98 commit 13f73fd
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 19 deletions.
1 change: 1 addition & 0 deletions public/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /index.html 200
18 changes: 5 additions & 13 deletions src/components/modals/BaseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ const BaseModal: React.FC<ModalProps> = ({ children, onClose, primaryButton, sec
const textStyles = {
color: theme.primaryTextColor,
};
const renderButton = (config) => {
const renderButton = (config, color) => {
console.log('base modal button', config);

if (!config) return null;
if (config.button) return config.button;
if (config.title && config.onPress)
return (
<TouchableOpacity
style={[styles.button, { backgroundColor: theme.primaryBackgroundColor }]}
style={[styles.button, { backgroundColor: color }]}
onPress={config.onPress}
>
<Text style={[styles.text, textStyles]}>{config.title}</Text>
Expand All @@ -48,17 +48,9 @@ const BaseModal: React.FC<ModalProps> = ({ children, onClose, primaryButton, sec
{children}
<View>
<View style={styles.ctaContainer}>
{renderButton(primaryButton)}
{secondaryButton && (
<TouchableOpacity
style={[styles.button, { backgroundColor: theme.secondaryColor }]}
onPress={secondaryButton.onPress}
>
<Text style={[styles.text, textStyles]}>
{secondaryButton.title}
</Text>
</TouchableOpacity>
)}
{renderButton(primaryButton, theme.primaryBackgroundColor)}
{secondaryButton &&
renderButton(secondaryButton, theme.secondaryBackgroundColor)}
</View>
<Button title="Close" color="purple" onPress={closeModal} />
</View>
Expand Down
2 changes: 0 additions & 2 deletions src/inventory/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ const item: InventoryItem = {
description: 'Give your jinni access to your code repos to learn from your daily adds',
provider: ITEM_ID,
canDo: async (status: ItemStatus) => (status === 'equipped' ? 'idle' : 'unequipped'),
displayType: 'none',
do: async () => {
track(ABILITY_SYNC_REPOS, {
spell: ABILITY_SYNC_REPOS,
Expand Down Expand Up @@ -154,7 +153,6 @@ const item: InventoryItem = {
description: 'Jinni will learn from what you have been working on',
provider: ITEM_ID,
canDo: async (status: ItemStatus) => (status === 'equipped' ? 'idle' : 'unequipped'),
displayType: 'none',
do: async () => {
track(ABILITY_TRACK_COMMITS, {
spell: ABILITY_TRACK_COMMITS,
Expand Down
3 changes: 1 addition & 2 deletions src/inventory/maliks-majik.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ const item: InventoryItem = {
provider: ITEM_ID,
symbol: '🧞‍♂️',
description: 'Get access to the full game',
displayType: 'none',
canDo: async (status: ItemStatus) => {
// @dev implicit check for PROOF_MAJIK
if (status !== 'equipped') return 'unequipped';
Expand Down Expand Up @@ -161,7 +160,6 @@ const item: InventoryItem = {
name: 'Create Mystic Crypt',
provider: ITEM_ID,
symbol: '🏦',
displayType: 'none',
description:
"Save game progress to your phone'scloud storage to restore account if you lose your phone",
canDo: async (status: ItemStatus) => {
Expand Down Expand Up @@ -196,6 +194,7 @@ const item: InventoryItem = {
canDo: async () => 'unequipped',
do: async () => async () => true,
}),
// TODO add speak intentions as widget. displayType 'avatar'
),
};

Expand Down
2 changes: 0 additions & 2 deletions src/inventory/spotify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ const item: InventoryItem = {
symbol: '🎶',
description: 'Share a playlist on Spotify with another player',
provider: ITEM_ID,
displayType: 'none',
canDo: async (status: ItemStatus) => (status === 'equipped' ? 'idle' : 'unequipped'),
do: async () => {
// const pid = await getStorage(ID_PLAYER_SLOT);
Expand Down Expand Up @@ -132,7 +131,6 @@ const item: InventoryItem = {
description: 'Share your Spotfiy profile with another player',
provider: ITEM_ID,
canDo: async (status: ItemStatus) => (status === 'equipped' ? 'idle' : 'unequipped'),
displayType: 'none',
do: async () => {
console.log('Spotify:Ability:ShareProfile');
track(TRACK_SHARE_CONTENT, {
Expand Down
2 changes: 2 additions & 0 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ export const getStorage: <T>(slot: string, useMysticCrypt?: boolean) => Promise<
slot,
useMysticCrypt,
) => {
console.log('get storage 0', Platform.OS, Platform.OS === 'web', slot);

try {
if (!slot) return null;
const cached = await getCached.cache.get(JSON.stringify({ slot, secure: useMysticCrypt }));
Expand Down

0 comments on commit 13f73fd

Please sign in to comment.