Skip to content

Commit

Permalink
Merge pull request #23 from ITPNYU/feature/booking_app
Browse files Browse the repository at this point in the history
update dark mode
  • Loading branch information
rlho authored Sep 21, 2023
2 parents 9f9c29b + 159f30d commit b30ef36
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { SafetyTraining } from './SafetyTraining';
import { Ban } from './Ban';
import { AdminUsers } from './AdminUsers';
import { Liaisons } from './Liaisons';
import { formatDate } from '../../utils/date';

const ACTIVE_SHEET_ID = '1VZ-DY6o0GM5DL-v9AKkpCbF0w-xm-_T-vVUSPZph06Q';
const BOOKING_SHEET_NAME = 'bookings';
Expand All @@ -31,6 +32,7 @@ type BookingStatus = {
canceledAt: string;
checkedInAt: string;
};

const Admin = () => {
const [bookings, setBookings] = useState([]);
const [mappingBookings, setMappingBookings] = useState([]);
Expand Down Expand Up @@ -150,17 +152,6 @@ const Admin = () => {
}
};

const formatDate = (oldDate) => {
const oldDateObject = new Date(oldDate);

const year = oldDateObject.getFullYear();
const month = String(oldDateObject.getMonth() + 1).padStart(2, '0');
const date = String(oldDateObject.getDate()).padStart(2, '0');
const hours = String(oldDateObject.getHours()).padStart(2, '0');
const minutes = String(oldDateObject.getMinutes()).padStart(2, '0');

return `${year}-${month}-${date} ${hours}:${minutes}`;
};
return (
<div className="m-10">
<ul className="flex flex-wrap text-sm font-medium text-center text-gray-500 border-b border-gray-200 dark:border-gray-700 dark:text-gray-400">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';

// This is a wrapper for google.script.run that lets us use promises.
import { serverFunctions } from '../../utils/serverFunctions';
import { formatDate } from '@fullcalendar/core';

const SAFETY_TRAINING_SHEET_NAME = 'admin_users';

Expand Down Expand Up @@ -48,18 +49,6 @@ export const AdminUsers = () => {
};
};

const formatDate = (oldDate) => {
const oldDateObject = new Date(oldDate);

const year = oldDateObject.getFullYear();
const month = String(oldDateObject.getMonth() + 1).padStart(2, '0');
const date = String(oldDateObject.getDate()).padStart(2, '0');
const hours = String(oldDateObject.getHours()).padStart(2, '0');
const minutes = String(oldDateObject.getMinutes()).padStart(2, '0');

return `${year}-${month}-${date} ${hours}:${minutes}`;
};

console.log('adminEmails', adminEmails);
const addSafetyTrainingUser = () => {
if (adminEmails.includes(email)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';

// This is a wrapper for google.script.run that lets us use promises.
import { serverFunctions } from '../../utils/serverFunctions';

import { formatDate } from '../../utils/date';
const BAN_SHEET_NAME = 'banned_users';

type Ban = {
Expand Down Expand Up @@ -48,18 +48,6 @@ export const Ban = () => {
};
};

const formatDate = (oldDate) => {
const oldDateObject = new Date(oldDate);

const year = oldDateObject.getFullYear();
const month = String(oldDateObject.getMonth() + 1).padStart(2, '0');
const date = String(oldDateObject.getDate()).padStart(2, '0');
const hours = String(oldDateObject.getHours()).padStart(2, '0');
const minutes = String(oldDateObject.getMinutes()).padStart(2, '0');

return `${year}-${month}-${date} ${hours}:${minutes}`;
};

console.log('trainedEmails', trainedEmails);
const addBanUser = () => {
if (trainedEmails.includes(email)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';

// This is a wrapper for google.script.run that lets us use promises.
import { serverFunctions } from '../../utils/serverFunctions';
import { formatDate } from '../../utils/date';

const SHEET_NAME = 'liaisons';

Expand Down Expand Up @@ -50,18 +51,6 @@ export const Liaisons = () => {
};
};

const formatDate = (oldDate) => {
const oldDateObject = new Date(oldDate);

const year = oldDateObject.getFullYear();
const month = String(oldDateObject.getMonth() + 1).padStart(2, '0');
const date = String(oldDateObject.getDate()).padStart(2, '0');
const hours = String(oldDateObject.getHours()).padStart(2, '0');
const minutes = String(oldDateObject.getMinutes()).padStart(2, '0');

return `${year}-${month}-${date} ${hours}:${minutes}`;
};

console.log('liaisonEmails', liaisonEmails);
const addSafetyTrainingUser = () => {
if (liaisonEmails.includes(email)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';

// This is a wrapper for google.script.run that lets us use promises.
import { serverFunctions } from '../../utils/serverFunctions';
import { formatDate } from '../../utils/date';

const SAFETY_TRAINING_SHEET_NAME = 'safety_training_users';

Expand Down Expand Up @@ -48,18 +49,6 @@ export const SafetyTraining = () => {
};
};

const formatDate = (oldDate) => {
const oldDateObject = new Date(oldDate);

const year = oldDateObject.getFullYear();
const month = String(oldDateObject.getMonth() + 1).padStart(2, '0');
const date = String(oldDateObject.getDate()).padStart(2, '0');
const hours = String(oldDateObject.getHours()).padStart(2, '0');
const minutes = String(oldDateObject.getMinutes()).padStart(2, '0');

return `${year}-${month}-${date} ${hours}:${minutes}`;
};

console.log('trainedEmails', trainedEmails);
const addSafetyTrainingUser = () => {
if (trainedEmails.includes(email)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import dayGridPlugin from '@fullcalendar/daygrid';
import { CalendarDatePicker } from './CalendarDatePicker';
import { DateSelectArg } from '@fullcalendar/core';
import { RoomSetting } from './SheetEditor';
import { formatDate } from '../../utils/date';

type CalendarProps = {
apiKey: string;
Expand Down Expand Up @@ -48,7 +49,9 @@ export const Calendars = ({
`You are booking the following rooms: ${selectedRooms.map(
(room) => `${room.roomId} ${room.name}`
)}
\nYour reserved time slot: ${bookInfo.startStr} ~ ${bookInfo.endStr}`
\nYour reserved time slot: ${formatDate(
bookInfo.startStr
)} ~ ${formatDate(bookInfo.endStr)}`
);
if (isConfirmed) handleSetDate(bookInfo);
}
Expand Down
Loading

0 comments on commit b30ef36

Please sign in to comment.