Skip to content

Commit ad3af96

Browse files
💄 - style: implement landing page design more strictly
1 parent 92d6f22 commit ad3af96

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

frontend/src/pages/destructionlist/utils.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,16 @@ export async function updateSelectedZaken(
2727
/**
2828
* Returns the correct format for a user.
2929
* @param user
30+
* @param showRole
3031
*/
31-
export function formatUser(user: User) {
32-
if (user.firstName && user.lastName)
33-
return `${user.firstName} ${user.lastName} (${user.username})`;
34-
return user.username;
32+
export function formatUser(user: User, showRole = false) {
33+
const displayName =
34+
user.firstName && user.lastName
35+
? `${user.firstName} ${user.lastName} (${user.username})`
36+
: user.username;
37+
38+
if (showRole && user.role.name) {
39+
return `${displayName} (${user.role.name})`;
40+
}
41+
return displayName;
3542
}
+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
.LandingPage {
2-
/* Rules here. */
1+
.LandingPage__assignees-count {
2+
color: var(--page-color-primary);
3+
font-weight: var(--typography-font-weight-bold);
34
}

frontend/src/pages/landing/Landing.tsx

+11-4
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,18 @@ export const Landing = () => {
111111

112112
const objectLists: AttributeData[][] = Object.values(statusMap).map((lists) =>
113113
lists.map((list) => {
114-
const firstAssignee = list.assignees[0];
114+
const currentAssignee = list.assignee;
115115
const otherAssignees = [...list.assignees].splice(1);
116116

117117
const footer = (
118118
<P muted size="xs">
119-
{formatUser(firstAssignee.user)}
120-
{otherAssignees.length && <strong> +{otherAssignees.length}</strong>}
119+
{formatUser(currentAssignee, true)}
120+
{otherAssignees.length && (
121+
<strong className="LandingPage__assignees-count">
122+
{" "}
123+
+{otherAssignees.length}
124+
</strong>
125+
)}
121126
</P>
122127
);
123128

@@ -128,7 +133,9 @@ export const Landing = () => {
128133
timeAgo: timeAgo(list.created),
129134
assignees: otherAssignees.length ? (
130135
<Tooltip
131-
content={otherAssignees.map((a) => formatUser(a.user)).join(", ")}
136+
content={otherAssignees
137+
.map((a) => formatUser(a.user, true))
138+
.join(", ")}
132139
placement="top"
133140
>
134141
<span>{footer}</span>

0 commit comments

Comments
 (0)