Skip to content

Commit

Permalink
♻️ [#390] Remove unused fields frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Oct 1, 2024
1 parent 89bc829 commit 673b46f
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 25 deletions.
3 changes: 0 additions & 3 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ function App() {
{user?.firstName} {user?.lastName}
</P>
</Column>
<Column span={12}>
<P>{user?.role.name}</P>
</Column>
<Column span={12}>
<P muted>{user?.email}</P>
</Column>
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/fixtures/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Role>(FIXTURE_ROLE);

Expand All @@ -26,11 +24,9 @@ const FIXTURE_RECORD_MANAGER: User = {
lastName: "Manager",
email: "[email protected]",
role: {
name: "recordmanager",
canStartDestruction: true,
canReviewDestruction: false,
canReviewFinalList: false,
canViewCaseDetails: false,
},
};

Expand All @@ -41,11 +37,9 @@ const FIXTURE_BEOORDELAAR: User = {
lastName: "del Laar",
email: "[email protected]",
role: {
name: "beoordelaar",
canStartDestruction: false,
canReviewDestruction: true,
canReviewFinalList: false,
canViewCaseDetails: false,
},
};

Expand All @@ -56,11 +50,9 @@ const FIXTURE_PROCES_EIGENAAR: User = {
lastName: "ei Genaar",
email: "[email protected]",
role: {
name: "proceseigenaar",
canStartDestruction: false,
canReviewDestruction: true,
canReviewFinalList: false,
canViewCaseDetails: false,
},
};

Expand Down
2 changes: 0 additions & 2 deletions frontend/src/lib/api/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ export type User = {
};

export type Role = {
name: string;
canStartDestruction: boolean;
canReviewDestruction: boolean;
canReviewFinalList: boolean;
canViewCaseDetails: boolean;
};

/**
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/lib/format/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ const meta: Meta<typeof DestructionListCreatePage> = {
lastName: "Doe",
email: "[email protected]",
role: {
name: "Admin",
canStartDestruction: true,
canReviewDestruction: true,
canReviewFinalList: false,
canViewCaseDetails: true,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ export function DestructionListToolbar({ title }: DestructionListToolbarProps) {
<Column span={3}>
<AttributeTable
object={{
"Laatste review door":
review.author && formatUser(review.author, { showRole: true }),
"Laatste review door": review.author && formatUser(review.author),
Opmerking: review.listFeedback,
Beoordeling: (
<Badge level={REVIEW_DECISION_LEVEL_MAPPING[review.decision]}>
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/pages/landing/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ export const Landing = () => {
&nbsp;
{formatUser(currentAssignee, {
showUsername: false,
showRole: false,
})}
{otherAssignees.length && (
<strong className="LandingPage__assignees-count">
Expand All @@ -186,9 +185,7 @@ export const Landing = () => {
timeAgo: timeAgo(list.created),
assignees: otherAssignees.length ? (
<Tooltip
content={otherAssignees
.map((a) => formatUser(a.user, { showRole: true }))
.join(", ")}
content={otherAssignees.map((a) => formatUser(a.user)).join(", ")}
placement="bottom"
>
<span>{footer}</span>
Expand Down

0 comments on commit 673b46f

Please sign in to comment.