style: fix linting issues met Prettier
This commit is contained in:
		
							parent
							
								
									5893933d4b
								
							
						
					
					
						commit
						e348e1198b
					
				
					 3 changed files with 323 additions and 300 deletions
				
			
		|  | @ -24,8 +24,12 @@ router.get('/testTeachersOnly', teachersOnly, (_req, res) => { | ||||||
| 
 | 
 | ||||||
| // This endpoint is called by the client when the user has just logged in.
 | // This endpoint is called by the client when the user has just logged in.
 | ||||||
| // It creates or updates the user entity based on the authentication data the endpoint was called with.
 | // It creates or updates the user entity based on the authentication data the endpoint was called with.
 | ||||||
| router.post('/hello', authenticatedOnly, /* | router.post( | ||||||
|  |     '/hello', | ||||||
|  |     authenticatedOnly, | ||||||
|  |     /* | ||||||
|     #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] |     #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] | ||||||
| */ postHelloHandler ); | */ postHelloHandler | ||||||
|  | ); | ||||||
| 
 | 
 | ||||||
| export default router; | export default router; | ||||||
|  |  | ||||||
|  | @ -19,11 +19,29 @@ router.get('/', (_, res: Response) => { | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| router.use('/auth', authRouter /* #swagger.tags = ['Auth'] */); | router.use('/auth', authRouter /* #swagger.tags = ['Auth'] */); | ||||||
| router.use('/class', classRouter /* #swagger.tags = ['Class'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */); | router.use( | ||||||
| router.use('/learningObject', learningObjectRoutes /* #swagger.tags = ['Learning Object'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */); |     '/class', | ||||||
| router.use('/learningPath', learningPathRoutes /* #swagger.tags = ['Learning Path'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */); |     classRouter /* #swagger.tags = ['Class'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */ | ||||||
| router.use('/student', studentRouter /* #swagger.tags = ['Student'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */); | ); | ||||||
| router.use('/teacher', teacherRouter /* #swagger.tags = ['Teacher'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */); | router.use( | ||||||
| router.use('/theme', themeRoutes /* #swagger.tags = ['Theme'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */); |     '/learningObject', | ||||||
|  |     learningObjectRoutes /* #swagger.tags = ['Learning Object'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */ | ||||||
|  | ); | ||||||
|  | router.use( | ||||||
|  |     '/learningPath', | ||||||
|  |     learningPathRoutes /* #swagger.tags = ['Learning Path'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */ | ||||||
|  | ); | ||||||
|  | router.use( | ||||||
|  |     '/student', | ||||||
|  |     studentRouter /* #swagger.tags = ['Student'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */ | ||||||
|  | ); | ||||||
|  | router.use( | ||||||
|  |     '/teacher', | ||||||
|  |     teacherRouter /* #swagger.tags = ['Teacher'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */ | ||||||
|  | ); | ||||||
|  | router.use( | ||||||
|  |     '/theme', | ||||||
|  |     themeRoutes /* #swagger.tags = ['Theme'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */ | ||||||
|  | ); | ||||||
| 
 | 
 | ||||||
| export default router; | export default router; | ||||||
|  |  | ||||||
|  | @ -1,180 +1,180 @@ | ||||||
| <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, watchEffect } from 'vue'; |     import { onMounted, ref, watchEffect } from "vue"; | ||||||
| import type { TeacherDTO } from '@dwengo-1/common/interfaces/teacher'; |     import type { TeacherDTO } from "@dwengo-1/common/interfaces/teacher"; | ||||||
| import type { ClassDTO } from '@dwengo-1/common/interfaces/class'; |     import type { ClassDTO } from "@dwengo-1/common/interfaces/class"; | ||||||
| import type { TeacherInvitationData, TeacherInvitationDTO } from '@dwengo-1/common/interfaces/teacher-invitation'; |     import type { TeacherInvitationData, TeacherInvitationDTO } from "@dwengo-1/common/interfaces/teacher-invitation"; | ||||||
| import { useTeacherClassesQuery } from '@/queries/teachers'; |     import { useTeacherClassesQuery } from "@/queries/teachers"; | ||||||
| import type { ClassesResponse } from '@/controllers/classes'; |     import type { ClassesResponse } from "@/controllers/classes"; | ||||||
| import UsingQueryResult from '@/components/UsingQueryResult.vue'; |     import UsingQueryResult from "@/components/UsingQueryResult.vue"; | ||||||
| import { useCreateClassMutation } from '@/queries/classes'; |     import { useCreateClassMutation } from "@/queries/classes"; | ||||||
| import type { TeacherInvitationsResponse } from '@/controllers/teacher-invitations'; |     import type { TeacherInvitationsResponse } from "@/controllers/teacher-invitations"; | ||||||
| import { |     import { | ||||||
|     useRespondTeacherInvitationMutation, |         useRespondTeacherInvitationMutation, | ||||||
|     useTeacherInvitationsReceivedQuery, |         useTeacherInvitationsReceivedQuery, | ||||||
| } from '@/queries/teacher-invitations'; |     } from "@/queries/teacher-invitations"; | ||||||
| import { useDisplay } from 'vuetify'; |     import { useDisplay } from "vuetify"; | ||||||
| import '../../assets/common.css'; |     import "../../assets/common.css"; | ||||||
| import ClassDisplay from '@/views/classes/ClassDisplay.vue'; |     import ClassDisplay from "@/views/classes/ClassDisplay.vue"; | ||||||
| 
 | 
 | ||||||
| const { t } = useI18n(); |     const { t } = useI18n(); | ||||||
| 
 | 
 | ||||||
| // Username of logged in teacher |     // Username of logged in teacher | ||||||
| const username = ref<string | undefined>(undefined); |     const username = ref<string | undefined>(undefined); | ||||||
| const isLoading = ref(false); |     const isLoading = ref(false); | ||||||
| const isError = ref(false); |     const isError = ref(false); | ||||||
| const errorMessage = ref<string>(''); |     const errorMessage = ref<string>(""); | ||||||
| 
 | 
 | ||||||
| // Load current user before rendering the page |     // Load current user before rendering the page | ||||||
| onMounted(async () => { |     onMounted(async () => { | ||||||
|     isLoading.value = true; |         isLoading.value = true; | ||||||
|     try { |         try { | ||||||
|         const userObject = await authState.loadUser(); |             const userObject = await authState.loadUser(); | ||||||
|         username.value = userObject!.profile.preferred_username; |             username.value = userObject!.profile.preferred_username; | ||||||
|     } catch (error) { |         } catch (error) { | ||||||
|         isError.value = true; |             isError.value = true; | ||||||
|         errorMessage.value = error instanceof Error ? error.message : String(error); |             errorMessage.value = error instanceof Error ? error.message : String(error); | ||||||
|     } finally { |         } finally { | ||||||
|         isLoading.value = false; |             isLoading.value = false; | ||||||
|     } |         } | ||||||
| }); |  | ||||||
| 
 |  | ||||||
| // Fetch all classes of the logged in teacher |  | ||||||
| const classesQuery = useTeacherClassesQuery(username, true); |  | ||||||
| const { mutate } = useCreateClassMutation(); |  | ||||||
| const getInvitationsQuery = useTeacherInvitationsReceivedQuery(username); |  | ||||||
| const { mutate: respondToInvitation } = useRespondTeacherInvitationMutation(); |  | ||||||
| 
 |  | ||||||
| // Boolean that handles visibility for dialogs |  | ||||||
| // Creating a class will generate a popup with the generated code |  | ||||||
| const dialog = ref(false); |  | ||||||
| 
 |  | ||||||
| // Code generated when new class was created |  | ||||||
| const code = ref<string>(''); |  | ||||||
| 
 |  | ||||||
| // Function to handle an invitation request |  | ||||||
| function handleInvitation(ti: TeacherInvitationDTO, accepted: boolean): void { |  | ||||||
|     const data: TeacherInvitationData = { |  | ||||||
|         sender: (ti.sender as TeacherDTO).id, |  | ||||||
|         receiver: (ti.receiver as TeacherDTO).id, |  | ||||||
|         class: ti.classId, |  | ||||||
|         accepted: accepted, |  | ||||||
|     }; |  | ||||||
|     respondToInvitation(data, { |  | ||||||
|         onSuccess: async () => { |  | ||||||
|             if (accepted) { |  | ||||||
|                 await classesQuery.refetch(); |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             await getInvitationsQuery.refetch(); |  | ||||||
|         }, |  | ||||||
|         onError: (e) => { |  | ||||||
|             showSnackbar(t('failed') + ': ' + e.response.data.error || e.message, 'error'); |  | ||||||
|         }, |  | ||||||
|     }); |     }); | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| // Teacher should be able to set a displayname when making a class |     // Fetch all classes of the logged in teacher | ||||||
| const className = ref<string>(''); |     const classesQuery = useTeacherClassesQuery(username, true); | ||||||
|  |     const { mutate } = useCreateClassMutation(); | ||||||
|  |     const getInvitationsQuery = useTeacherInvitationsReceivedQuery(username); | ||||||
|  |     const { mutate: respondToInvitation } = useRespondTeacherInvitationMutation(); | ||||||
| 
 | 
 | ||||||
| // The name can only contain dash, underscore letters and numbers |     // Boolean that handles visibility for dialogs | ||||||
| // These rules are used to display a message to the user if the name is not valid |     // Creating a class will generate a popup with the generated code | ||||||
| const nameRules = [ |     const dialog = ref(false); | ||||||
|     (value: string | undefined): string | boolean => { |  | ||||||
|         if (!value) return true; |  | ||||||
|         if (value && /^[a-zA-Z0-9_-]+$/.test(value)) return true; |  | ||||||
|         return t('onlyUse'); |  | ||||||
|     }, |  | ||||||
| ]; |  | ||||||
| 
 | 
 | ||||||
| // Function called when a teacher creates a class |     // Code generated when new class was created | ||||||
| async function createClass(): Promise<void> { |     const code = ref<string>(""); | ||||||
|     // Check if the class name is valid | 
 | ||||||
|     if (className.value && className.value.length > 0 && /^[a-zA-Z0-9_-]+$/.test(className.value)) { |     // Function to handle an invitation request | ||||||
|         const classDto: ClassDTO = { |     function handleInvitation(ti: TeacherInvitationDTO, accepted: boolean): void { | ||||||
|             id: '', |         const data: TeacherInvitationData = { | ||||||
|             displayName: className.value, |             sender: (ti.sender as TeacherDTO).id, | ||||||
|             teachers: [username.value!], |             receiver: (ti.receiver as TeacherDTO).id, | ||||||
|             students: [], |             class: ti.classId, | ||||||
|  |             accepted: accepted, | ||||||
|         }; |         }; | ||||||
|  |         respondToInvitation(data, { | ||||||
|  |             onSuccess: async () => { | ||||||
|  |                 if (accepted) { | ||||||
|  |                     await classesQuery.refetch(); | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|         mutate(classDto, { |                 await getInvitationsQuery.refetch(); | ||||||
|             onSuccess: async (classResponse) => { |  | ||||||
|                 showSnackbar(t('classCreated'), 'success'); |  | ||||||
|                 const createdClass: ClassDTO = classResponse.class; |  | ||||||
|                 code.value = createdClass.id; |  | ||||||
|                 await classesQuery.refetch(); |  | ||||||
|             }, |             }, | ||||||
|             onError: (err) => { |             onError: (e) => { | ||||||
|                 showSnackbar(t('creationFailed') + ': ' + err.message, 'error'); |                 showSnackbar(t("failed") + ": " + e.response.data.error || e.message, "error"); | ||||||
|             }, |             }, | ||||||
|         }); |         }); | ||||||
|         dialog.value = true; |  | ||||||
|     } |     } | ||||||
|     if (!className.value || className.value === '') { | 
 | ||||||
|         showSnackbar(t('nameIsMandatory'), 'error'); |     // Teacher should be able to set a displayname when making a class | ||||||
|  |     const className = ref<string>(""); | ||||||
|  | 
 | ||||||
|  |     // The name can only contain dash, underscore letters and numbers | ||||||
|  |     // These rules are used to display a message to the user if the name is not valid | ||||||
|  |     const nameRules = [ | ||||||
|  |         (value: string | undefined): string | boolean => { | ||||||
|  |             if (!value) return true; | ||||||
|  |             if (value && /^[a-zA-Z0-9_-]+$/.test(value)) return true; | ||||||
|  |             return t("onlyUse"); | ||||||
|  |         }, | ||||||
|  |     ]; | ||||||
|  | 
 | ||||||
|  |     // Function called when a teacher creates a class | ||||||
|  |     async function createClass(): Promise<void> { | ||||||
|  |         // Check if the class name is valid | ||||||
|  |         if (className.value && className.value.length > 0 && /^[a-zA-Z0-9_-]+$/.test(className.value)) { | ||||||
|  |             const classDto: ClassDTO = { | ||||||
|  |                 id: "", | ||||||
|  |                 displayName: className.value, | ||||||
|  |                 teachers: [username.value!], | ||||||
|  |                 students: [], | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             mutate(classDto, { | ||||||
|  |                 onSuccess: async (classResponse) => { | ||||||
|  |                     showSnackbar(t("classCreated"), "success"); | ||||||
|  |                     const createdClass: ClassDTO = classResponse.class; | ||||||
|  |                     code.value = createdClass.id; | ||||||
|  |                     await classesQuery.refetch(); | ||||||
|  |                 }, | ||||||
|  |                 onError: (err) => { | ||||||
|  |                     showSnackbar(t("creationFailed") + ": " + err.message, "error"); | ||||||
|  |                 }, | ||||||
|  |             }); | ||||||
|  |             dialog.value = true; | ||||||
|  |         } | ||||||
|  |         if (!className.value || className.value === "") { | ||||||
|  |             showSnackbar(t("nameIsMandatory"), "error"); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| const snackbar = ref({ |     const snackbar = ref({ | ||||||
|     visible: false, |         visible: false, | ||||||
|     message: '', |         message: "", | ||||||
|     color: 'success', |         color: "success", | ||||||
| }); |     }); | ||||||
| 
 | 
 | ||||||
| function showSnackbar(message: string, color: string): void { |     function showSnackbar(message: string, color: string): void { | ||||||
|     snackbar.value.message = message; |         snackbar.value.message = message; | ||||||
|     snackbar.value.color = color; |         snackbar.value.color = color; | ||||||
|     snackbar.value.visible = true; |         snackbar.value.visible = true; | ||||||
| } |     } | ||||||
| 
 | 
 | ||||||
| // Show the teacher, copying of the code was a successs |     // Show the teacher, copying of the code was a successs | ||||||
| const copied = ref(false); |     const copied = ref(false); | ||||||
| 
 | 
 | ||||||
| // Copy the generated code to the clipboard |     // Copy the generated code to the clipboard | ||||||
| async function copyToClipboard(): Promise<void> { |     async function copyToClipboard(): Promise<void> { | ||||||
|     await navigator.clipboard.writeText(code.value); |         await navigator.clipboard.writeText(code.value); | ||||||
|     copied.value = true; |         copied.value = true; | ||||||
| } |     } | ||||||
| 
 | 
 | ||||||
| async function copyCode(selectedCode: string): Promise<void> { |     async function copyCode(selectedCode: string): Promise<void> { | ||||||
|     code.value = selectedCode; |         code.value = selectedCode; | ||||||
|     await copyToClipboard(); |         await copyToClipboard(); | ||||||
|     showSnackbar(t('copied'), 'white'); |         showSnackbar(t("copied"), "white"); | ||||||
|     copied.value = false; |         copied.value = false; | ||||||
| } |     } | ||||||
| 
 | 
 | ||||||
| // Custom breakpoints |     // Custom breakpoints | ||||||
| const customBreakpoints = { |     const customBreakpoints = { | ||||||
|     xs: 0, |         xs: 0, | ||||||
|     sm: 500, |         sm: 500, | ||||||
|     md: 1370, |         md: 1370, | ||||||
|     lg: 1400, |         lg: 1400, | ||||||
|     xl: 1600, |         xl: 1600, | ||||||
| }; |     }; | ||||||
| 
 | 
 | ||||||
| // Logic for small screens |     // Logic for small screens | ||||||
| const display = useDisplay(); |     const display = useDisplay(); | ||||||
| 
 | 
 | ||||||
| // 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); |     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; |         isSmAndDown.value = display.width.value < customBreakpoints.sm; | ||||||
| }); |     }); | ||||||
| 
 | 
 | ||||||
| // Code display dialog logic |     // Code display dialog logic | ||||||
| const viewCodeDialog = ref(false); |     const viewCodeDialog = ref(false); | ||||||
| const selectedCode = ref(''); |     const selectedCode = ref(""); | ||||||
| 
 | 
 | ||||||
| function openCodeDialog(codeToView: string): void { |     function openCodeDialog(codeToView: string): void { | ||||||
|     selectedCode.value = codeToView; |         selectedCode.value = codeToView; | ||||||
|     viewCodeDialog.value = true; |         viewCodeDialog.value = true; | ||||||
| } |     } | ||||||
| </script> | </script> | ||||||
| <template> | <template> | ||||||
|     <main> |     <main> | ||||||
|  | @ -192,7 +192,7 @@ function openCodeDialog(codeToView: string): void { | ||||||
|             ></v-empty-state> |             ></v-empty-state> | ||||||
|         </div> |         </div> | ||||||
|         <div v-else> |         <div v-else> | ||||||
|             <h1 class="h1">{{ t('classes') }}</h1> |             <h1 class="h1">{{ t("classes") }}</h1> | ||||||
|             <using-query-result |             <using-query-result | ||||||
|                 :query-result="classesQuery" |                 :query-result="classesQuery" | ||||||
|                 v-slot="classesResponse: { data: ClassesResponse }" |                 v-slot="classesResponse: { data: ClassesResponse }" | ||||||
|  | @ -213,62 +213,62 @@ function openCodeDialog(codeToView: string): void { | ||||||
|                         > |                         > | ||||||
|                             <v-table class="table"> |                             <v-table class="table"> | ||||||
|                                 <thead> |                                 <thead> | ||||||
|                                 <tr> |                                     <tr> | ||||||
|                                     <th class="header">{{ t('classes') }}</th> |                                         <th class="header">{{ t("classes") }}</th> | ||||||
|                                     <th class="header"> |                                         <th class="header"> | ||||||
|                                         {{ t('code') }} |                                             {{ t("code") }} | ||||||
|                                     </th> |                                         </th> | ||||||
|                                     <th class="header">{{ t('members') }}</th> |                                         <th class="header">{{ t("members") }}</th> | ||||||
|                                 </tr> |                                     </tr> | ||||||
|                                 </thead> |                                 </thead> | ||||||
|                                 <tbody v-if="classesResponse.data.classes.length"> |                                 <tbody v-if="classesResponse.data.classes.length"> | ||||||
|                                 <tr |                                     <tr | ||||||
|                                     v-for="c in classesResponse.data.classes as ClassDTO[]" |                                         v-for="c in classesResponse.data.classes as ClassDTO[]" | ||||||
|                                     :key="c.id" |                                         :key="c.id" | ||||||
|                                 > |                                     > | ||||||
|                                     <td> |                                         <td> | ||||||
|                                         <v-btn |                                             <v-btn | ||||||
|                                             :to="`/class/${c.id}`" |                                                 :to="`/class/${c.id}`" | ||||||
|                                             variant="text" |                                                 variant="text" | ||||||
|                                         > |                                             > | ||||||
|                                             {{ c.displayName }} |                                                 {{ c.displayName }} | ||||||
|                                             <v-icon end> mdi-menu-right</v-icon> |                                                 <v-icon end> mdi-menu-right</v-icon> | ||||||
|                                         </v-btn> |                                             </v-btn> | ||||||
|                                     </td> |                                         </td> | ||||||
|                                     <td> |                                         <td> | ||||||
|                                         <v-btn |                                             <v-btn | ||||||
|                                             v-if="!isMdAndDown" |                                                 v-if="!isMdAndDown" | ||||||
|                                             variant="text" |                                                 variant="text" | ||||||
|                                             append-icon="mdi-content-copy" |                                                 append-icon="mdi-content-copy" | ||||||
|                                             @click="copyCode(c.id)" |                                                 @click="copyCode(c.id)" | ||||||
|                                         > |                                             > | ||||||
|                                             {{ c.id }} |                                                 {{ c.id }} | ||||||
|                                         </v-btn> |                                             </v-btn> | ||||||
|                                         <span |                                             <span | ||||||
|                                             v-else |                                                 v-else | ||||||
|                                             style="cursor: pointer" |                                                 style="cursor: pointer" | ||||||
|                                             @click="openCodeDialog(c.id)" |                                                 @click="openCodeDialog(c.id)" | ||||||
|                                         ><v-icon icon="mdi-eye"></v-icon |                                                 ><v-icon icon="mdi-eye"></v-icon | ||||||
|                                         ></span> |                                             ></span> | ||||||
|                                     </td> |                                         </td> | ||||||
| 
 | 
 | ||||||
|                                     <td>{{ c.students.length }}</td> |                                         <td>{{ c.students.length }}</td> | ||||||
|                                 </tr> |                                     </tr> | ||||||
|                                 </tbody> |                                 </tbody> | ||||||
|                                 <tbody v-else> |                                 <tbody v-else> | ||||||
|                                 <tr> |                                     <tr> | ||||||
|                                     <td |                                         <td | ||||||
|                                         colspan="3" |                                             colspan="3" | ||||||
|                                         class="empty-message" |                                             class="empty-message" | ||||||
|                                     > |  | ||||||
|                                         <v-icon |  | ||||||
|                                             icon="mdi-information-outline" |  | ||||||
|                                             size="small" |  | ||||||
|                                         > |                                         > | ||||||
|                                         </v-icon> |                                             <v-icon | ||||||
|                                         {{ t('no-classes-found') }} |                                                 icon="mdi-information-outline" | ||||||
|                                     </td> |                                                 size="small" | ||||||
|                                 </tr> |                                             > | ||||||
|  |                                             </v-icon> | ||||||
|  |                                             {{ t("no-classes-found") }} | ||||||
|  |                                         </td> | ||||||
|  |                                     </tr> | ||||||
|                                 </tbody> |                                 </tbody> | ||||||
|                             </v-table> |                             </v-table> | ||||||
|                         </v-col> |                         </v-col> | ||||||
|  | @ -279,13 +279,13 @@ function openCodeDialog(codeToView: string): void { | ||||||
|                             class="responsive-col" |                             class="responsive-col" | ||||||
|                         > |                         > | ||||||
|                             <div> |                             <div> | ||||||
|                                 <h2>{{ t('createClass') }}</h2> |                                 <h2>{{ t("createClass") }}</h2> | ||||||
| 
 | 
 | ||||||
|                                 <v-sheet |                                 <v-sheet | ||||||
|                                     class="pa-4 sheet" |                                     class="pa-4 sheet" | ||||||
|                                     max-width="600px" |                                     max-width="600px" | ||||||
|                                 > |                                 > | ||||||
|                                     <p>{{ t('createClassInstructions') }}</p> |                                     <p>{{ t("createClassInstructions") }}</p> | ||||||
|                                     <v-form @submit.prevent> |                                     <v-form @submit.prevent> | ||||||
|                                         <v-text-field |                                         <v-text-field | ||||||
|                                             class="mt-4" |                                             class="mt-4" | ||||||
|  | @ -301,9 +301,8 @@ function openCodeDialog(codeToView: string): void { | ||||||
|                                             type="submit" |                                             type="submit" | ||||||
|                                             @click="createClass" |                                             @click="createClass" | ||||||
|                                             block |                                             block | ||||||
|                                         >{{ t('create') }} |                                             >{{ t("create") }} | ||||||
|                                         </v-btn |                                         </v-btn> | ||||||
|                                         > |  | ||||||
|                                     </v-form> |                                     </v-form> | ||||||
|                                 </v-sheet> |                                 </v-sheet> | ||||||
|                                 <v-container> |                                 <v-container> | ||||||
|  | @ -325,7 +324,7 @@ function openCodeDialog(codeToView: string): void { | ||||||
|                                                         v-if="copied" |                                                         v-if="copied" | ||||||
|                                                         class="text-center mt-2" |                                                         class="text-center mt-2" | ||||||
|                                                     > |                                                     > | ||||||
|                                                         {{ t('copied') }} |                                                         {{ t("copied") }} | ||||||
|                                                     </div> |                                                     </div> | ||||||
|                                                 </v-slide-y-transition> |                                                 </v-slide-y-transition> | ||||||
|                                             </v-card-text> |                                             </v-card-text> | ||||||
|  | @ -338,7 +337,7 @@ function openCodeDialog(codeToView: string): void { | ||||||
|                                                         copied = false; |                                                         copied = false; | ||||||
|                                                     " |                                                     " | ||||||
|                                                 > |                                                 > | ||||||
|                                                     {{ t('close') }} |                                                     {{ t("close") }} | ||||||
|                                                 </v-btn> |                                                 </v-btn> | ||||||
|                                             </v-card-actions> |                                             </v-card-actions> | ||||||
|                                         </v-card> |                                         </v-card> | ||||||
|  | @ -351,7 +350,7 @@ function openCodeDialog(codeToView: string): void { | ||||||
|             </using-query-result> |             </using-query-result> | ||||||
| 
 | 
 | ||||||
|             <h1 class="h1"> |             <h1 class="h1"> | ||||||
|                 {{ t('invitations') }} |                 {{ t("invitations") }} | ||||||
|             </h1> |             </h1> | ||||||
|             <v-container |             <v-container | ||||||
|                 fluid |                 fluid | ||||||
|  | @ -359,29 +358,31 @@ function openCodeDialog(codeToView: string): void { | ||||||
|             > |             > | ||||||
|                 <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">{{ t('accept') + '/' + t('reject') }}</th> |                             <th class="header">{{ t("accept") + "/" + t("reject") }}</th> | ||||||
|                     </tr> |                         </tr> | ||||||
|                     </thead> |                     </thead> | ||||||
|                     <tbody> |                     <tbody> | ||||||
|                     <using-query-result |                         <using-query-result | ||||||
|                         :query-result="getInvitationsQuery" |                             :query-result="getInvitationsQuery" | ||||||
|                         v-slot="invitationsResponse: { data: TeacherInvitationsResponse }" |                             v-slot="invitationsResponse: { data: TeacherInvitationsResponse }" | ||||||
|                     > |                         > | ||||||
|                         <template v-if="invitationsResponse.data.invitations.length"> |                             <template v-if="invitationsResponse.data.invitations.length"> | ||||||
|                             <tr |                                 <tr | ||||||
|                                 v-for="i in invitationsResponse.data.invitations as TeacherInvitationDTO[]" |                                     v-for="i in invitationsResponse.data.invitations as TeacherInvitationDTO[]" | ||||||
|                                 :key="i.classId" |                                     :key="i.classId" | ||||||
|                             > |                                 > | ||||||
|                                 <td> |                                     <td> | ||||||
|                                     <ClassDisplay :classId="i.classId" /> |                                         <ClassDisplay :classId="i.classId" /> | ||||||
|                                 </td> |                                     </td> | ||||||
|                                 <td> |                                     <td> | ||||||
|                                     {{ (i.sender as TeacherDTO).firstName + ' ' + (i.sender as TeacherDTO).lastName }} |                                         {{ | ||||||
|                                 </td> |                                             (i.sender as TeacherDTO).firstName + " " + (i.sender as TeacherDTO).lastName | ||||||
|                                 <td class="text-right"> |                                         }} | ||||||
|  |                                     </td> | ||||||
|  |                                     <td class="text-right"> | ||||||
|                                         <span v-if="!isSmAndDown"> |                                         <span v-if="!isSmAndDown"> | ||||||
|                                             <div> |                                             <div> | ||||||
|                                                 <v-btn |                                                 <v-btn | ||||||
|  | @ -389,17 +390,17 @@ function openCodeDialog(codeToView: string): void { | ||||||
|                                                     @click="handleInvitation(i, true)" |                                                     @click="handleInvitation(i, true)" | ||||||
|                                                     class="mr-2" |                                                     class="mr-2" | ||||||
|                                                 > |                                                 > | ||||||
|                                                     {{ t('accept') }} |                                                     {{ t("accept") }} | ||||||
|                                                 </v-btn> |                                                 </v-btn> | ||||||
|                                                 <v-btn |                                                 <v-btn | ||||||
|                                                     color="red" |                                                     color="red" | ||||||
|                                                     @click="handleInvitation(i, false)" |                                                     @click="handleInvitation(i, false)" | ||||||
|                                                 > |                                                 > | ||||||
|                                                     {{ t('deny') }} |                                                     {{ t("deny") }} | ||||||
|                                                 </v-btn> |                                                 </v-btn> | ||||||
|                                             </div> |                                             </div> | ||||||
|                                         </span> |                                         </span> | ||||||
|                                     <span v-else> |                                         <span v-else> | ||||||
|                                             <div> |                                             <div> | ||||||
|                                                 <v-btn |                                                 <v-btn | ||||||
|                                                     @click="handleInvitation(i, true)" |                                                     @click="handleInvitation(i, true)" | ||||||
|  | @ -418,26 +419,26 @@ function openCodeDialog(codeToView: string): void { | ||||||
|                                                 > |                                                 > | ||||||
|                                                 </v-btn> |                                                 </v-btn> | ||||||
|                                             </div> |                                             </div> | ||||||
|                                     </span> |                                         </span> | ||||||
|                                 </td> |                                     </td> | ||||||
|                             </tr> |                                 </tr> | ||||||
|                         </template> |                             </template> | ||||||
|                         <template v-else> |                             <template v-else> | ||||||
|                             <tr> |                                 <tr> | ||||||
|                                 <td |                                     <td | ||||||
|                                     colspan="3" |                                         colspan="3" | ||||||
|                                     class="empty-message" |                                         class="empty-message" | ||||||
|                                 > |  | ||||||
|                                     <v-icon |  | ||||||
|                                         icon="mdi-information-outline" |  | ||||||
|                                         size="small" |  | ||||||
|                                     > |                                     > | ||||||
|                                     </v-icon> |                                         <v-icon | ||||||
|                                     {{ t('no-invitations-found') }} |                                             icon="mdi-information-outline" | ||||||
|                                 </td> |                                             size="small" | ||||||
|                             </tr> |                                         > | ||||||
|                         </template> |                                         </v-icon> | ||||||
|                     </using-query-result> |                                         {{ t("no-invitations-found") }} | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                             </template> | ||||||
|  |                         </using-query-result> | ||||||
|                     </tbody> |                     </tbody> | ||||||
|                 </v-table> |                 </v-table> | ||||||
|             </v-container> |             </v-container> | ||||||
|  | @ -454,7 +455,7 @@ function openCodeDialog(codeToView: string): void { | ||||||
|             max-width="400px" |             max-width="400px" | ||||||
|         > |         > | ||||||
|             <v-card> |             <v-card> | ||||||
|                 <v-card-title class="headline">{{ t('code') }}</v-card-title> |                 <v-card-title class="headline">{{ t("code") }}</v-card-title> | ||||||
|                 <v-card-text> |                 <v-card-text> | ||||||
|                     <v-text-field |                     <v-text-field | ||||||
|                         v-model="selectedCode" |                         v-model="selectedCode" | ||||||
|  | @ -467,7 +468,7 @@ function openCodeDialog(codeToView: string): void { | ||||||
|                             v-if="copied" |                             v-if="copied" | ||||||
|                             class="text-center mt-2" |                             class="text-center mt-2" | ||||||
|                         > |                         > | ||||||
|                             {{ t('copied') }} |                             {{ t("copied") }} | ||||||
|                         </div> |                         </div> | ||||||
|                     </v-slide-y-transition> |                     </v-slide-y-transition> | ||||||
|                 </v-card-text> |                 </v-card-text> | ||||||
|  | @ -480,7 +481,7 @@ function openCodeDialog(codeToView: string): void { | ||||||
|                             copied = false; |                             copied = false; | ||||||
|                         " |                         " | ||||||
|                     > |                     > | ||||||
|                         {{ t('close') }} |                         {{ t("close") }} | ||||||
|                     </v-btn> |                     </v-btn> | ||||||
|                 </v-card-actions> |                 </v-card-actions> | ||||||
|             </v-card> |             </v-card> | ||||||
|  | @ -488,49 +489,49 @@ function openCodeDialog(codeToView: string): void { | ||||||
|     </main> |     </main> | ||||||
| </template> | </template> | ||||||
| <style scoped> | <style scoped> | ||||||
| h2 { |     h2 { | ||||||
|     color: #0e6942; |         color: #0e6942; | ||||||
|     font-size: 30px; |         font-size: 30px; | ||||||
| } |     } | ||||||
| 
 | 
 | ||||||
| .join { |  | ||||||
|     display: flex; |  | ||||||
|     flex-direction: column; |  | ||||||
|     gap: 20px; |  | ||||||
|     margin-top: 50px; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .link { |  | ||||||
|     color: #0b75bb; |  | ||||||
|     text-decoration: underline; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| @media screen and (max-width: 850px) { |  | ||||||
|     .join { |     .join { | ||||||
|         text-align: center; |  | ||||||
|         align-items: center; |  | ||||||
|         margin-left: 0; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     .sheet { |  | ||||||
|         width: 100%; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     main { |  | ||||||
|         display: flex; |         display: flex; | ||||||
|         flex-direction: column; |         flex-direction: column; | ||||||
|         align-items: center; |         gap: 20px; | ||||||
|         justify-content: center; |         margin-top: 50px; | ||||||
|         margin: 5px; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     .custom-breakpoint { |     .link { | ||||||
|         flex-direction: column !important; |         color: #0b75bb; | ||||||
|  |         text-decoration: underline; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     .responsive-col { |     @media screen and (max-width: 850px) { | ||||||
|         max-width: 100% !important; |         .join { | ||||||
|         flex-basis: 100% !important; |             text-align: center; | ||||||
|  |             align-items: center; | ||||||
|  |             margin-left: 0; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .sheet { | ||||||
|  |             width: 100%; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         main { | ||||||
|  |             display: flex; | ||||||
|  |             flex-direction: column; | ||||||
|  |             align-items: center; | ||||||
|  |             justify-content: center; | ||||||
|  |             margin: 5px; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .custom-breakpoint { | ||||||
|  |             flex-direction: column !important; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .responsive-col { | ||||||
|  |             max-width: 100% !important; | ||||||
|  |             flex-basis: 100% !important; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } |  | ||||||
| </style> | </style> | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Lint Action
						Lint Action