Skip to content

Commit b4b5882

Browse files
authored
Merge pull request #81 from markfijneman/ctf-card-progressbar
Replaced CTF progress bar with Quasar component
2 parents c50d90f + d5a5a8e commit b4b5882

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

front/src/components/CTF/Card.vue

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<template>
22
<q-card bordered class="ctfcard">
33
<card-admin-menu :ctf="ctf" />
4+
<q-linear-progress v-if="progress >= 0" :value="progress" animation-speed="0" color="positive" />
45
<q-card-section>
5-
<div class="row progress-row q-gutter-md items-center" :style="style">
6+
<div class="row q-gutter-md items-center">
67
<div class="col-auto">
78
<logo-link :ctf="ctf" />
89
</div>
@@ -118,36 +119,19 @@ export default defineComponent({
118119
startDate() {
119120
return date.formatDate(this.ctf.startTime, 'YYYY/MM/DD');
120121
},
121-
style(): Record<string, string> {
122+
progress() {
122123
const start = this.ctf.startTime.getTime();
123124
const end = this.ctf.endTime.getTime();
124125
const duration = end - start;
125126
const elapsed = this.now.valueOf() - start;
126-
const progress = Math.min((elapsed / duration) * 100, 100);
127-
return { '--progress-percent': `${progress.toFixed(2)}%` };
127+
const progress = Math.min((elapsed / duration), 1);
128+
return progress;
128129
},
129130
},
130131
});
131132
</script>
132133

133134
<style lang="scss" scoped>
134-
.progress-row {
135-
--progress-percent: 0%;
136-
137-
&::before {
138-
position: absolute;
139-
content: '';
140-
transition: max-width linear 1s;
141-
top: 1px;
142-
left: 4px;
143-
height: 2px;
144-
width: calc(var(--progress-percent) - 8px);
145-
border-radius: 5px;
146-
background: $positive;
147-
box-shadow: 0 1px 3px 0px lighten($positive, 5%),
148-
0 0.2px 1px 0px rgba(255, 255, 255, 0.8) inset;
149-
}
150-
}
151135
@keyframes blinker {
152136
from {
153137
opacity: 1;

0 commit comments

Comments
 (0)