Skip to content

Commit fd1604d

Browse files
authored
[dashboard] imporved workspace entry layout (#20016)
1 parent fbc0d76 commit fd1604d

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

components/dashboard/src/components/ItemsList.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,19 @@ export function ItemsList(props: { children?: React.ReactNode; className?: strin
1111
}
1212

1313
export function Item(props: { children?: React.ReactNode; className?: string; header?: boolean; solid?: boolean }) {
14+
let layoutClassName = "flex flex-grow flex-row justify-between";
15+
// set layoutClassName to "" if className contains 'grid'
16+
if (props.className?.includes("grid")) {
17+
layoutClassName = "";
18+
}
19+
1420
// cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700
1521
const solidClassName = props.solid ? "bg-gray-100 dark:bg-gray-800" : "hover:bg-gray-100 dark:hover:bg-gray-800";
1622
const headerClassName = "text-sm text-gray-400 border-t border-b border-gray-200 dark:border-gray-800";
1723
const notHeaderClassName = "rounded-xl focus:bg-kumquat-light " + solidClassName;
1824
return (
1925
<div
20-
className={`flex flex-grow flex-row w-full p-3 justify-between transition ease-in-out ${
26+
className={`${layoutClassName} w-full p-3 transition ease-in-out ${
2127
props.header ? headerClassName : notHeaderClassName
2228
} ${props.className || ""}`}
2329
>
@@ -44,7 +50,7 @@ export function ItemFieldContextMenu(props: {
4450

4551
return (
4652
<div
47-
className={`flex hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md cursor-pointer w-8 ${cls} ${
53+
className={`flex hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md cursor-pointer min-w-8 w-8 ${cls} ${
4854
props.className || ""
4955
}`}
5056
>

components/dashboard/src/workspaces/WorkspaceEntry.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,15 @@ export const WorkspaceEntry: FunctionComponent<Props> = ({ info, shortVersion })
5656
[workspace.id],
5757
);
5858

59+
let gridCol =
60+
"grid-cols-[minmax(32px,32px),minmax(100px,auto),minmax(100px,300px),minmax(80px,160px),minmax(32px,32px),minmax(32px,32px)]";
61+
if (shortVersion) {
62+
gridCol = "grid-cols-[minmax(32px,32px),minmax(100px,auto)]";
63+
}
64+
5965
return (
60-
<Item className="whitespace-nowrap py-6" solid={menuActive}>
61-
<ItemFieldIcon>
66+
<Item className={`whitespace-nowrap py-6 px-4 gap-3 grid ${gridCol}`} solid={menuActive}>
67+
<ItemFieldIcon className="min-w-8">
6268
<WorkspaceStatusIndicator status={workspace?.status} />
6369
</ItemFieldIcon>
6470
<div className="flex-grow flex flex-col h-full py-auto truncate">
@@ -77,7 +83,7 @@ export const WorkspaceEntry: FunctionComponent<Props> = ({ info, shortVersion })
7783
</div>
7884
{!shortVersion && (
7985
<>
80-
<div className="w-2/12 sm:w-3/12 xl:w-4/12 flex flex-col xl:flex-row xl:items-center xl:gap-6 justify-between px-1 md:px-3">
86+
<div className="flex flex-col justify-between">
8187
<div className="text-gray-500 dark:text-gray-400 flex flex-row gap-1 items-center overflow-hidden">
8288
<div className="min-w-4">
8389
<GitBranchIcon className="h-4 w-4" />
@@ -86,14 +92,11 @@ export const WorkspaceEntry: FunctionComponent<Props> = ({ info, shortVersion })
8692
{currentBranch}
8793
</Tooltip>
8894
</div>
89-
<div className="mr-auto xl:hidden">
95+
<div className="mr-auto">
9096
<PendingChangesDropdown gitStatus={gitStatus} />
9197
</div>
9298
</div>
93-
<div className="hidden xl:flex xl:items-center xl:min-w-46">
94-
<PendingChangesDropdown gitStatus={gitStatus} />
95-
</div>
96-
<div className="px-1 md:px-3 flex items-center min-w-96 w-28 lg:w-44 text-right">
99+
<div className="flex items-center">
97100
<Tooltip
98101
content={`Last Activate ${dayjs(
99102
info.status!.phase!.lastTransitionTime!.toDate(),
@@ -105,7 +108,7 @@ export const WorkspaceEntry: FunctionComponent<Props> = ({ info, shortVersion })
105108
</div>
106109
</Tooltip>
107110
</div>
108-
<div className="px-1 md:px-3 flex items-center">
111+
<div className="min-w-8 flex items-center">
109112
<div
110113
onClick={togglePinned}
111114
className={

0 commit comments

Comments
 (0)