1
1
<template >
2
- <div >
2
+ <main >
3
3
<!-- eslint-disable-next-line vue/no-v-html -->
4
4
<div v-html =" mucIconsSprite" />
5
5
<!-- eslint-disable-next-line vue/no-v-html -->
6
6
<div v-html =" customIconsSprite" />
7
- <muc-callout >
8
- <template #header >
9
- <p >checklist-overview Webcomponent</p >
10
- </template >
11
- <template #content >
12
- <p >{{ calloutContent }}</p >
13
- </template >
14
- </muc-callout >
15
- </div >
7
+ <div
8
+ v-if =" checklists.length > 0 || !displayOptionDetailScreen"
9
+ :class ="
10
+ displayOptionDetailScreen ? 'details-background' : 'overview-padding'
11
+ "
12
+ >
13
+ <div class =" container" >
14
+ <div class =" header" >
15
+ <div class =" headline" >
16
+ <span class =" header-icon" >
17
+ <muc-icon icon =" calendar" />
18
+ </span >
19
+ <h2 tabindex =" 0" >
20
+ <span v-if =" displayOptionDetailScreen"
21
+ >Meine weiteren Checklisten</span
22
+ >
23
+ <span v-else >Meine Checklisten</span >
24
+
25
+ <span
26
+ v-if ="
27
+ checklists.length &&
28
+ !displayOptionDetailScreen &&
29
+ !loadingError
30
+ "
31
+ >
32
+ ({{ checklists.length }})</span
33
+ >
34
+ </h2 >
35
+ </div >
36
+ <muc-link
37
+ v-if =" !loadingError && checklists.length > 2 && !isMobile"
38
+ label =" Alle Checklisten anzeigen"
39
+ icon =" chevron-right"
40
+ target =" _self"
41
+ no-underline
42
+ :href =" checklistOverviewUrl"
43
+ />
44
+ </div >
45
+ <error-alert
46
+ v-if =" loadingError"
47
+ class =" no-padding-top"
48
+ message =" Es gibt aktuell leider ein technisches Problem mit dieser Funktion. Bitte versuchen Sie es später noch einmal."
49
+ header =" Ihre Checklisten können zur Zeit nicht geladen werden."
50
+ />
51
+ <muc-card-container
52
+ v-else-if =" loading"
53
+ class =" checklist-card-container"
54
+ >
55
+ <skeleton-loader />
56
+ </muc-card-container >
57
+ <div v-else >
58
+ <checklist-card-viewer
59
+ :all-checklists =" checklists"
60
+ :is-mobile =" isMobile"
61
+ :new-checklist-url =" newChecklistUrl"
62
+ :checklist-detail-url =" checklistDetailUrl"
63
+ :displayed-on-detail-screen =" displayOptionDetailScreen"
64
+ />
65
+ <muc-link
66
+ v-if =" !loadingError && checklists.length > 2 && isMobile"
67
+ class =" mobile-link"
68
+ label =" Alle Checklisten anzeigen"
69
+ icon =" chevron-right"
70
+ target =" _self"
71
+ no-underline
72
+ :href =" checklistOverviewUrl"
73
+ />
74
+ </div >
75
+ </div >
76
+ </div >
77
+ </main >
16
78
</template >
17
79
18
80
<script setup lang="ts">
19
- import { MucCallout } from " @muenchen/muc-patternlab-vue" ;
81
+ import type DummyChecklist from " @/api/dummyservice/DummyChecklist.ts" ;
82
+
83
+ import {
84
+ MucCardContainer ,
85
+ MucIcon ,
86
+ MucLink ,
87
+ } from " @muenchen/muc-patternlab-vue" ;
20
88
import customIconsSprite from " @muenchen/muc-patternlab-vue/assets/icons/custom-icons.svg?raw" ;
21
89
import mucIconsSprite from " @muenchen/muc-patternlab-vue/assets/icons/muc-icons.svg?raw" ;
22
- import { computed } from " vue" ;
90
+ import { onMounted , ref } from " vue" ;
23
91
24
- import { FIRSTNAME_DEFAULT } from " @/util/constants" ;
92
+ import DummyChecklistService from " @/api/dummyservice/DummyChecklistService.ts" ;
93
+ import ChecklistCardViewer from " @/components/ChecklistCardViewer.vue" ;
94
+ import ErrorAlert from " @/components/common/ErrorAlert.vue" ;
95
+ import SkeletonLoader from " @/components/common/skeleton-loader.vue" ;
96
+ import { QUERY_PARAM_CHECKLIST_ID } from " @/util/constants.ts" ;
25
97
26
- const { firstName = FIRSTNAME_DEFAULT } = defineProps <{
27
- firstName? : string ;
98
+ const { displayedOnDetailScreen } = defineProps <{
99
+ checklistDetailUrl: string ;
100
+ checklistOverviewUrl: string ;
101
+ newChecklistUrl: string ;
102
+ displayedOnDetailScreen: string ;
28
103
}>();
29
104
30
- const calloutContent = computed (() => {
31
- return ` Hello ${firstName } ` ;
105
+ const checklists = ref <DummyChecklist []>([]);
106
+ const loading = ref (true );
107
+ const loadingError = ref (false );
108
+ const isMobile = ref (false );
109
+ const displayOptionDetailScreen =
110
+ displayedOnDetailScreen .toLowerCase () === " true" ;
111
+
112
+ const checksMobile = () => {
113
+ isMobile .value = window .matchMedia (" (max-width: 767px)" ).matches ;
114
+ };
115
+
116
+ onMounted (() => {
117
+ loading .value = true ;
118
+ checksMobile ();
119
+ window .addEventListener (" resize" , checksMobile );
120
+
121
+ const dcl = new DummyChecklistService ();
122
+ dcl
123
+ .getChecklists ()
124
+ .then ((checklist ) => {
125
+ checklists .value = checklist ;
126
+
127
+ if (displayOptionDetailScreen ) {
128
+ const urlParams = new URLSearchParams (window .location .search );
129
+ const checklistId = urlParams .get (QUERY_PARAM_CHECKLIST_ID );
130
+ checklists .value = checklists .value .filter (
131
+ (checklist ) => checklist .id != checklistId
132
+ );
133
+ }
134
+ })
135
+ .finally (() => (loading .value = false ));
32
136
});
33
137
</script >
34
138
@@ -37,3 +141,63 @@ const calloutContent = computed(() => {
37
141
@import " @muenchen/muc-patternlab-vue/assets/css/custom-style.css" ;
38
142
@import " @muenchen/muc-patternlab-vue/style.css" ;
39
143
</style >
144
+
145
+ <style scoped>
146
+ /* Padding on overview page */
147
+ .overview-padding {
148
+ padding-top : 40px ;
149
+ }
150
+
151
+ /* Background color on details page */
152
+ .details-background {
153
+ background-color : var (--color-neutrals-blue-xlight );
154
+ padding : 24px 0 ;
155
+ }
156
+
157
+ /* Header styles */
158
+ .header {
159
+ display : flex ;
160
+ align-items : center ;
161
+ justify-content : space-between ;
162
+ padding-bottom : 24px ;
163
+ }
164
+
165
+ /* Headline styles */
166
+ .headline {
167
+ display : flex ;
168
+ align-items : center ;
169
+ }
170
+
171
+ .header-icon {
172
+ margin-right : 8px ;
173
+ }
174
+
175
+ /* Mobile link styles */
176
+ .mobile-link {
177
+ padding-top : 24px ;
178
+ }
179
+
180
+ /* No padding-top on error message */
181
+ .no-padding-top {
182
+ padding-top : 0 !important ;
183
+ }
184
+
185
+ .checklist-card-container {
186
+ grid-template-columns : repeat (auto-fit , 100% );
187
+ }
188
+
189
+ /* CSS for desktop */
190
+ @media (min-width : 768px ) {
191
+ .overview-padding {
192
+ padding-top : 40px ;
193
+ }
194
+
195
+ .details-background {
196
+ padding : 64px 0 ;
197
+ }
198
+
199
+ .checklist-card-container {
200
+ grid-template-columns : repeat (auto-fit , 589px );
201
+ }
202
+ }
203
+ </style >
0 commit comments