-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show point totals in the backpack and notes
- Loading branch information
1 parent
101b6ca
commit 2841155
Showing
7 changed files
with
228 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<div class="row-scores" :class="{ horizontal: props.horizontal ?? false }"> | ||
<span | ||
v-for="{ score, values } in rowScores" | ||
:key="score.id" | ||
class="row-score-item" | ||
> | ||
{{ values }} {{ score.afterText }} | ||
</span> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { join, map, toPairs } from 'ramda'; | ||
import { useProjectStore } from '~/composables/store/project'; | ||
import type { ScoreAcc } from '~/composables/viewer/usePoints'; | ||
const store = useProjectStore(); | ||
const props = defineProps<{ | ||
scores: Record<string, ScoreAcc>; | ||
horizontal?: boolean; | ||
}>(); | ||
const rowScores = computed(() => { | ||
return map(([scoreId, value]) => { | ||
const score = store.getPointType(scoreId); | ||
const values: string[] = []; | ||
if (value.gain > 0) { | ||
values.push(`+${value.gain}`); | ||
} | ||
if (value.cost > 0) { | ||
values.push(`-${value.cost}`); | ||
} | ||
return { | ||
score: score, | ||
values: join(', ', values), | ||
}; | ||
}, toPairs(props.scores)); | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.row-scores { | ||
font-size: smaller; | ||
color: gray; | ||
font-family: monospace; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.25rem; | ||
&.horizontal { | ||
flex-direction: row; | ||
} | ||
} | ||
.row-score-item { | ||
display: flex; | ||
flex-direction: row; | ||
gap: 0.5rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.