From 673b46f02ab850f56f0fc5304bef1de8efb5afa6 Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Tue, 1 Oct 2024 14:35:27 +0200 Subject: [PATCH] :recycle: [#390] Remove unused fields frontend --- frontend/src/App.tsx | 3 --- frontend/src/fixtures/user.ts | 8 -------- frontend/src/lib/api/auth.ts | 2 -- frontend/src/lib/format/user.ts | 5 +---- .../create/DestructionListCreate.stories.tsx | 2 -- .../DestructionListToolbar/DestructionListToolbar.tsx | 3 +-- frontend/src/pages/landing/Landing.tsx | 5 +---- 7 files changed, 3 insertions(+), 25 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index e7b9230d4..b0ca5e142 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -126,9 +126,6 @@ function App() { {user?.firstName} {user?.lastName}

- -

{user?.role.name}

-

{user?.email}

diff --git a/frontend/src/fixtures/user.ts b/frontend/src/fixtures/user.ts index 43dcf67dd..b3337f0fa 100644 --- a/frontend/src/fixtures/user.ts +++ b/frontend/src/fixtures/user.ts @@ -2,11 +2,9 @@ import { Role, User } from "../lib/api/auth"; import { createArrayFactory, createObjectFactory } from "./factory"; const FIXTURE_ROLE = { - name: "Test Role", canStartDestruction: false, canReviewDestruction: false, canReviewFinalList: false, - canViewCaseDetails: true, }; export const roleFactory = createObjectFactory(FIXTURE_ROLE); @@ -26,11 +24,9 @@ const FIXTURE_RECORD_MANAGER: User = { lastName: "Manager", email: "recordmanager@example.com", role: { - name: "recordmanager", canStartDestruction: true, canReviewDestruction: false, canReviewFinalList: false, - canViewCaseDetails: false, }, }; @@ -41,11 +37,9 @@ const FIXTURE_BEOORDELAAR: User = { lastName: "del Laar", email: "beoordelaar@example.com", role: { - name: "beoordelaar", canStartDestruction: false, canReviewDestruction: true, canReviewFinalList: false, - canViewCaseDetails: false, }, }; @@ -56,11 +50,9 @@ const FIXTURE_PROCES_EIGENAAR: User = { lastName: "ei Genaar", email: "proceseigenaar@example.com", role: { - name: "proceseigenaar", canStartDestruction: false, canReviewDestruction: true, canReviewFinalList: false, - canViewCaseDetails: false, }, }; diff --git a/frontend/src/lib/api/auth.ts b/frontend/src/lib/api/auth.ts index 85d11d36b..86d37a79b 100644 --- a/frontend/src/lib/api/auth.ts +++ b/frontend/src/lib/api/auth.ts @@ -11,11 +11,9 @@ export type User = { }; export type Role = { - name: string; canStartDestruction: boolean; canReviewDestruction: boolean; canReviewFinalList: boolean; - canViewCaseDetails: boolean; }; /** diff --git a/frontend/src/lib/format/user.ts b/frontend/src/lib/format/user.ts index f294f0447..04ecede8f 100644 --- a/frontend/src/lib/format/user.ts +++ b/frontend/src/lib/format/user.ts @@ -6,10 +6,7 @@ import { User } from "../api/auth"; * @param showUsername * @param showRole */ -export function formatUser( - user: User, - { showUsername = true, showRole = false } = {}, -) { +export function formatUser(user: User, { showUsername = true } = {}) { if (!user) { return ""; } diff --git a/frontend/src/pages/destructionlist/create/DestructionListCreate.stories.tsx b/frontend/src/pages/destructionlist/create/DestructionListCreate.stories.tsx index ac42d7bea..e74e01d6b 100644 --- a/frontend/src/pages/destructionlist/create/DestructionListCreate.stories.tsx +++ b/frontend/src/pages/destructionlist/create/DestructionListCreate.stories.tsx @@ -57,11 +57,9 @@ const meta: Meta = { lastName: "Doe", email: "aaa@aaa.aaa", role: { - name: "Admin", canStartDestruction: true, canReviewDestruction: true, canReviewFinalList: false, - canViewCaseDetails: true, }, }, }, diff --git a/frontend/src/pages/destructionlist/detail/components/DestructionListToolbar/DestructionListToolbar.tsx b/frontend/src/pages/destructionlist/detail/components/DestructionListToolbar/DestructionListToolbar.tsx index b49a51723..681c3bba6 100644 --- a/frontend/src/pages/destructionlist/detail/components/DestructionListToolbar/DestructionListToolbar.tsx +++ b/frontend/src/pages/destructionlist/detail/components/DestructionListToolbar/DestructionListToolbar.tsx @@ -95,8 +95,7 @@ export function DestructionListToolbar({ title }: DestructionListToolbarProps) { diff --git a/frontend/src/pages/landing/Landing.tsx b/frontend/src/pages/landing/Landing.tsx index 945b6c7db..276008ae8 100644 --- a/frontend/src/pages/landing/Landing.tsx +++ b/frontend/src/pages/landing/Landing.tsx @@ -166,7 +166,6 @@ export const Landing = () => {   {formatUser(currentAssignee, { showUsername: false, - showRole: false, })} {otherAssignees.length && ( @@ -186,9 +185,7 @@ export const Landing = () => { timeAgo: timeAgo(list.created), assignees: otherAssignees.length ? ( formatUser(a.user, { showRole: true })) - .join(", ")} + content={otherAssignees.map((a) => formatUser(a.user)).join(", ")} placement="bottom" > {footer}