Skip to content

Commit 27e6830

Browse files
author
Alexandra Zwinger
committed
Cleanup old code
1 parent fc8c2bd commit 27e6830

File tree

6 files changed

+61
-32
lines changed

6 files changed

+61
-32
lines changed

src/components/ModuleProgressSettings.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,15 @@ const ModuleProgressSettings: React.FC<ModalProps> = ({isOpen, onClose}) => {
9191

9292
return (
9393
<div className="modal-overlay" onClick={onClose}>
94-
<div className="modal-content min-w-[300px] w-[650px] max-w-[90%]" onClick={(e) => e.stopPropagation()}>
95-
<p className="text-2xl font-bold text-white text-left mt-3 ml-3 mb-2">
94+
<div className="modal-content p-8 min-w-[300px] w-[650px] overflow-y-scroll max-h-[80%] max-w-[90%]"
95+
onClick={(e) => e.stopPropagation()}>
96+
<p className="text-2xl font-bold text-white text-left sm:ml-3">
9697
Lernfortschritt
9798
</p>
9899
{chapters.map((chapter) => (
99100
<div key={chapter.id}>
100-
<div className="flex gap-4 items-center mt-2 ml-3 mb-4">
101-
<p className="text-xl text-white text-left">
101+
<div className="flex gap-4 items-center mt-2 sm:ml-3 mb-4">
102+
<p className="sm:text-xl text-lg text-white text-left">
102103
{chapter.title}
103104
</p>
104105
<button
@@ -109,7 +110,7 @@ const ModuleProgressSettings: React.FC<ModalProps> = ({isOpen, onClose}) => {
109110
x
110111
</button>
111112
</div>
112-
<div className="checkbox-group ml-8 mb-4">
113+
<div className="checkbox-group sm:ml-8 mb-4">
113114
{chapter.checkboxes.map((checkbox) => (
114115
<div key={checkbox.id} className="checkbox-item w-[65%]">
115116
<input
@@ -150,7 +151,7 @@ const ModuleProgressSettings: React.FC<ModalProps> = ({isOpen, onClose}) => {
150151
))}
151152
</div>
152153

153-
<div className="add-checkbox-container">
154+
<div className="add-checkbox-container sm:ml-8">
154155
<button
155156
className="add-checkbox-btn"
156157
onClick={() => addCheckbox(chapter.id)}
@@ -167,17 +168,17 @@ const ModuleProgressSettings: React.FC<ModalProps> = ({isOpen, onClose}) => {
167168
</div>
168169
))}
169170

170-
<div className="mt-auto flex justify-end gap-4">
171+
<div className="mt-auto flex justify-end items-center gap-4">
171172
<CuteButton
172173
onClick={onClose}
173174
text={'Abbrechen'}
174175
bgColor={"#598BB1"} textColor={"#ffffff"}
175-
classname={'text-base'}
176+
classname={'sm:text-base text-sm'}
176177
/>
177178
<CuteButton
178179
text={'Speichern'}
179180
bgColor={"#56A095"} textColor={"#e8fcf6"}
180-
classname={'text-2xl'}
181+
classname={'sm:text-2xl text-lg'}
181182
/>
182183
</div>
183184

src/components/yourStudies/UserInfo.tsx

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@ import {getMeetingsOfWeek} from "../../api/MeetingApi";
44
import axiosInstance from "../../AxiosConfig";
55
import {MeetingDto} from "../../dtos/MeetingDto";
66
import ModuleProgressSettings from "../ModuleProgressSettings";
7-
8-
const subjects = [
9-
{name: "Algorithmen und Datenstrukturen", date: "17.02.2025", time: "10:30", room: "HQ.120", progress: 70},
10-
{name: "Mathematik III", date: "29.01.2025", time: "08:30", room: "KA.046", progress: 50},
11-
{name: "Mensch-Computer-Interaktion", date: "15.02.2025", time: "08:30", room: "HQ.120", progress: 40},
12-
{name: "Software Engineering", date: "27.01.2025", time: "14:00", room: "KA.046", progress: 80},
13-
];
7+
import {ModuleDto} from "../../dtos/ModuleDto";
8+
import {getUser} from "../../api/UserApi";
149

1510
export default function UserInfo() {
1611
const [weeklyMeetings, setWeeklyMeetings] = useState<MeetingDto[]>([]);
1712
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
13+
const [modules, setModules] = useState<ModuleDto[]>([]);
1814

1915
const filterMeetingsForCurrentWeek = (meetings: MeetingDto[]) => {
2016
const currentDate = new Date();
@@ -26,6 +22,14 @@ export default function UserInfo() {
2622
return meetingDate >= startOfWeek && meetingDate <= endOfWeek;
2723
});
2824
};
25+
const fetchUserInfo = async () => {
26+
try {
27+
const response = await getUser(axiosInstance);
28+
setModules(response.modules);
29+
} catch (error) {
30+
console.error("Fehler beim Abrufen der UserDaten: " + error);
31+
}
32+
}
2933

3034
const fetchMeetings = async () => {
3135
try {
@@ -38,6 +42,7 @@ export default function UserInfo() {
3842

3943
useEffect(() => {
4044
fetchMeetings();
45+
fetchUserInfo();
4146
}, []);
4247

4348
const openModal = () => {
@@ -55,28 +60,27 @@ export default function UserInfo() {
5560

5661
<table className="w-full border-collapse hidden md:table">
5762
<tbody>
58-
{subjects.map((subject, index) => (
63+
{modules.map((subject, index) => (
5964
<tr key={index}>
6065
<td className="px-1 py-1 text-[#9B9B9B]">{subject.name}</td>
61-
<td className="px-1 py-1 text-[#2AB19D]">{subject.date}</td>
62-
<td className="px-1 py-1 text-[#9B9B9B]">{subject.time}</td>
63-
<td className="px-1 py-1 text-[#9B9B9B]">{subject.room}</td>
66+
<td className="px-1 py-1 text-[#2AB19D]">DATE</td>
67+
<td className="px-1 py-1 text-[#9B9B9B]">TIME</td>
68+
<td className="px-1 py-1 text-[#9B9B9B]">ROOM</td>
6469
</tr>
6570
))}
6671
</tbody>
6772
</table>
68-
6973
<div className="md:hidden space-y-4">
70-
{subjects.map((subject, index) => (
74+
{modules.map((subject, index) => (
7175
<div key={index} className="p-3 shadow-sm">
7276
<p className="text-[#9B9B9B]">
7377
{subject.name}
7478
</p>
7579
<p className="text-[#2AB19D] inline">
76-
{subject.date}
80+
DATE
7781
</p>
7882
<p className="text-[#9B9B9B] inline ml-2">
79-
{subject.time} {subject.room}
83+
TIME ROOM
8084
</p>
8185
</div>
8286
))}
@@ -124,11 +128,11 @@ export default function UserInfo() {
124128
</div>
125129

126130
<p className="text-2xl font-bold text-white text-left mt-9 mb-6">Lernfortschritt</p>
127-
{subjects.map((subject, index) => (
131+
{modules.map((subject, index) => (
128132
<div key={index} className="mb-6">
129133
<p className="text-m text-[#9B9B9B]">{subject.name}</p>
130134
<div onClick={openModal}>
131-
<ProgressBar progress={subject.progress}/>
135+
<ProgressBar progress={0.5}/>
132136
</div>
133137
</div>
134138
))}

src/pages/YourStudies.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from "react";
22
import UserSettings from "../components/yourStudies/UserSettings";
33
import UserInfo from "../components/yourStudies/UserInfo";
4+
import '../styles/Scrollbar.css';
45

56
export default function YourStudies() {
67
return (
78
<div
8-
className="flex lg:justify-between justify-start lg:flex-row flex-col overflow-y-scroll lg:items-start items-center lg:mt-12 mt-4 h-full">
9+
className="flex lg:justify-between justify-start lg:flex-row scrollbar flex-col overflow-y-scroll lg:items-start items-center lg:mt-12 mt-4 h-full">
910
<UserSettings/>
1011
<div className="lg:h-[90%] lg:w-[1px] w-[90%] min-h-[2px] bg-[#1C7E70]"></div>
1112
<UserInfo/>

src/styles/Calendar.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,13 @@
1414
.fc-timegrid-slot-label {
1515
background-color: #165B51 !important;
1616
color: lightgray;
17+
}
18+
19+
.fc-scroller::-webkit-scrollbar-thumb {
20+
background-color: #050810;
21+
border-radius: 4px;
22+
}
23+
24+
.fc-scroller::-webkit-scrollbar {
25+
background-color: #161821;
1726
}

src/styles/Modal.css

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,21 @@
1414

1515
.modal-content {
1616
background-color: #1C212C;
17-
padding: 40px;
18-
padding-bottom: 20px;
1917
border-radius: 8px;
2018
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
2119
display: flex;
2220
flex-direction: column;
2321
gap: 20px;
2422
z-index: 10000;
23+
}
2524

25+
.modal-content::-webkit-scrollbar {
26+
background-color: #1c212c;
27+
}
28+
29+
.modal-content::-webkit-scrollbar-thumb {
30+
background-color: #161821;
31+
border-radius: 4px;
2632
}
2733

2834
.checkbox-group {
@@ -58,7 +64,7 @@
5864
top: 50%;
5965
left: 50%;
6066
transform: translate(-50%, -50%);
61-
background-color: transparent;
67+
background-color: transparent;
6268
}
6369

6470
.checkbox-item {
@@ -71,6 +77,7 @@
7177
justify-content: space-between;
7278
gap: 10px;
7379
position: relative;
80+
width: 100%;
7481
}
7582

7683
.delete-btn {
@@ -86,7 +93,6 @@
8693
display: flex;
8794
align-items: center;
8895
gap: 10px;
89-
margin-left: 20px;
9096
}
9197

9298
.add-checkbox-btn, .add-chapter-btn {
@@ -99,7 +105,7 @@
99105
height: 30px;
100106
border-radius: 4px;
101107
font-size: 16px;
102-
display: inline-flex;
108+
display: inline-flex;
103109
align-items: center;
104110
}
105111

src/styles/Scrollbar.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.scrollbar::-webkit-scrollbar {
2+
background-color: #1c212c;
3+
}
4+
5+
.scrollbar::-webkit-scrollbar-thumb {
6+
background-color: #161821;
7+
border-radius: 4px;
8+
}

0 commit comments

Comments
 (0)