Skip to content

Commit 5f1361f

Browse files
committed
Change UI when sponsor picks the booth spot
1 parent 736fb76 commit 5f1361f

File tree

13 files changed

+144
-53
lines changed

13 files changed

+144
-53
lines changed

apps/api/src/company/company.controller.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {
22
CompanyAdminDto,
3+
CompanyBoothPlanDto,
34
CompanyDto,
45
CompanyModifyDescriptionDto,
56
CompanyModifyDto,
67
CompanyModifyFlyTalkHoldersDto,
78
CompanyPublicDto,
89
FloorPlanCompanyDto,
9-
CompanyBoothPlanDto,
1010
} from '@ddays-app/types';
1111
import { UserToCompanyDto } from '@ddays-app/types/src/dto/user';
1212
import {
@@ -50,7 +50,6 @@ export class CompanyController {
5050
return await this.companyService.getAllPublic();
5151
}
5252

53-
5453
@UseGuards(SponsorGuard)
5554
@Get('booth-plans')
5655
async getBoothPlans(): Promise<CompanyBoothPlanDto[]> {

apps/api/src/company/company.service.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {
22
CompanyAdminDto,
3+
CompanyBoothPlanDto,
34
CompanyDto,
45
CompanyModifyDescriptionDto,
56
CompanyModifyDto,
67
CompanyModifyFlyTalkHoldersDto,
78
CompanyPublicDto,
89
FloorPlanCompanyDto,
9-
CompanyBoothPlanDto,
1010
} from '@ddays-app/types';
1111
import { UserToCompanyDto } from '@ddays-app/types/src/dto/user';
1212
import { Injectable, NotFoundException } from '@nestjs/common';
@@ -660,6 +660,29 @@ export class CompanyService {
660660
}));
661661
}
662662

