Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import { Grid } from '@chakra-ui/react';
import { Grid, useBreakpointValue } from '@chakra-ui/react';
import { BrowserRouter as Router } from 'react-router-dom';

import { Footer } from './components/Footer';
import { Header } from './components/Header';
import AppRoutes from './Routes';

export const App = (): JSX.Element => {
const isDesktop = useBreakpointValue({ base: false, lg: true });

return (
<Router>
<Grid
maxW="1800px"
minHeight="100vh"
px={{ base: 8, sm: 12, md: 20 }}
px={{ base: 2, sm: 12, md: 20 }}
templateColumns="100%"
templateRows="auto 1fr auto"
>
<Header />
<AppRoutes />
<Footer />
{isDesktop && <Footer />}
</Grid>
</Router>
);
Expand Down
311 changes: 135 additions & 176 deletions packages/client/src/components/ActionsPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,195 +1,154 @@
import { Stack, Text } from '@chakra-ui/react';

enum ActionEvents {
Attack = 'attack',
Defend = 'defend against',
GainGold = 'gold',
GainExperience = 'experience',
}

type BattleEvent = {
type: ActionEvents;
monster: string;
amount: number;
};

type ResolutionEvent = {
type: ActionEvents;
amount: number;
};

const BATTLE_EVENTS: BattleEvent[] = [
{
type: ActionEvents.Defend,
amount: 1,
monster: 'Green Slime',
},
{
type: ActionEvents.Attack,
amount: 2,
monster: 'Green Slime',
},
];

const RESOLUTION_EVENTS: ResolutionEvent[] = [
{
type: ActionEvents.GainGold,
amount: 2,
},
{
type: ActionEvents.GainExperience,
amount: 3,
},
];

export const ActionsPanel = (): JSX.Element => {
return (
<Stack spacing={8}>
<Stack>
<Text>
You attack{' '}
<Text as="span" color="green">
Green Slime
</Text>{' '}
for{' '}
<Text as="span" color="red">
2 damage
</Text>
.
</Text>
<Text>
<Text as="span" color="green">
Green Slime
</Text>{' '}
attacks and misses!
</Text>
<Text>
You attack{' '}
<Text as="span" color="green">
Green Slime
</Text>{' '}
for{' '}
<Text as="span" color="red">
1 damage
</Text>
.
</Text>
<Text>Green slime is slain! You gain 2 $GOLD!</Text>
{BATTLE_EVENTS.map((event, i) => (
<Text
key={`battle-event-${i}`}
size={{ base: 'xs', sm: 'sm', lg: 'md' }}
>
You {event.type}{' '}
<Text as="span" color="green">
{event.monster}
</Text>{' '}
{event.type === ActionEvents.Attack ? 'for' : 'taking'}{' '}
<Text as="span" color="red">
{event.amount} damage
</Text>
.
</Text>
))}
</Stack>
<Stack>
<Text>
You gain 2{' '}
<Text as="span" color="yellow">
$GOLD
</Text>
!
</Text>
<Text>
You gain 3{' '}
<Text as="span" color="green">
experience
</Text>
!
</Text>
{RESOLUTION_EVENTS.map((event, i) => (
<Text
key={`resolution-event-${i}`}
size={{ base: 'xs', sm: 'sm', lg: 'md' }}
>
You gain {event.amount}{' '}
<Text
as="span"
color={event.type === ActionEvents.GainGold ? 'yellow' : 'green'}
>
{event.type === ActionEvents.GainGold ? '$GOLD' : 'experience'}
</Text>
!
</Text>
))}
</Stack>
<Stack>
<Text>
You attack{' '}
<Text as="span" color="green">
Green Slime
</Text>{' '}
for{' '}
<Text as="span" color="red">
2 damage
</Text>
.
</Text>
<Text>
<Text as="span" color="green">
Green Slime
</Text>{' '}
attacks and misses!
</Text>
<Text>
You attack{' '}
<Text as="span" color="green">
Green Slime
</Text>{' '}
for{' '}
<Text as="span" color="red">
1 damage
</Text>
.
</Text>
<Text>Green slime is slain! You gain 2 $GOLD!</Text>
{BATTLE_EVENTS.map((event, i) => (
<Text
key={`battle-event-${i}`}
size={{ base: 'xs', sm: 'sm', lg: 'md' }}
>
You {event.type}{' '}
<Text as="span" color="green">
{event.monster}
</Text>{' '}
{event.type === ActionEvents.Attack ? 'for' : 'taking'}{' '}
<Text as="span" color="red">
{event.amount} damage
</Text>
.
</Text>
))}
</Stack>
<Stack>
<Text>
You gain 2{' '}
<Text as="span" color="yellow">
$GOLD
</Text>
!
</Text>
<Text>
You gain 3{' '}
<Text as="span" color="green">
experience
</Text>
!
</Text>
{RESOLUTION_EVENTS.map((event, i) => (
<Text
key={`resolution-event-${i}`}
size={{ base: 'xs', sm: 'sm', lg: 'md' }}
>
You gain {event.amount}{' '}
<Text
as="span"
color={event.type === ActionEvents.GainGold ? 'yellow' : 'green'}
>
{event.type === ActionEvents.GainGold ? '$GOLD' : 'experience'}
</Text>
!
</Text>
))}
</Stack>
<Stack>
<Text>
You attack{' '}
<Text as="span" color="green">
Green Slime
</Text>{' '}
for{' '}
<Text as="span" color="red">
2 damage
</Text>
.
</Text>
<Text>
<Text as="span" color="green">
Green Slime
</Text>{' '}
attacks and misses!
</Text>
<Text>
You attack{' '}
<Text as="span" color="green">
Green Slime
</Text>{' '}
for{' '}
<Text as="span" color="red">
1 damage
</Text>
.
</Text>
<Text>Green slime is slain! You gain 2 $GOLD!</Text>
</Stack>
<Stack>
<Text>
You gain 2{' '}
<Text as="span" color="yellow">
$GOLD
</Text>
!
</Text>
<Text>
You gain 3{' '}
<Text as="span" color="green">
experience
</Text>
!
</Text>
{BATTLE_EVENTS.map((event, i) => (
<Text
key={`battle-event-${i}`}
size={{ base: 'xs', sm: 'sm', lg: 'md' }}
>
You {event.type}{' '}
<Text as="span" color="green">
{event.monster}
</Text>{' '}
{event.type === ActionEvents.Attack ? 'for' : 'taking'}{' '}
<Text as="span" color="red">
{event.amount} damage
</Text>
.
</Text>
))}
</Stack>
<Stack>
<Text>
You attack{' '}
<Text as="span" color="green">
Green Slime
</Text>{' '}
for{' '}
<Text as="span" color="red">
2 damage
</Text>
.
</Text>
<Text>
<Text as="span" color="green">
Green Slime
</Text>{' '}
attacks and misses!
</Text>
<Text>
You attack{' '}
<Text as="span" color="green">
Green Slime
</Text>{' '}
for{' '}
<Text as="span" color="red">
1 damage
</Text>
.
</Text>
<Text>Green slime is slain! You gain 2 $GOLD!</Text>
</Stack>
<Stack>
<Text>
You gain 2{' '}
<Text as="span" color="yellow">
$GOLD
</Text>
!
</Text>
<Text>
You gain 3{' '}
<Text as="span" color="green">
experience
</Text>
!
</Text>
{RESOLUTION_EVENTS.map((event, i) => (
<Text
key={`resolution-event-${i}`}
size={{ base: 'xs', sm: 'sm', lg: 'md' }}
>
You gain {event.amount}{' '}
<Text
as="span"
color={event.type === ActionEvents.GainGold ? 'yellow' : 'green'}
>
{event.type === ActionEvents.GainGold ? '$GOLD' : 'experience'}
</Text>
!
</Text>
))}
</Stack>
</Stack>
);
Expand Down
12 changes: 10 additions & 2 deletions packages/client/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ export const Header = (): JSX.Element => {
}

return (
<Box as="header" bgColor="grey300" mt={8} padding="10px">
<Heading size={{ base: 'sm', sm: 'md' }} textAlign="right">
<Box
as="header"
bgColor={{ base: 'white', lg: 'grey300' }}
mt={8}
padding={{ base: 1, lg: 2 }}
>
<Heading
size={{ base: 'sm', sm: 'md' }}
textAlign={{ base: 'left', lg: 'right' }}
>
Ultimate Dominion
</Heading>
</Box>
Expand Down
Loading