Skip to content

Commit 6b6f3f6

Browse files
committed
[Design] Add animations to some buttons during progress
1 parent ce64661 commit 6b6f3f6

File tree

3 files changed

+79
-33
lines changed

3 files changed

+79
-33
lines changed

src/App.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
}
4545
}
4646
47-
/* TODO: Update this colour (maybe add a separate variable to the theme) */
4847
::selection {
4948
background-color: #7c8cec;
5049
color: white;

src/components/admin/surveys/SurveyMagicLinks.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
useSurveyStore
1010
} from '@/ts/stores/admin';
1111
12-
// TODO: Download magic links from server to display (if this is supported)
13-
// --> Likely won't be due to bcrypt or the like being used for passwords
14-
1512
const surveyStore = useSurveyStore();
1613
const notifications = useNotification();
1714
const status = useStatusStore();

src/components/admin/surveys/SurveyProperties.vue

Lines changed: 79 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<script setup lang="ts">
22
import {
3-
deleteSurvey, exportSurvey
3+
deleteSurvey,
4+
exportSurvey
45
} from '@/ts/surveys';
6+
import {
7+
ref,
8+
watch
9+
} from 'vue';
510
import {
611
useNotification
712
} from '@kyvg/vue3-notification';
@@ -14,53 +19,74 @@
1419
import {
1520
useSurveyStore
1621
} from '@/ts/stores/admin';
17-
import {
18-
watch
19-
} from 'vue';
20-
21-
// TODO: Download magic links from server to display (if this is supported)
22-
// --> Likely won't be due to bcrypt or the like being used for passwords
2322
2423
const route = useRoute();
2524
const surveyStore = useSurveyStore();
2625
const maxSurveyLength = 50;
2726
const notifications = useNotification();
2827
const status = useStatusStore();
28+
const deleting = ref( false );
29+
const exporting = ref( false );
2930
3031
const removeSurvey = () => {
31-
deleteSurvey( surveyStore.getSelectedSurveyID! ).then( ( success: boolean ) => {
32-
if ( success ) {
33-
notifications.notify( {
34-
'text': 'Survey was deleted successfuly',
35-
'type': 'success',
36-
'title': 'Survey Deleted'
37-
} );
38-
window.location.reload();
39-
} else {
32+
deleting.value = true;
33+
deleteSurvey( surveyStore.getSelectedSurveyID! )
34+
.then( ( success: boolean ) => {
35+
if ( success ) {
36+
notifications.notify( {
37+
'text': 'Survey was deleted successfuly',
38+
'type': 'success',
39+
'title': 'Survey Deleted'
40+
} );
41+
window.location.reload();
42+
} else {
43+
deleting.value = false;
44+
notifications.notify( {
45+
'text': 'Survey could not be deleted',
46+
'type': 'error',
47+
'title': 'Error: Survey Deletion'
48+
} );
49+
}
50+
} )
51+
.catch( e => {
52+
console.debug( e );
53+
deleting.value = false;
4054
notifications.notify( {
4155
'text': 'Survey could not be deleted',
4256
'type': 'error',
4357
'title': 'Error: Survey Deletion'
4458
} );
45-
}
46-
} );
59+
} );
4760
};
4861
4962
const exportThisSurvey = () => {
50-
exportSurvey( surveyStore.getSelectedSurveyID! ).then( ( success: boolean ) => {
51-
if ( success )
52-
notifications.notify( {
53-
'text': 'Survey exported successfuly',
54-
'type': 'success',
55-
'title': 'Survey Export'
56-
} );
57-
else
63+
exporting.value = true;
64+
exportSurvey( surveyStore.getSelectedSurveyID! )
65+
.then( ( success: boolean ) => {
66+
exporting.value = false;
67+
68+
if ( success )
69+
notifications.notify( {
70+
'text': 'Survey exported successfuly',
71+
'type': 'success',
72+
'title': 'Survey Export'
73+
} );
74+
else
75+
notifications.notify( {
76+
'text': 'Survey could not be exported',
77+
'type': 'error',
78+
'title': 'Error: Survey Export'
79+
} );
80+
} )
81+
.catch( e => {
82+
console.debug( e );
83+
exporting.value = false;
5884
notifications.notify( {
5985
'text': 'Survey could not be exported',
6086
'type': 'error',
6187
'title': 'Error: Survey Export'
6288
} );
63-
} );
89+
} );
6490
};
6591
6692
const truncate = ( text: string, limit: number ) => {
@@ -119,13 +145,17 @@
119145
v-if="surveyStore.selectedSurveyIndex >= 0"
120146
class="bar-buttons"
121147
>
122-
<span>
148+
<span
149+
:class="deleting ? 'progress-active' : ''"
150+
>
123151
<i
124152
class="fa-solid fa-trash fa-lg trash-icon"
125153
@click="removeSurvey"
126154
></i>
127155
</span>
128-
<span>
156+
<span
157+
:class="exporting ? 'progress-active' : ''"
158+
>
129159
<i
130160
class="fa-solid fa-download fa-lg dl-icon"
131161
@click="exportThisSurvey"
@@ -165,6 +195,26 @@
165195
@use '@/scss/admin/general';
166196
@use '@/scss/admin/top-bar';
167197
198+
@keyframes progressing-bounce {
199+
0% {
200+
transform: scale(1);
201+
}
202+
30% {
203+
transform: scale(0.9);
204+
}
205+
50% {
206+
transform: scale(1.25);
207+
}
208+
70% {
209+
transform: scale(0.9);
210+
}
211+
}
212+
213+
.progress-active {
214+
animation: progressing-bounce 0.5s linear infinite;
215+
}
216+
217+
168218
.survey-properties {
169219
// Mainly for wide displays
170220
.top-bar {

0 commit comments

Comments
 (0)