feat: introducing i18n support to admin dashboard (#3051)
This commit is contained in:
committed by
GitHub
parent
b07243f131
commit
331d482b22
@@ -25,7 +25,7 @@
|
||||
|
||||
<div class="py-8">
|
||||
<HoppSmartTabs v-model="selectedOptionTab" render-inactive-tabs>
|
||||
<HoppSmartTab :id="'details'" label="Details">
|
||||
<HoppSmartTab :id="'details'" :label="t('teams.details')">
|
||||
<TeamsDetails
|
||||
:team="team"
|
||||
:teamName="teamName"
|
||||
@@ -35,17 +35,17 @@
|
||||
class="py-8 px-4"
|
||||
/>
|
||||
</HoppSmartTab>
|
||||
<HoppSmartTab :id="'members'" label="Members">
|
||||
<HoppSmartTab :id="'members'" :label="t('teams.team_members')">
|
||||
<TeamsMembers @update-team="updateTeam()" class="py-8 px-4" />
|
||||
</HoppSmartTab>
|
||||
<HoppSmartTab :id="'invites'" label="Invites">
|
||||
<HoppSmartTab :id="'invites'" :label="t('teams.invites')">
|
||||
<TeamsPendingInvites :editingTeamID="team.id" class="py-8 px-4" />
|
||||
</HoppSmartTab>
|
||||
</HoppSmartTabs>
|
||||
|
||||
<HoppSmartConfirmModal
|
||||
:show="confirmDeletion"
|
||||
:title="`Confirm Deletion of ${team.name} team?`"
|
||||
:title="t('teams.confirm_team_deletion')"
|
||||
@hide-modal="confirmDeletion = false"
|
||||
@resolve="deleteTeamMutation(deleteTeamUID)"
|
||||
/>
|
||||
@@ -58,7 +58,7 @@
|
||||
import { useClientHandle, useMutation } from '@urql/vue';
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useToast } from '../../composables/toast';
|
||||
import { useToast } from '~/composables/toast';
|
||||
import {
|
||||
RemoveTeamDocument,
|
||||
RenameTeamDocument,
|
||||
@@ -67,6 +67,9 @@ import {
|
||||
TeamInfoQuery,
|
||||
} from '../../helpers/backend/graphql';
|
||||
import { HoppSmartTabs } from '@hoppscotch/ui';
|
||||
import { useI18n } from '~/composables/i18n';
|
||||
|
||||
const t = useI18n();
|
||||
|
||||
const toast = useToast();
|
||||
|
||||
@@ -77,11 +80,11 @@ const selectedOptionTab = ref<OptionTabs>('details');
|
||||
const currentTabName = computed(() => {
|
||||
switch (selectedOptionTab.value) {
|
||||
case 'details':
|
||||
return 'Team details';
|
||||
return t('teams.team_details');
|
||||
case 'members':
|
||||
return 'Team members';
|
||||
return t('teams.team_members_tab');
|
||||
case 'invites':
|
||||
return 'Pending invites';
|
||||
return t('teams.pending_invites');
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
@@ -100,7 +103,7 @@ const getTeamInfo = async () => {
|
||||
.query(TeamInfoDocument, { teamID: route.params.id.toString() })
|
||||
.toPromise();
|
||||
if (result.error) {
|
||||
return toast.error('Unable to load team info..');
|
||||
return toast.error(`${t('team.load_info_error')}`);
|
||||
}
|
||||
if (result.data?.admin.teamInfo) {
|
||||
team.value = result.data.admin.teamInfo;
|
||||
@@ -127,12 +130,12 @@ const renameTeamName = async (teamName: string) => {
|
||||
const variables = { uid: team.value.id, name: teamName };
|
||||
await teamRename.executeMutation(variables).then((result) => {
|
||||
if (result.error) {
|
||||
toast.error('Failed to rename team!!');
|
||||
toast.error(`${t('state.rename_team_failure')}`);
|
||||
} else {
|
||||
showRenameInput.value = false;
|
||||
if (team.value) {
|
||||
team.value.name = teamName;
|
||||
toast.success('Team renamed successfully!!');
|
||||
toast.success(`${t('state.rename_team_success')}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -152,15 +155,15 @@ const deleteTeam = (id: string) => {
|
||||
const deleteTeamMutation = async (id: string | null) => {
|
||||
if (!id) {
|
||||
confirmDeletion.value = false;
|
||||
toast.error('Team deletion failed!!');
|
||||
toast.error(`${t('state.delete_team_failure')}`);
|
||||
return;
|
||||
}
|
||||
const variables = { uid: id };
|
||||
await teamDeletion.executeMutation(variables).then((result) => {
|
||||
if (result.error) {
|
||||
toast.error('Team deletion failed!!');
|
||||
toast.error(`${t('state.delete_team_failure')}`);
|
||||
} else {
|
||||
toast.success('Team deleted successfully!!');
|
||||
toast.success(`${t('state.delete_team_success')}`);
|
||||
}
|
||||
});
|
||||
confirmDeletion.value = false;
|
||||
|
||||
Reference in New Issue
Block a user