663+
async updateEquipment(
664+
companyId: number,
665+
data: { equipment: string },
666+
): Promise<CompanyPublicDto> {
667+
const updatedCompany = await this.prisma.company.update({
668+
where: { id: companyId },
669+
data: {
670+
equipment: data.equipment === '[]' ? null : data.equipment,
671+
},
672+
include: {
673+
booth: { select: { name: true, id: true } },
674+
},
675+
});
676+
677+
return {
678+
...updatedCompany,
679+
booth: updatedCompany.booth?.name || null,
680+
boothId: updatedCompany.booth?.id || null,
681+
flytalkHolders:
682+
(updatedCompany.flytalkHolders as unknown as JSON) || null,
683+
};
684+
}
685+
663686
async updateBoothPlan(
664687
companyId: number,
665688
data: { boothPlan: string },

apps/sponsor/src/api/company/useCompanyUpdateEquipment.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ export const useCompanyUpdateEquipment = () => {
88

99
return useMutation(
1010
async (data: { equipment: string }) => {
11-
const response = await api.patch<
12-
{ equipment: string },
13-
CompanyPublicDto
14-
>('/company/equipment', data);
11+
const response = await api.patch<{ equipment: string }, CompanyPublicDto>(
12+
'/company/equipment',
13+
data,
14+
);
1515
return response;
1616
},
1717
{

apps/sponsor/src/components/ChooseBooth/ChooseBooth.module.scss

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,46 @@ ul {
9696
background-color: color-mix(in srgb, #fff 90%, #000 10%);
9797
}
9898
}
99+
100+
.confirmation {
101+
display: flex;
102+
flex-direction: column;
103+
align-items: flex-start;
104+
margin-top: 0;
105+
106+
.header {
107+
font-size: 24px;
108+
font-weight: 800;
109+
font-family: Fuse;
110+
color: #fff;
111+
margin-bottom: 54px;
112+
}
113+
114+
.mainTitle {
115+
font-size: 50px;
116+
font-weight: 800;
117+
font-family: Fuse;
118+
color: #fff;
119+
line-height: title;
120+
margin-bottom: 24px;
121+
line-height: normal;
122+
}
123+
124+
.desc {
125+
font-size: 16px;
126+
font-weight: 400;
127+
font-family: Fuse;
128+
color: #fff;
129+
margin-bottom: 40px;
130+
line-height: 1.5;
131+
opacity: 0.5;
132+
}
133+
134+
.button {
135+
width: 100%;
136+
margin-top: 0;
137+
}
138+
}
99139
}
100140

101141
.map {

apps/sponsor/src/components/ChooseBooth/ChooseBooth.tsx

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,26 @@ import { useEffect, useState } from 'react';
44
import { useQueryClient } from 'react-query';
55
import { io } from 'socket.io-client';
66

7+
import { useClearBooth } from '../../api/booth/useClearBooth';
78
import { useGetBooths } from '../../api/booth/useGetBooths';
89
import { useReserveBooth } from '../../api/booth/useReserveBooth';
910
import floorPlan from '../../assets/images/floor-plan-2025.png';
1011
import c from './ChooseBooth.module.scss';
1112

1213
const socket = io();
1314

14-
export const ChooseBooth = () => {
15+
interface Props {
16+
confirmedBooth?: string | null;
17+
}
18+
19+
export const ChooseBooth = ({ confirmedBooth }: Props) => {
1520
const [selectedBoothId, setSelectedBoothId] = useState<number | null>(null);
1621

1722
const queryClient = useQueryClient();
1823

1924
const booths = useGetBooths();
2025
const reserveBooth = useReserveBooth();
26+
const clearBooth = useClearBooth();
2127

2228
useEffect(() => {
2329
socket.on('booth:reserve', ({ id }: { id: number }) => {
@@ -72,32 +78,54 @@ export const ChooseBooth = () => {
7278
return (
7379
<section className={c.container}>
7480
<article className={c.choice}>
75-
<span className={c.title}>Odaberite svoje mjesto</span>
76-
<ul className={c.spots}>
77-
{booths.data
78-
.sort((a, b) => a.id - b.id)
79-
.map((booth) => (
80-
<li
81-
className={clsx(c.spot, {
82-
[c.chosen]: booth.id === selectedBoothId,
83-
[c.taken]: booth.isTaken,
84-
})}
85-
key={booth.id}
86-
onClick={() => !booth.isTaken && setSelectedBoothId(booth.id)}>
87-
<span className={c.text}>{booth.name}</span>
88-
</li>
89-
))}
90-
</ul>
91-
<button
92-
className={clsx(c.button, !selectedBoothId && c.disabled)}
93-
onClick={handleReserve}
94-
disabled={!selectedBoothId || reserveBooth.isLoading}>
95-
Odaberi {selectedBooth?.name}
96-
</button>
81+
{confirmedBooth ? (
82+
<div className={c.confirmation}>
83+
<span className={c.header}>Biranje mjesta</span>
84+
<span className={c.mainTitle}>
85+
Mjesto {confirmedBooth} je <br /> sada vaše!
86+
</span>
87+
<span className={c.desc}>
88+
Ukoliko imate dodatnih pitanja ili zahtjeva vezanih za vaš
89+
prostor, stojimo na raspolaganju.
90+
</span>
91+
<button
92+
className={c.button}
93+
onClick={() => clearBooth.mutateAsync()}>
94+
Uredi odabir
95+
</button>
96+
</div>
97+
) : (
98+
<>
99+
<span className={c.title}>Odaberite svoje mjesto</span>
100+
<ul className={c.spots}>
101+
{booths.data
102+
.sort((a, b) => a.id - b.id)
103+
.map((booth) => (
104+
<li
105+
className={clsx(c.spot, {
106+
[c.chosen]: booth.id === selectedBoothId,
107+
[c.taken]: booth.isTaken,
108+
})}
109+
key={booth.id}
110+
onClick={() =>
111+
!booth.isTaken && setSelectedBoothId(booth.id)
112+
}>
113+
<span className={c.text}>{booth.name}</span>
114+
</li>
115+
))}
116+
</ul>
117+
<button
118+
className={clsx(c.button, !selectedBoothId && c.disabled)}
119+
onClick={handleReserve}
120+
disabled={!selectedBoothId || reserveBooth.isLoading}>
121+
Odaberi {selectedBooth?.name}
122+
</button>
123+
</>
124+
)}
97125
</article>
98126
<aside className={c.map}>
99127
<img src={floorPlan} alt='Mapa štanda' />
100128
</aside>
101129
</section>
102130
);
103-
};
131+
};

apps/sponsor/src/components/Input/Input.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import clsx from 'clsx';
2+
23
import c from './Input.module.scss';
34

45
type InputProps = {

apps/sponsor/src/constants/forms.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { CompanyCategory } from '@ddays-app/types';
22
import { DISPLAY } from '@ddays-app/types';
33

44
import { Accreditation } from '../formSteps/Accreditation';
5-
import { BoothPlan } from '../formSteps/BoothPlan';
65
import { BoothEquipment } from '../formSteps/BoothEquipment/BoothEquipment';
6+
import { BoothPlan } from '../formSteps/BoothPlan';
77
import { Description } from '../formSteps/Description';
88
import { InterestPicker } from '../formSteps/InterestPicker';
99
import { Job } from '../formSteps/Job/Job';

apps/sponsor/src/formSteps/BoothEquipment/BoothEquipment.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ export const BoothEquipment: FormComponent = ({ close }) => {
7979
<div className={c.infoContainer}>
8080
<h1 className={c.title}>Materijali potrebni za štand</h1>
8181
<p className={c.description}>
82-
Oprema za štand su školske klupe, stolnjaci, stolice - napišite što vam je potrebno i u kojoj količini. Ako ste izrazili želju za tepihom, on je već podrazumijevan i čekat će vas na štandu. Svaki štand imat će produžni kabel s 4 do 5 utičnica, ako imate preferencu za to, također naznačite.
82+
Oprema za štand su školske klupe, stolnjaci, stolice - napišite što
83+
vam je potrebno i u kojoj količini. Ako ste izrazili želju za tepihom,
84+
on je već podrazumijevan i čekat će vas na štandu. Svaki štand imat će
85+
produžni kabel s 4 do 5 utičnica, ako imate preferencu za to, također
86+
naznačite.
8387
</p>
8488
</div>
8589

apps/sponsor/src/formSteps/BoothPlan/BoothPlan.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import c from './BoothPlan.module.scss';
1111
export const BoothPlan: FormComponent = ({ close }) => {
1212
const ref = useRef(true);
1313
const [boothPlan, setBoothPlan] = useState('');
14-
const [displayErrors, setDisplayErrors] = useState(false);
1514

1615
const { data: company } = useCompanyGetCurrentPublic();
1716
const { mutateAsync: updateBoothPlan } = useCompanyUpdateBoothPlan();

apps/sponsor/src/pages/FlyTalksPage/FlyTalksPage.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
width: 100%;
99
margin: 0 auto;
1010
box-sizing: border-box;
11-
padding: 40px 0;
11+
padding: 24px 0;
1212
}
1313
}
1414

0 commit comments

Comments
 (0)