Skip to content

Commit 80646ff

Browse files
feat: Add scaling toggle to achievement progress
This commit introduces a new feature that allows users to toggle the scaling of the achievement progress bars on the achievement details page. - Adds a toggle switch next to the "Achievement Progress" heading. - When toggled, the progress bars are scaled to the highest achievement count among all users, instead of the achievement's target value. - This provides a better visual representation of user progress when the target value is very high.
1 parent 1b66339 commit 80646ff

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

app/components/ToggleButton.vue

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<template>
2+
<label class="switch">
3+
<input type="checkbox" :checked="value" @change="$emit('input', $event.target.checked)">
4+
<span class="slider round"></span>
5+
</label>
6+
</template>
7+
8+
<script>
9+
export default {
10+
props: {
11+
value: {
12+
type: Boolean,
13+
required: true,
14+
},
15+
},
16+
};
17+
</script>
18+
19+
<style scoped>
20+
.switch {
21+
position: relative;
22+
display: inline-block;
23+
width: 30px;
24+
height: 17px;
25+
vertical-align: middle;
26+
margin-left: 0.5rem;
27+
}
28+
29+
.switch input {
30+
opacity: 0;
31+
width: 0;
32+
height: 0;
33+
}
34+
35+
.slider {
36+
position: absolute;
37+
cursor: pointer;
38+
top: 0;
39+
left: 0;
40+
right: 0;
41+
bottom: 0;
42+
background-color: #ccc;
43+
-webkit-transition: .4s;
44+
transition: .4s;
45+
}
46+
47+
.slider:before {
48+
position: absolute;
49+
content: "";
50+
height: 13px;
51+
width: 13px;
52+
left: 2px;
53+
bottom: 2px;
54+
background-color: white;
55+
-webkit-transition: .4s;
56+
transition: .4s;
57+
}
58+
59+
input:checked + .slider {
60+
background-color: #2196F3;
61+
}
62+
63+
input:focus + .slider {
64+
box-shadow: 0 0 1px #2196F3;
65+
}
66+
67+
input:checked + .slider:before {
68+
-webkit-transform: translateX(13px);
69+
-ms-transform: translateX(13px);
70+
transform: translateX(13px);
71+
}
72+
73+
/* Rounded sliders */
74+
.slider.round {
75+
border-radius: 17px;
76+
}
77+
78+
.slider.round:before {
79+
border-radius: 50%;
80+
}
81+
</style>

0 commit comments

Comments
 (0)