Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwain-Anderson committed Feb 16, 2025
1 parent c62dbfc commit 8119008
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
4 changes: 1 addition & 3 deletions frontend/src/components/EmployeeModal/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import uploadBox from './upload.svg';
import styles from './employeemodal.module.css';
//import { useToast, ToastStatus } from '../../context/toastContext';


const IMAGE_SIZE_LIMIT = 500000000;


type UploadProps = {
imageChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
existingPhoto?: string;
Expand All @@ -33,7 +31,7 @@ const Upload = ({ imageChange, existingPhoto }: UploadProps) => {
setImageURL(URL.createObjectURL(files[0]));
imageChange(e);
} else {
setErrorMessage(`Images must be under ${ IMAGE_SIZE_LIMIT / 1000} KB`);
setErrorMessage(`Images must be under ${IMAGE_SIZE_LIMIT / 1000} KB`);
console.log(errorMessage); // placeholder for MUI chane.
}
}
Expand Down
16 changes: 5 additions & 11 deletions frontend/src/components/EmployeeModal/WeekContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const WeekProvider = ({ children }: WeekProviderProps) => {
});

const setDay = useCallback((day: string, value: number) => {
setWeek(prev => {
setWeek((prev) => {
if (prev[day] === value) return prev;
return { ...prev, [day]: value };
});
Expand All @@ -51,23 +51,17 @@ export const WeekProvider = ({ children }: WeekProviderProps) => {
[setDay]
);

const deselectDay = useCallback(
(day: string) => setDay(day, -1),
[setDay]
);
const deselectDay = useCallback((day: string) => setDay(day, -1), [setDay]);

const isDayOpen = useCallback(
(day: string) => week[day] === -1,
[week]
);
const isDayOpen = useCallback((day: string) => week[day] === -1, [week]);

const isDaySelectedByInstance = useCallback(
(day: string, index: number) => week[day] === index,
[week]
);

const getSelectedDays = useCallback(
(index: number) => Object.keys(week).filter(day => week[day] === index),
(index: number) => Object.keys(week).filter((day) => week[day] === index),
[week]
);

Expand All @@ -84,4 +78,4 @@ export const WeekProvider = ({ children }: WeekProviderProps) => {
{children}
</WeekContext.Provider>
);
};
};
8 changes: 4 additions & 4 deletions server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ app.use(express.urlencoded({ limit: '500mb', extended: true }));

// Very useful API Debugger Method.
app.use((req, res, next) => {
console.log(`[${new Date().toISOString()}] ${req.method} ${req.url}`);
console.log('Headers:', req.headers);
console.log('Body:', req.body); // Requires body-parser or express.json()
next();
console.log(`[${new Date().toISOString()}] ${req.method} ${req.url}`);
console.log('Headers:', req.headers);
console.log('Body:', req.body); // Requires body-parser or express.json()
next();
});

app.use('/api/riders', rider);
Expand Down
7 changes: 6 additions & 1 deletion server/src/router/upload.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import express from 'express';
import { S3, ObjectCannedACL } from '@aws-sdk/client-s3'; // Import required types
import {
S3,
PutObjectCommand,
DeleteObjectCommand,
HeadObjectCommand,
} from '@aws-sdk/client-s3';
import * as db from './common';
import { Driver } from '../models/driver';
import { Admin } from '../models/admin';
Expand Down

0 comments on commit 8119008

Please sign in to comment.