style: responsive
This commit is contained in:
parent
eba7033226
commit
4bc9d29de7
2 changed files with 110 additions and 51 deletions
|
@ -1,7 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import authState from "@/services/auth/auth-service.ts";
|
import authState from "@/services/auth/auth-service.ts";
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref, watchEffect } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import type { ClassResponse } from "@/controllers/classes";
|
import type { ClassResponse } from "@/controllers/classes";
|
||||||
import type { JoinRequestsResponse, StudentsResponse } from "@/controllers/students";
|
import type { JoinRequestsResponse, StudentsResponse } from "@/controllers/students";
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
import { useClassDeleteStudentMutation, useClassQuery, useClassStudentsQuery } from "@/queries/classes";
|
import { useClassDeleteStudentMutation, useClassQuery, useClassStudentsQuery } from "@/queries/classes";
|
||||||
import { useCreateTeacherInvitationMutation } from "@/queries/teacher-invitations";
|
import { useCreateTeacherInvitationMutation } from "@/queries/teacher-invitations";
|
||||||
import type { TeacherInvitationData } from "@dwengo-1/common/interfaces/teacher-invitation";
|
import type { TeacherInvitationData } from "@dwengo-1/common/interfaces/teacher-invitation";
|
||||||
|
import { useDisplay } from "vuetify";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -142,6 +143,28 @@
|
||||||
snackbar.value.color = color;
|
snackbar.value.color = color;
|
||||||
snackbar.value.visible = true;
|
snackbar.value.visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Custom breakpoints
|
||||||
|
const customBreakpoints = {
|
||||||
|
xs: 0,
|
||||||
|
sm: 500,
|
||||||
|
md: 1370,
|
||||||
|
lg: 1400,
|
||||||
|
xl: 1600,
|
||||||
|
};
|
||||||
|
|
||||||
|
// logic for small screens
|
||||||
|
const display = useDisplay();
|
||||||
|
|
||||||
|
// Reactive variables to hold custom logic based on breakpoints
|
||||||
|
const isSmAndDown = ref(false);
|
||||||
|
const isMdAndDown = ref(false);
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
// Custom breakpoint logic
|
||||||
|
isSmAndDown.value = display.width.value < customBreakpoints.sm;
|
||||||
|
isMdAndDown.value = display.width.value < customBreakpoints.md;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<main>
|
<main>
|
||||||
|
@ -228,6 +251,7 @@
|
||||||
{{ jr.requester.firstName + " " + jr.requester.lastName }}
|
{{ jr.requester.firstName + " " + jr.requester.lastName }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<span v-if="!isSmAndDown && !isMdAndDown">
|
||||||
<v-btn
|
<v-btn
|
||||||
@click="handleJoinRequest(jr, true)"
|
@click="handleJoinRequest(jr, true)"
|
||||||
class="mr-2"
|
class="mr-2"
|
||||||
|
@ -243,6 +267,12 @@
|
||||||
>
|
>
|
||||||
{{ t("reject") }}
|
{{ t("reject") }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
</span>
|
||||||
|
<span v-else>
|
||||||
|
<v-btn @click="handleJoinRequest(jr, true)" icon="mdi-check-circle" class="mr-2" color="green" variant="text"></v-btn>
|
||||||
|
<v-btn @click="handleJoinRequest(jr, false)" icon="mdi-close-circle" class="mr-2" color="red" variant="text"></v-btn>
|
||||||
|
</span>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -152,10 +152,12 @@
|
||||||
|
|
||||||
// Reactive variables to hold custom logic based on breakpoints
|
// Reactive variables to hold custom logic based on breakpoints
|
||||||
const isMdAndDown = ref(false);
|
const isMdAndDown = ref(false);
|
||||||
|
const isSmAndDown = ref(false);
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
// Custom breakpoint logic
|
// Custom breakpoint logic
|
||||||
isMdAndDown.value = display.width.value < customBreakpoints.md;
|
isMdAndDown.value = display.width.value < customBreakpoints.md;
|
||||||
|
isSmAndDown.value = display.width.value < customBreakpoints.sm;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Code display dialog logic
|
// Code display dialog logic
|
||||||
|
@ -320,13 +322,16 @@
|
||||||
<h1 class="title">
|
<h1 class="title">
|
||||||
{{ t("invitations") }}
|
{{ t("invitations") }}
|
||||||
</h1>
|
</h1>
|
||||||
<v-container fluid class="ma-4">
|
<v-container
|
||||||
|
fluid
|
||||||
|
class="ma-4"
|
||||||
|
>
|
||||||
<v-table class="table">
|
<v-table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="header">{{ t("class") }}</th>
|
<th class="header">{{ t("class") }}</th>
|
||||||
<th class="header">{{ t("sender") }}</th>
|
<th class="header">{{ t("sender") }}</th>
|
||||||
<th class="header"></th>
|
<th class="header">{{ t("accept") + "/" + t("reject") }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -344,14 +349,18 @@
|
||||||
>
|
>
|
||||||
<td>
|
<td>
|
||||||
{{
|
{{
|
||||||
(classesResponse.data.classes as ClassDTO[]).filter((c) => c.id == i.classId)[0]
|
(classesResponse.data.classes as ClassDTO[]).filter(
|
||||||
.displayName
|
(c) => c.id == i.classId,
|
||||||
|
)[0].displayName
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ (i.sender as TeacherDTO).firstName + " " + (i.sender as TeacherDTO).lastName }}
|
{{
|
||||||
|
(i.sender as TeacherDTO).firstName + " " + (i.sender as TeacherDTO).lastName
|
||||||
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
|
<span v-if="!isSmAndDown">
|
||||||
<div>
|
<div>
|
||||||
<v-btn
|
<v-btn
|
||||||
color="green"
|
color="green"
|
||||||
|
@ -367,6 +376,26 @@
|
||||||
{{ t("deny") }}
|
{{ t("deny") }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</div>
|
</div>
|
||||||
|
</span>
|
||||||
|
<span v-else>
|
||||||
|
<div>
|
||||||
|
<v-btn
|
||||||
|
@click="handleInvitation(i, true)"
|
||||||
|
class="mr-2"
|
||||||
|
icon="mdi-check-circle"
|
||||||
|
color="green"
|
||||||
|
variant="text"
|
||||||
|
>
|
||||||
|
</v-btn>
|
||||||
|
<v-btn
|
||||||
|
@click="handleInvitation(i, false)"
|
||||||
|
class="mr-2"
|
||||||
|
icon="mdi-close-circle"
|
||||||
|
color="red"
|
||||||
|
variant="text"
|
||||||
|
>
|
||||||
|
</v-btn></div
|
||||||
|
></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</using-query-result>
|
</using-query-result>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue