Skip to content

Commit 98e88a9

Browse files
authored
Merge pull request #81 from DSAV-Dodeka/newregistration
New Volta registration and update dependencies
2 parents bc014b8 + a7b7689 commit 98e88a9

File tree

50 files changed

+2127
-1767
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2127
-1767
lines changed

.env.staging

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VITE_PAGES_AUTH_URL=https://apidemo.tipten.nl
1+
VITE_PAGES_AUTH_URL=https://apidemo.dsavdodeka.nl
22
VITE_PAGES_CLIENT_URL=https://demo.tipten.nl
33
VITE_PAGES_API_URL=https://apidemo.tipten.nl
44
VITE_PAGES_CLIENT_ID=dodekaweb_client

package-lock.json

+1,070-725
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
{
22
"name": "newreact",
33
"version": "0.1.0",
4+
"type": "module",
45
"scripts": {
56
"dev": "vite --mode localdev",
67
"build": "tsc && vite build --mode localdev",
78
"build-mode": "vite build",
89
"preview": "vite preview"
910
},
1011
"dependencies": {
11-
"@tanstack/react-query": "^4.36.1",
12-
"@tanstack/react-table": "^8.10.7",
12+
"@tanstack/react-query": "5.64.0",
13+
"@tanstack/react-table": "8.20.6",
1314
"disable-scroll": "^0.6.0",
14-
"html-react-parser": "^4.2.2",
15-
"ky": "^1.0.1",
16-
"papaparse": "^5.4.0",
17-
"react": "^18.2.0",
18-
"react-dom": "^18.2.0",
19-
"react-router-dom": "^6.17.0",
20-
"zod": "^3.22.4"
15+
"html-react-parser": "5.2.2",
16+
"ky": "1.7.4",
17+
"papaparse": "5.5.1",
18+
"react": "19.0.0",
19+
"react-dom": "19.0.0",
20+
"react-router-dom": "6.28.1",
21+
"zod": "3.24.1"
2122
},
2223
"devDependencies": {
23-
"@types/node": "^18.18.5",
24-
"@types/papaparse": "^5.3.10",
25-
"@types/react": "^18.2.31",
26-
"@types/react-dom": "^18.2.14",
27-
"@vitejs/plugin-react": "^4.1.0",
28-
"sass": "^1.69.3",
29-
"typescript": "^5.2.2",
30-
"vite": "^4.4.11",
31-
"vite-plugin-svgr": "^4.1.0"
24+
"@types/node": "22.10.5",
25+
"@types/papaparse": "5.3.15",
26+
"@types/react": "19.0.6",
27+
"@types/react-dom": "19.0.3",
28+
"@vitejs/plugin-react": "4.3.4",
29+
"sass": "1.69.3",
30+
"typescript": "5.7.3",
31+
"vite": "6.0.7",
32+
"vite-plugin-svgr": "4.3.0"
3233
}
3334
}

src/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const cacheTime = 1000 * 60 // 1 minute
6262
const queryClient = new QueryClient({
6363
defaultOptions: {
6464
queries: {
65-
cacheTime,
65+
gcTime: cacheTime,
6666
},
6767
},
6868
})

src/components/Contact Bar/ContactBar.jsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
import "./ContactBar.scss";
66

77
import Heading from "./Heading";
8-
import getUrl from "../../functions/links";
8+
import {getNestedImagesUrl} from "../../functions/links";
99

