♻️ Refactor frontend code
This commit is contained in:
@ -2,12 +2,12 @@
|
|||||||
--bg-color: #353535;
|
--bg-color: #353535;
|
||||||
--element-color: #333030;
|
--element-color: #333030;
|
||||||
--element-color-hover: #292424;
|
--element-color-hover: #292424;
|
||||||
--element-border-input: #34631f;
|
--element-border-input: #4e7a3a;
|
||||||
--element-border-action: #1f5b63;
|
--element-border-action: #1f5b63;
|
||||||
--text-color: #bdbdbd;
|
--text-color: #bdbdbd;
|
||||||
--font-family: "sourcesanspro";
|
--font-family: "sourcesanspro";
|
||||||
--titlebar-color: #212121;
|
--titlebar-color: #212121;
|
||||||
--titlebar-element-active-color: #335723;
|
--titlebar-element-active-color: #466439;
|
||||||
--bottomnav-color: #555555;
|
--bottomnav-color: #555555;
|
||||||
--bottomnav-icon-color: #c7c7c7;
|
--bottomnav-icon-color: #c7c7c7;
|
||||||
--bottomnav-icon-active-color: #456c47;
|
--bottomnav-icon-active-color: #456c47;
|
||||||
@ -18,6 +18,8 @@
|
|||||||
--substitution-background-addition: #476331;
|
--substitution-background-addition: #476331;
|
||||||
--substitution-background-deletion: #7d2b2d;
|
--substitution-background-deletion: #7d2b2d;
|
||||||
--substitution-background-unchanged: #26272a;
|
--substitution-background-unchanged: #26272a;
|
||||||
|
--timetable-trust-warning-border: #b71c1c;
|
||||||
|
--timetable-trust-warning-background: #412727;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
|
@ -26,10 +26,12 @@ defineProps({
|
|||||||
transition: all 0.8s;
|
transition: all 0.8s;
|
||||||
transition-delay: 0.2s;
|
transition-delay: 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container.active {
|
.container.active {
|
||||||
height: 100px;
|
height: 100px;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loader {
|
.loader {
|
||||||
width: 48px;
|
width: 48px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
@ -40,6 +42,7 @@ defineProps({
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
animation: rotation 1s linear infinite;
|
animation: rotation 1s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes rotation {
|
@keyframes rotation {
|
||||||
0% {
|
0% {
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
|
@ -58,10 +58,11 @@ a {
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
|
border-radius: 5px;
|
||||||
|
transition: background-color 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.router-link-active {
|
a.router-link-active {
|
||||||
background-color: var(--titlebar-element-active-color);
|
background-color: var(--titlebar-element-active-color);
|
||||||
border-radius: 5px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -110,10 +110,10 @@ export async function fetchData() {
|
|||||||
const checkResponse = await fetch(`${baseUrl}/check`);
|
const checkResponse = await fetch(`${baseUrl}/check`);
|
||||||
if (checkResponse.status != 200) router.push("/login");
|
if (checkResponse.status != 200) router.push("/login");
|
||||||
|
|
||||||
fetchClassList();
|
await fetchClassList();
|
||||||
fetchTimetable();
|
await fetchTimetable();
|
||||||
fetchSubstitutions();
|
await fetchSubstitutions();
|
||||||
fetchHistory();
|
await fetchHistory();
|
||||||
|
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ function getColor(type) {
|
|||||||
border-radius: 11px;
|
border-radius: 11px;
|
||||||
margin: 10px 0px;
|
margin: 10px 0px;
|
||||||
padding: 10px 10px;
|
padding: 10px 10px;
|
||||||
grid-template-columns: 40px auto;
|
grid-template-columns: min-content auto;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ const gitHash = GITVERSION;
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="settings">
|
<div class="settings">
|
||||||
|
<!-- Filtering -->
|
||||||
<h2>{{ $t("settings.heading.filtering") }}</h2>
|
<h2>{{ $t("settings.heading.filtering") }}</h2>
|
||||||
<p>{{ $t("settings.text.filtering") }}</p>
|
<p>{{ $t("settings.text.filtering") }}</p>
|
||||||
<select v-model="classFilter">
|
<select v-model="classFilter">
|
||||||
@ -23,6 +24,8 @@ const gitHash = GITVERSION;
|
|||||||
<option value="other">{{ $t("settings.other") }}</option>
|
<option value="other">{{ $t("settings.other") }}</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
|
|
||||||
|
<!-- Timetable Groups -->
|
||||||
<h2>{{ $t("settings.heading.timetableGroups") }}</h2>
|
<h2>{{ $t("settings.heading.timetableGroups") }}</h2>
|
||||||
<p>{{ $t("settings.text.timetableGroups") }}</p>
|
<p>{{ $t("settings.text.timetableGroups") }}</p>
|
||||||
<select v-model="timetableGroups" multiple>
|
<select v-model="timetableGroups" multiple>
|
||||||
@ -36,6 +39,8 @@ const gitHash = GITVERSION;
|
|||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
|
|
||||||
|
<!-- Language -->
|
||||||
<h2>{{ $t("settings.heading.language") }}</h2>
|
<h2>{{ $t("settings.heading.language") }}</h2>
|
||||||
<p>{{ $t("settings.text.language") }}</p>
|
<p>{{ $t("settings.text.language") }}</p>
|
||||||
<select v-model="language">
|
<select v-model="language">
|
||||||
@ -48,6 +53,8 @@ const gitHash = GITVERSION;
|
|||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
|
|
||||||
|
<!-- About -->
|
||||||
<h2>{{ $t("settings.heading.about") }}</h2>
|
<h2>{{ $t("settings.heading.about") }}</h2>
|
||||||
<p>{{ $t("settings.text.about") }}</p>
|
<p>{{ $t("settings.text.about") }}</p>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
@ -74,6 +81,12 @@ select {
|
|||||||
outline: none;
|
outline: none;
|
||||||
border: 2px solid var(--element-border-input);
|
border: 2px solid var(--element-border-input);
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
background-color: var(--element-color);
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
select:hover {
|
||||||
|
background-color: var(--element-color-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
select[multiple] {
|
select[multiple] {
|
||||||
|
@ -36,14 +36,10 @@ const substitutions = computed(() => {
|
|||||||
padding: 0px 10px 80px 10px;
|
padding: 0px 10px 80px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.substitution {
|
.substitution {
|
||||||
display: grid;
|
display: grid;
|
||||||
background-color: var(--substitution-background-unchanged);
|
background-color: var(--substitution-background-unchanged);
|
||||||
min-height: 35px;
|
min-height: 50px;
|
||||||
border-radius: 11px;
|
border-radius: 11px;
|
||||||
margin: 10px 0px;
|
margin: 10px 0px;
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
|
@ -12,11 +12,14 @@ import { getSubstitutionColor } from "../util";
|
|||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import TimetableSetup from "../components/initial-setup.vue";
|
import TimetableSetup from "../components/initial-setup.vue";
|
||||||
|
|
||||||
|
// Link the timetable with the substitutions
|
||||||
const linkedTimetable = computed(() => {
|
const linkedTimetable = computed(() => {
|
||||||
const currentDay = parsedTimetable.value[selectedDay.value];
|
const currentDay = parsedTimetable.value[selectedDay.value];
|
||||||
if (!currentDay) return [];
|
if (!currentDay) return [];
|
||||||
|
|
||||||
const newDay = currentDay.map((e, index) => {
|
const newDay = currentDay.map((e, index) => {
|
||||||
const newElement = { ...e };
|
const newElement = { ...e };
|
||||||
|
// Find a substitution mathing this lesson
|
||||||
newElement.substitution = substitutions.value.find((entry) => {
|
newElement.substitution = substitutions.value.find((entry) => {
|
||||||
const entryDay = new Date(entry.date).getTime();
|
const entryDay = new Date(entry.date).getTime();
|
||||||
return (
|
return (
|
||||||
@ -32,16 +35,14 @@ const linkedTimetable = computed(() => {
|
|||||||
|
|
||||||
function isChanged(lesson, key) {
|
function isChanged(lesson, key) {
|
||||||
const substitution = lesson.substitution;
|
const substitution = lesson.substitution;
|
||||||
if (!substitution) return false;
|
if (!(substitution && substitution.change)) return false;
|
||||||
if (!substitution.change) return false;
|
|
||||||
const changedKeys = Object.keys(substitution.change);
|
const changedKeys = Object.keys(substitution.change);
|
||||||
if (!changedKeys.includes(key)) return false;
|
if (!changedKeys.includes(key)) return false;
|
||||||
return lesson[key] != substitution.change[key];
|
return lesson[key] != substitution.change[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNotes(substitution) {
|
function getNotes(substitution) {
|
||||||
if (!substitution) return;
|
if (!(substitution && substitution.notes)) return;
|
||||||
if (!substitution.notes) return;
|
|
||||||
return substitution.notes;
|
return substitution.notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ function isCancelled(substitution) {
|
|||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<TimetableSetup
|
<TimetableSetup
|
||||||
v-show="!classFilter || classFilter == 'none'"
|
v-show="classFilter == 'none'"
|
||||||
:options="classList"
|
:options="classList"
|
||||||
v-model="classFilter"
|
v-model="classFilter"
|
||||||
/>
|
/>
|
||||||
@ -113,8 +114,8 @@ function isCancelled(substitution) {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
.trust-warning {
|
.trust-warning {
|
||||||
border: 1px solid #b71c1c;
|
border: 1px solid var(--timetable-trust-warning-border);
|
||||||
background-color: #412727;
|
background-color: var(--timetable-trust-warning-background);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 3px 10px;
|
padding: 3px 10px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
@ -127,7 +128,7 @@ function isCancelled(substitution) {
|
|||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
border-radius: 11px;
|
border-radius: 11px;
|
||||||
margin: 10px 0px;
|
margin: 10px 0px;
|
||||||
padding: 15px 15px;
|
padding: 15px;
|
||||||
grid-template-columns: max-content auto;
|
grid-template-columns: max-content auto;
|
||||||
gap: 15px;
|
gap: 15px;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user