Skip to content

Commit 6933149

Browse files
Bugfix/UI fixes (#90)
2 parents 3bde875 + d7d2cb9 commit 6933149

5 files changed

Lines changed: 39 additions & 4 deletions

File tree

client/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ FROM nginx:alpine
2323
COPY --from=build /app/dist /usr/share/nginx/html
2424
COPY public/config.template.js /usr/share/nginx/html/config.template.js
2525
COPY entrypoint.sh /entrypoint.sh
26+
COPY nginx.conf /etc/nginx/nginx.conf
2627
RUN chmod +x /entrypoint.sh
2728

2829
EXPOSE 80

client/nginx.conf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
worker_processes 1;
2+
3+
events { worker_connections 1024; }
4+
5+
http {
6+
include mime.types;
7+
default_type application/octet-stream;
8+
sendfile on;
9+
keepalive_timeout 65;
10+
11+
server {
12+
listen 80;
13+
server_name localhost;
14+
15+
root /usr/share/nginx/html;
16+
17+
location / {
18+
try_files $uri $uri/ /index.html;
19+
}
20+
21+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
22+
expires 1y;
23+
add_header Cache-Control "public";
24+
}
25+
}
26+
}

client/src/components/CreateMatchRequestDialog.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ const CreateMatchRequestDialog: React.FC<CreateMatchRequestDialogProps> = ({
131131
return;
132132
}
133133

134-
const formattedDate = selectedDate.toISOString().split('T')[0]; // YYYY-MM-DD format
134+
// Format date using local values to avoid UTC shift
135+
const formattedDate = selectedDate
136+
? `${selectedDate.getFullYear()}-${String(selectedDate.getMonth() + 1).padStart(2, '0')}-${String(selectedDate.getDate()).padStart(2, '0')}`
137+
: '';
135138

136139
onSubmit({
137140
userID: userID,

client/src/components/Dashboard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { useUserID } from '../contexts/UserIDContext';
2525
import { Link as RouterLink } from 'react-router-dom';
2626
import { useMatchActions } from '../hooks/useMatchActions';
2727
import MatchActionDialogs from './MatchActionDialogs';
28+
import { formatTimeslots } from '../utils/formatting';
2829

2930
const Dashboard = () => {
3031
const { user } = useAuth0();
@@ -728,7 +729,7 @@ const Dashboard = () => {
728729
{formatDate(req.date)}
729730
</Typography>
730731
<Typography variant="body2" sx={{ color: 'text.secondary', mb: 0.5 }}>
731-
{req.timeslot && req.timeslot.length > 0 ? formatTime(req.timeslot[0]) : 'No timeslot'}
732+
{req.timeslot && req.timeslot.length > 0 ? formatTimeslots(req.timeslot) : 'No timeslot'}
732733
</Typography>
733734
<Typography variant="body2" sx={{ color: 'text.secondary', mb: 1 }}>
734735
{req.location}

client/src/components/MatchRequests.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,12 @@ const MatchRequests = () => {
8383
await submitMatchRequest(matchRequestData);
8484
setIsCreateDialogOpen(false);
8585
await fetchMatchRequests();
86-
} catch (err) {
87-
setError('Failed to create match request. Please try again later.');
86+
} catch (err: any) {
87+
if (err?.response?.status === 409) {
88+
setError('You can only create one match request per day.');
89+
} else {
90+
setError('Failed to create match request. Please try again later.');
91+
}
8892
console.error('Error creating match request:', err);
8993
}
9094
};

0 commit comments

Comments
 (0)