Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ If you have a disability that prevents you from walking around campus, getting a
### Current Contributors

#### Technical Project Manager

- Matthew Kim

### Designer

- Ryan Qiu

#### Software Developers

- Anika Chandra
- Emir Icyer

Expand All @@ -40,6 +43,7 @@ If you have a disability that prevents you from walking around campus, getting a
### Past Contributors

#### Product Managers

- Andrew Choi
- Bryan Graeser
- Kathy Lim
Expand All @@ -49,6 +53,7 @@ If you have a disability that prevents you from walking around campus, getting a
- Stephy Chen

#### Technical Project Managers

- Christopher Hansen
- Desmond Atikpui
- Daniel Wei
Expand All @@ -59,6 +64,7 @@ If you have a disability that prevents you from walking around campus, getting a
- Selena Liu

#### Software Developers

- Aaron Kang
- Aiden Kim
- Andrew Choi
Expand Down Expand Up @@ -90,6 +96,7 @@ If you have a disability that prevents you from walking around campus, getting a
- Zack Ashen

#### Designers

- Aiden Kim
- Chelsea Wang
- Joanne Lee
Expand Down
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "index.js",
"dependencies": {
"@carriage-web/shared": "workspace:*"
"@carriage-web/shared": "workspace:*",
"node-releases": "^2.0.36"
},
"scripts": {
"dev": "vite",
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type ModalProps = {
isRider?: boolean;
id?: string;
arialabelledby?: string;
className?: string;
};

const Modal = ({
Expand All @@ -50,6 +51,7 @@ const Modal = ({
isRider = true,
arialabelledby,
id = 'modal',
className,
}: ModalProps) => {
// Wrapping children in Array to match type for numPages
const pages = paginate ? (children as React.ReactNodeArray) : [children];
Expand All @@ -74,7 +76,7 @@ const Modal = ({
clickOutsideDeactivates: true,
}}
>
<div className={styles.modal}>
<div className={`${styles.modal} ${className ?? ''}`.trim()}>
<div className={styles.topContainer}>
{isRider ? (
<h1 className={styles.title} id={id}>
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/components/Modal/modal.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,16 @@

@media screen and (max-height: 600px), screen and (max-width: 768px) {
.modal {
max-width: 100%;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 100%;
max-width: 395px;
height: 100%;
max-height: 100%;
overflow-y: scroll;
overflow-y: auto;
border-radius: 0;
padding: 0;
}

.page {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext } from 'react';
import React, { useContext, useRef } from 'react';
import { FormProvider, useForm } from 'react-hook-form';
import moment from 'moment';
import AuthContext from '../../context/auth';
Expand All @@ -7,7 +7,7 @@ import { Button } from '../FormElements/FormElements';
import { ObjectType } from '../../types/index';
import { RideType } from '@carriage-web/shared/types/ride';
import styles from './requestridemodal.module.css';
import RequestRideInfo from './RequestRideInfo';
import RequestRideWizard from './RequestRideWizard';
import { RideModalType } from './types';
import { format_date } from '../../util/index';
import axios from '../../util/axios';
Expand Down Expand Up @@ -40,25 +40,35 @@ const CreateOrEditRideModal = ({
return format_date(ride.startTime);
}
}
return format_date();
// For new rides, start with empty date so button is disabled
return '';
};

const defaultValues = {
startDate: defaultStartDate(),
whenRepeat: ride?.isRecurring ? 'custom' : undefined,
whenRepeat: ride?.isRecurring ? 'custom' : 'no-repeat',
pickupTime: ride ? moment(ride.startTime).format('HH:mm') : '',
dropoffTime: ride ? moment(ride.endTime).format('HH:mm') : '',
recurring: ride?.isRecurring ?? false,
};

const methods = useForm({ defaultValues });
const { id } = useContext(AuthContext);
const formRef = useRef<HTMLFormElement>(null);

const closeModal = () => {
methods.clearErrors();
onClose();
};

const handleFormSubmit = async () => {
// Trigger form submission
const isValid = await methods.trigger();
if (isValid) {
methods.handleSubmit(handleSubmit)();
}
};

// Removes null fields from object
const cleanData = (data: ObjectType) =>
Object.fromEntries(Object.entries(data).filter(([_, v]) => v !== null));
Expand Down Expand Up @@ -96,14 +106,17 @@ const CreateOrEditRideModal = ({
? endLocation
: `${customDropoff}, ${dropoffCity} NY, ${dropoffZip}`;
let rideData: ObjectType;
if (recurring || whenRepeat) {
// Check if it's a recurring ride (not "no-repeat")
const isRecurringRide =
recurring || (whenRepeat && whenRepeat !== 'no-repeat');
if (isRecurringRide) {
// For now, block recurring rides as they're not fully implemented
alert(
'Recurring rides are not yet supported. Please create a single ride instead.'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably doesn't matter since it won't be in production until later but having to go to the end of the workflow before this message appears is kinda annoying

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I'll fix

);
return;
} else {
// Single ride (non-recurring)
// Single ride (non-recurring) - "No repeat" or no repeat selection
rideData = {
startLocation: startLoc,
endLocation: endLoc,
Expand Down Expand Up @@ -148,22 +161,27 @@ const CreateOrEditRideModal = ({

return (
<Modal
title={!ride ? 'Request a Ride' : 'Edit Ride'}
title=""
isOpen={isOpen}
onClose={closeModal}
displayClose={true}
className={styles.requestRideModal}
>
<FormProvider {...methods}>
<form onSubmit={methods.handleSubmit(handleSubmit)}>
<form
ref={formRef}
onSubmit={methods.handleSubmit(handleSubmit)}
id="ride-form"
>
<div className={styles.inputContainer}>
<RequestRideInfo
<RequestRideWizard
ride={ride}
showRepeatingCheckbox={!ride}
showRepeatingInfo={modalType !== 'EDIT_SINGLE_RECURRING'}
modalType={modalType}
onClose={closeModal}
onSubmit={handleFormSubmit}
/>
<Button className={styles.submit} type="submit">
{!ride ? 'Request a Ride' : 'Edit Ride'}
</Button>
</div>
</form>
</FormProvider>
Expand Down
Loading
Loading