Skip to content

Commit c041ef5

Browse files
committed
migrate to typescript
1 parent 4ee1fe8 commit c041ef5

25 files changed

+7164
-1458
lines changed

backend/Cargo.lock

Lines changed: 185 additions & 157 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package-lock.json

Lines changed: 6758 additions & 1214 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,26 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@fortawesome/fontawesome-svg-core": "^6.5.2",
6+
"@fortawesome/fontawesome-svg-core": "6.5.2",
77
"@fortawesome/free-brands-svg-icons": "^6.5.2",
88
"@fortawesome/free-regular-svg-icons": "^6.5.2",
99
"@fortawesome/free-solid-svg-icons": "^6.5.2",
1010
"@fortawesome/react-fontawesome": "^0.2.2",
1111
"@testing-library/jest-dom": "^5.17.0",
1212
"@testing-library/react": "^13.4.0",
1313
"@testing-library/user-event": "^13.5.0",
14+
"@types/jest": "^29.5.12",
15+
"@types/node": "^22.5.0",
16+
"@types/react": "^18.3.4",
17+
"@types/react-dom": "^18.3.0",
1418
"babel-plugin-macros": "^3.1.0",
1519
"cors": "^2.8.5",
1620
"react": "^18.3.1",
1721
"react-dom": "^18.3.1",
1822
"react-router-dom": "^6.23.1",
1923
"react-scripts": "^5.0.1",
2024
"rsuite": "^5.64.0",
25+
"typescript": "^5.5.4",
2126
"web-vitals": "^2.1.4"
2227
},
2328
"scripts": {
File renamed without changes.

frontend/src/App.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
2+
import Index from "./pages/index";
3+
import Generate from "./pages/generate";
4+
import Browse from "./pages/browse";
5+
import Search from "./pages/search";
6+
import Header from './components/header';
7+
import Footer from './components/footer';
8+
import React from "react";
9+
10+
function App() {
11+
return (
12+
<Router>
13+
<div id="superContainer">
14+
<Header />
15+
<Routes>
16+
<Route path="/" element={<Index />} />
17+
<Route path="/generate" element={<Generate />} />
18+
<Route path="/browse" element={<Browse />} />
19+
<Route path="/search" element={<Search />} />
20+
</Routes>
21+
<Footer />
22+
</div>
23+
</Router>
24+
);
25+
}
26+
27+
export default App;

frontend/src/components/alert.js renamed to frontend/src/components/alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
22
import { icon } from '@fortawesome/fontawesome-svg-core/import.macro'
33
import React, { useState } from "react";
44

5-
const Alert = (props) => {
5+
const Alert = (props: any) => {
66
const [hidden, setHidden] = useState(false);
77
return (
88
<div className="alert alert-info" hidden={hidden}>

frontend/src/components/courseChildren.js renamed to frontend/src/components/courseChildren.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const getCourseChildren = async (searchData, setLoading) => {
1+
const getCourseChildren = async (searchData: any, setLoading: any) => {
22
setLoading(true);
33
return await fetch("/api/generate/getCourseOpts", {
44
method: "POST",
5-
headers: {'Content-Type':'application/json'},
5+
headers: { 'Content-Type': 'application/json' },
66
body: JSON.stringify(searchData),
77
}).then((res) => {
88
if (res.status === 200) {
@@ -20,4 +20,4 @@ const getCourseChildren = async (searchData, setLoading) => {
2020
});
2121
}
2222

23-
export default getCourseChildren;
23+
export default getCourseChildren;

frontend/src/components/coursecart.js renamed to frontend/src/components/coursecart.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
22
import { icon } from '@fortawesome/fontawesome-svg-core/import.macro'
3+
import React from "react";
34

45
const CourseCart = () => {
56
return (
@@ -19,7 +20,7 @@ const CourseCart = () => {
1920
<button
2021
type="button"
2122
className="btn btn-danger pull-right"
22-
disabled="disabled"
23+
disabled={true}
2324
>
2425
<FontAwesomeIcon icon={icon({ name: "minus" })} />
2526
<FontAwesomeIcon icon={icon({ name: "shopping-cart" })} /> All
@@ -33,16 +34,13 @@ const CourseCart = () => {
3334
type="button"
3435
className="btn btn-xs btn-primary hidden-md hidden-lg pull-right"
3536
>
36-
<FontAwesomeIcon icon={icon({ name: "angle-down" })} style={null} />
37+
<FontAwesomeIcon icon={icon({ name: "angle-down" })} />
3738
</button>
3839
</h2>
3940
</div>
40-
<div
41-
className="panel-body course-cart-window hidden-xs hidden-sm"
42-
style={null}
43-
>
41+
<div className="panel-body course-cart-window hidden-xs hidden-sm">
4442
<div className="animate-show-hide">
45-
<div className="alert" style={null}>
43+
<div className="alert">
4644
Add courses to your cart and make a schedule with them. They will
4745
show up here.
4846
</div>

frontend/src/components/footer.js renamed to frontend/src/components/footer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Link } from 'react-router-dom'
2+
import React from 'react';
23

34
const Footer = () => {
45
return (

frontend/src/components/header.js renamed to frontend/src/components/header.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
22
import { Link } from 'react-router-dom'
33
import { icon } from '@fortawesome/fontawesome-svg-core/import.macro'
4+
import React from 'react';
45

56
const Header = () => {
67
return (
@@ -29,17 +30,17 @@ const Header = () => {
2930
<ul className="nav navbar-nav">
3031
<li ui-sref-active="active">
3132
<Link to="/generate">
32-
<FontAwesomeIcon icon={icon({name: "calendar", style: 'regular'})}/> Make a Schedule
33+
<FontAwesomeIcon icon={icon({ name: "calendar", style: 'regular' })} /> Make a Schedule
3334
</Link>
3435
</li>
3536
<li ui-sref-active="active">
3637
<Link to="/browse">
37-
<FontAwesomeIcon icon={icon({name: "list"})}/> Browse Courses
38+
<FontAwesomeIcon icon={icon({ name: "list" })} /> Browse Courses
3839
</Link>
3940
</li>
4041
<li ui-sref-active="active">
4142
<Link to="/search">
42-
<FontAwesomeIcon icon={icon({name: "search"})}/> Search Courses
43+
<FontAwesomeIcon icon={icon({ name: "search" })} /> Search Courses
4344
</Link>
4445
</li>
4546
</ul>
@@ -49,4 +50,4 @@ const Header = () => {
4950
);
5051
};
5152

52-
export default Header;
53+
export default Header;

0 commit comments

Comments
 (0)