|
1 | 1 | <template> |
2 | 2 | <q-card bordered class="ctfcard"> |
3 | 3 | <card-admin-menu :ctf="ctf" /> |
| 4 | + <q-linear-progress v-if="progress >= 0" :value="progress" animation-speed="0" color="positive" /> |
4 | 5 | <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"> |
6 | 7 | <div class="col-auto"> |
7 | 8 | <logo-link :ctf="ctf" /> |
8 | 9 | </div> |
@@ -118,36 +119,19 @@ export default defineComponent({ |
118 | 119 | startDate() { |
119 | 120 | return date.formatDate(this.ctf.startTime, 'YYYY/MM/DD'); |
120 | 121 | }, |
121 | | - style(): Record<string, string> { |
| 122 | + progress() { |
122 | 123 | const start = this.ctf.startTime.getTime(); |
123 | 124 | const end = this.ctf.endTime.getTime(); |
124 | 125 | const duration = end - start; |
125 | 126 | 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; |
128 | 129 | }, |
129 | 130 | }, |
130 | 131 | }); |
131 | 132 | </script> |
132 | 133 |
|
133 | 134 | <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 | | -} |
151 | 135 | @keyframes blinker { |
152 | 136 | from { |
153 | 137 | opacity: 1; |
|
0 commit comments