Add prompt for selecting a class

This commit is contained in:
2022-07-06 18:35:42 +02:00
parent 14cf7f5f60
commit 9a5d7d5717
2 changed files with 102 additions and 0 deletions

View File

@ -0,0 +1,91 @@
<script setup>
import CalendarIcon from "./icons/calendar-icon.vue";
defineProps({
title: {
required: true,
type: String,
},
description: {
required: true,
type: String,
},
selectPrompt: {
required: true,
type: String,
},
options: {
required: true,
type: Array,
},
modelValue: {
type: String,
},
});
</script>
<template>
<div class="setup-wrapper">
<div class="content">
<CalendarIcon class="icon" />
<span class="title">{{ title }}</span>
<span class="description">{{ description }}</span>
<select
@input="(event) => $emit('update:modelValue', event.target.value)"
>
<option value="none">{{ selectPrompt }}</option>
<option v-for="option in options" :value="option" :key="option">
{{ option }}
</option>
</select>
</div>
</div>
</template>
<style scoped>
.setup-wrapper {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
width: max-content;
height: max-content;
max-width: 100%;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
gap: 3px;
max-width: 400px;
padding: 30px;
}
.icon {
width: 100px;
height: 100px;
stroke-width: 1px;
padding-bottom: 15px;
}
span {
word-wrap: normal;
text-align: center;
}
span.title {
font-weight: bold;
font-size: 18px;
}
span.description {
font-weight: 300;
}
select {
margin-top: 15px;
}
</style>

View File

@ -1,12 +1,15 @@
<script setup>
import {
parsedTimetable,
classFilter,
classList,
substitutions,
selectedDate,
selectedDay,
} from "../store";
import { getSubstitutionColor } from "../util";
import { computed } from "vue";
import TimetableSetup from "../components/initial-setup.vue";
const timetable = computed(() => {
const currentDay = parsedTimetable.value[selectedDay.value];
@ -47,6 +50,14 @@ function isCancelled(substitution) {
}
</script>
<template>
<TimetableSetup
v-show="!classFilter || classFilter == 'none'"
title="No Class Selected"
description="Please select your class so you can view your timetable and only see substitutions that affect you. You can change this later in the settings."
selectPrompt="Select a class"
:options="classList"
v-model="classFilter"
/>
<div class="timetable">
<template v-for="(lesson, index) in timetable" :key="index">
<div class="lesson" :style="getSubstitutionColor(lesson.substitution)">