Skip to content

Commit

Permalink
extract showTags v-ifs into computed booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasongg committed Apr 15, 2024
1 parent 0e177cb commit 875c335
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions frontend/src/components/c-summary-charts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
) {{ getPercentile(i) }} %&nbsp
span.tooltip-text.right-aligned {{ getPercentileExplanation(i) }}
.summary-charts__title--tags(
v-if="filterGroupSelection === 'groupByRepos' && viewRepoTags"
v-if="isViewingTagsByRepo"
)
a.tag(
v-for="tag in getTags(repo)",
Expand Down Expand Up @@ -270,10 +270,7 @@
v-if="filterGroupSelection === 'groupByNone' && sortGroupSelection.includes('totalCommits')"
) {{ getPercentile(j) }} %&nbsp
span.tooltip-text.right-aligned {{ getPercentileExplanation(j) }}
.summary-chart__title--tags(
v-if="(filterGroupSelection === 'groupByAuthors' || filterGroupSelection === 'groupByNone')\
&& viewRepoTags"
)
.summary-chart__title--tags(v-if="isViewingTagsByAuthor")
a.tag(
v-for="tag in getTags(repo, user)",
v-bind:href="getTagLink(repo[0], tag)",
Expand Down Expand Up @@ -440,6 +437,14 @@ export default defineComponent({
isChartWidgetMode() {
return this.chartIndex !== undefined && this.chartIndex >= 0 && this.isChartGroupWidgetMode;
},
isViewingTagsByRepo() {
return this.filterGroupSelection === FilterGroupSelection.GroupByRepos && this.viewRepoTags;
},
isViewingTagsByAuthor() {
return (this.filterGroupSelection === FilterGroupSelection.GroupByAuthors
|| this.filterGroupSelection === FilterGroupSelection.GroupByNone)
&& this.viewRepoTags;
},
...mapState({
mergedGroups: (state: unknown) => (state as StoreState).mergedGroups,
fileTypeColors: (state: unknown) => (state as StoreState).fileTypeColors,
Expand Down

0 comments on commit 875c335

Please sign in to comment.