Skip to content

Commit

Permalink
minor ui/ux updates on inventory and item pages
Browse files Browse the repository at this point in the history
  • Loading branch information
kibagateaux committed Oct 30, 2024
1 parent 8534054 commit 27ef0f1
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/app/inventory/[item].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const ItemPage: React.FC<ItemPageProps> = () => {
});
}
}
}, [item]);
}, [item?.id]);

// console.log('Item: status & modal', status, activeModal);

Expand Down
36 changes: 26 additions & 10 deletions src/app/inventory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import { useInventory } from 'hooks';

import { Card } from 'components';
import { InventoryItem } from 'types/GameMechanics';
import { useGameContent } from 'contexts';

const InventoryScreen: React.FC = () => {
const { inventory, loading } = useInventory();
const [categorizedInventory, setCategories] = useState<
{ title: string; data: InventoryItem[] }[]
>([]);
const { inventory: content } = useGameContent();

useMemo(async () => {
if (inventory.length) {
Expand Down Expand Up @@ -55,16 +57,21 @@ const InventoryScreen: React.FC = () => {
<Text style={styles.inventoryHeader}>{title.toUpperCase()}</Text>
);

return loading ? (
<ActivityIndicator animating size="large" />
) : (
<SectionList
style={styles.container}
sections={categorizedInventory}
ItemSeparatorComponent={() => <View style={styles.itemSeperator} />}
renderSectionHeader={renderCategoryHeader}
renderItem={({ item }) => renderItem({ item })}
/>
return (
<>
<Text style={styles.pageDescription}>{content?.index?.meta?.description}</Text>
{loading ? (
<ActivityIndicator animating size="large" />
) : (
<SectionList
style={styles.container}
sections={categorizedInventory}
ItemSeparatorComponent={() => <View style={styles.itemSeperator} />}
renderSectionHeader={renderCategoryHeader}
renderItem={({ item }) => renderItem({ item })}
/>
)}
</>
);
};

Expand All @@ -74,6 +81,15 @@ const styles = StyleSheet.create({
flex: 1,
width: '100%',
},
pageDescription: {
backgroundColor: 'pink',
fontSize: 18,
padding: 10,
// fontWeight: 'bold',
// marginTop: 18,
// marginBottom: 18,
// marginLeft: 10, // same as list
},
inventoryHeader: {
fontSize: 24,
fontWeight: 'bold',
Expand Down
7 changes: 7 additions & 0 deletions src/assets/game-content/inventory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
export default {
index: {
// when displaying all items
meta: {
description:
'Equip items to feed data to your jinni, help it evolve in different ways faster, and get personalized mini-games',
},
},
MaliksMajik: {
meta: {
description:
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/Pill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ const styles = StyleSheet.create({
sm: {
padding: 7,
height: 35,
width: 70,
maxWidth: 126,
},
md: {
padding: 25,
height: 70,
width: 140,
maxWidth: 252,
},
pill: {
textAlign: 'center',
Expand Down
2 changes: 1 addition & 1 deletion src/inventory/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const equip = _equip(ITEM_ID);
const unequip = _unequip(ITEM_ID);
const item: InventoryItem = {
id: ITEM_ID,
name: 'Octopus Brains',
name: ITEM_ID,
dataProvider: ITEM_ID,
image: 'https://pngimg.com/uploads/github/github_PNG90.png',
tags: ['digital', 'productivity'],
Expand Down
2 changes: 1 addition & 1 deletion src/inventory/spotify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const unequip = _unequip(ITEM_ID);

const item: InventoryItem = {
id: ITEM_ID,
name: "Horn o' Vibranium",
name: ITEM_ID,
dataProvider: ITEM_ID,
image: 'https://w7.pngwing.com/pngs/420/432/png-transparent-spotify-logo-spotify-computer-icons-podcast-music-apps-miscellaneous-angle-logo-thumbnail.png',
tags: ['digital', 'music', 'social'],
Expand Down

0 comments on commit 27ef0f1

Please sign in to comment.