refactor(tui): style console org account headers
This commit is contained in:
parent
8922a77e93
commit
d0ef2b2ade
2 changed files with 19 additions and 3 deletions
|
|
@ -3,6 +3,7 @@ import { DialogSelect } from "@tui/ui/dialog-select"
|
||||||
import { useSDK } from "@tui/context/sdk"
|
import { useSDK } from "@tui/context/sdk"
|
||||||
import { useDialog } from "@tui/ui/dialog"
|
import { useDialog } from "@tui/ui/dialog"
|
||||||
import { useToast } from "@tui/ui/toast"
|
import { useToast } from "@tui/ui/toast"
|
||||||
|
import { useTheme } from "@tui/context/theme"
|
||||||
|
|
||||||
type OrgOption = {
|
type OrgOption = {
|
||||||
accountID: string
|
accountID: string
|
||||||
|
|
@ -28,6 +29,7 @@ export function DialogConsoleOrg() {
|
||||||
const sdk = useSDK()
|
const sdk = useSDK()
|
||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
const { theme } = useTheme()
|
||||||
|
|
||||||
const [orgs] = createResource(async () => {
|
const [orgs] = createResource(async () => {
|
||||||
const result = await sdk.client.experimental.console.listOrgs({}, { throwOnError: true })
|
const result = await sdk.client.experimental.console.listOrgs({}, { throwOnError: true })
|
||||||
|
|
@ -73,6 +75,12 @@ export function DialogConsoleOrg() {
|
||||||
title: item.orgName,
|
title: item.orgName,
|
||||||
value: item,
|
value: item,
|
||||||
category: accountLabel(item),
|
category: accountLabel(item),
|
||||||
|
categoryView: (
|
||||||
|
<box flexDirection="row" gap={2}>
|
||||||
|
<text fg={theme.accent}>{item.accountEmail}</text>
|
||||||
|
<text fg={theme.textMuted}>{accountHost(item.accountUrl)}</text>
|
||||||
|
</box>
|
||||||
|
),
|
||||||
onSelect: async () => {
|
onSelect: async () => {
|
||||||
if (item.active) {
|
if (item.active) {
|
||||||
dialog.clear()
|
dialog.clear()
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ export interface DialogSelectOption<T = any> {
|
||||||
description?: string
|
description?: string
|
||||||
footer?: JSX.Element | string
|
footer?: JSX.Element | string
|
||||||
category?: string
|
category?: string
|
||||||
|
categoryView?: JSX.Element
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
bg?: RGBA
|
bg?: RGBA
|
||||||
gutter?: JSX.Element
|
gutter?: JSX.Element
|
||||||
|
|
@ -291,9 +292,16 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
|
||||||
<>
|
<>
|
||||||
<Show when={category}>
|
<Show when={category}>
|
||||||
<box paddingTop={index() > 0 ? 1 : 0} paddingLeft={3}>
|
<box paddingTop={index() > 0 ? 1 : 0} paddingLeft={3}>
|
||||||
<text fg={theme.accent} attributes={TextAttributes.BOLD}>
|
<Show
|
||||||
{category}
|
when={options[0]?.categoryView}
|
||||||
</text>
|
fallback={
|
||||||
|
<text fg={theme.accent} attributes={TextAttributes.BOLD}>
|
||||||
|
{category}
|
||||||
|
</text>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{options[0]?.categoryView}
|
||||||
|
</Show>
|
||||||
</box>
|
</box>
|
||||||
</Show>
|
</Show>
|
||||||
<For each={options}>
|
<For each={options}>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue