From 880805b080e828d4398d2795610ffcc4c2e31585 Mon Sep 17 00:00:00 2001 From: MiniDigger Date: Thu, 11 Feb 2021 13:37:06 +0100 Subject: [PATCH] linkout + some i18n --- frontend/locales/en.ts | 15 +++++++++++++++ frontend/pages/_author/_slug.vue | 3 +-- frontend/pages/_author/index.vue | 20 ++++++++------------ frontend/pages/index.vue | 9 ++------- frontend/pages/linkout.vue | 23 +++++++++++++++++++---- frontend/plugins/utils.ts | 2 +- frontend/types/internal/data.d.ts | 5 +++++ 7 files changed, 51 insertions(+), 26 deletions(-) diff --git a/frontend/locales/en.ts b/frontend/locales/en.ts index 525c4710..421a3897 100644 --- a/frontend/locales/en.ts +++ b/frontend/locales/en.ts @@ -245,6 +245,21 @@ const msgs: LocaleMessageObject = { softDelete: 'Project deleted by {0}', }, }, + author: { + watching: 'Watching', + stars: 'Stars', + orgs: 'Organizations', + viewOnForums: 'View on forums ', + memberSince: 'A member since {}', + numProjects: '{0} project(s)', + addTagline: 'Add a tagline', + }, + linkout: { + title: 'External Link Warning', + text: 'You have clicked on an external link to "{0}". If you did not intend to visit this link, please go back. Otherwise, click continue.', + abort: 'Go Back', + continue: 'Continue', + }, message: 'Good morning!', }; diff --git a/frontend/pages/_author/_slug.vue b/frontend/pages/_author/_slug.vue index d40ad90f..0b950950 100644 --- a/frontend/pages/_author/_slug.vue +++ b/frontend/pages/_author/_slug.vue @@ -93,8 +93,7 @@ v-for="tab in tabs" :key="tab.title" :exact="!!tab.exact" - :to="tab.external ? undefined : tab.link" - :href="tab.external ? tab.link : undefined" + :to="tab.external ? '/linkout?remoteUrl=' + tab.link : tab.link" :nuxt="!tab.external" > {{ tab.icon }} diff --git a/frontend/pages/_author/index.vue b/frontend/pages/_author/index.vue index a9ffaba6..e95355f5 100644 --- a/frontend/pages/_author/index.vue +++ b/frontend/pages/_author/index.vue @@ -19,7 +19,7 @@ - + mdi-pencil @@ -28,10 +28,9 @@ - - {{ user.projectCount }} project(s) - A member since {{ $util.prettyDate(user.joinDate) }} - View on forums mdi-open-in-new + {{ $t('author.numProjects', [user.projectCount]) }} + {{ $t('author.memberSince', [$util.prettyDate(user.joinDate)]) }} + {{ $t('author.viewForums') }}mdi-open-in-new @@ -41,18 +40,15 @@ - - Organizations + {{ $t('author.orgs') }} - - Stars + {{ $t('author.stars') }} - - Watching + {{ $t('author.watching') }} @@ -66,7 +62,7 @@ import { PaginatedResult, Project } from 'hangar-api'; import { Context } from '@nuxt/types'; import { HangarUser } from 'hangar-internal'; import UserAvatar from '~/components/UserAvatar.vue'; -import ProjectList from '~/components/ProjectList.vue'; +import ProjectList from '~/components/projects/ProjectList.vue'; interface Button { icon: String; diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue index 9529b95f..f08742e9 100644 --- a/frontend/pages/index.vue +++ b/frontend/pages/index.vue @@ -59,15 +59,10 @@ diff --git a/frontend/plugins/utils.ts b/frontend/plugins/utils.ts index 6b7fc8e4..d6439be0 100644 --- a/frontend/plugins/utils.ts +++ b/frontend/plugins/utils.ts @@ -159,7 +159,7 @@ const createUtil = ({ store, error }: Context) => { }); console.log(err); } else if (err.response) { - // TODO check is msg is a i18n key and use that instead + // TODO check is msg is a i18n key and use that instead (use $te to check existence of a key) if (err.response.data.isHangarApiException) { const data: HangarApiException = err.response.data; store.dispatch('snackbar/SHOW_NOTIF', { diff --git a/frontend/types/internal/data.d.ts b/frontend/types/internal/data.d.ts index 658e9c9a..4cd4cec5 100644 --- a/frontend/types/internal/data.d.ts +++ b/frontend/types/internal/data.d.ts @@ -22,4 +22,9 @@ declare module 'hangar-internal' { name: string; hex: string; } + + interface Platform { + icon: string; + text: string; + } }