Skip to content

Commit

Permalink
fix: add missing translations
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuseduardomedeiros committed Sep 20, 2024
1 parent c20c60e commit 4048edf
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/components/insights/widgets/TableGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<section class="table-group">
<UnnnicTab
:tabs="tabsName"
:activeTab="activeTab.name"
@change="activeTabName = $event"
:activeTab="$t(activeTab.name)"
@change="changeActiveTabName"
>
<template
v-for="tab in tabs"
#[`tab-head-${tab.name}`]
:key="`tab-head-${tab.name}`"
#[`tab-head-${$t(tab.name)}`]
:key="`tab-head-${$t(tab.name)}`"
/>
<template
v-for="tab in tabs"
#[`tab-panel-${tab.name}`]
:key="`tab-panel-${tab.name}`"
#[`tab-panel-${$t(tab.name)}`]
:key="`tab-panel-${$t(tab.name)}`"
>
<UnnnicTableNext
v-if="activeTable.headers"
Expand Down Expand Up @@ -77,13 +77,15 @@ export default {
computed: {
tabsName() {
const tabsValues = Object.values(this.tabs);
return tabsValues?.map((mappedConfig) => mappedConfig.name);
return tabsValues?.map((mappedConfig) => this.$t(mappedConfig.name));
},
activeTab() {
const tabsEntries = Object.entries(this.tabs);
const activeTab =
tabsEntries.find(([_key, tab]) => tab.name === this.activeTabName) ||
tabsEntries.find(([_key, tab]) => tab.is_default);
tabsEntries.find(
([_key, tab]) => this.$t(tab.name) === this.activeTabName,
) || tabsEntries.find(([_key, tab]) => tab.is_default);
if (activeTab) {
const [key, tab] = activeTab;
Expand Down Expand Up @@ -127,7 +129,7 @@ export default {
const dynamicHeaders = activeTab?.fields
?.filter((field) => field.display && !field.hidden_name)
.map((field) => ({ content: field.name, value: field.value }));
.map((field) => ({ content: this.$t(field.name), value: field.value }));
const dynamicRows = data.map((row) => {
const content = dynamicHeaders.map((header) =>
Expand All @@ -151,15 +153,10 @@ export default {
},
watch: {
['$route.query']() {
'$route.query'() {
this.page = 0;
this.emitRequestData();
},
activeTab(newActiveTab) {
if (this.activeTabName !== newActiveTab.name) {
this.activeTabName = newActiveTab.name;
}
},
async activeTabName() {
const { $route } = this;
Expand Down Expand Up @@ -190,6 +187,9 @@ export default {
},
methods: {
changeActiveTabName(newActiveTabName) {
this.activeTabName = newActiveTabName;
},
emitRequestData() {
const { offset, limit } = this.paginationConfig;
this.$emit('request-data', { offset, limit });
Expand Down

0 comments on commit 4048edf

Please sign in to comment.