diff --git a/client/Dockerfile b/client/Dockerfile index 05359e44..a01aede1 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -23,6 +23,7 @@ FROM nginx:alpine COPY --from=build /app/dist /usr/share/nginx/html COPY public/config.template.js /usr/share/nginx/html/config.template.js COPY entrypoint.sh /entrypoint.sh +COPY nginx.conf /etc/nginx/nginx.conf RUN chmod +x /entrypoint.sh EXPOSE 80 diff --git a/client/nginx.conf b/client/nginx.conf new file mode 100644 index 00000000..acf7de61 --- /dev/null +++ b/client/nginx.conf @@ -0,0 +1,26 @@ +worker_processes 1; + +events { worker_connections 1024; } + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + + location / { + try_files $uri $uri/ /index.html; + } + + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { + expires 1y; + add_header Cache-Control "public"; + } + } +} \ No newline at end of file diff --git a/client/src/components/CreateMatchRequestDialog.tsx b/client/src/components/CreateMatchRequestDialog.tsx index 9fca1865..8b3f46a5 100644 --- a/client/src/components/CreateMatchRequestDialog.tsx +++ b/client/src/components/CreateMatchRequestDialog.tsx @@ -131,7 +131,10 @@ const CreateMatchRequestDialog: React.FC = ({ return; } - const formattedDate = selectedDate.toISOString().split('T')[0]; // YYYY-MM-DD format + // Format date using local values to avoid UTC shift + const formattedDate = selectedDate + ? `${selectedDate.getFullYear()}-${String(selectedDate.getMonth() + 1).padStart(2, '0')}-${String(selectedDate.getDate()).padStart(2, '0')}` + : ''; onSubmit({ userID: userID, diff --git a/client/src/components/Dashboard.tsx b/client/src/components/Dashboard.tsx index 17ebe0d1..c640b698 100644 --- a/client/src/components/Dashboard.tsx +++ b/client/src/components/Dashboard.tsx @@ -25,6 +25,7 @@ import { useUserID } from '../contexts/UserIDContext'; import { Link as RouterLink } from 'react-router-dom'; import { useMatchActions } from '../hooks/useMatchActions'; import MatchActionDialogs from './MatchActionDialogs'; +import { formatTimeslots } from '../utils/formatting'; const Dashboard = () => { const { user } = useAuth0(); @@ -728,7 +729,7 @@ const Dashboard = () => { {formatDate(req.date)} - {req.timeslot && req.timeslot.length > 0 ? formatTime(req.timeslot[0]) : 'No timeslot'} + {req.timeslot && req.timeslot.length > 0 ? formatTimeslots(req.timeslot) : 'No timeslot'} {req.location} diff --git a/client/src/components/MatchRequests.tsx b/client/src/components/MatchRequests.tsx index 0fd26152..aae0714f 100644 --- a/client/src/components/MatchRequests.tsx +++ b/client/src/components/MatchRequests.tsx @@ -83,8 +83,12 @@ const MatchRequests = () => { await submitMatchRequest(matchRequestData); setIsCreateDialogOpen(false); await fetchMatchRequests(); - } catch (err) { - setError('Failed to create match request. Please try again later.'); + } catch (err: any) { + if (err?.response?.status === 409) { + setError('You can only create one match request per day.'); + } else { + setError('Failed to create match request. Please try again later.'); + } console.error('Error creating match request:', err); } };