Skip to content

Commit

Permalink
Merge branch 'main' into balance
Browse files Browse the repository at this point in the history
  • Loading branch information
broody committed Sep 15, 2023
2 parents 295f14a + 4f45fdc commit 0b47f6d
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 55 deletions.
32 changes: 20 additions & 12 deletions web/src/pages/[gameId]/[locationSlug]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
StyleProps,
useDisclosure,
useBreakpointValue,
Flex,
} from "@chakra-ui/react";
import Layout from "@/components/Layout";
import { useRouter } from "next/router";
Expand Down Expand Up @@ -120,24 +121,31 @@ export default function Location() {
{drugInfo.name}
</CardHeader>
<CardBody>
<HStack w="full" justify="center" position="relative" m="2px">
<HStack
<HStack w="full" justify="center">
<Flex
as={motion.div}
initial={{ opacity: 0 }}
whileHover={{ opacity: 1 }}
w="full"
p="20px"
gap="10px"
p="2px"
align="center"
boxSize="full"
position="absolute"
bgColor="neon.900"
pointerEvents={["none", "auto"]}
>
<BuySellBtns
canBuy={canBuy}
canSell={canSell}
drugSlug={drugInfo.slug}
/>
</HStack>
<HStack
h="100px"
w="full"
p="20px"
gap="10px"
bgColor="neon.900"
>
<BuySellBtns
canBuy={canBuy}
canSell={canSell}
drugSlug={drugInfo.slug}
/>
</HStack>
</Flex>
{drugInfo.icon({})}
</HStack>
</CardBody>
Expand Down
1 change: 1 addition & 0 deletions web/src/pages/[gameId]/travel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default function Travel() {
if (playerEntity && !isSubmitting) {
const location = getLocationById(playerEntity.locationId);
setCurrentLocationId(location.id);
setTargetId(location.id);
}
}, [playerEntity, isSubmitting]);

Expand Down
103 changes: 60 additions & 43 deletions web/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { usePlayerStore } from "@/hooks/state";
import { Cartridge } from "@/components/icons/branding/Cartridge";
import { Dojo } from "@/components/icons/branding/Dojo";
import { ScrollDown } from "@/components/icons/ScrollDown";
import { useState } from "react";
import { useEffect, useState } from "react";

// hardcode game params for now
const START_TIME = 0;
Expand All @@ -49,59 +49,76 @@ export default function Home() {
const { resetAll } = usePlayerStore();
const { toast } = useToast();
const [isSubmitting, setIsSubmitting] = useState(false);
const [isGated, setIsGated] = useState(false);

useEffect(
() =>
setIsGated(window.location.host === "rollyourown.preview.cartridge.gg"),
[],
);

return (
<Layout CustomLeftPanel={HomeLeftPanel}>
<VStack boxSize="full" gap="10px" justify="center">
<Card variant="pixelated">
<HStack w="full" p="20px" gap="10px" justify="center">
{/* <VStack>
<HStack>
<Alert />
<Text align="center">Under Construction</Text>
</HStack>
<Text align="center">
Get ready hustlers... Season II starts in September
</Text>
</VStack> */}
{isGated ? (
<VStack>
<HStack>
<Alert />
<Text align="center">Under Construction</Text>
</HStack>
<Text align="center">
Get ready hustlers... Season II starts in September
</Text>
</VStack>
) : (
<Button
flex="1"
isDisabled={!account}
isLoading={isSubmitting && !txError}
onClick={async () => {
setIsSubmitting(true);
resetAll();
const { event, hash } = await createGame(
START_TIME,
MAX_PLAYERS,
NUM_TURNS,
);

<Button
flex="1"
isDisabled={!account}
isLoading={isSubmitting && !txError}
onClick={async () => {
setIsSubmitting(true);
resetAll();
const { event, hash } = await createGame(
START_TIME,
MAX_PLAYERS,
NUM_TURNS,
);
const { gameId, locationId } = event as JoinedEventData;
toast(
"Created Game",
Alert,
`http://amazing_explorer/${hash}`,
);

const { gameId, locationId } = event as JoinedEventData;
toast("Created Game", Alert, `http://amazing_explorer/${hash}`);

router.push(`/${gameId}/${getLocationById(locationId).slug}`);
}}
>
Hustle
</Button>
router.push(`/${gameId}/${getLocationById(locationId).slug}`);
}}
>
Hustle
</Button>
)}
</HStack>
</Card>

<Text>HALL OF FAME</Text>
<VStack
boxSize="full"
gap="20px"
sx={{
overflowY: "scroll",
"&::-webkit-scrollbar": {
display: "none",
},
}}
>
<Leaderboard />
</VStack>
{!isGated && (
<>
<Text>HALL OF FAME</Text>
<VStack
boxSize="full"
gap="20px"
sx={{
overflowY: "scroll",
"&::-webkit-scrollbar": {
display: "none",
},
}}
>
<Leaderboard />
</VStack>
</>
)}
</VStack>
</Layout>
);
Expand Down

0 comments on commit 0b47f6d

Please sign in to comment.