Skip to content

Commit 86da2ad

Browse files
committed
adding reports page to player's page
1 parent 3c03a4e commit 86da2ad

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
lines changed

apps/demo-game/src/components/DecisionsDisplay.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ function DecisionsDisplayCompact({ segmentDecisions }: DecisionDisplayProps) {
107107
<TableBody>
108108
{segmentDecisions.map((e) => {
109109
return (
110-
<TableRow key={e.segment.id}>
110+
<TableRow key={e.segment?.id}>
111111
<TableCell className="flex text-nowrap">
112-
P{e.period.index + 1} S{e.segment.index + 1}
112+
P{e.period?.index + 1} S{e.segment?.index + 1}
113113
</TableCell>
114114
<TableCell>
115115
<OnOffIcon on={e.decisions.bank} />

apps/demo-game/src/pages/play/cockpit.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ function GameLayout({ children }: { children: React.ReactNode }) {
124124
role: data.self.role,
125125
}
126126

127+
const tabs = [
128+
{
129+
name: 'Reports',
130+
href: `/admin/reports/${data?.result?.currentGame?.id}`,
131+
},
132+
]
133+
127134
const sidebar = (
128135
<div id="sidebar" className="flex flex-col justify-between">
129136
<Card
@@ -218,11 +225,6 @@ function GameLayout({ children }: { children: React.ReactNode }) {
218225
)
219226
}
220227

221-
const tabs = [
222-
{ name: 'Welcome', href: '/play/welcome' },
223-
{ name: 'Cockpit', href: '/play/cockpit' },
224-
]
225-
226228
const colors = [
227229
'hsl(var(--chart-1))',
228230
'hsl(var(--chart-2))',

apps/demo-game/src/pages/play/welcome.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ import { COLORS } from '@gbl-uzh/platform/src/lib/constants'
33
import { Logo } from '@gbl-uzh/ui'
44
import {
55
Button,
6-
NewFormikSelectField,
7-
NewFormikTextField,
6+
FormikSelectField,
7+
FormikTextField,
88
} from '@uzh-bf/design-system'
99
import { Form, Formik } from 'formik'
1010
import { useRouter } from 'next/router'
1111
import { useState } from 'react'
12-
import LogoSelector from '~/components/LogoSelector'
1312
import {
1413
SelfDocument,
1514
UpdatePlayerDataDocument,
1615
} from 'src/graphql/generated/ops'
1716
import { LOCATIONS } from 'src/lib/constants'
1817
import * as Yup from 'yup'
18+
import LogoSelector from '~/components/LogoSelector'
1919

2020
import {
2121
Card,
@@ -117,7 +117,7 @@ function Welcome() {
117117
<CardTitle>Introduction</CardTitle>
118118
</CardHeader>
119119
<CardContent>
120-
<div className='pb-4'>
120+
<div className="pb-4">
121121
Welcome, {values.name}
122122
<br />
123123
Lucky you! You recently found out that you picked five
@@ -134,7 +134,6 @@ function Welcome() {
134134
want to invest in bonds and what proportion you want to
135135
invest in stocks.
136136
</div>
137-
138137
</div>
139138
</CardContent>
140139
</Card>
@@ -158,12 +157,12 @@ function Welcome() {
158157
</div>
159158
<div className="flex flex-col">
160159
<div className="flex-initial space-y-1.5">
161-
<NewFormikTextField
160+
<FormikTextField
162161
label="Name of bank"
163162
name="name"
164163
className={{ label: 'pb-2 font-normal' }}
165164
/>
166-
<NewFormikSelectField
165+
<FormikSelectField
167166
label="Location"
168167
name="location"
169168
items={LOCATIONS.Trader.map((label) => ({
@@ -177,13 +176,13 @@ function Welcome() {
177176
}}
178177
/>
179178
<LogoSelector
180-
label='Avatar'
179+
label="Avatar"
181180
className="w-48 pb-2 text-sm text-gray-600"
182181
color={values.color}
183182
name="imgPathAvatar"
184183
/>
185184

186-
<NewFormikSelectField
185+
<FormikSelectField
187186
label="Color"
188187
name="color"
189188
items={Object.keys(COLORS).map((label) => ({

packages/ui/src/components/NavBar.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
NavigationMenuList,
88
navigationMenuTriggerStyle,
99
} from '@uzh-bf/design-system/dist/future'
10+
import { Button } from '@uzh-bf/design-system'
1011

1112
interface Props {
1213
tabs: { name: string; href: string }[]
@@ -23,7 +24,7 @@ function NavBar({
2324
playerLevel,
2425
playerColor,
2526
playerImgPathAvatar,
26-
playerHref = '/play/cockpit',
27+
playerHref = '/play/welcome',
2728
}: Props) {
2829
return (
2930
<>
@@ -48,7 +49,9 @@ function NavBar({
4849
<div className="text-orange-700">Level {playerLevel}</div>
4950
</div>
5051
<div className="w-10">
51-
<Logo imgPathAvatar={playerImgPathAvatar} color={playerColor} />
52+
<Button className={{ root: 'p-0 hover:' }}>
53+
<Logo imgPathAvatar={playerImgPathAvatar} color={playerColor} />
54+
</Button>
5255
</div>
5356
</div>
5457
</Link>

0 commit comments

Comments
 (0)