1010
function ContactBar() {
1111
return (
@@ -30,10 +30,10 @@ function ContactBar() {
3030
<div className="bar_container">
3131
<Link className="no_underline" to="/contact/sponsors#"><Heading title="Sponsors" /></ Link>
3232
<div className="bar_info">
33-
<a target="_blank" rel="noreferrer" href="https://www.malthasport.nl/"><img src={getUrl(`sponsors/maltha.png`)} alt="" className="bar_sponsor maltha_bar"></img></a>
34-
<a target="_blank" rel="noreferrer" href="https://kernengineers.nl/"><img src={getUrl(`sponsors/kern.svg`)} alt="" className="bar_sponsor kverneland_bar"></img></a>
35-
{/* <a target="_blank" rel="noreferrer" href="https://www.tsagroup.nl/"><img src={getUrl(`sponsors/tsa.png`)} alt="" className="bar_sponsor tsa_bar"></img></a> */}
36-
<a target="_blank" rel="noreferrer" href="https://www.studentendrukwerk.nl/"><img src={getUrl(`sponsors/studentendrukwerk.png`)} alt="" className="bar_sponsor tsa_bar"></img></a>
33+
<a target="_blank" rel="noreferrer" href="https://www.malthasport.nl/"><img src={getNestedImagesUrl(`sponsors/maltha.png`)} alt="" className="bar_sponsor maltha_bar"></img></a>
34+
<a target="_blank" rel="noreferrer" href="https://kernengineers.nl/"><img src={getNestedImagesUrl(`sponsors/kern.svg`)} alt="" className="bar_sponsor kverneland_bar"></img></a>
35+
{/* <a target="_blank" rel="noreferrer" href="https://www.tsagroup.nl/"><img src={getNestedImagesUrl(`sponsors/tsa.png`)} alt="" className="bar_sponsor tsa_bar"></img></a> */}
36+
<a target="_blank" rel="noreferrer" href="https://www.studentendrukwerk.nl/"><img src={getNestedImagesUrl(`sponsors/studentendrukwerk.png`)} alt="" className="bar_sponsor tsa_bar"></img></a>
3737
</div>
3838

3939
</div>

src/components/Login/Login.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import "./Login.scss";
88
import Item from "../Navigation Bar/Item";
99
import Dropdown from "../Navigation Bar/Dropdown";
1010
import {Logger} from "../../functions/logger";
11-
import getUrl from "../../functions/links";
11+
import {getImagesUrl, getNestedImagesUrl} from "../../functions/links";
1212

1313
/**
1414
* Hook that alerts clicks outside of the passed ref
1515
*/
16-
function useOutsideClick(ref: React.RefObject<HTMLElement>, callback: () => void) {
16+
function useOutsideClick(ref: React.RefObject<HTMLElement | null>, callback: () => void) {
1717
const handleClick = (e: MouseEvent) => {
18-
if (ref.current && !ref.current.contains(e.target as Node)) {
18+
if (ref !== null && ref.current !== null && !ref.current.contains(e.target as Node)) {
1919
callback();
2020
}
2121
}
@@ -54,11 +54,11 @@ const Login = () => {
5454
return (
5555
<div className="profile-box">
5656
{ac.isLoaded && !ac.isAuthenticated &&
57-
<button className="login_button" onClick={handleLogin}><img className="login_icon" src={getUrl(`login/login.png`)} /></button>
57+
<button className="login_button" onClick={handleLogin}><img className="login_icon" src={getNestedImagesUrl(`login/login.png`)} /></button>
5858
}
5959
{ac.isLoaded && ac.isAuthenticated &&
6060
<div className="profile_dropdown" onClick={() => setActive(!active)}>
61-
<h2 ref={ref} className="profile_login"><img className="login_icon" src={getUrl(`login/ingelogd.png`)} /></h2>
61+
<h2 ref={ref} className="profile_login"><img className="login_icon" src={getNestedImagesUrl(`login/ingelogd.png`)} /></h2>
6262
<div className={active ? "profile_drop" : "dropHide"}>
6363
<Link className="profile_dropdownElement" to="/profiel">Profiel</Link>
6464
{ac.scope.includes("admin") ? (<Link className="profile_dropdownElement" to="/admin">Admin</Link>) : ""}

src/components/Navigation Bar/NavigationBar.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import MobileDropdown from "./MobileDropdown";
99
import disableScroll from 'disable-scroll';
1010
import wedstrijdText from "../../content/Wedstrijden.json";
1111
import "./NavigationBar.scss"
12-
import getUrl from "../../functions/links";
12+
import {getNestedImagesUrl, getImagesUrl} from "../../functions/links";
1313
import authContext from "../../pages/Auth/AuthContext";
1414
import Login from "../Login/Login";
1515

@@ -29,9 +29,9 @@ function NavigationBar() {
2929
<div id="navBar">
3030
<nav id="navPc">
3131
<Link to="/">
32-
<img id="navLogo" className={(location === "/" ? "hidden" : "")} src={getUrl(`logo.png`)} alt="" />
32+
<img id="navLogo" className={(location === "/" ? "hidden" : "")} src={getImagesUrl(`logo.png`)} alt="" />
3333
</Link>
34-
<img id="home_logo" className={(location === "/" ? "" : "hidden")} src={getUrl('logo.png')} alt=""/>
34+
<img id="home_logo" className={(location === "/" ? "" : "hidden")} src={getImagesUrl('logo.png')} alt=""/>
3535
<div id="navItems">
3636
<Item name="Home" path="/" />
3737
<Item name="OWee" path="/owee" />
@@ -52,7 +52,7 @@ function NavigationBar() {
5252
<div className={"hamburgerStreepje" + (active ? " hamburgerMiddle" : "")}></div>
5353
<div className={"hamburgerStreepje" + (active ? " hamburgerBottom" : "")}></div>
5454
</div>
55-
{/* <img id="navMobileLogo" src={getUrl(`dodeka.png`)} alt="" /> */}
55+
{/* <img id="navMobileLogo" src={getNestedImagesUrl(`dodeka.png`)} alt="" /> */}
5656
<div className="mobileLogin">
5757
<Login />
5858
</div>

src/functions/api/api.ts

-5
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,10 @@ export const su_request = async (auth: AuthUse, options?: Options) => {
9999
const UserData = z.object({
100100
firstname: z.string(),
101101
lastname: z.string(),
102-
phone: z.string(),
103102
email: z.string(),
104103
user_id: z.string(),
105-
callname: z.string(),
106-
av40id: z.number(),
107104
joined: z.string(),
108-
eduinstitution: z.string(),
109105
birthdate: z.string(),
110-
registered: z.boolean()
111106
})
112107
export type UserData = z.infer<typeof UserData>;
113108

src/functions/api/klassementen.ts

+91-91
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,92 @@
1-
import {Options} from "ky";
2-
import {z} from "zod";
3-
import {AuthUse} from "../../pages/Auth/AuthContext";
4-
import {back_request} from "./api";
5-
6-
const KlassementData = z.object({
7-
firstname: z.string(),
8-
lastname: z.string(),
9-
user_id: z.string(),
10-
points: z.number()
11-
})
12-
export type KlassementData = z.infer<typeof KlassementData>;
13-
14-
const KlassementList = z.object({
15-
last_updated: z.coerce.date(),
16-
frozen: z.boolean(),
17-
points: z.array(KlassementData)
18-
})
19-
export type KlassementList = z.infer<typeof KlassementList>;
20-
21-
22-
export const klassement_request = async (auth: AuthUse, is_admin: boolean, rank_type: 'points'|'training', options?: Options): Promise<KlassementData[]> => {
23-
let role;
24-
if (is_admin) {
25-
role = "admin"
26-
} else {
27-
role = "members"
28-
}
29-
30-
let response = await back_request(`${role}/class/get/${rank_type}/`, auth, options)
31-
const punt_klas: KlassementData[] = KlassementData.array().parse(response)
32-
punt_klas.sort((a, b) => {
33-
return b.points - a.points
34-
})
35-
return punt_klas
36-
}
37-
38-
export const klassement_with_info_request = async (auth: AuthUse, rank_type: 'points'|'training', options?: Options): Promise<KlassementList> => {
39-
let response = await back_request(`members/class/get_with_info/${rank_type}/`, auth, options)
40-
const punt_klas: KlassementList = KlassementList.parse(response)
41-
punt_klas.points.sort((a, b) => {
42-
return b.points - a.points
43-
})
44-
return punt_klas
45-
}
46-
47-
48-
49-
const UserIDData = z.object({
50-
user_id: z.string(),
51-
})
52-
export type UserIDData = {
53-
user_id: string
54-
}
55-
56-
const UserIDList = z.array(UserIDData)
57-
58-
export const user_id_request = async (auth: AuthUse, options?: Options): Promise<Set<string>> => {
59-
let response = await back_request('admin/users/ids/', auth, options)
60-
const user_ids = UserIDList.parse(response).map(s => s.user_id)
61-
return new Set(user_ids)
62-
}
63-
64-
const UserNames = z.object({
65-
user_id: z.string(),
66-
firstname: z.string(),
67-
lastname: z.string()
68-
})
69-
export type UserNames = z.infer<typeof UserNames>
70-
const UserNamesList = z.array(UserNames)
71-
72-
export const user_names_request = async (auth: AuthUse, options?: Options): Promise<UserNames[]> => {
73-
let response = await back_request('admin/users/names/', auth, options)
74-
return UserNamesList.parse(response)
75-
}
76-
77-
const ClassMetaList = z.object({
78-
type: z.enum(["training", "points"]),
79-
end_date: z.coerce.date(),
80-
hidden_date: z.coerce.date(),
81-
start_date: z.coerce.date(),
82-
classification_id: z.number()
83-
}).array()
84-
export type ClassMetaList = z.infer<typeof ClassMetaList>;
85-
86-
export const class_get_meta_request = async (auth: AuthUse, options?: Options): Promise<ClassMetaList> => {
87-
let response = await back_request(`admin/class/get_meta/4/`, auth, options)
88-
const class_list: ClassMetaList = ClassMetaList.parse(response)
89-
console.log(class_list)
90-
class_list.sort((a, b) => b.start_date.getTime() - a.start_date.getTime())
91-
return class_list
1+
import {Options} from "ky";
2+
import {z} from "zod";
3+
import {AuthUse} from "../../pages/Auth/AuthContext";
4+
import {back_request} from "./api";
5+
6+
const KlassementData = z.object({
7+
firstname: z.string(),
8+
lastname: z.string(),
9+
user_id: z.string(),
10+
points: z.number()
11+
})
12+
export type KlassementData = z.infer<typeof KlassementData>;
13+
14+
const KlassementList = z.object({
15+
last_updated: z.coerce.date(),
16+
frozen: z.boolean(),
17+
points: z.array(KlassementData)
18+
})
19+
export type KlassementList = z.infer<typeof KlassementList>;
20+
21+
22+
export const klassement_request = async (auth: AuthUse, is_admin: boolean, rank_type: 'points'|'training', options?: Options): Promise<KlassementData[]> => {
23+
let role;
24+
if (is_admin) {
25+
role = "admin"
26+
} else {
27+
role = "members"
28+
}
29+
30+
let response = await back_request(`${role}/class/get/${rank_type}/`, auth, options)
31+
const punt_klas: KlassementData[] = KlassementData.array().parse(response)
32+
punt_klas.sort((a, b) => {
33+
return b.points - a.points
34+
})
35+
return punt_klas
36+
}
37+
38+
export const klassement_with_info_request = async (auth: AuthUse, rank_type: 'points'|'training', options?: Options): Promise<KlassementList> => {
39+
let response = await back_request(`members/class/get_with_info/${rank_type}/`, auth, options)
40+
const punt_klas: KlassementList = KlassementList.parse(response)
41+
punt_klas.points.sort((a, b) => {
42+
return b.points - a.points
43+
})
44+
return punt_klas
45+
}
46+
47+
48+
49+
const UserIDData = z.object({
50+
user_id: z.string(),
51+
})
52+
export type UserIDData = {
53+
user_id: string
54+
}
55+
56+
const UserIDList = z.array(UserIDData)
57+
58+
export const user_id_request = async (auth: AuthUse, options?: Options): Promise<Set<string>> => {
59+
let response = await back_request('admin/users/ids/', auth, options)
60+
const user_ids = UserIDList.parse(response).map(s => s.user_id)
61+
return new Set(user_ids)
62+
}
63+
64+
const UserNames = z.object({
65+
user_id: z.string(),
66+
firstname: z.string(),
67+
lastname: z.string()
68+
})
69+
export type UserNames = z.infer<typeof UserNames>
70+
const UserNamesList = z.array(UserNames)
71+
72+
export const user_names_request = async (auth: AuthUse, options?: Options): Promise<UserNames[]> => {
73+
let response = await back_request('admin/users/names/', auth, options)
74+
return UserNamesList.parse(response)
75+
}
76+
77+
const ClassMetaList = z.object({
78+
type: z.enum(["training", "points"]),
79+
end_date: z.coerce.date(),
80+
hidden_date: z.coerce.date(),
81+
start_date: z.coerce.date(),
82+
classification_id: z.number()
83+
}).array()
84+
export type ClassMetaList = z.infer<typeof ClassMetaList>;
85+
86+
export const class_get_meta_request = async (auth: AuthUse, options?: Options): Promise<ClassMetaList> => {
87+
let response = await back_request(`admin/class/get_meta/4/`, auth, options)
88+
const class_list: ClassMetaList = ClassMetaList.parse(response)
89+
console.log(class_list)
90+
class_list.sort((a, b) => b.start_date.getTime() - a.start_date.getTime())
91+
return class_list
9292
}

src/functions/links.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
const getUrl = (loc: string, dir: string='images') => {
2-
return new URL(`../${dir}/${loc}`, import.meta.url).href
1+
export const getImagesUrl = (loc: string) => {
2+
return new URL(`../images/${loc}`, import.meta.url).href
33
}
44

5-
export default getUrl;
5+
// TODO this is ugly hack to fix new behavior (which "fixes" a bug) from Vite 6
6+
export const getNestedImagesUrl = (loc: string) => {
7+
const split = loc.split('/')
8+
return new URL(`../images/${split[0]}/${split[1]}`, import.meta.url).href
9+
}
10+
11+
export const getDeepImagesUrl = (loc: string) => {
12+
const split = loc.split('/')
13+
return new URL(`../images/${split[0]}/${split[1]}/${split[2]}`, import.meta.url).href
14+
}

0 commit comments

Comments
 (0)