From 78cca76d48d712d68e08e0bdaf5ce9d2f8f8b40f Mon Sep 17 00:00:00 2001 From: Charlie Park Date: Tue, 29 Apr 2025 11:50:12 -0400 Subject: [PATCH 01/10] Add EmptyRow component to MiniTable --- .../form/fields/DisksTableField.tsx | 36 +++++++++++-------- app/ui/lib/MiniTable.tsx | 19 ++++++++++ 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/app/components/form/fields/DisksTableField.tsx b/app/components/form/fields/DisksTableField.tsx index 6134b505f3..390c915a8f 100644 --- a/app/components/form/fields/DisksTableField.tsx +++ b/app/components/form/fields/DisksTableField.tsx @@ -46,17 +46,17 @@ export function DisksTableField({ return ( <>
- {!!items.length && ( - - - Name - Type - Size - {/* For remove button */} - - - - {items.map((item, index) => ( + + + Name + Type + Size + {/* For remove button */} + + + + {items.length ? ( + items.map((item, index) => ( - ))} - - - )} + )) + ) : ( + + )} + +
)} - { ) } -export const EmptyState = (props: { title: string; body: string; columnCount: number }) => ( +export const EmptyState = (props: { title: string; body: string; colSpan: number }) => ( - +
From 8bcf86123864caa81fc65d3aab604f158cc60f42 Mon Sep 17 00:00:00 2001 From: Charlie Park Date: Fri, 6 Jun 2025 10:44:14 -0700 Subject: [PATCH 09/10] small refactors --- app/components/form/fields/DisksTableField.tsx | 2 +- app/forms/firewall-rules-common.tsx | 2 +- app/ui/styles/components/mini-table.css | 16 ++++++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/components/form/fields/DisksTableField.tsx b/app/components/form/fields/DisksTableField.tsx index 256d02c93f..13caaada6b 100644 --- a/app/components/form/fields/DisksTableField.tsx +++ b/app/components/form/fields/DisksTableField.tsx @@ -67,7 +67,7 @@ export function DisksTableField({ - {item.type} + {item.type} {item.type === 'attach' ? ( diff --git a/app/forms/firewall-rules-common.tsx b/app/forms/firewall-rules-common.tsx index 809799b722..aefc29fb11 100644 --- a/app/forms/firewall-rules-common.tsx +++ b/app/forms/firewall-rules-common.tsx @@ -235,7 +235,7 @@ const TargetAndHostFilterSubform = ({ key={`${type}|${value}`} > - {type} + {type} {value} div > button { - @apply flex items-center justify-center text-tertiary; + @apply -m-2 flex items-center justify-center p-2 text-tertiary; } & td:last-child > div:has(button:hover, button:focus) { @apply text-default; From fc6fb4b72b8680897ff45d37dee190eca542bb31 Mon Sep 17 00:00:00 2001 From: Charlie Park Date: Mon, 9 Jun 2025 10:35:34 -0700 Subject: [PATCH 10/10] review tweaks --- app/components/form/fields/DisksTableField.tsx | 3 ++- app/ui/styles/components/mini-table.css | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/components/form/fields/DisksTableField.tsx b/app/components/form/fields/DisksTableField.tsx index 13caaada6b..6a78ce9f6a 100644 --- a/app/components/form/fields/DisksTableField.tsx +++ b/app/components/form/fields/DisksTableField.tsx @@ -13,6 +13,7 @@ import type { DiskCreate } from '@oxide/api' import { AttachDiskModalForm } from '~/forms/disk-attach' import { CreateDiskSideModalForm } from '~/forms/disk-create' import type { InstanceCreateInput } from '~/forms/instance-create' +import { EmptyCell } from '~/table/cells/EmptyCell' import { Badge } from '~/ui/lib/Badge' import { Button } from '~/ui/lib/Button' import * as MiniTable from '~/ui/lib/MiniTable' @@ -71,7 +72,7 @@ export function DisksTableField({ {item.type === 'attach' ? ( - '—' + ) : ( <> {bytesToGiB(item.size)} diff --git a/app/ui/styles/components/mini-table.css b/app/ui/styles/components/mini-table.css index a663275428..5bbcc717bc 100644 --- a/app/ui/styles/components/mini-table.css +++ b/app/ui/styles/components/mini-table.css @@ -54,10 +54,7 @@ /* the delete button */ & td:last-child > div > button { - @apply -m-2 flex items-center justify-center p-2 text-tertiary; - } - & td:last-child > div:has(button:hover, button:focus) { - @apply text-default; + @apply -m-2 flex items-center justify-center p-2 text-tertiary hover:text-secondary focus:text-secondary; } & tr:last-child td {