Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/society dropdown #54

Merged
merged 20 commits into from
Dec 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
88b8564
Merge branch 'main' of https://github.com/devsoc-unsw/trainee-fool-24t3
Gyoumi Dec 13, 2024
6afd04f
Merge branch 'main' of https://github.com/devsoc-unsw/trainee-fool-24t3
Gyoumi Dec 13, 2024
39dcab2
Merge branch 'main' of https://github.com/devsoc-unsw/trainee-fool-24t3
Gyoumi Dec 13, 2024
2f2b00e
Merge branch 'main' of https://github.com/devsoc-unsw/trainee-fool-24t3
Gyoumi Dec 13, 2024
b50b3c2
Merge branch 'main' of https://github.com/devsoc-unsw/trainee-fool-24t3
Gyoumi Dec 14, 2024
b7d2c33
Merge branch 'main' of https://github.com/devsoc-unsw/trainee-fool-24t3
Gyoumi Dec 14, 2024
c3e9747
added redirection upon registration and logging in
Gyoumi Dec 13, 2024
e10e23c
began working on file upload for event creation
Gyoumi Dec 13, 2024
b5d24d0
frontend side of upload image banner
Gyoumi Dec 13, 2024
2632bfa
rebasing latest pr
Gyoumi Dec 13, 2024
c286eb0
Added image uploading and linked to supabase storage. added input box…
Gyoumi Dec 14, 2024
4c09494
create event page + society dropdown complete
Gyoumi Dec 14, 2024
1a063c6
deleting otp upon success is important
Gyoumi Dec 14, 2024
5fce307
🧹 fix frontend errors
lachlanshoesmith Dec 14, 2024
41d0a31
🧪 make storage-related env vars optional for test env
lachlanshoesmith Dec 14, 2024
49f7dbb
❌ rm lockfile
lachlanshoesmith Dec 14, 2024
f3578b4
🧪 fix borked tests
lachlanshoesmith Dec 15, 2024
19bf8f4
🧪 fix borked tests pt 2
lachlanshoesmith Dec 15, 2024
53c43c1
Merge branch 'features/society-dropdown' of https://github.com/devsoc…
Gyoumi Dec 15, 2024
788a229
🔧 fixed otp test
Gyoumi Dec 15, 2024
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
Prev Previous commit
Next Next commit
🧹 fix frontend errors
lachlanshoesmith committed Dec 14, 2024
commit 5fce30704b962cbcdf2d2add34ac35a2fafdc6b3
1 change: 0 additions & 1 deletion frontend/src/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@ import {
XMarkIcon,
} from '@heroicons/react/24/outline';
import { ButtonIcons, ButtonVariants } from './ButtonTypes';
import { MouseEventHandler } from 'react';

