From 7239158e7f868b6239878d0e81854327559caa4b Mon Sep 17 00:00:00 2001 From: lemmyMwaura Date: Mon, 29 Jul 2024 19:37:19 +0300 Subject: [PATCH] refactor: localize tabs at both the org and project level --- frontend/src/types/TabSections.ts | 13 ------------- frontend/src/views/Org/types/TabSections.ts | 11 +++++++++++ frontend/src/{ => views/Org}/types/index.ts | 0 frontend/src/views/Project/types/TabSections.ts | 11 +++++++++++ frontend/src/views/Project/types/index.ts | 3 +++ 5 files changed, 25 insertions(+), 13 deletions(-) delete mode 100644 frontend/src/types/TabSections.ts create mode 100644 frontend/src/views/Org/types/TabSections.ts rename frontend/src/{ => views/Org}/types/index.ts (100%) create mode 100644 frontend/src/views/Project/types/TabSections.ts create mode 100644 frontend/src/views/Project/types/index.ts diff --git a/frontend/src/types/TabSections.ts b/frontend/src/types/TabSections.ts deleted file mode 100644 index ef49919bc..000000000 --- a/frontend/src/types/TabSections.ts +++ /dev/null @@ -1,13 +0,0 @@ -enum TabSections { - Member = "members", - Roles = "roles", - Groups = "groups", - Identities = "identities", - ServiceTokens = "service-tokens" -} - -const isTabSection = (value: any): value is TabSections => { - return Object.values(TabSections).includes(value); -} - -export { TabSections, isTabSection } diff --git a/frontend/src/views/Org/types/TabSections.ts b/frontend/src/views/Org/types/TabSections.ts new file mode 100644 index 000000000..ffc93587e --- /dev/null +++ b/frontend/src/views/Org/types/TabSections.ts @@ -0,0 +1,11 @@ +export enum TabSections { + Member = "members", + Roles = "roles", + Groups = "groups", + Identities = "identities", + ServiceTokens = "service-tokens" +} + +export const isTabSection = (value: string): value is TabSections => { + return (Object.values(TabSections) as string[]).includes(value); +} diff --git a/frontend/src/types/index.ts b/frontend/src/views/Org/types/index.ts similarity index 100% rename from frontend/src/types/index.ts rename to frontend/src/views/Org/types/index.ts diff --git a/frontend/src/views/Project/types/TabSections.ts b/frontend/src/views/Project/types/TabSections.ts new file mode 100644 index 000000000..ffc93587e --- /dev/null +++ b/frontend/src/views/Project/types/TabSections.ts @@ -0,0 +1,11 @@ +export enum TabSections { + Member = "members", + Roles = "roles", + Groups = "groups", + Identities = "identities", + ServiceTokens = "service-tokens" +} + +export const isTabSection = (value: string): value is TabSections => { + return (Object.values(TabSections) as string[]).includes(value); +} diff --git a/frontend/src/views/Project/types/index.ts b/frontend/src/views/Project/types/index.ts new file mode 100644 index 000000000..76f47c6f2 --- /dev/null +++ b/frontend/src/views/Project/types/index.ts @@ -0,0 +1,3 @@ +import { TabSections, isTabSection } from "./TabSections"; + +export { TabSections, isTabSection };