This commit is contained in:
Katie Kroell 2025-12-08 09:11:49 -05:00
parent a253312245
commit 5d99bad99e
2 changed files with 92 additions and 96 deletions

View file

@ -1,113 +1,103 @@
<template> <template>
<div id="progress-bar-container"> <div
v-if="progress > 0"
class="progress-bar-container">
<div class="progress-bar-header">
<span aria-hidden="true">{{ progress }}%</span>
</div>
<progress <progress
v-if="progress > 0" class="progress-bar progress-bar-success"
:value="progress" :value="progress"
max="100" max="100"
v-html="progress + '%' " /> aria-label="Scheduling progress">
<div class="progress-bar-middle"></div>
</progress>
</div> </div>
</template> </template>
<script> <script>
import { getProgressBarPercentage } from '@/constants/progress-bar-mapper'; import { getProgressBarPercentage } from '@/constants/progress-bar-mapper';
import { useMainStore } from '@/store';
// Module-level variable to persist progress across component lifecycles
let lastProgress = 0;
export default { export default {
name: 'progress-bar', name: 'progress-bar',
props: {
page: {
type: String,
required: true
},
vertical: {
type: Boolean,
default: false
}
},
data() { data() {
return { return {
displayedProgress: lastProgress, progress: this.getProgress()
timeoutId: null
}; };
}, },
computed: { methods: {
progressStyle() { getProgress() {
if (this.vertical) { const pageName = useMainStore().applicationUser.lastPageVisited;
return { return getProgressBarPercentage(pageName);
height: `${this.displayedProgress}%`,
width: '100%'
};
}
return {
width: `${this.displayedProgress}%`,
height: '100%'
};
},
barClass() {
return this.vertical ? 'progress-bar-outer-vertical' : 'progress-bar-outer';
} }
},
watch: {
page: {
immediate: true,
handler(newPage) {
const target = getProgressBarPercentage(newPage);
if (this.timeoutId) clearTimeout(this.timeoutId);
// Animate from current value to new value
this.timeoutId = setTimeout(() => {
this.displayedProgress = target;
lastProgress = target; // Update the module-level variable
}, 150);
}
}
},
beforeUnmount() {
if (this.timeoutId) clearTimeout(this.timeoutId);
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.progress-bar-outer { .progress-bar-container {
background: $blue-100; padding: .75rem 0;
height: 5px; width: 55%;
position: relative; display: block;
border-radius: 0;
width: 100%;
margin-top: 0;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.075);
.progress-bar-inner {
transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
will-change: width;
height: 100%;
background-color: $red;
position: absolute;
top: 0;
left: 0;
border-radius: 0;
}
}
.progress-bar-outer-vertical { .progress-bar-header {
background: $blue-100; width: 38px;
width: 24px; height: 15px;
height: 356px; float: left;
position: relative; padding-right: 5px;
margin-top: 0; // color: @color-progress-bar;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.075); // font-weight: @font-weight-bold;
overflow: hidden; font-style: normal;
border-radius: 50rem; font-stretch: normal;
.progress-bar-inner { font-size: 14px;
transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important; line-height: 15px;
will-change: height !important; text-align: right;
width: 100%; }
background-color: $red;
position: absolute; .progress {
left: 0; height: 10px;
top: 0; width: 100%;
border-radius: 50rem; box-shadow: none;
border-top-left-radius: 7.5px;
border-bottom-left-radius: 7.5px;
line-height: inherit;
/* Firefox */
appearance: none;
background-color: $blue-100;
border: 0;
border-radius: $border-radius-pill;
box-shadow: $box-shadow-inset;
&::-moz-progress-bar {
background-color: $blue;
border-radius: $border-radius-pill;
}
/* Webkit */
-webkit-appearance: none;
&::-webkit-progress-bar {
background-color: $blue-100;
border-radius: $border-radius-pill;
box-shadow: $box-shadow-inset;
}
&::-webkit-progress-value {
background-color: $blue;
border-radius: $border-radius-pill;
}
}
.progress-bar-middle {
position: relative;
float: right;
margin-right: -8.5px;
width: 17px;
height: 17px;
margin-top: -1px;
border: solid 2px; //@progress-bar-outer-color;
border-radius: 50%;
//background-color: @color-progress-bar;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
}
} }
}
</style> </style>

View file

@ -2,12 +2,17 @@
<div <div
class="site-header-container" class="site-header-container"
:style="logoBackgroundStyle"> :style="logoBackgroundStyle">
<div class="site-header iss-heritage-container-width"> <div class="site-header iss-heritage-container-width row">
<img <div class="col">
id="siteHeaderImage" <img
class="img-fluid" id="siteHeaderImage"
:src="imageSrc" class="img-fluid"
:alt="altText" /> :src="imageSrc"
:alt="altText" />
</div>
<div class="col">
<progress-bar />
</div>
</div> </div>
<alert <alert
v-if="displayGlobalAlert" v-if="displayGlobalAlert"
@ -25,11 +30,12 @@ import alert from '@/ux-components/alert/alert.vue';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import eventBus from '@/helpers/event-bus/event-bus'; import eventBus from '@/helpers/event-bus/event-bus';
import { globalEvents } from '@/constants/events'; import { globalEvents } from '@/constants/events';
import progressBar from '@/iss-components/site-header/progress-bar/progress-bar.vue';
export default { export default {
name: 'site-header', name: 'site-header',
components: { components: {
alert alert, progressBar
}, },
props: { props: {
cmsWidgetName: String cmsWidgetName: String