Skip to content

Commit

Permalink
Merge branch 'hl-prefer-box' of https://github.com/gorstdon-cs/gordon…
Browse files Browse the repository at this point in the history
…-360-ui into hl-prefer-box
  • Loading branch information
JayBae9903 committed Nov 20, 2023
2 parents 0a0a05f + 8c69a69 commit a522bcc
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# VITE_API_URL=https://360Api.gordon.edu/

# @TRAIN
VITE_API_URL=https://360ApiTrain.gordon.edu/
VITE_API_URL=https://360ApiSP.gordon.edu/

# @LOCALHOST
# VITE_API_URL=http://localhost:51626/
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
VITE_ANALYTICS_ID=G-2FE78G0CBN

# @TRAIN
VITE_API_URL=https://360ApiTrain.gordon.edu/
VITE_API_URL=https://360ApiSP.gordon.edu/
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches:
- develop
- master
- senior-project

jobs:
build:
Expand Down Expand Up @@ -59,3 +60,10 @@ jobs:
with:
name: build-prod
path: dist

- name: Upload senior-project build artifacts for deployment
if: ${{ github.ref == 'refs/heads/senior-project' }}
uses: actions/upload-artifact@v3
with:
name: build-senior-project
path: dist
2 changes: 1 addition & 1 deletion src/routes.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import About from './views/About';
import HousingLottery from './views/HousingLottery/HousingLottery.jsx';
import HousingLottery from './views/HousingLottery';
import Admin from './views/Admin';
import ApartmentApp from './views/ApartmentApp';
import BannerSubmission from './views/BannerSubmission';
Expand Down
5 changes: 1 addition & 4 deletions src/services/housing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ const getSubmittedApartmentApplications = async (): Promise<ApplicationDetails[]
const submitApplication = (applicationID: number): Promise<boolean> =>
http.put(`housing/apartment/applications/${applicationID}/submit`);

const addRoommate = (value: string) => http.put(`housing/housing_lottery/roommate/${value}`);
const addHall = (rank: number, hall: string) =>
http.put(`housing/housing_lottery/hall/${rank}`, hall);
const addRoommate = (value: string) => http.put(`housing/housing_lottery/${value}`);

const housingService = {
getApartmentSelectionDate,
Expand All @@ -179,7 +177,6 @@ const housingService = {
getSubmittedApartmentApplications,
submitApplication,
addRoommate,
addHall,
};

export default housingService;
57 changes: 57 additions & 0 deletions src/views/HousingLottery/components/PreferenceBox/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React, { useEffect, useState } from 'react';
import {
Card,
CardContent,
CardHeader,
Grid,
Table,
TableBody,
TableContainer,
Typography,
FormControl,
RadioGroup,
FormControlLabel,
Radio,
} from '@mui/material';
import housing from 'services/housing';
import styles from '../../../../HousingLottery.module.css';

function SurveyQuestionBox() {
const [selectedOption, setSelectedOption] = useState(''); // Store the selected option

// Handle the change of the selected option
const handleOptionChange = (event) => {
setSelectedOption(event.target.value);
};

// Your survey question text can go here
const questionText = 'Are you a night owl or a morning bird?';

return (
<Card>
<CardHeader title={questionText} />
<CardContent>
<FormControl component="fieldset">
<RadioGroup
aria-label="morning-or-night"
name="morning-or-night"
value={selectedOption}
onChange={handleOptionChange}
>
<FormControlLabel value="night-owl" control={<Radio />} label="Night Owl" />
<FormControlLabel value="morning-bird" control={<Radio />} label="Morning Bird" />
</RadioGroup>
<RadioGroup
aria-label="quiet-or-loud"
name="quiet-or-loud"
value={selectedOption}
onChange={handleOptionChange}
>
<FormControlLabel value="quiet" control={<Radio />} label="Quiet" />
<FormControlLabel value="loud" control={<Radio />} label="Loud" />
</RadioGroup>
</FormControl>
</CardContent>
</Card>
);
}
64 changes: 64 additions & 0 deletions src/views/HousingLottery/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React, { useState } from 'react';
import { Input, Button, Radio, RadioGroup, FormControlLabel } from '@mui/material';
import housingService from 'services/housing';

const HousingLottery = () => {
const [message, setMessage] = useState('');
const [morningOrNight, setMorningOrNight] = useState('');
const [loudOrQuiet, setLoudOrQuiet] = useState('');

const handleChange = (event) => {
setMessage(event.target.value);
};

const handleMorningOrNightChange = (event) => {
setMorningOrNight(event.target.value);
};

const handleLoudOrQuietChange = (event) => {
setLoudOrQuiet(event.target.value);
};

const handleClick = async () => {
// You can access message, morningOrNight, and loudOrQuiet to submit to your housing service
await housingService.addRoommate({ message, morningOrNight, loudOrQuiet });
};

return (
<div>
<div>
<label>Are you a night owl or a morning bird?</label>
<RadioGroup
aria-label="morning-or-night"
name="morning-or-night"
value={morningOrNight}
onChange={handleMorningOrNightChange}
>
<FormControlLabel value="night-owl" control={<Radio />} label="Night Owl" />
<FormControlLabel value="morning-bird" control={<Radio />} label="Morning Bird" />
</RadioGroup>
</div>

<div>
<label>Do you consider yourself quiet or loud in the dorm?</label>
<RadioGroup
aria-label="loud-or-quiet"
name="loud-or-quiet"
value={loudOrQuiet}
onChange={handleLoudOrQuietChange}
>
<FormControlLabel value="quiet" control={<Radio />} label="Quiet" />
<FormControlLabel value="loud" control={<Radio />} label="Loud" />
</RadioGroup>
</div>

<Input onChange={handleChange} placeholder="Enter your message" />

<Button variant="contained" onClick={handleClick}>
Submit
</Button>
</div>
);
};

export default HousingLottery;

1 comment on commit a522bcc

@JayBae9903
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed merge conflict

Please sign in to comment.