Skip to content

Commit ed5bc80

Browse files
authored
Merge pull request #891 from tsg-ut/feature/achievement-progress-scaling-7820949080073161408
Feat: Add scaling toggle to achievement progress
2 parents 9b672ac + 8d00d60 commit ed5bc80

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

app/pages/achievements/[id]/index.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
</li>
3636
</ul>
3737
<h1 class="title is-3">実績の達成状況</h1>
38+
<div class="field">
39+
<input id="scaleSwitch" v-model="scaleToMaxUser" type="checkbox" name="scaleSwitch" class="switch">
40+
<label for="scaleSwitch">最大ユーザを基準にする</label>
41+
</div>
3842
<div class="table-container">
3943
<table class="table">
4044
<thead>
@@ -57,7 +61,7 @@
5761
class="progress is-success"
5862
:class="(user.count || 0) >= value ? 'is-success' : 'is-warning'"
5963
:value="user.count || 0"
60-
:max="value"
64+
:max="scaleToMaxUser ? maxCount : value"
6165
/>
6266
</td>
6367
<td :style="{whiteSpace: 'nowrap'}">
@@ -80,6 +84,7 @@ export default {
8084
data() {
8185
return {
8286
isLoading: true,
87+
scaleToMaxUser: false,
8388
};
8489
},
8590
async fetch({store}) {
@@ -137,6 +142,9 @@ export default {
137142
id: user.id,
138143
}));
139144
},
145+
maxCount() {
146+
return Math.max(...this.sortedUserList.map((user) => user.count));
147+
},
140148
sameCounterAchievements() {
141149
if (this.counter === null) {
142150
return [];

nuxt.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default defineNuxtConfig({
2424
'bulma-o-steps/bulma-steps.css',
2525
'bulma-timeline/dist/css/bulma-timeline.min.css',
2626
'remixicon/fonts/remixicon.css',
27+
'bulma-switch-control/css/main.css',
2728
],
2829

2930
postcss: {

package-lock.json

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"dependencies": {
1818
"bulma": "^1.0.2",
1919
"bulma-o-steps": "^1.1.0",
20+
"bulma-switch-control": "^1.2.2",
2021
"bulma-timeline": "^3.0.5",
2122
"chart.js": "^4.5.1",
2223
"core-js": "^3.47.0",

0 commit comments

Comments
 (0)