Skip to content

Commit

Permalink
Remove console logs, add Add component (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanGrims authored Dec 8, 2024
1 parent 86efbd5 commit 8912c1e
Show file tree
Hide file tree
Showing 20 changed files with 387 additions and 47 deletions.
1 change: 0 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ App.loader = async function loader() {

votes.docs.map((e) => {
let data = e.data();
console.log(data, e.id);

const now = moment().tz("Europe/Berlin");
const startTime = moment.unix(data.startTime.seconds).tz("Europe/Berlin");
Expand Down
3 changes: 2 additions & 1 deletion src/Vote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export default function Vote() {
startTime,
description,
} = vote;


const [firstName, setFirstName] = React.useState();
const [lastName, setLastName] = React.useState();
const [grade, setGrade] = React.useState();
Expand Down Expand Up @@ -118,7 +120,6 @@ export default function Vote() {
})
.catch((error) => {
setSending(false);
console.log(JSON.stringify(error));
if (error.code === "permission-denied") {
alert(
"Da hat etwas nicht geklappt. Sie sind nicht (mehr) berechtigt, Ihre Daten abzugeben. Bitte wenden Sie sich an den zuständigen Lehrer."
Expand Down
3 changes: 0 additions & 3 deletions src/admin/NewVote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export default function NewVote() {
}

async function publish() {
console.log("Generating new vote with id: " + id);
const berlinStartTime = moment.tz(startTime, "Europe/Berlin").toDate();
const berlinEndTime = moment.tz(endTime, "Europe/Berlin").toDate();

Expand All @@ -76,8 +75,6 @@ export default function NewVote() {

await Promise.all(option);

console.log("Vote created successfully.");

snackbar({
message: "Wahl erfolgreich erstellt.",
timeout: 5000,
Expand Down
3 changes: 0 additions & 3 deletions src/admin/Students.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export default function Students() {
const fileInputRef = useRef<HTMLInputElement>(null);

function uploadStudents(event) {
console.log(event.target.files);
const file = event.target.files[0];
const reader = new FileReader();
reader.onload = async (e) => {
Expand All @@ -50,7 +49,6 @@ export default function Students() {
}

function updateStudents(event) {
console.log(event.target.files);
const file = event.target.files[0];
const reader = new FileReader();
reader.onload = async (e) => {
Expand Down Expand Up @@ -168,7 +166,6 @@ export default function Students() {
onSubmit={(e) => {
e.preventDefault();
if (classId) {
console.log(updatedStudents);
updateClass(classId, {
students: JSON.parse(updatedStudents),
}).then(() => navigate(`/admin/students/${classId}`));
Expand Down
4 changes: 1 addition & 3 deletions src/admin/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export default function Login() {

const handleLogin = () => {
signInWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
console.log(userCredential);
})
.then((userCredential) => {})
.catch((error) => {
snackbar({
message: error.message,
Expand Down
5 changes: 0 additions & 5 deletions src/admin/deprecated/AnswerList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export default function AnswerList() {
try {
getDoc(doc(db, `/votes/${id}`)).then((e) => {
let data = e.data();
console.log(data);
if (data === undefined) {
alert("Document not found");
navigate("/admin");
Expand Down Expand Up @@ -119,17 +118,13 @@ for (const student of sortedStudentIds) {
}
setResult(options)
console.log(options)
`);
console.log(optionsLet);
console.log(choicesLet);
setLoading(false);
});
});
} catch (error) {
alert(error);
AES("");
console.log(enc);
}
}, [id]);

Expand Down
4 changes: 0 additions & 4 deletions src/admin/deprecated/AssignStudents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import React, { useState } from "react";
import { useLoaderData } from "react-router-dom";
import { db } from "../../firebase";
import { Choice, Option, Vote } from "../../types";
import CSVFileUpload from "./FileUpload";

export default function AssignStudents() {
const { vote, choices, options } = useLoaderData() as {
Expand Down Expand Up @@ -40,8 +39,6 @@ export default function AssignStudents() {
setAssignments(newAssignments);
}, []);

console.log(assignments);

function deactivate() {
if (prompt("Möchten Sie wirklich die Wahl beenden?") !== "Ja") return;
updateDoc(doc(db, `/votes/${vote.id}`), {
Expand Down Expand Up @@ -131,7 +128,6 @@ export default function AssignStudents() {
<div className="assign-title">{vote.title}</div>
<br />
<p />
<CSVFileUpload upload={(e) => console.log(e)} />

<div className="actions">
<div
Expand Down
1 change: 0 additions & 1 deletion src/admin/deprecated/ListVotes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default function ListVotes() {
getDocs(collection(db, "/votes")).then((data) => {
data.docs.map((e) => {
let data = e.data();
console.log(data.version > 1);
if (data.active) {
setActiveVotes((activeVotes) => [
...activeVotes,
Expand Down
1 change: 0 additions & 1 deletion src/admin/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default function Admin(props) {
const listen = onAuthStateChanged(auth, (user) => {
if (user) {
setAuthUser(user);
console.log(user);
setLoading(false);
} else {
setAuthUser(false);
Expand Down
9 changes: 1 addition & 8 deletions src/admin/navigation/DrawerList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default function DrawerList() {
.then((data) => {
data.docs.map((e) => {
let data = e.data();
console.log(data.version > 1);
if (data.active && data.endTime.seconds * 1000 > Date.now()) {
if (data.startTime.seconds * 1000 > Date.now()) {
setScheduledVotes((scheduledVotes) => [
Expand Down Expand Up @@ -80,8 +79,6 @@ export default function DrawerList() {
setActive(location.pathname.split("/")[2]);
}, [location]);

console.log(active, pages.includes(active));

if (!pages.includes(active)) {
return <VoteDrawer />;
}
Expand Down Expand Up @@ -120,11 +117,7 @@ export default function DrawerList() {
onCLick={() => navigate("/admin")}
/>

<mdui-collapse
accordion
onChange={(e) => console.log(e)}
value="active-votes"
>
<mdui-collapse accordion value="active-votes">
<mdui-collapse-item value="active-votes">
<mdui-list-item
rounded
Expand Down
6 changes: 6 additions & 0 deletions src/admin/navigation/VoteDrawer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ export default function VoteDrawer({}) {
active={active === "match"}
onCLick={() => navigate(`/admin/${id}/match`)}
/>
<DrawerItem
icon={"add"}
title={"Hinzufügen"}
active={active === "add"}
onCLick={() => navigate(`/admin/${id}/add`)}
/>
<DrawerItem
icon={"auto_awesome"}
title={"Zuteilen"}
Expand Down
Loading

0 comments on commit 8912c1e

Please sign in to comment.