type ButtonProps = {
children?: string;
Original file line number Diff line number Diff line change
@@ -2,14 +2,12 @@ import { Link, useLocation } from 'react-router';
import Button from '../../../Button/Button';
import { ButtonIcons, ButtonVariants } from '../../../Button/ButtonTypes';
import { SettingsPage } from '../SettingsPage';
import { useContext, useEffect } from 'react';
import { useEffect } from 'react';
import classes from './EventManagementPage.module.css';
import { UserContext } from '../../../UserContext/UserContext';

export function EventManagementPage() {
const location = useLocation();
const { creationSuccess } = location.state;
const { societies } = useContext(UserContext);

useEffect(() => {
const getEvents = async () => {
@@ -46,10 +44,11 @@ export function EventManagementPage() {
</Link>,
]}
>
{creationSuccess &&
<div className={classes.success}>
<p>Event created!</p>
</div>}
{creationSuccess && (
<div className={classes.success}>
<p>Event created!</p>
</div>
)}
<table>
<thead>
<tr>
88 changes: 50 additions & 38 deletions frontend/src/Settings/SocietyDropdown/SocietyDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,47 +1,59 @@
import { ChangeEvent, FormEventHandler, useContext, useEffect, useState } from "react";
import classes from "./SocietyDropdown.module.css";
import { Society, UserContext } from "../../UserContext/UserContext";
import { ChangeEvent, useContext, useEffect } from 'react';
import classes from './SocietyDropdown.module.css';
import { UserContext } from '../../UserContext/UserContext';

export function SocietyDropdown() {
const { societies, setSocieties, setSociety } = useContext(UserContext);
const { societies, setSocieties, setSociety } = useContext(UserContext);

useEffect(() => {
const getSocieties = async () => {
const res = await fetch("http://localhost:5180/user/societies", {
method: "Get",
credentials: "include"
});
const json = await res.json();
useEffect(() => {
const getSocieties = async () => {
const res = await fetch('http://localhost:5180/user/societies', {
method: 'Get',
credentials: 'include',
});
const json = await res.json();

console.log(json);
console.log(json);

if(json) {
setSocieties?.(json);
}
}
getSocieties();
},[]);

const handleSelect = (event: ChangeEvent<HTMLSelectElement>) => {
const newSelection = event.target.value;
const findSelection = societies?.administering.find((soc) => soc.name === newSelection);
console.log(newSelection);
if(findSelection) {
setSociety?.(findSelection);
console.log(findSelection);
if (json) {
setSocieties?.(json);
}
};
getSocieties();
}, []);

return (
<div className={classes.container}>
<label className={classes.label} htmlFor="society-select">Currently logged into...</label>
<select name="societies" id="society-select" className={classes.select} onChange={handleSelect}>
<option value="">--Choose a society to manage--</option>
<hr />
{societies && societies.administering.map((soc) =>
<option className={classes.option} value={soc.name}>{soc.name}</option>
)}
</select>
</div>
const handleSelect = (event: ChangeEvent<HTMLSelectElement>) => {
const newSelection = event.target.value;
const findSelection = societies?.administering.find(
(soc) => soc.name === newSelection
);
}
console.log(newSelection);
if (findSelection) {
setSociety?.(findSelection);
console.log(findSelection);
}
};

return (
<div className={classes.container}>
<label className={classes.label} htmlFor="society-select">
Currently logged into...
</label>
<select
name="societies"
id="society-select"
className={classes.select}
onChange={handleSelect}
>
<option value="">--Choose a society to manage--</option>
<hr />
{societies &&
societies.administering.map((soc) => (
<option className={classes.option} value={soc.name}>
{soc.name}
</option>
))}
</select>
</div>
);
}

Unchanged files with check annotations Beta

const SERVICE_KEY = process.env["SERVICE_ROLE"];
if(!STORAGE_URL) {
throw new Error("Storage URL not found.");

Check failure on line 8 in backend/src/config/storage.ts

GitHub Actions / integration-tests

tests/attendEvent.test.ts

Error: Storage URL not found. ❯ src/config/storage.ts:8:11 ❯ src/index.ts:12:32

Check failure on line 8 in backend/src/config/storage.ts

GitHub Actions / integration-tests

tests/createEvent.test.ts

Error: Storage URL not found. ❯ src/config/storage.ts:8:11 ❯ src/index.ts:12:32

Check failure on line 8 in backend/src/config/storage.ts

GitHub Actions / integration-tests

tests/createKeyword.test.ts

Error: Storage URL not found. ❯ src/config/storage.ts:8:11 ❯ src/index.ts:12:32

Check failure on line 8 in backend/src/config/storage.ts

GitHub Actions / integration-tests

tests/createSociety.test.ts

Error: Storage URL not found. ❯ src/config/storage.ts:8:11 ❯ src/index.ts:12:32

Check failure on line 8 in backend/src/config/storage.ts

GitHub Actions / integration-tests

tests/deleteEvent.test.ts

Error: Storage URL not found. ❯ src/config/storage.ts:8:11 ❯ src/index.ts:12:32

Check failure on line 8 in backend/src/config/storage.ts

GitHub Actions / integration-tests

tests/deleteSociety.test.ts

Error: Storage URL not found. ❯ src/config/storage.ts:8:11 ❯ src/index.ts:12:32

Check failure on line 8 in backend/src/config/storage.ts

GitHub Actions / integration-tests

tests/getEvent.test.ts

Error: Storage URL not found. ❯ src/config/storage.ts:8:11 ❯ src/index.ts:12:32

Check failure on line 8 in backend/src/config/storage.ts

GitHub Actions / integration-tests

tests/getEvents.test.ts

Error: Storage URL not found. ❯ src/config/storage.ts:8:11 ❯ src/index.ts:12:32

Check failure on line 8 in backend/src/config/storage.ts

GitHub Actions / integration-tests

tests/getSociety.test.ts

Error: Storage URL not found. ❯ src/config/storage.ts:8:11 ❯ src/index.ts:12:32

Check failure on line 8 in backend/src/config/storage.ts

GitHub Actions / integration-tests

tests/getSocietyEvents.test.ts

Error: Storage URL not found. ❯ src/config/storage.ts:8:11 ❯ src/index.ts:12:32
}
if(!SERVICE_KEY) {
throw new Error("Service key not found.");