mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-07 04:09:17 +02:00
fix:#3 linted formatted
This commit is contained in:
@@ -478,7 +478,8 @@ $highlightFocusBg: rgba($primaryColor, 0.24) !default;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fc-event-selected::after, .fc-event:focus::after {
|
.fc-event-selected::after,
|
||||||
|
.fc-event:focus::after {
|
||||||
background: var(--fc-event-selected-overlay-color);
|
background: var(--fc-event-selected-overlay-color);
|
||||||
inset: -1px;
|
inset: -1px;
|
||||||
content: "";
|
content: "";
|
||||||
|
@@ -488,7 +488,8 @@ $highlightFocusBg: rgba($primaryColor, 0.24) !default;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fc-event-selected::after, .fc-event:focus::after {
|
.fc-event-selected::after,
|
||||||
|
.fc-event:focus::after {
|
||||||
background: var(--fc-event-selected-overlay-color);
|
background: var(--fc-event-selected-overlay-color);
|
||||||
inset: -1px;
|
inset: -1px;
|
||||||
content: "";
|
content: "";
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -37,7 +37,7 @@ const disabledPages = [
|
|||||||
"edit-calendar",
|
"edit-calendar",
|
||||||
"rooms",
|
"rooms",
|
||||||
"free-rooms",
|
"free-rooms",
|
||||||
"room-schedule"
|
"room-schedule",
|
||||||
];
|
];
|
||||||
|
|
||||||
const store = moduleStore();
|
const store = moduleStore();
|
||||||
@@ -60,10 +60,15 @@ const emit = defineEmits(["dark-mode-toggled"]);
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// set theme matching browser preference
|
// set theme matching browser preference
|
||||||
settings().setDarkMode(window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches)
|
settings().setDarkMode(
|
||||||
|
window.matchMedia &&
|
||||||
|
window.matchMedia("(prefers-color-scheme: dark)").matches,
|
||||||
|
);
|
||||||
setTheme(settings, primeVue, emit);
|
setTheme(settings, primeVue, emit);
|
||||||
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) => {
|
window
|
||||||
settings().setDarkMode(e.matches)
|
.matchMedia("(prefers-color-scheme: dark)")
|
||||||
|
.addEventListener("change", (e) => {
|
||||||
|
settings().setDarkMode(e.matches);
|
||||||
setTheme(settings, primeVue, emit);
|
setTheme(settings, primeVue, emit);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -16,7 +16,26 @@
|
|||||||
|
|
||||||
import { BSON } from "bson";
|
import { BSON } from "bson";
|
||||||
import { RoomOccupancyList } from "@/model/roomOccupancyList.ts";
|
import { RoomOccupancyList } from "@/model/roomOccupancyList.ts";
|
||||||
import { Duration, NormalizedInterval, add, addDays, addMinutes, addMonths, clamp, differenceInMinutes, eachDayOfInterval, endOfDay, interval, isAfter, isBefore, isEqual, max, min, startOfDay, subDays } from "date-fns";
|
import {
|
||||||
|
Duration,
|
||||||
|
NormalizedInterval,
|
||||||
|
add,
|
||||||
|
addDays,
|
||||||
|
addMinutes,
|
||||||
|
addMonths,
|
||||||
|
clamp,
|
||||||
|
differenceInMinutes,
|
||||||
|
eachDayOfInterval,
|
||||||
|
endOfDay,
|
||||||
|
interval,
|
||||||
|
isAfter,
|
||||||
|
isBefore,
|
||||||
|
isEqual,
|
||||||
|
max,
|
||||||
|
min,
|
||||||
|
startOfDay,
|
||||||
|
subDays,
|
||||||
|
} from "date-fns";
|
||||||
import { formatYearMonthDay } from "@/helpers/dates";
|
import { formatYearMonthDay } from "@/helpers/dates";
|
||||||
|
|
||||||
const END_OF_SUMMER_SEMESTER = "0930";
|
const END_OF_SUMMER_SEMESTER = "0930";
|
||||||
@@ -66,7 +85,7 @@ export function getSemesterStart(date: Date): Date {
|
|||||||
|
|
||||||
export async function fetchRoomOccupancy(
|
export async function fetchRoomOccupancy(
|
||||||
from_date?: string,
|
from_date?: string,
|
||||||
to_date?: string
|
to_date?: string,
|
||||||
): Promise<RoomOccupancyList> {
|
): Promise<RoomOccupancyList> {
|
||||||
if (from_date == undefined) {
|
if (from_date == undefined) {
|
||||||
let new_from_date = getSemesterStart(new Date());
|
let new_from_date = getSemesterStart(new Date());
|
||||||
|
@@ -71,7 +71,6 @@ const toggle = (info: EventClickArg) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const selectedToken = computed(() => {
|
const selectedToken = computed(() => {
|
||||||
return props.token;
|
return props.token;
|
||||||
});
|
});
|
||||||
@@ -89,7 +88,7 @@ const { data: calendar} = useQuery({
|
|||||||
refetchOnWindowFocus: "always",
|
refetchOnWindowFocus: "always",
|
||||||
refetchOnReconnect: "always",
|
refetchOnReconnect: "always",
|
||||||
networkMode: "offlineFirst",
|
networkMode: "offlineFirst",
|
||||||
enabled: () => tokenStore().token !== ""
|
enabled: () => tokenStore().token !== "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@@ -103,7 +102,7 @@ const invalidateAndRefetchCalendar = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
invalidateAndRefetchCalendar
|
invalidateAndRefetchCalendar,
|
||||||
});
|
});
|
||||||
|
|
||||||
const events = computed(() => {
|
const events = computed(() => {
|
||||||
|
@@ -29,7 +29,6 @@ const emit = defineEmits(["dark-mode-toggled"]);
|
|||||||
const store = settingsStore;
|
const store = settingsStore;
|
||||||
|
|
||||||
const isDark = computed(() => store().isDark);
|
const isDark = computed(() => store().isDark);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@@ -20,10 +20,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
import { computed, ComputedRef, ref } from "vue";
|
import { computed, ComputedRef, ref } from "vue";
|
||||||
import settingsStore from "../store/settingsStore.ts";
|
import settingsStore from "../store/settingsStore.ts";
|
||||||
|
|
||||||
const pageOptions: ComputedRef<(string | {
|
const pageOptions: ComputedRef<
|
||||||
|
(
|
||||||
|
| string
|
||||||
|
| {
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
})[]> = computed(() => [...settingsStore().getDefaultPageOptions()]);
|
}
|
||||||
|
)[]
|
||||||
|
> = computed(() => [...settingsStore().getDefaultPageOptions()]);
|
||||||
|
|
||||||
const selectedPage = ref(settingsStore().defaultPage);
|
const selectedPage = ref(settingsStore().defaultPage);
|
||||||
|
|
||||||
|
@@ -21,8 +21,6 @@ import { computed } from "vue";
|
|||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
const { t } = useI18n({ useScope: "global" });
|
const { t } = useI18n({ useScope: "global" });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const items = computed(() => [
|
const items = computed(() => [
|
||||||
{
|
{
|
||||||
label: t("calendar"),
|
label: t("calendar"),
|
||||||
@@ -133,7 +131,15 @@ const items = computed(() => [
|
|||||||
<div class="flex align-items-stretch justify-content-center">
|
<div class="flex align-items-stretch justify-content-center">
|
||||||
<!-- Settings Button with Gear Icon -->
|
<!-- Settings Button with Gear Icon -->
|
||||||
<router-link v-slot="{ navigate }" :to="`/settings`" custom>
|
<router-link v-slot="{ navigate }" :to="`/settings`" custom>
|
||||||
<Button icon="pi pi-cog" severity="secondary" rounded text size="large" aria-label="Settings" @click="navigate" />
|
<Button
|
||||||
|
icon="pi pi-cog"
|
||||||
|
severity="secondary"
|
||||||
|
rounded
|
||||||
|
text
|
||||||
|
size="large"
|
||||||
|
aria-label="Settings"
|
||||||
|
@click="navigate"
|
||||||
|
/>
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -93,8 +93,7 @@ function transformData(data: RoomOccupancyList) {
|
|||||||
|
|
||||||
const { data: occupancy } = useQuery({
|
const { data: occupancy } = useQuery({
|
||||||
queryKey: ["roomOccupancy"], //, selectedRoom, currentDateFrom, currentDateTo],
|
queryKey: ["roomOccupancy"], //, selectedRoom, currentDateFrom, currentDateTo],
|
||||||
queryFn: () =>
|
queryFn: () => fetchRoomOccupancy(),
|
||||||
fetchRoomOccupancy(),
|
|
||||||
staleTime: 12 * 3600000, // 12 hours
|
staleTime: 12 * 3600000, // 12 hours
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -192,9 +191,7 @@ const calendarOptions: ComputedRef<CalendarOptions> = computed(() => ({
|
|||||||
color: event.event.free
|
color: event.event.free
|
||||||
? "var(--htwk-gruen-500)"
|
? "var(--htwk-gruen-500)"
|
||||||
: "var(--htwk-grau-60-500)",
|
: "var(--htwk-grau-60-500)",
|
||||||
textColor: event.event.free
|
textColor: event.event.free ? "var(--green-50)" : "white",
|
||||||
? "var(--green-50)"
|
|
||||||
: "white",
|
|
||||||
title: event.event.stub
|
title: event.event.stub
|
||||||
? t("roomFinderPage.stub")
|
? t("roomFinderPage.stub")
|
||||||
: event.event.free
|
: event.event.free
|
||||||
|
@@ -41,10 +41,13 @@ export function parseICalData(
|
|||||||
const jCalData = ICAL.parse(icalData);
|
const jCalData = ICAL.parse(icalData);
|
||||||
const comp = new ICAL.Component(jCalData);
|
const comp = new ICAL.Component(jCalData);
|
||||||
const vEvents = comp.getAllSubcomponents("vevent");
|
const vEvents = comp.getAllSubcomponents("vevent");
|
||||||
const events: CalendarComponent[] = vEvents.map((vevent: CalendarComponent) => {
|
const events: CalendarComponent[] = vEvents.map(
|
||||||
|
(vevent: CalendarComponent) => {
|
||||||
return new ICAL.Event(vevent);
|
return new ICAL.Event(vevent);
|
||||||
});
|
},
|
||||||
const colorDistinctionEvents: ColorDistinctionEvent[] = extractedColorizedEvents(events);
|
);
|
||||||
|
const colorDistinctionEvents: ColorDistinctionEvent[] =
|
||||||
|
extractedColorizedEvents(events);
|
||||||
|
|
||||||
return vEvents.map((vevent: CalendarComponent) => {
|
return vEvents.map((vevent: CalendarComponent) => {
|
||||||
const event = new ICAL.Event(vevent);
|
const event = new ICAL.Event(vevent);
|
||||||
|
@@ -36,7 +36,7 @@ export function toggleTheme(
|
|||||||
export function setTheme(
|
export function setTheme(
|
||||||
store: SettingsStore,
|
store: SettingsStore,
|
||||||
{ changeTheme }: { changeTheme: PrimeVueChangeTheme },
|
{ changeTheme }: { changeTheme: PrimeVueChangeTheme },
|
||||||
emit: EmitFn<"dark-mode-toggled"[]>
|
emit: EmitFn<"dark-mode-toggled"[]>,
|
||||||
) {
|
) {
|
||||||
const isDark = ref(store().isDark);
|
const isDark = ref(store().isDark);
|
||||||
const newTheme = isDark.value ? darkTheme.value : lightTheme.value,
|
const newTheme = isDark.value ? darkTheme.value : lightTheme.value,
|
||||||
|
@@ -70,10 +70,10 @@ app.use(VueQueryPlugin, {
|
|||||||
queryClientConfig: {
|
queryClientConfig: {
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
queries: {
|
queries: {
|
||||||
refetchOnWindowFocus: false
|
refetchOnWindowFocus: false,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(PrimeVue);
|
app.use(PrimeVue);
|
||||||
|
@@ -93,10 +93,16 @@ export class RoomOccupancyList {
|
|||||||
const roomOccupancy = this.rooms.find((r) => r.name === room);
|
const roomOccupancy = this.rooms.find((r) => r.name === room);
|
||||||
|
|
||||||
// Get start and end of decoded time range (within encoded list and requested range)
|
// Get start and end of decoded time range (within encoded list and requested range)
|
||||||
let decodeInterval = interval(clamp(from, this.getOccupancyInterval()), clamp(to, this.getOccupancyInterval()));
|
let decodeInterval = interval(
|
||||||
|
clamp(from, this.getOccupancyInterval()),
|
||||||
|
clamp(to, this.getOccupancyInterval()),
|
||||||
|
);
|
||||||
|
|
||||||
// if the room is not in the list or the time range is empty, return stub events
|
// if the room is not in the list or the time range is empty, return stub events
|
||||||
if (roomOccupancy === undefined || isEqual(decodeInterval.start, decodeInterval.end)) {
|
if (
|
||||||
|
roomOccupancy === undefined ||
|
||||||
|
isEqual(decodeInterval.start, decodeInterval.end)
|
||||||
|
) {
|
||||||
return RoomOccupancyList.generateStubEvents(room, from, to);
|
return RoomOccupancyList.generateStubEvents(room, from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,7 +35,6 @@ const NotFound = () => import("../view/NotFound.vue");
|
|||||||
import i18n from "../i18n";
|
import i18n from "../i18n";
|
||||||
import settingsStore from "@/store/settingsStore.ts";
|
import settingsStore from "@/store/settingsStore.ts";
|
||||||
|
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
routes: [
|
routes: [
|
||||||
|
@@ -23,7 +23,10 @@ const settingsStore = defineStore("settingsStore", {
|
|||||||
return {
|
return {
|
||||||
locale: useLocalStorage("locale", "en"), //useLocalStorage takes in a key of 'count' and default value of 0
|
locale: useLocalStorage("locale", "en"), //useLocalStorage takes in a key of 'count' and default value of 0
|
||||||
isDark: true,
|
isDark: true,
|
||||||
defaultPage: useLocalStorage("defaultPage", {label: "Home", value: "/home"}),
|
defaultPage: useLocalStorage("defaultPage", {
|
||||||
|
label: "Home",
|
||||||
|
value: "/home",
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@@ -36,10 +39,7 @@ const settingsStore = defineStore("settingsStore", {
|
|||||||
getDarkMode(): boolean {
|
getDarkMode(): boolean {
|
||||||
return this.isDark;
|
return this.isDark;
|
||||||
},
|
},
|
||||||
setDefaultPage(page: {
|
setDefaultPage(page: { label: string; value: string }) {
|
||||||
label: string;
|
|
||||||
value: string;
|
|
||||||
}) {
|
|
||||||
this.defaultPage = page;
|
this.defaultPage = page;
|
||||||
},
|
},
|
||||||
getDefaultPageOptions(): {
|
getDefaultPageOptions(): {
|
||||||
|
@@ -11,6 +11,4 @@ import DynamicPage from "@/view/DynamicPage.vue";
|
|||||||
</DynamicPage>
|
</DynamicPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
|
||||||
import LocaleSwitcher from "@/components/LocaleSwitcher.vue";
|
import LocaleSwitcher from "@/components/LocaleSwitcher.vue";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import DarkModeSwitcher from "@/components/DarkModeSwitcher.vue";
|
import DarkModeSwitcher from "@/components/DarkModeSwitcher.vue";
|
||||||
@@ -14,7 +13,6 @@ function handleDarkModeToggled(isDarkVar: boolean) {
|
|||||||
// Assuming the root component has an isDark ref
|
// Assuming the root component has an isDark ref
|
||||||
isDark.value = isDarkVar;
|
isDark.value = isDarkVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -68,11 +66,9 @@ class="opacity-100 transition-all transition-duration-500 transition-ease-in-out
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.col {
|
.col {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
@@ -77,7 +77,7 @@ onMounted(() => {
|
|||||||
></Button>
|
></Button>
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<CalendarViewer :token="tokenStore().token" ref="calendarViewerRef" />
|
<CalendarViewer ref="calendarViewerRef" :token="tokenStore().token" />
|
||||||
</template>
|
</template>
|
||||||
</DynamicPage>
|
</DynamicPage>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -86,11 +86,11 @@ export default defineConfig({
|
|||||||
cleanupOutdatedCaches: true,
|
cleanupOutdatedCaches: true,
|
||||||
runtimeCaching: [
|
runtimeCaching: [
|
||||||
{
|
{
|
||||||
urlPattern: ({ url }) => url.pathname.startsWith('/api/feed'),
|
urlPattern: ({ url }) => url.pathname.startsWith("/api/feed"),
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
handler: 'NetworkFirst',
|
handler: "NetworkFirst",
|
||||||
options: {
|
options: {
|
||||||
cacheName: 'calendar-feed-cache',
|
cacheName: "calendar-feed-cache",
|
||||||
expiration: {
|
expiration: {
|
||||||
maxAgeSeconds: 12 * 60 * 60, // 12 hours
|
maxAgeSeconds: 12 * 60 * 60, // 12 hours
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user