-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/4 item equipping #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
1aae8ba
Ugly commit
Fluffy9 488857e
added the ability to un-equip items
MrDeadCe11 1e2bd84
Render character token address in creation flow
ECWireless 3474261
Minor fixes for Vercel build
ECWireless a65d3b9
Get synced status
ECWireless 4822914
Tweak roll stats to generate based on class (#42)
ECWireless 78b350d
Display indexer sync status
ECWireless e908dd4
Ugly commit #2
Fluffy9 1f3178a
Fix
Fluffy9 c807660
added the ability to un-equip items
MrDeadCe11 93898d7
Minor fixes for Vercel build
ECWireless 194d0f1
Add MapSystem
ECWireless efc17a7
Add move smart contract functionality
ECWireless 7f9d79d
Make StatsPanel dynamic
ECWireless 56f9cad
Add CharacterSystem and MapSystem to gitignore
ECWireless f739757
Prompt user to spawn in ActionsPanel
ECWireless 54648ed
Render characters dynamically in TileDetailsPanel
ECWireless b100b42
Add CopyText component
ECWireless a2028a1
Add WalletDetailsModal
ECWireless 6f9201f
New base sepolia deployment
ECWireless 1505a3d
Ugly commit
Fluffy9 b1d866f
added the ability to un-equip items
MrDeadCe11 e255444
Minor fixes for Vercel build
ECWireless fa7f5d1
Ugly commit #2
Fluffy9 1657958
Merge branch 'main' into feat/4-item-equipping
ECWireless e8e3c21
Add multicall
Fluffy9 929f02d
Add multicall
Fluffy9 7486c3d
No character page
Fluffy9 33814d0
Fix metadata
Fluffy9 6371807
Add isPlayer changes
Fluffy9 4d6fd37
fix
Fluffy9 4c99cb4
fixes
Fluffy9 a9c5312
Minor tweaks
ECWireless b97fd66
Fix CharacterPage state management
ECWireless 103fb88
Minor responsiveness tweaks
ECWireless File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
89 changes: 89 additions & 0 deletions
89
packages/client/src/components/Character/Card/ItemCard.tsx
This file contains hidden or 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,89 @@ | ||
| import { | ||
| Card, | ||
| CardBody, | ||
| CardFooter, | ||
| CardHeader, | ||
| Center, | ||
| Text, | ||
| } from '@chakra-ui/react'; | ||
| import { | ||
| FaBook, | ||
| FaBug, | ||
| FaDatabase, | ||
| FaDoorClosed, | ||
| FaFire, | ||
| FaPizzaSlice, | ||
| FaRoad, | ||
| FaScribd, | ||
| FaSearchLocation, | ||
| FaShieldAlt, | ||
| FaSocks, | ||
| FaStarAndCrescent, | ||
| } from 'react-icons/fa'; | ||
|
|
||
| export const ItemCard = ({ | ||
| agi, | ||
| disabled, | ||
| icon, | ||
| image, | ||
| int, | ||
| name, | ||
| str, | ||
| }: { | ||
| agi: number; | ||
| disabled: boolean; | ||
| icon: string; | ||
| image: string; | ||
| int: number; | ||
| name: string; | ||
| str: number; | ||
| }): JSX.Element => { | ||
| return ( | ||
| <Card | ||
| border={disabled ? 'solid lightgray' : 'solid'} | ||
| borderRadius={2} | ||
| cursor="pointer" | ||
| direction="row" | ||
| overflow="hidden" | ||
| variant={disabled ? 'light' : 'outline'} | ||
| _active={{ | ||
| bgColor: 'rgba(0, 0, 0, .04)', | ||
| border: 'solid', | ||
| }} | ||
| _hover={{ | ||
| border: 'solid', | ||
| }} | ||
| > | ||
| <CardHeader backgroundColor="grey300"> | ||
| <Center h="100%"> | ||
| {image == 'book' && <FaBook size={24} />} | ||
| {image == 'bug' && <FaBug size={24} />} | ||
| {image == 'database' && <FaDatabase size={24} />} | ||
| {image == 'door-closed' && <FaDoorClosed size={24} />} | ||
| {image == 'pizza-slice' && <FaPizzaSlice size={24} />} | ||
| {image == 'scribd' && <FaScribd size={24} />} | ||
| {image == 'search' && <FaSearchLocation size={24} />} | ||
| {image == 'socks' && <FaSocks size={24} />} | ||
| {image == 'star-crescent' && <FaStarAndCrescent size={24} />} | ||
| </Center> | ||
| </CardHeader> | ||
| <CardBody> | ||
| <Text fontWeight="bold" size={{ base: 'xs', sm: 'md' }}> | ||
| {name} | ||
| </Text> | ||
|
|
||
| <Text size={{ base: '2xs', sm: 'sm' }}> | ||
| STR+{str} AGI+{agi} INT+{int} | ||
| </Text> | ||
| </CardBody> | ||
|
|
||
| <CardFooter> | ||
| <Center> | ||
| {icon == 'fire' && <FaFire size={20} />} | ||
| {icon == 'road' && <FaRoad size={20} />} | ||
| {icon == 'shield' && <FaShieldAlt size={20} />} | ||
| </Center> | ||
| </CardFooter> | ||
| </Card> | ||
| ); | ||
| }; |
76 changes: 76 additions & 0 deletions
76
packages/client/src/components/Character/Card/ItemEquipModal.tsx
This file contains hidden or 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,76 @@ | ||
| import { | ||
| Box, | ||
| Button, | ||
| Modal, | ||
| ModalBody, | ||
| ModalCloseButton, | ||
| ModalContent, | ||
| ModalFooter, | ||
| ModalHeader, | ||
| ModalOverlay, | ||
| useDisclosure, | ||
| } from '@chakra-ui/react'; | ||
|
|
||
| import { ItemCard } from './ItemCard'; | ||
|
|
||
| export const ItemEquipModal = ({ | ||
| agi, | ||
| disabled, | ||
| icon, | ||
| image, | ||
| int, | ||
| isOwner, | ||
| name, | ||
| str, | ||
| }: { | ||
| agi: number; | ||
| disabled: boolean; | ||
| icon: string; | ||
| image: string; | ||
| int: number; | ||
| isOwner: boolean; | ||
| name: string; | ||
| str: number; | ||
| }): JSX.Element => { | ||
| const { isOpen, onClose, onOpen } = useDisclosure(); | ||
|
|
||
| return ( | ||
| <Box> | ||
| <Modal isOpen={isOpen} onClose={onClose}> | ||
| <ModalOverlay /> | ||
| <ModalContent> | ||
| <ModalHeader>{isOwner ? 'Equip' : 'Make an offer'}</ModalHeader> | ||
| <ModalCloseButton /> | ||
| <ModalBody padding={4}> | ||
| <ItemCard | ||
| agi={agi} | ||
| disabled={disabled} | ||
| icon={icon} | ||
| image={image} | ||
| int={int} | ||
| name={name} | ||
| str={str} | ||
| ></ItemCard> | ||
| </ModalBody> | ||
| <ModalFooter> | ||
| <Button colorScheme="blue" mr={3} onClick={onClose}> | ||
| Yes | ||
| </Button> | ||
| <Button variant="ghost">No</Button> | ||
| </ModalFooter> | ||
| </ModalContent> | ||
| </Modal> | ||
| <Box onClick={onOpen}> | ||
| <ItemCard | ||
| agi={agi} | ||
| disabled={disabled} | ||
| icon={icon} | ||
| image={image} | ||
| int={int} | ||
| name={name} | ||
| str={str} | ||
| ></ItemCard> | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| }; |
This file contains hidden or 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,51 @@ | ||
| import { Box, Button, HStack, Spacer, Text, VStack } from '@chakra-ui/react'; | ||
| import { useMemo } from 'react'; | ||
|
|
||
| import { Level } from '../Level'; | ||
|
|
||
| export const Misc = ({ | ||
| experience, | ||
| isPlayer, | ||
| max, | ||
| goldBalance, | ||
| }: { | ||
| experience: string; | ||
| isPlayer: boolean; | ||
| max: string; | ||
| goldBalance: string; | ||
| }): JSX.Element => { | ||
| const levelPercent = useMemo(() => { | ||
| return (100 * Number(experience)) / Number(max); | ||
| }, [experience, max]); | ||
|
|
||
| return ( | ||
| <VStack h="100%"> | ||
| <Box w="100%"> | ||
| <HStack alignItems="start"> | ||
| <Box> | ||
| <Text fontWeight="bold"> | ||
| {Number(goldBalance).toLocaleString('en', { useGrouping: true })}{' '} | ||
| $GOLD | ||
| </Text> | ||
| <Text> | ||
| {experience}/{max} | ||
| </Text> | ||
| </Box> | ||
| <Spacer /> | ||
| <Text fontWeight="bold">Level 1</Text> | ||
| </HStack> | ||
| <Level levelPercent={levelPercent} /> | ||
| </Box> | ||
|
|
||
| <Spacer /> | ||
| <Box alignSelf="start" w="100%"> | ||
| <Button m={'5px 0'} w="100%"> | ||
| {isPlayer ? 'Auction House' : 'Chat'} | ||
| </Button> | ||
| <Button m={'5px 0'} w="100%"> | ||
| Leader Board | ||
| </Button> | ||
| </Box> | ||
| </VStack> | ||
| ); | ||
| }; |
This file contains hidden or 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,60 @@ | ||
| import { | ||
| Avatar, | ||
| Box, | ||
| Button, | ||
| Center, | ||
| Heading, | ||
| HStack, | ||
| Spacer, | ||
| Text, | ||
| VStack, | ||
| } from '@chakra-ui/react'; | ||
| import { FaStarAndCrescent } from 'react-icons/fa'; | ||
|
|
||
| export const Profile = ({ | ||
| description, | ||
| image, | ||
| isOwner, | ||
| name, | ||
| }: { | ||
| description: string; | ||
| image: string; | ||
| isOwner: boolean; | ||
| name: string; | ||
| }): JSX.Element => { | ||
| return ( | ||
| <Box h="100%" position="relative"> | ||
| <VStack> | ||
| <HStack w="100%"> | ||
| <Center> | ||
| <Avatar size="lg" src={image} /> | ||
| <Heading margin="0px 20px" size="lg"> | ||
| {name} | ||
| </Heading> | ||
| </Center> | ||
| <Spacer /> | ||
| <Center> | ||
| <FaStarAndCrescent size={40} /> | ||
| </Center> | ||
| </HStack> | ||
| <Spacer /> | ||
| <Box mt={3} w="100%"> | ||
| <Text overflow="hidden" size="sm" textAlign="left"> | ||
| {description} | ||
| </Text> | ||
| {isOwner && ( | ||
| <Button | ||
| bottom="0" | ||
| position="absolute" | ||
| right="0" | ||
| size="sm" | ||
| variant="ghost" | ||
| > | ||
| Edit Character | ||
| </Button> | ||
| )} | ||
| </Box> | ||
| </VStack> | ||
| </Box> | ||
| ); | ||
| }; |
This file contains hidden or 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,50 @@ | ||
| import { HStack, Text, VStack } from '@chakra-ui/react'; | ||
|
|
||
| export const Stats = ({ | ||
| agility, | ||
| hitPoints, | ||
| intelligence, | ||
| strength, | ||
| }: { | ||
| agility: string; | ||
| hitPoints: string; | ||
| intelligence: string; | ||
| strength: string; | ||
| }): JSX.Element => { | ||
| return ( | ||
| <VStack> | ||
| <HStack justify="space-between" w="100%"> | ||
| <Text alignSelf="start" fontWeight="bold"> | ||
| My Stats | ||
| </Text> | ||
| <Text alignSelf="start" fontWeight="bold"> | ||
| Ability Points: 3 | ||
| </Text> | ||
| </HStack> | ||
| <Text alignSelf="end" mt={4} size="xs"> | ||
| Base | ||
| </Text> | ||
| <VStack w="100%"> | ||
| <HStack justify="space-between" w="100%"> | ||
| <Text size="lg">HP - Hit</Text> | ||
| <Text size="lg">{hitPoints}</Text> | ||
| </HStack> | ||
|
|
||
| <HStack justify="space-between" w="100%"> | ||
| <Text size="lg">STR - Strength</Text> | ||
| <Text size="lg">{strength}</Text> | ||
| </HStack> | ||
|
|
||
| <HStack justify="space-between" w="100%"> | ||
| <Text size="lg">AGI - Agility</Text> | ||
| <Text size="lg">{agility}</Text> | ||
| </HStack> | ||
|
|
||
| <HStack justify="space-between" w="100%"> | ||
| <Text size="lg">INT - Intelligence</Text> | ||
| <Text size="lg">{intelligence}</Text> | ||
| </HStack> | ||
| </VStack> | ||
| </VStack> | ||
| ); | ||
| }; |
This file contains hidden or 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,35 @@ | ||
| import { Box, HStack, Progress, Spacer, Text } from '@chakra-ui/react'; | ||
|
|
||
| const CURRENT_LEVEL = 1; | ||
|
|
||
| export const Level = ({ | ||
| levelPercent, | ||
| }: { | ||
| levelPercent: number; | ||
| }): JSX.Element => { | ||
| return ( | ||
| <Box fontSize="10px" mt={8} position="relative" w="100%"> | ||
| <Text | ||
| position="absolute" | ||
| right={100 - levelPercent - 2 + '%'} | ||
| top="-15px" | ||
| > | ||
| {levelPercent}% | ||
| </Text> | ||
| <Text | ||
| display={levelPercent > 90 ? 'none' : 'block'} | ||
| position="absolute" | ||
| right="0%" | ||
| top="-15px" | ||
| > | ||
| 100% | ||
| </Text> | ||
| <Progress h={2} value={levelPercent} /> | ||
| <HStack mt={1}> | ||
| <Text>Level {CURRENT_LEVEL}</Text> | ||
| <Spacer /> | ||
| <Text>Level {CURRENT_LEVEL + 1}</Text> | ||
| </HStack> | ||
| </Box> | ||
| ); | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.