Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(ui): implement window component (#3117)

Fake-User8f5341796284
diff --git a/js/app/packages/app/component/app-sidebar/invite-modal.tsx b/js/app/packages/app/component/app-sidebar/invite-modal.tsx
index 9e9efe4bb0..9a211d03e6 100644
--- a/js/app/packages/app/component/app-sidebar/invite-modal.tsx
+++ b/js/app/packages/app/component/app-sidebar/invite-modal.tsx
@@ -4,7 +4,7 @@ import { getWebOrigin } from '@core/util/webOrigin';
import { authServiceClient } from '@service-auth/client';
import { contactsClient } from '@service-contacts/client';
import { isOk } from '@core/util/maybeResult';
-import { Dialog, Button, Panel } from '@ui';
+import { Dialog, Button, Window } from '@ui';
import { toast } from '@core/component/Toast/Toast';
import CloseIcon from '@icon/regular/x.svg';
import ClipboardIcon from '@icon/regular/clipboard.svg';
@@ -67,92 +67,82 @@ export const InviteModal = () => {
return (
<Dialog open={inviteModalOpen()} onOpenChange={(o) => !o && handleClose()}>
- <Panel depth={2} active>
- <div class="*:max-h-[75vh]">
- <div class="flex flex-col text-ink">
- <div class="shrink-0 flex flex-row items-center px-2 gap-1 border-b border-b-edge-muted h-[40px]">
- <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm">
- <CloseIcon />
- </Dialog.CloseButton>
- <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
- Invite
- </Dialog.Title>
- </div>
+ <Window depth={2} active class="max-h-[75vh] text-ink">
+ <Window.Header class="px-2 gap-1">
+ <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm">
+ <CloseIcon />
+ </Dialog.CloseButton>
+ <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
+ Invite
+ </Dialog.Title>
+ </Window.Header>
- <div class="p-3 flex flex-col gap-3">
- <p>
- Invite friends and teammates to Macro. You’ll get $100 in
- credits for each person who signs up.
- </p>
- <div class="flex flex-col gap-2">
- <textarea
- ref={(el) => {
- requestAnimationFrame(() =>
- requestAnimationFrame(() => el.focus())
- );
- }}
- value={value()}
- onInput={(e) => setValue(e.currentTarget.value)}
- rows={4}
- class="w-full px-3 py-2 text-sm border border-edge-muted rounded-xs bg-input text-ink placeholder:text-ink/30 outline-none focus:border-accent/50 resize-none leading-relaxed"
- />
- </div>
-
- <div class="flex justify-end gap-1 pt-2">
- <Button
- variant="ghost"
- class="rounded-xs"
- onClick={handleClose}
- >
- Cancel
- </Button>
- <Button
- onClick={handleSend}
- variant={
- sending() || !parseEmails(value()).length
- ? 'ghost'
- : 'active'
- }
- disabled={sending() || !parseEmails(value()).length}
- class="rounded-xs font-semibold"
- >
- {sending() ? 'Sending…' : 'Send Invites'}
- </Button>
- </div>
+ <Window.Body scroll class="p-3 flex flex-col gap-3">
+ <p>
+ Invite friends and teammates to Macro. You'll get $100 in credits
+ for each person who signs up.
+ </p>
+ <div class="flex flex-col gap-2">
+ <textarea
+ ref={(el) => {
+ requestAnimationFrame(() =>
+ requestAnimationFrame(() => el.focus())
+ );
+ }}
+ value={value()}
+ onInput={(e) => setValue(e.currentTarget.value)}
+ rows={4}
+ class="w-full px-3 py-2 text-sm border border-edge-muted rounded-xs bg-input text-ink placeholder:text-ink/30 outline-none focus:border-accent/50 resize-none leading-relaxed"
+ />
+ </div>
- <Show when={referralUrl()}>
- {(url) => (
- <div class="flex flex-col gap-1.5 pt-3 ">
- <p class="text-xs text-ink/50">
- Or share your personal referral link:
- </p>
- <div class="flex items-stretch gap-2">
- <input
- type="text"
- readOnly
- value={url()}
- class="flex-1 px-3 py-1.5 text-xs border border-edge-muted rounded-xs bg-input text-ink/70 outline-none select-all"
- onClick={(e) => e.currentTarget.select()}
- />
- <Button
- type="button"
- onClick={handleCopy}
- size="md"
- variant="base"
- class="font-medium rounded-xs border px-2"
- >
- <ClipboardIcon class="size-3" />
- {copied() ? 'Copied!' : 'Copy'}
- </Button>
- </div>
- </div>
- )}
- </Show>
- </div>
+ <div class="flex justify-end gap-1 pt-2">
+ <Button variant="ghost" class="rounded-xs" onClick={handleClose}>
+ Cancel
+ </Button>
+ <Button
+ onClick={handleSend}
+ variant={
+ sending() || !parseEmails(value()).length ? 'ghost' : 'active'
+ }
+ disabled={sending() || !parseEmails(value()).length}
+ class="rounded-xs font-semibold"
+ >
+ {sending() ? 'Sending…' : 'Send Invites'}
+ </Button>
</div>
- </div>
- </Panel>
+
+ <Show when={referralUrl()}>
+ {(url) => (
+ <div class="flex flex-col gap-1.5 pt-3 ">
+ <p class="text-xs text-ink/50">
+ Or share your personal referral link:
+ </p>
+ <div class="flex items-stretch gap-2">
+ <input
+ type="text"
+ readOnly
+ value={url()}
+ class="flex-1 px-3 py-1.5 text-xs border border-edge-muted rounded-xs bg-input text-ink/70 outline-none select-all"
+ onClick={(e) => e.currentTarget.select()}
+ />
+ <Button
+ type="button"
+ onClick={handleCopy}
+ size="md"
+ variant="base"
+ class="font-medium rounded-xs border px-2"
+ >
+ <ClipboardIcon class="size-3" />
+ {copied() ? 'Copied!' : 'Copy'}
+ </Button>
+ </div>
+ </div>
+ )}
+ </Show>
+ </Window.Body>
+ </Window>
</Dialog>
);
};
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index 16c265e326..4610bef28b 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -570,7 +570,7 @@ export const AppSidebar = (props: AppSidebarProps) => {
</div>
<div class="px-2">
- <hr class="border-edge-muted" />
+ <hr class="border-transparent" />
</div>
<div class="w-full px-2 my-[4.5px]">
@@ -584,7 +584,7 @@ export const AppSidebar = (props: AppSidebarProps) => {
</div>
<div class="px-2">
- <hr class="border-edge-muted mb-2" />
+ <hr class="border-transparent mb-2" />
</div>
<nav>
@@ -604,7 +604,7 @@ export const AppSidebar = (props: AppSidebarProps) => {
</nav>
<div class="px-2">
- <hr class="border-edge-muted my-2" />
+ <hr class="border-transparent my-2" />
</div>
<div class="block max-h-[clamp(10%,60%,20rem)]">
@@ -618,7 +618,7 @@ export const AppSidebar = (props: AppSidebarProps) => {
</Show>
<div class={cn('px-2 w-full', !callCtx?.isInCall() && 'mt-auto')}>
- <hr class="border-edge-muted mb-2" />
+ <hr class="border-transparent mb-2" />
</div>
<div class="w-full px-2 flex flex-col">
diff --git a/js/app/packages/app/component/command/CommandMenu.tsx b/js/app/packages/app/component/command/CommandMenu.tsx
index 8bded7a6ba..183ea3e08f 100644
--- a/js/app/packages/app/component/command/CommandMenu.tsx
+++ b/js/app/packages/app/component/command/CommandMenu.tsx
@@ -6,7 +6,7 @@ import {
} from './useCommandItems';
import { getActiveCommandsFromScope } from '@core/hotkey/getCommands';
import { runCommand } from '@core/hotkey/utils';
-import { Dialog, Panel } from '@ui';
+import { Dialog, Window } from '@ui';
import { Tabs } from '@core/component/Tabs';
import { registerHotkey, useHotkeyDOMScope } from 'core/hotkey/hotkeys';
import {
@@ -57,7 +57,6 @@ const MAX_LIST_HEIGHT = VIRTUAL_ITEM_HEIGHT * 8;
const EMPTY_STATE_HEIGHT = VIRTUAL_ITEM_HEIGHT * 1.5;
export function CommandMenu() {
- const [commandMenuRef, setCommandMenuRef] = createSignal<HTMLDivElement>();
const splitManager = globalSplitManager();
const isListMode = splitManager
? () => isListViewID(splitManager.activeSplit()?.content().id)
@@ -84,35 +83,32 @@ export function CommandMenu() {
return (
<Dialog
- open={CommandState.isOpen()}
onOpenChange={CommandState.setIsOpen}
- contentRef={setCommandMenuRef}
- onCloseAutoFocus={(event) => {
+ onCloseAutoFocus={(e) => {
if (suppressCloseAutoFocus) {
- event.preventDefault();
+ e.preventDefault();
suppressCloseAutoFocus = false;
}
}}
+ open={CommandState.isOpen()}
>
- <Panel depth={2} active>
- <div class="*:max-h-[75vh]">
- <CommandMenuInner
- commandMenuRef={commandMenuRef}
- onSelect={handleSelect}
- />
- </div>
- </Panel>
+ <CommandMenuInner depth={2} onSelect={handleSelect} />
</Dialog>
);
}
export function CommandMenuInner(props: {
- commandMenuRef: () => HTMLDivElement | undefined;
/** Override items source with custom data (e.g. sandbox entities for tutorial) */
items?: () => CommandMenuItem[];
/** Called when the user selects an item from the menu */
onSelect?: (item: CommandMenuItem) => void;
+ /** Optional class merged onto the Window wrapper. */
+ class?: string;
+ /** Optional depth for the Window wrapper. */
+ depth?: 0 | 1 | 2 | 3 | 4 | 5;
}) {
+ const [commandMenuRef, setCommandMenuRef] = createSignal<HTMLDivElement>();
+
const analytics = useAnalytics();
const { openWithSplit } = useSplitLayout();
@@ -151,6 +147,19 @@ export function CommandMenuInner(props: {
return items[index];
};
+ const selectedIsCommand = () => {
+ const item = selectedItem();
+ return item && isCommandItem(item);
+ };
+ const selectedIsEntity = () => {
+ const item = selectedItem();
+ return item && isEntityItem(item);
+ };
+ const selectedIsSearch = () => {
+ const item = selectedItem();
+ return item && isSearchItem(item);
+ };
+
function handleItemAction(item: CommandMenuItem, openInNewSplit = false) {
if (!item) return;
@@ -389,7 +398,7 @@ export function CommandMenuInner(props: {
});
onMount(() => {
- const element = props.commandMenuRef();
+ const element = commandMenuRef();
if (element) {
attachHotkeys(element);
}
@@ -424,26 +433,34 @@ export function CommandMenuInner(props: {
CommandState.isEntityActionMode()
);
- const handleBackFromCommandScope = () => {
+ // Back is only available in command scope (entity action mode just closes).
+ const handleBack = () => {
+ if (!isInCommandScope()) return;
CommandState.clearCommandScopeCommands();
CommandState.setSelectedIndex(0);
};
- // Show back button only in command scope (entity action mode just closes)
- const showBackButton = () => isInCommandScope();
-
- const handleBack = () => {
- if (isInCommandScope()) {
- handleBackFromCommandScope();
- }
+ const resultsHeight = () => {
+ const count = filteredItems().length;
+ if (count === 0) return EMPTY_STATE_HEIGHT;
+ return Math.min(MAX_LIST_HEIGHT, count * VIRTUAL_ITEM_HEIGHT);
};
+ const categoryTabs = CATEGORIES.map((c) => ({
+ value: c.id,
+ label: c.label,
+ }));
+
return (
- <div class="flex flex-col">
- {/* Search Input */}
- <div class="flex items-center gap-2 bg-panel px-2 h-10 border-b border-edge-muted">
+ <Window
+ class={cn('max-h-[75vh]', props.class)}
+ ref={setCommandMenuRef}
+ depth={props.depth}
+ active
+ >
+ <Window.Header class="gap-2 px-2 bg-panel">
<Show
- when={showBackButton()}
+ when={isInCommandScope()}
fallback={
<span class="pl-2 text-accent">
<Macro class="size-3" />
@@ -466,33 +483,104 @@ export function CommandMenuInner(props: {
onInput={(e) => CommandState.setQuery(e.currentTarget.value)}
autofocus
/>
- </div>
+ </Window.Header>
- {/* Entity Action Preview Row */}
- <Show when={isEntityActionMode()}>
- <EntityActionPreview entities={CommandState.entityActionEntities()} />
+ <Show when={isEntityActionMode() || !isInCommandScope()}>
+ <Window.Toolbar
+ class={cn('bg-panel', isEntityActionMode() ? 'px-3 gap-2' : 'px-1.5')}
+ >
+ <Show
+ when={isEntityActionMode()}
+ fallback={
+ <Tabs
+ list={categoryTabs}
+ value={CommandState.categoryFilter()}
+ onChange={(value) => {
+ if (value) {
+ CommandState.setCategoryFilter(value as CategoryFilter);
+ }
+ }}
+ />
+ }
+ >
+ <EntityActionPreview
+ entities={CommandState.entityActionEntities()}
+ />
+ </Show>
+ </Window.Toolbar>
</Show>
- <Show when={!isInCommandScope() && !isEntityActionMode()}>
- <CategoryFilterTabs />
- </Show>
+ <Window.Body>
+ <div
+ class="bg-panel overflow-hidden transition-[height] duration-60 ease-out"
+ style={{ height: `${resultsHeight()}px` }}
+ >
+ <Show
+ when={filteredItems().length > 0}
+ fallback={
+ <div class="px-4 py-4 text-center text-ink-muted">
+ No results found
+ </div>
+ }
+ >
+ <VirtualizedCommandList
+ items={filteredItems()}
+ selectedIndex={CommandState.selectedIndex()}
+ onSelect={(item, openInNewSplit) =>
+ handleItemAction(item, openInNewSplit)
+ }
+ onMouseEnter={handleMouseEnter}
+ />
+ </Show>
+ </div>
+ </Window.Body>
- <ResultsContainer
- items={filteredItems()}
- selectedIndex={CommandState.selectedIndex()}
- onSelect={(item, openInNewSplit) =>
- handleItemAction(item, openInNewSplit)
- }
- onMouseEnter={handleMouseEnter}
- />
-
- <CommandMenuFooter
- selectedItem={selectedItem()}
- isInCommandScope={isInCommandScope()}
- isEntityActionMode={isEntityActionMode()}
- canOpenInNewSplit={canOpenInNewSplit()}
- />
- </div>
+ <Window.Footer class="gap-4 px-4 bg-panel text-xs text-ink-extra-muted/80">
+ <span class="flex items-center gap-1">
+ <div class="flex gap-1">
+ <div class="flex border border-edge-muted text-xxs rounded-xs items-center px-1.5 py-0.25 font-normal">
+ <Hotkey shortcut="arrowup" class="space-x-1" />
+ </div>
+ <div class="flex border border-edge-muted text-xxs rounded-xs items-center px-1.5 py-0.25 font-normal">
+ <Hotkey shortcut="arrowdown" class="space-x-1" />
+ </div>
+ </div>
+ Navigate
+ </span>
+
+ <Switch>
+ <Match when={isInCommandScope()}>
+ <HotkeyHint shortcut="enter" label="Run action" />
+ <HotkeyHint shortcut="escape" label="Back" />
+ </Match>
+ <Match when={selectedIsCommand() || isEntityActionMode()}>
+ <HotkeyHint shortcut="enter" label="Run action" />
+ </Match>
+ <Match when={selectedIsSearch()}>
+ <HotkeyHint shortcut="enter" label="Search" />
+ <Show when={canOpenInNewSplit()}>
+ <HotkeyHint shortcut="shift+enter" label="Search in new split" />
+ </Show>
+ </Match>
+ <Match when={selectedIsEntity()}>
+ <HotkeyHint shortcut="enter" label="Open" />
+ <Show when={canOpenInNewSplit()}>
+ <HotkeyHint shortcut="shift+enter" label="Open in new split" />
+ </Show>
+ </Match>
+ </Switch>
+
+ <Show when={!isInCommandScope() && !isEntityActionMode()}>
+ <HotkeyHint shortcut="tab" label="Category" />
+ </Show>
+ <Show
+ when={isInCommandScope()}
+ fallback={<HotkeyHint shortcut="escape" label="Close" />}
+ >
+ <HotkeyHint shortcut="escape" label="Back" />
+ </Show>
+ </Window.Footer>
+ </Window>
);
}
@@ -502,7 +590,7 @@ function EntityActionPreview(props: { entities: EntityData[] }) {
const remainingCount = () => Math.max(0, props.entities.length - 2);
return (
- <div class="flex items-center gap-2 px-3 py-2 bg-panel border-b border-edge-muted">
+ <>
<For each={displayEntities()}>
{(entity) => {
return (
@@ -521,44 +609,7 @@ function EntityActionPreview(props: { entities: EntityData[] }) {
+{remainingCount()} more
</div>
</Show>
- </div>
- );
-}
-
-function ResultsContainer(props: {
- items: CommandMenuItem[];
- selectedIndex: number;
- onSelect: (item: CommandMenuItem, openInNewSplit: boolean) => void;
- onMouseEnter: (index: number) => void;
-}) {
- const containerHeight = () => {
- const count = props.items.length;
- if (count === 0) return EMPTY_STATE_HEIGHT;
- const totalHeight = count * VIRTUAL_ITEM_HEIGHT;
- return Math.min(MAX_LIST_HEIGHT, totalHeight);
- };
-
- return (
- <div
- class="bg-panel overflow-hidden transition-[height] duration-60 ease-out"
- style={{ height: `${containerHeight()}px` }}
- >
- <Show
- when={props.items.length > 0}
- fallback={
- <div class="px-4 py-4 text-center text-ink-muted">
- No results found
- </div>
- }
- >
- <VirtualizedCommandList
- items={props.items}
- selectedIndex={props.selectedIndex}
- onSelect={props.onSelect}
- onMouseEnter={props.onMouseEnter}
- />
- </Show>
- </div>
+ </>
);
}
@@ -623,81 +674,3 @@ function HotkeyHint(props: { shortcut: string; label: string }) {
</span>
);
}
-
-function CommandMenuFooter(props: {
- selectedItem: CommandMenuItem | undefined;
- isInCommandScope: boolean;
- isEntityActionMode?: boolean;
- canOpenInNewSplit: boolean;
-}) {
- const isCommand = () =>
- props.selectedItem && isCommandItem(props.selectedItem);
- const isEntity = () => props.selectedItem && isEntityItem(props.selectedItem);
- const isSearch = () => props.selectedItem && isSearchItem(props.selectedItem);
-
- return (
- <div class="flex items-center gap-4 px-4 py-2 bg-panel border-t border-edge-muted text-xs text-ink-extra-muted/80">
- <span class="flex items-center gap-1">
- <div class="flex gap-1">
- <div class="flex border border-edge-muted text-xxs rounded-xs items-center px-1.5 py-0.25 font-normal">
- <Hotkey shortcut="arrowup" class="space-x-1" />
- </div>
- <div class="flex border border-edge-muted text-xxs rounded-xs items-center px-1.5 py-0.25 font-normal">
- <Hotkey shortcut="arrowdown" class="space-x-1" />
- </div>
- </div>
- Navigate
- </span>
-
- <Switch>
- <Match when={props.isInCommandScope}>
- <HotkeyHint shortcut="enter" label="Run action" />
- <HotkeyHint shortcut="escape" label="Back" />
- </Match>
- <Match when={isCommand() || props.isEntityActionMode}>
- <HotkeyHint shortcut="enter" label="Run action" />
- </Match>
- <Match when={isSearch()}>
- <HotkeyHint shortcut="enter" label="Search" />
- <Show when={props.canOpenInNewSplit}>
- <HotkeyHint shortcut="shift+enter" label="Search in new split" />
- </Show>
- </Match>
- <Match when={isEntity()}>
- <HotkeyHint shortcut="enter" label="Open" />
- <Show when={props.canOpenInNewSplit}>
- <HotkeyHint shortcut="shift+enter" label="Open in new split" />
- </Show>
- </Match>
- </Switch>
-
- <Show when={!props.isInCommandScope && !props.isEntityActionMode}>
- <HotkeyHint shortcut="tab" label="Category" />
- </Show>
- <Show
- when={props.isInCommandScope}
- fallback={<HotkeyHint shortcut="escape" label="Close" />}
- >
- <HotkeyHint shortcut="escape" label="Back" />
- </Show>
- </div>
- );
-}
-
-function CategoryFilterTabs() {
- const list = CATEGORIES.map((c) => ({ value: c.id, label: c.label }));
-
- return (
- <div class="px-1.5 h-10 border-b border-edge-muted">
- <Tabs
- list={list}
- value={CommandState.categoryFilter()}
- onChange={(value) => {
- if (value) {
- CommandState.setCategoryFilter(value as CategoryFilter);
- }
- }}
- />
- </div>
- );
-}
diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx
index ae0c04af58..a4dafaffbc 100644
--- a/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx
+++ b/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx
@@ -1,7 +1,6 @@
import { CommandMenuInner, CommandState } from '@app/component/command';
import type { CategoryFilter } from '@app/component/command';
import { createSoupState } from '@app/component/next-soup/create-soup-state';
-import { Panel } from '@ui';
import { createFreshSearch } from '@core/util/freshSort';
import { Dialog } from '@kobalte/core/dialog';
import {
@@ -71,8 +70,6 @@ function CommandKContent(_props: LessonContentProps) {
}
function CommandKDemo(props: LessonContentProps) {
- const [commandMenuRef, setCommandMenuRef] = createSignal<HTMLDivElement>();
-
const [hasOpened, setHasOpened] = createSignal(false);
onMount(() => {
@@ -161,18 +158,13 @@ function CommandKDemo(props: LessonContentProps) {
class="max-w-[calc(100vw-16px)] overflow-hidden portal-scope"
style={{ width: '800px' }}
>
- <Panel active>
- <div class="*:max-h-[75vh]" ref={setCommandMenuRef}>
- <CommandMenuInner
- commandMenuRef={commandMenuRef}
- items={filteredItems}
- onSelect={() => {
- setCompleted(true);
- props.onComplete();
- }}
- />
- </div>
- </Panel>
+ <CommandMenuInner
+ items={filteredItems}
+ onSelect={() => {
+ setCompleted(true);
+ props.onComplete();
+ }}
+ />
</Dialog.Content>
</div>
</Dialog.Portal>
diff --git a/js/app/packages/app/component/paywall/Paywall.tsx b/js/app/packages/app/component/paywall/Paywall.tsx
index fc31fb8c43..9a4aff40dd 100644
--- a/js/app/packages/app/component/paywall/Paywall.tsx
+++ b/js/app/packages/app/component/paywall/Paywall.tsx
@@ -59,7 +59,7 @@ export function Paywall() {
open={paywallOpen()}
onOpenChange={(open) => !open && hidePaywall()}
position="center"
- class="w-[900px]"
+ class="w-225"
>
<Panel active depth={2}>
<div
diff --git a/js/app/packages/app/component/paywall/PaywallComponent.tsx b/js/app/packages/app/component/paywall/PaywallComponent.tsx
index 9d761baeac..26726c9350 100644
--- a/js/app/packages/app/component/paywall/PaywallComponent.tsx
+++ b/js/app/packages/app/component/paywall/PaywallComponent.tsx
@@ -1,4 +1,5 @@
import { Button } from '@ui/components/Button';
+import { cn } from '@ui/utils/classname';
import { useHasPaidAccess } from '@core/auth';
import { toast } from '@core/component/Toast/Toast';
import { type PaywallKey, PaywallMessages } from '@core/constant/PaywallState';
@@ -169,12 +170,12 @@ const PaywallComponent = (props: PaywallComponent) => {
{(plan) => (
<button
onClick={() => setUserSelectedTier(plan.tier)}
- class="p-4 sm:p-5 border flex flex-col transition-all relative text-left"
- classList={{
- 'border-accent-ink bg-active': selectedTier() === plan.tier,
- 'border-edge hover:border-edge': selectedTier() !== plan.tier,
- }}
- style={{ 'border-radius': '2px' }}
+ class={cn(
+ selectedTier() === plan.tier
+ ? 'border-accent-ink bg-active'
+ : 'border-edge hover:border-edge',
+ 'p-4 sm:p-5 border flex flex-col transition-all relative text-left rounded-sm'
+ )}
>
<div class="flex flex-col gap-3 w-full">
<div class="flex justify-between items-start">
diff --git a/js/app/packages/app/component/settings/Account.tsx b/js/app/packages/app/component/settings/Account.tsx
index e701d5da07..69364150c8 100644
--- a/js/app/packages/app/component/settings/Account.tsx
+++ b/js/app/packages/app/component/settings/Account.tsx
@@ -7,7 +7,7 @@ import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
import { toast } from '@core/component/Toast/Toast';
import { staticFileIdEndpoint } from '@core/constant/servers';
import { createStaticFile } from '@core/util/create';
-import { Dialog, Button, Panel } from '@ui';
+import { Dialog, Button, Window } from '@ui';
import {
blockNameToFileExtensions,
blockNameToMimeTypes,
@@ -180,11 +180,11 @@ export function Account() {
style="scrollbar-width: none;"
>
<div class="max-w-200 w-full mx-auto">
- <Panel depth={2}>
- <div class="text-ink">
- <div class="relative flex items-center justify-between h-10 px-6 after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-edge-muted after:content-['']">
- <div class="text-sm font-semibold">Account</div>
- </div>
+ <Window depth={2}>
+ <Window.Header class="px-6">
+ <div class="text-sm font-semibold">Account</div>
+ </Window.Header>
+ <Window.Body class="text-ink">
<div class="grid gap-px bg-edge-muted border-b border-edge-muted">
<Show when={permissions()?.includes('write:stripe_subscription') && !isNativeMobilePlatform()}>
<div class="bg-panel px-6 py-2">
@@ -438,28 +438,30 @@ export function Account() {
position="center"
class="w-120"
>
- <Panel active depth={2}>
- <div class="p-6 font-sans flex flex-col gap-3">
- <Dialog.Title class="text-ink text-lg font-semibold leading-7">
- Delete Account
- </Dialog.Title>
- <Dialog.Description class="text-ink-muted text-sm font-normal leading-tight">
- Are you sure you want to delete your account? This action is
- permanent and cannot be undone.
- </Dialog.Description>
- <div class="pt-3 justify-end items-center gap-3 inline-flex">
- <Button variant="base" depth={3} onClick={() => setShowDeleteModal(false)}>
- Cancel
- </Button>
- <Button variant="danger" depth={3} onClick={() => {
- setShowDeleteModal(false);
- setShowDeleteConfirmModal(true);
- }}>
- Delete
- </Button>
- </div>
- </div>
- </Panel>
+ <Window active depth={2}>
+ <Window.Header class="px-6">
+ <Dialog.Title class="text-ink text-sm font-semibold">
+ Delete Account
+ </Dialog.Title>
+ </Window.Header>
+ <Window.Body class="p-6 font-sans flex flex-col gap-3">
+ <Dialog.Description class="text-ink-muted text-sm font-normal leading-tight">
+ Are you sure you want to delete your account? This action is
+ permanent and cannot be undone.
+ </Dialog.Description>
+ <div class="pt-3 justify-end items-center gap-3 inline-flex">
+ <Button variant="base" depth={3} onClick={() => setShowDeleteModal(false)}>
+ Cancel
+ </Button>
+ <Button variant="danger" depth={3} onClick={() => {
+ setShowDeleteModal(false);
+ setShowDeleteConfirmModal(true);
+ }}>
+ Delete
+ </Button>
+ </div>
+ </Window.Body>
+ </Window>
</Dialog>
<Dialog
open={showDeleteConfirmModal()}
@@ -467,30 +469,32 @@ export function Account() {
position="center"
class="w-120"
>
- <Panel active depth={2}>
- <div class="p-6 font-sans flex flex-col gap-3">
- <Dialog.Title class="text-ink text-lg font-semibold leading-7">
- Are you absolutely sure?
- </Dialog.Title>
- <Dialog.Description class="text-ink-muted text-sm font-normal leading-tight">
- This will permanently delete your account and all associated
- data. This cannot be undone.
- </Dialog.Description>
- <div class="pt-3 justify-end items-center gap-3 inline-flex">
- <Button variant="base" depth={3} onClick={() => setShowDeleteConfirmModal(false)}>
- Cancel
- </Button>
- <Button variant="danger" depth={3} onClick={deleteAccountHandler}>
- Delete My Account
- </Button>
- </div>
- </div>
- </Panel>
+ <Window active depth={2}>
+ <Window.Header class="px-6">
+ <Dialog.Title class="text-ink text-sm font-semibold">
+ Are you absolutely sure?
+ </Dialog.Title>
+ </Window.Header>
+ <Window.Body class="p-6 font-sans flex flex-col gap-3">
+ <Dialog.Description class="text-ink-muted text-sm font-normal leading-tight">
+ This will permanently delete your account and all associated
+ data. This cannot be undone.
+ </Dialog.Description>
+ <div class="pt-3 justify-end items-center gap-3 inline-flex">
+ <Button variant="base" depth={3} onClick={() => setShowDeleteConfirmModal(false)}>
+ Cancel
+ </Button>
+ <Button variant="danger" depth={3} onClick={deleteAccountHandler}>
+ Delete My Account
+ </Button>
+ </div>
+ </Window.Body>
+ </Window>
</Dialog>
</div>
</Show>
- </div>
- </Panel>
+ </Window.Body>
+ </Window>
</div>
</div>
);
diff --git a/js/app/packages/app/component/settings/Appearance.tsx b/js/app/packages/app/component/settings/Appearance.tsx
index 3ae98910fc..32daaa87f7 100644
--- a/js/app/packages/app/component/settings/Appearance.tsx
+++ b/js/app/packages/app/component/settings/Appearance.tsx
@@ -60,10 +60,8 @@ export function Appearance() {
</Window>
<Window depth={2}>
- <Window.Body>
- <ThemeList />
- </Window.Body>
- </Window>
+ <ThemeList />
+ </Window>
</div>
</div>
);
diff --git a/js/app/packages/app/component/settings/MobileApp.tsx b/js/app/packages/app/component/settings/MobileApp.tsx
index de2d1b8b88..b3c797e346 100644
--- a/js/app/packages/app/component/settings/MobileApp.tsx
+++ b/js/app/packages/app/component/settings/MobileApp.tsx
@@ -1,5 +1,5 @@
import AppStoreQr from '@macro-icons/app-store.svg';
-import { Panel } from '@ui';
+import { Window } from '@ui';
export function MobileApp() {
return (
@@ -7,12 +7,11 @@ export function MobileApp() {
class="h-full overflow-hidden flex justify-center p-2"
>
<div class="max-w-200 w-full h-full">
- <Panel depth={2} class="h-full overflow-hidden">
- <div class="text-ink h-full flex flex-col">
- <div class="flex items-center justify-between h-10 px-6 border-b border-edge-muted">
- <div class="text-sm font-semibold">Mobile App</div>
- </div>
- <div class="flex-1 flex flex-col items-center justify-center gap-6 py-8">
+ <Window depth={2} class="h-full overflow-hidden text-ink">
+ <Window.Header class="px-6">
+ <div class="text-sm font-semibold">Mobile App</div>
+ </Window.Header>
+ <Window.Body class="flex flex-col items-center justify-center gap-6 py-8">
<AppStoreQr style="display: block; max-width: 300px;" />
<p class="text-sm text-ink text-center">
Download on the<br/>
@@ -25,9 +24,8 @@ export function MobileApp() {
App Store
</a>
</p>
- </div>
- </div>
- </Panel>
+ </Window.Body>
+ </Window>
</div>
</div>
);
diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsx
index ca5a858b12..f8e7110abd 100644
--- a/js/app/packages/app/component/settings/Settings.tsx
+++ b/js/app/packages/app/component/settings/Settings.tsx
@@ -181,7 +181,6 @@ export function SettingsPanel(props: SettingsPanelProps) {
tabIndex={0}
ref={settingsContainerRef}
>
-
<SplitHeaderLeft>
<div class="h-full flex gap-3 items-center">
<h1 class="font-semibold text-ink select-none text-sm shrink-0">
diff --git a/js/app/packages/app/component/settings/Shortcuts.tsx b/js/app/packages/app/component/settings/Shortcuts.tsx
index ce689d3e5b..4907259f61 100644
--- a/js/app/packages/app/component/settings/Shortcuts.tsx
+++ b/js/app/packages/app/component/settings/Shortcuts.tsx
@@ -1,6 +1,6 @@
import { IS_MAC } from '@core/constant/isMac';
import { Hotkey } from '@core/component/Hotkey';
-import { Keyboard, Panel } from '@ui';
+import { Keyboard, Window } from '@ui';
import { cn } from '@ui/utils/classname';
import { createSignal, For, Index, type JSX } from 'solid-js';
@@ -124,12 +124,12 @@ function ShortcutSectionComponent(props: { section: ShortcutSection }) {
function ShortcutsContent() {
return (
- <div class="flex flex-col h-full overflow-hidden">
- <div class="relative flex items-center justify-between h-10 px-6 shrink-0 after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-edge-muted after:content-['']">
+ <>
+ <Window.Header class="px-6">
<div class="text-sm font-semibold">Keyboard Shortcuts</div>
- </div>
+ </Window.Header>
- <div class="flex-1 overflow-auto px-6 py-2 @container">
+ <Window.Body scroll class="px-6 py-2 @container">
<Keyboard keys={hoveredCodes()} />
<div class="grid grid-cols-1 @[600px]:grid-cols-2 gap-x-6">
@@ -153,8 +153,8 @@ function ShortcutsContent() {
</div>
</div>
</div>
- </div>
- </div>
+ </Window.Body>
+ </>
);
}
@@ -162,11 +162,9 @@ export function Shortcuts() {
return (
<div class="h-full overflow-hidden flex justify-center p-2">
<div class="max-w-200 w-full h-full">
- <Panel depth={2} class="h-full overflow-hidden">
- <div class="text-ink h-full">
- <ShortcutsContent />
- </div>
- </Panel>
+ <Window depth={2} class="h-full overflow-hidden text-ink">
+ <ShortcutsContent />
+ </Window>
</div>
</div>
);
diff --git a/js/app/packages/app/component/settings/Team.tsx b/js/app/packages/app/component/settings/Team.tsx
index 5e41f85736..b0c76808ee 100644
--- a/js/app/packages/app/component/settings/Team.tsx
+++ b/js/app/packages/app/component/settings/Team.tsx
@@ -12,7 +12,7 @@ import CheckIcon from '@icon/regular/check.svg';
import { toast } from '@core/component/Toast/Toast';
import { Tooltip } from '@core/component/Tooltip';
import { Button } from '@ui/components/Button';
-import { Dialog, Panel } from '@ui';
+import { Dialog, Window } from '@ui';
import { cn } from '@ui/utils/classname';
import { Select } from '@kobalte/core/select';
import { useUserId } from '@core/context/user';
@@ -569,31 +569,38 @@ function TeamInvites() {
rejectMutation.variables?.teamInviteId === inviteId;
return (
- <Show when={invites().length > 0}>
- <section class="px-6 py-4">
- <header class="mb-2">
- <h3 class="text-sm font-medium">You've been invited to join a team</h3>
- </header>
- <div class="border border-edge rounded-sm px-3">
- <For each={invites()}>
- {(invite) => (
- <UserInviteRow
- invite={invite}
- onAccept={() =>
- joinTeamMutation.mutate({ teamInviteId: invite.id })
- }
- onDecline={() =>
- rejectMutation.mutate({ teamInviteId: invite.id })
- }
- isAccepting={isAccepting(invite.id)}
- isDeclining={isDeclining(invite.id)}
- />
- )}
- </For>
- </div>
- </section>
- </Show>
- );
+ <>
+ <Window.Header class="px-6">
+ <div class="text-sm font-semibold">Team</div>
+ </Window.Header>
+ <Window.Body>
+ <Show when={invites().length > 0}>
+ <section class="px-6 py-4">
+ <header class="mb-2">
+ <h3 class="text-sm font-medium">You've been invited to join a team</h3>
+ </header>
+ <div class="border border-edge rounded-sm px-3">
+ <For each={invites()}>
+ {(invite) => (
+ <UserInviteRow
+ invite={invite}
+ onAccept={() =>
+ joinTeamMutation.mutate({ teamInviteId: invite.id })
+ }
+ onDecline={() =>
+ rejectMutation.mutate({ teamInviteId: invite.id })
+ }
+ isAccepting={isAccepting(invite.id)}
+ isDeclining={isDeclining(invite.id)}
+ />
+ )}
+ </For>
+ </div>
+ </section>
+ </Show>
+ </Window.Body>
+ </>
+ );
}
const TEAM_NAME_MAX_LENGTH = 50;
@@ -678,18 +685,16 @@ function CreateTeamDialog(props: { open: boolean; onClose: () => void }) {
teamNameInputRef?.focus();
}}
>
- <Panel depth={2} active>
- <div class="*:max-h-[75vh]">
- <div class="flex flex-col text-ink">
- <div class="shrink-0 flex flex-row items-center px-2 gap-1 border-b border-b-edge-muted h-10">
- <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm">
- <XIcon />
- </Dialog.CloseButton>
- <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
- Create Team
- </Dialog.Title>
- </div>
- <div class="p-3 flex flex-col gap-3">
+ <Window depth={2} active class="max-h-[75vh] text-ink">
+ <Window.Header class="px-2 gap-1">
+ <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm">
+ <XIcon />
+ </Dialog.CloseButton>
+ <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
+ Create Team
+ </Dialog.Title>
+ </Window.Header>
+ <Window.Body scroll class="p-3 flex flex-col gap-3">
<div class="flex flex-col gap-1">
<div class="flex items-center justify-between">
<label class="text-sm text-ink-muted">Team name</label>
@@ -753,10 +758,8 @@ function CreateTeamDialog(props: { open: boolean; onClose: () => void }) {
</Show>
</Button>
</div>
- </div>
- </div>
- </div>
- </Panel>
+ </Window.Body>
+ </Window>
</Dialog>
);
}
@@ -767,52 +770,57 @@ function EmptyTeamState() {
const { showPaywall } = usePaywallState();
return (
- <>
- <div class="flex flex-col items-center justify-center py-12 text-center px-6">
- <div class="w-12 h-12 rounded-full bg-accent/10 flex items-center justify-center mb-4">
- <UsersIcon class="size-6 text-accent" />
- </div>
- <h3 class="text-sm font-medium text-ink mb-1">No team yet</h3>
- <Show
- when={hasPaidAccess()}
- fallback={
- <>
+ <>
+ <Window.Header class="px-6">
+ <div class="text-sm font-semibold">Team</div>
+ </Window.Header>
+ <Window.Body>
+ <div class="flex flex-col items-center justify-center py-12 text-center px-6">
+ <div class="w-12 h-12 rounded-full bg-accent/10 flex items-center justify-center mb-4">
+ <UsersIcon class="size-6 text-accent" />
+ </div>
+ <h3 class="text-sm font-medium text-ink mb-1">No team yet</h3>
+ <Show
+ when={hasPaidAccess()}
+ fallback={
+ <>
+ <p class="text-xs text-ink-muted max-w-xs mb-4">
+ Teams are available on paid plans. Upgrade to create and manage
+ teams.
+ </p>
+ <Button
+ variant="active"
+ class="rounded-xs"
+ onClick={() => showPaywall()}
+ >
+ Upgrade
+ </Button>
+ </>
+ }
+ >
<p class="text-xs text-ink-muted max-w-xs mb-4">
- Teams are available on paid plans. Upgrade to create and manage
- teams.
+ Create a team to collaborate with others and manage access together.
</p>
<Button
variant="active"
class="rounded-xs"
- onClick={() => showPaywall()}
+ onClick={() => setShowCreateModal(true)}
>
- Upgrade
+ <PlusIcon class="size-4" />
+ Create Team
</Button>
- </>
- }
- >
- <p class="text-xs text-ink-muted max-w-xs mb-4">
- Create a team to collaborate with others and manage access together.
- </p>
- <Button
- variant="active"
- class="rounded-xs"
- onClick={() => setShowCreateModal(true)}
- >
- <PlusIcon class="size-4" />
- Create Team
- </Button>
- </Show>
- </div>
+ </Show>
+ </div>
+ </Window.Body>
- <Show when={showCreateModal()}>
- <CreateTeamDialog
- open={showCreateModal()}
- onClose={() => setShowCreateModal(false)}
- />
- </Show>
- </>
- );
+ <Show when={showCreateModal()}>
+ <CreateTeamDialog
+ open={showCreateModal()}
+ onClose={() => setShowCreateModal(false)}
+ />
+ </Show>
+ </>
+ );
}
function TeamManagement(props: {
@@ -974,32 +982,34 @@ function TeamManagement(props: {
};
return (
- <div class="flex flex-col h-full overflow-hidden">
- <div class="relative flex items-center justify-between h-10 px-6 shrink-0 after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-edge-muted after:content-['']">
- <div class="text-sm font-semibold">Team</div>
- <Show when={isOwner()}>
- <div class="flex items-center gap-2">
- <Button
- variant="base"
- size="sm"
- class="rounded-xs"
- onClick={() => setShowInviteModal(true)}
- >
- <PlusIcon class="size-4" />
- Invite
- </Button>
- <Button
- variant="danger"
- size="sm"
- class="rounded-xs"
- onClick={() => setShowDeleteTeamModal(true)}
- >
- <TrashIcon class="size-4" />
- Delete Team
- </Button>
- </div>
- </Show>
- </div>
+ <>
+ <Window.Header class="justify-between px-6">
+ <div class="text-sm font-semibold">Team</div>
+ <Show when={isOwner()}>
+ <div class="flex items-center gap-2">
+ <Button
+ variant="base"
+ size="sm"
+ class="rounded-xs"
+ onClick={() => setShowInviteModal(true)}
+ >
+ <PlusIcon class="size-4" />
+ Invite
+ </Button>
+ <Button
+ variant="danger"
+ size="sm"
+ class="rounded-xs"
+ onClick={() => setShowDeleteTeamModal(true)}
+ >
+ <TrashIcon class="size-4" />
+ Delete Team
+ </Button>
+ </div>
+ </Show>
+ </Window.Header>
+
+ <Window.Body class="flex flex-col h-full overflow-hidden">
<div class="flex items-center px-2 h-15.25 border-b border-edge-muted shrink-0">
<div class="flex items-center justify-between w-full border border-edge rounded-sm px-4 py-2">
@@ -1123,27 +1133,26 @@ function TeamManagement(props: {
</section>
</Show>
</div>
+ </Window.Body>
<Dialog
open={showDeleteTeamModal()}
onOpenChange={handleDeleteTeamModalClose}
>
- <Panel depth={2} active>
- <div class="*:max-h-[75vh]">
- <div class="flex flex-col text-ink">
- <div class="shrink-0 flex flex-row items-center px-2 gap-1 border-b border-b-edge-muted h-10">
- <Dialog.CloseButton
- as={Button}
- variant="ghost"
- size="icon-sm"
- >
- <XIcon />
- </Dialog.CloseButton>
- <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
- Delete Team
- </Dialog.Title>
- </div>
- <div class="p-3 flex flex-col gap-3">
+ <Window depth={2} active class="max-h-[75vh] text-ink">
+ <Window.Header class="px-2 gap-1">
+ <Dialog.CloseButton
+ as={Button}
+ variant="ghost"
+ size="icon-sm"
+ >
+ <XIcon />
+ </Dialog.CloseButton>
+ <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
+ Delete Team
+ </Dialog.Title>
+ </Window.Header>
+ <Window.Body scroll class="p-3 flex flex-col gap-3">
<p>
Are you sure you want to delete{' '}
<span class="font-medium">{props.teamName}</span>? This action
@@ -1186,32 +1195,28 @@ function TeamManagement(props: {
</Show>
</Button>
</div>
- </div>
- </div>
- </div>
- </Panel>
+ </Window.Body>
+ </Window>
</Dialog>
<Dialog
open={!!showRemoveModal()}
onOpenChange={() => setShowRemoveModal(null)}
>
- <Panel depth={2} active>
- <div class="*:max-h-[75vh]">
- <div class="flex flex-col text-ink">
- <div class="shrink-0 flex flex-row items-center px-2 gap-1 border-b border-b-edge-muted h-10">
- <Dialog.CloseButton
- as={Button}
- variant="ghost"
- size="icon-sm"
- >
- <XIcon />
- </Dialog.CloseButton>
- <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
- Remove Member
- </Dialog.Title>
- </div>
- <div class="p-3 flex flex-col gap-3">
+ <Window depth={2} active class="max-h-[75vh] text-ink">
+ <Window.Header class="px-2 gap-1">
+ <Dialog.CloseButton
+ as={Button}
+ variant="ghost"
+ size="icon-sm"
+ >
+ <XIcon />
+ </Dialog.CloseButton>
+ <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
+ Remove Member
+ </Dialog.Title>
+ </Window.Header>
+ <Window.Body scroll class="p-3 flex flex-col gap-3">
<p>
Are you sure you want to remove{' '}
<Show when={showRemoveModal()}>
@@ -1239,32 +1244,28 @@ function TeamManagement(props: {
</Show>
</Button>
</div>
- </div>
- </div>
- </div>
- </Panel>
+ </Window.Body>
+ </Window>
</Dialog>
<Dialog
open={!!showCancelInviteModal()}
onOpenChange={() => setShowCancelInviteModal(null)}
>
- <Panel depth={2} active>
- <div class="*:max-h-[75vh]">
- <div class="flex flex-col text-ink">
- <div class="shrink-0 flex flex-row items-center px-2 gap-1 border-b border-b-edge-muted h-[40px]">
- <Dialog.CloseButton
- as={Button}
- variant="ghost"
- size="icon-sm"
- >
- <XIcon />
- </Dialog.CloseButton>
- <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
- Cancel Invitation
- </Dialog.Title>
- </div>
- <div class="p-3 flex flex-col gap-3">
+ <Window depth={2} active class="max-h-[75vh] text-ink">
+ <Window.Header class="px-2 gap-1">
+ <Dialog.CloseButton
+ as={Button}
+ variant="ghost"
+ size="icon-sm"
+ >
+ <XIcon />
+ </Dialog.CloseButton>
+ <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
+ Cancel Invitation
+ </Dialog.Title>
+ </Window.Header>
+ <Window.Body scroll class="p-3 flex flex-col gap-3">
<p>
Are you sure you want to cancel the invitation for{' '}
<span class="font-medium">
@@ -1295,32 +1296,28 @@ function TeamManagement(props: {
</Show>
</Button>
</div>
- </div>
- </div>
- </div>
- </Panel>
+ </Window.Body>
+ </Window>
</Dialog>
<Dialog
open={showInviteModal()}
onOpenChange={handleInviteModalClose}
>
- <Panel depth={2} active>
- <div class="*:max-h-[75vh]">
- <div class="flex flex-col text-ink">
- <div class="shrink-0 flex flex-row items-center px-2 gap-1 border-b border-b-edge-muted h-10">
- <Dialog.CloseButton
- as={Button}
- variant="ghost"
- size="icon-sm"
- >
- <XIcon />
- </Dialog.CloseButton>
- <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
- Invite to Team
- </Dialog.Title>
- </div>
- <div class="p-3 flex flex-col gap-3">
+ <Window depth={2} active class="max-h-[75vh] text-ink">
+ <Window.Header class="px-2 gap-1">
+ <Dialog.CloseButton
+ as={Button}
+ variant="ghost"
+ size="icon-sm"
+ >
+ <XIcon />
+ </Dialog.CloseButton>
+ <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">
+ Invite to Team
+ </Dialog.Title>
+ </Window.Header>
+ <Window.Body scroll class="p-3 flex flex-col gap-3">
<InviteEmailsInput
invites={invites()}
onChange={setInvites}
@@ -1356,12 +1353,10 @@ function TeamManagement(props: {
</Show>
</Button>
</div>
- </div>
- </div>
- </div>
- </Panel>
+ </Window.Body>
+ </Window>
</Dialog>
- </div>
+ </>
);
}
@@ -1404,13 +1399,11 @@ export function Team() {
class="h-full overflow-hidden flex justify-center p-2"
>
<div class="max-w-200 w-full h-full">
- <Panel depth={2} class="h-full overflow-hidden">
- <div class="text-ink h-full">
- <Suspense fallback={<div class="animate-pulse bg-ink-extra-muted rounded h-4 w-32 m-6" />}>
- <TeamContent />
- </Suspense>
- </div>
- </Panel>
+ <Window depth={2} class="h-full overflow-hidden text-ink">
+ <Suspense fallback={<div class="animate-pulse bg-ink-extra-muted rounded h-4 w-32 m-6" />}>
+ <TeamContent />
+ </Suspense>
+ </Window>
</div>
</div>
);
diff --git a/js/app/packages/channel/Attachments/SectionHeader.tsx b/js/app/packages/channel/Attachments/SectionHeader.tsx
index 32953a8439..25451927ae 100644
--- a/js/app/packages/channel/Attachments/SectionHeader.tsx
+++ b/js/app/packages/channel/Attachments/SectionHeader.tsx
@@ -1,5 +1,6 @@
import { type Accessor, Show, type JSX } from 'solid-js';
import { Button } from '@ui/components/Button';
+import { Window } from '@ui/components/Window';
import { cn } from '@ui/utils/classname';
import Spinner from '@phosphor-icons/core/bold/spinner-gap-bold.svg?component-solid';
@@ -11,19 +12,15 @@ export function AttachmentSection(props: {
contentClass?: string;
}) {
return (
- <div
- class={cn(
- 'rounded-sm border border-edge-muted bg-menu py-3',
- props.class
- )}
- >
- <div class="flex items-center justify-between px-3 pb-3">
+ <Window depth={2} class={cn('h-auto', props.class)}>
+ <Window.Header class="justify-between">
<h3 class="text-sm font-medium text-ink">{props.label}</h3>
<div class="shrink-0">{props.action}</div>
- </div>
- <div class="border-b border-edge-muted" />
- <div class={cn('px-3 pt-3', props.contentClass)}>{props.children}</div>
- </div>
+ </Window.Header>
+ <Window.Body class={cn('px-3 py-3', props.contentClass)}>
+ {props.children}
+ </Window.Body>
+ </Window>
);
}
diff --git a/js/app/packages/core/component/TopBar/ShareButton.tsx b/js/app/packages/core/component/TopBar/ShareButton.tsx
index e92092e6f5..b755a0a79d 100644
--- a/js/app/packages/core/component/TopBar/ShareButton.tsx
+++ b/js/app/packages/core/component/TopBar/ShareButton.tsx
@@ -84,7 +84,7 @@ import {
} from 'solid-js';
import { Dynamic } from 'solid-js/web';
import { match } from 'ts-pattern';
-import { Panel } from '@ui';
+import { Window } from '@ui/components/Window';
import { CustomScrollbar } from '../CustomScrollbar';
import { ForwardToChannel } from '../ForwardToChannel';
import { Permissions } from '../SharePermissions';
@@ -954,21 +954,19 @@ export function ShareModal(props: ShareModalProps) {
style={{ width: '800px' }}
>
{/* Card 1: Share form — gradient border */}
- <Panel active>
- <div class="text-ink flex flex-col">
- <div class="shrink-0 flex flex-row items-center justify-between px-3 h-10 gap-2 border-b border-edge-muted">
- <div class="flex-1 flex flex-row items-center gap-2 min-w-0">
- <Dialog.Title class="flex items-center gap-1.5 min-w-0 overflow-hidden whitespace-nowrap w-full text-sm font-medium">
- <span class="shrink-0">Share:</span>
- <EntityIcon
- targetType={props.blockAlias}
- size="sm"
- class="shrink-0"
- />
- <span class="truncate">{props.name}</span>
- </Dialog.Title>
- </div>
- </div>
+ <Window active>
+ <Window.Header class="px-3">
+ <Dialog.Title class="flex items-center gap-1.5 min-w-0 overflow-hidden whitespace-nowrap w-full text-sm font-medium">
+ <span class="shrink-0">Share:</span>
+ <EntityIcon
+ targetType={props.blockAlias}
+ size="sm"
+ class="shrink-0"
+ />
+ <span class="truncate">{props.name}</span>
+ </Dialog.Title>
+ </Window.Header>
+ <Window.Body>
<ForwardToChannel
submitPermissionInfo={{
setChannelPermissions: (id, accessLevel) =>
@@ -987,19 +985,21 @@ export function ShareModal(props: ShareModalProps) {
blockId={props.id}
blockName={props.blockAlias}
/>
- </div>
- </Panel>
+ </Window.Body>
+ </Window>
{/* Card 2: Recipients — plain border */}
<Show when={(recipients()?.length ?? 0) > 0 || !!props.owner}>
- <Panel>
- <div class="text-ink flex flex-col">
- <div class="shrink-0 h-10 flex items-center px-3 border-b border-edge-muted text-sm font-medium">
+ <Window>
+ <Window.Header class="px-3">
+ <span class="text-sm font-medium">
People with access to this{' '}
{props.itemType === 'email'
? 'email thread'
: props.itemType}
- </div>
+ </span>
+ </Window.Header>
+ <Window.Body class="text-ink">
<div class="relative">
<ScrollIndicators
scrollRef={recipientScrollRef}
@@ -1113,8 +1113,8 @@ export function ShareModal(props: ShareModalProps) {
</div>
</div>
</div>
- </div>
- </Panel>
+ </Window.Body>
+ </Window>
</Show>
{/* Card 3: Public link — plain border */}
@@ -1124,49 +1124,41 @@ export function ShareModal(props: ShareModalProps) {
props.itemType !== 'email'
}
>
- <Panel>
- <div class="text-ink flex flex-col">
- <div
- class={cn(
- 'h-10 flex items-center justify-between px-3 text-sm font-medium',
- publicAccessLevel() != null &&
- 'border-b border-edge-muted'
- )}
- >
- <div class="flex items-center gap-2">
- Public link
- <div
+ <Window>
+ <Window.Header class="justify-between px-3">
+ <div class="flex items-center gap-2">
+ <span class="text-sm font-medium">Public link</span>
+ <div
+ class={cn(
+ 'px-2 rounded-xl border py-0.5 flex justify-center items-center',
+ publicAccessLevel() != null
+ ? 'border-accent/30 bg-accent/10'
+ : 'border-edge-muted bg-edge-muted'
+ )}
+ >
+ <span
class={cn(
- 'px-2 rounded-xl border py-0.5 flex justify-center items-center',
+ 'text-xs font-medium whitespace-nowrap',
publicAccessLevel() != null
- ? 'border-accent/30 bg-accent/10'
- : 'border-edge-muted bg-edge-muted'
+ ? 'text-accent-ink'
+ : 'text-ink-extra-muted'
)}
>
- <span
- class={cn(
- 'text-xs font-medium whitespace-nowrap',
- publicAccessLevel() != null
- ? 'text-accent-ink'
- : 'text-ink-extra-muted'
- )}
- >
- {publicAccessLevel() != null
- ? 'ENABLED'
- : 'DISABLED'}
- </span>
- </div>
+ {publicAccessLevel() != null ? 'ENABLED' : 'DISABLED'}
+ </span>
</div>
- <MiniToggleSwitch
- size="Base"
- label="Enable public link"
- checked={publicAccessLevel() != null}
- onChange={(on) =>
- setPublicPermissions(on ? 'view' : null)
- }
- />
</div>
- <Show when={publicAccessLevel() != null}>
+ <MiniToggleSwitch
+ size="Base"
+ label="Enable public link"
+ checked={publicAccessLevel() != null}
+ onChange={(on) =>
+ setPublicPermissions(on ? 'view' : null)
+ }
+ />
+ </Window.Header>
+ <Show when={publicAccessLevel() != null}>
+ <Window.Body class="text-ink">
<div class="flex items-center p-3 justify-between">
<Button
variant="base"
@@ -1189,9 +1181,9 @@ export function ShareModal(props: ShareModalProps) {
/>
</span>
</div>
- </Show>
- </div>
- </Panel>
+ </Window.Body>
+ </Show>
+ </Window>
</Show>
</Dialog.Content>
</div>
diff --git a/js/app/packages/theme/components/ThemeList.tsx b/js/app/packages/theme/components/ThemeList.tsx
index 98e0387e68..a08e4fac0d 100644
--- a/js/app/packages/theme/components/ThemeList.tsx
+++ b/js/app/packages/theme/components/ThemeList.tsx
@@ -3,6 +3,7 @@ import { useAnalytics } from 'app/component/analytics-context';
import { applyTheme } from '../utils/themeUtils';
import { ColorSwatch } from './ColorSwatch';
import { ThemeCrud } from './ThemeCrud';
+import { Window } from '@ui';
import { For } from 'solid-js';
@@ -10,67 +11,26 @@ export function ThemeList() {
const analytics = useAnalytics()
return (
- <>
- <style>{`
- .theme-list-item-name.current-theme{
- transition: none !important;
- color: var(--a0) !important;
- }
-
- @media(hover){
- .theme-list-item-name:hover{
+ <>
+ <style>{`
+ .theme-list-item-name.current-theme{
transition: none !important;
color: var(--a0) !important;
}
- }
- `}</style>
- <div
- style="
- font-family: var(--font-sans);
- background-color: var(--b0);
- scrollbar-width: none;
- position: relative;
- overflow: hidden;
- font-size: 14px;
- display: block;
- height: 100%;
- "
- >
- <div
- style="
- overscroll-behavior: none;
- box-sizing: border-box;
- scrollbar-width: none;
- overflow-y: scroll;
- height: 100%;
- width: 100%;
- "
- >
- <div
- style="
- border-bottom: 1px solid var(--b3);
- background-color: var(--b0);
- align-items: center;
- position: absolute;
- padding: 0 20px;
- display: flex;
- height: 42px;
- width: 100%;
- z-index: 1;
- top: 0;
- left: 0;
- "
- >
- <div
- style={{
- 'font-size': '0.875rem',
- 'font-weight': '600'
- }}
- >
- Theme List
- </div>
- </div>
+ @media(hover){
+ .theme-list-item-name:hover{
+ transition: none !important;
+ color: var(--a0) !important;
+ }
+ }
+ `}</style>
+
+ <Window.Header class="px-5">
+ <div class="text-sm font-semibold">Theme List</div>
+ </Window.Header>
+
+ <Window.Body scroll>
<div
style="
grid-template-columns: min-content 1fr min-content;
@@ -78,7 +38,6 @@ export function ThemeList() {
box-sizing: border-box;
grid-auto-rows: 40px;
overflow-x: hidden;
- padding-top: 40px;
display: grid;
gap: 1px;
"
@@ -138,9 +97,8 @@ export function ThemeList() {
</>
)}
</For>
- </div>
</div>
- </div>
+ </Window.Body>
</>
);
}
diff --git a/js/app/packages/ui/components/Button.tsx b/js/app/packages/ui/components/Button.tsx
index 260b9e66a6..ee75eccbe1 100644
--- a/js/app/packages/ui/components/Button.tsx
+++ b/js/app/packages/ui/components/Button.tsx
@@ -21,7 +21,7 @@ type ButtonVariant = 'ghost' | 'base' | 'active' | 'danger';
const variantStyles: Record<ButtonVariant, string> = {
danger: 'bg-transparent text-failure border border-failure/50 not-disabled:hover:bg-failure/10 not-disabled:active:bg-failure/20 disabled:opacity-50 ',
- base: 'bg-transparent text-ink border border-edge not-disabled:hover:bg-ink/10 not-disabled:active:bg-ink/12 disabled:opacity-30 ',
+ base: 'bg-transparent text-ink border border-edge-muted not-disabled:hover:bg-ink/10 not-disabled:active:bg-ink/12 disabled:opacity-30 ',
active: 'bg-accent-bg text-accent border border-accent-ink ',
ghost: 'bg-transparent text-ink-muted not-disabled:hover:text-ink not-disabled:hover:bg-ink/10 not-disabled:active:bg-ink/12 disabled:opacity-30 ',
};
diff --git a/js/app/packages/ui/components/Panel.tsx b/js/app/packages/ui/components/Panel.tsx
index 427df073e2..86c667464b 100644
--- a/js/app/packages/ui/components/Panel.tsx
+++ b/js/app/packages/ui/components/Panel.tsx
@@ -2,33 +2,40 @@ import { splitProps, type JSX } from 'solid-js';
import { cn } from '../utils/classname';
import { Layer } from './Layer';
-export type PanelProps = JSX.HTMLAttributes<HTMLDivElement> & {
+export type PanelProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'style'> & {
depth?: 0 | 1 | 2 | 3 | 4 | 5;
+ style?: JSX.CSSProperties;
highlightColor?: string;
active?: boolean;
- hidden?: boolean;
};
export function Panel(props: PanelProps) {
- const [local, rest] = splitProps(props, ['highlightColor', 'active', 'depth', 'class', 'children', 'hidden']);
+ const [local, rest] = splitProps(props, [
+ 'highlightColor',
+ 'children',
+ 'active',
+ 'depth',
+ 'class',
+ 'style',
+ ]);
+
return (
<Layer depth={local.depth ?? 0}>
<div
style={{
- 'background-image': `linear-gradient(${local.active ? `${local.highlightColor || 'var(--color-accent)'}, var(--color-edge) 80%` : 'var(--color-edge)'})`,
- 'display': local.hidden ? 'none' : 'block'
+ 'background-image': local.active ? `linear-gradient(var(--b0), var(--b0)), linear-gradient(${local.highlightColor || 'var(--a0)'}, var(--b4) 80%)` : 'linear-gradient(var(--b0), var(--b0)), linear-gradient(var(--b4), var(--b4))',
+ 'background-origin': 'padding-box, border-box',
+ 'background-clip': 'padding-box, border-box',
+ 'border': '1px solid #0000',
+ ...local.style,
}}
- class={cn("p-px h-full w-full box-border rounded-md overflow-clip min-h-0")}
+ class={cn(
+ 'rounded-md overflow-clip min-h-0 h-full w-full',
+ local.class,
+ )}
+ {...rest}
>
- <div
- class={cn(
- 'h-full w-full box-border bg-panel rounded-[5px] overflow-clip',
- local.class
- )}
- {...rest}
- >
- {local.children}
- </div>
+ {local.children}
</div>
</Layer>
);
diff --git a/js/app/packages/ui/components/Window.tsx b/js/app/packages/ui/components/Window.tsx
index c5fcc4e194..5b6113a7d7 100644
--- a/js/app/packages/ui/components/Window.tsx
+++ b/js/app/packages/ui/components/Window.tsx
@@ -1,8 +1,8 @@
import type { ParentProps } from 'solid-js';
import { Show, splitProps } from 'solid-js';
import type { PanelProps } from './Panel';
-import { Panel } from './Panel';
import { cn } from '../utils/classname';
+import { Panel } from './Panel';
/**
* ```tsx
@@ -18,7 +18,7 @@ import { cn } from '../utils/classname';
export type WindowProps = PanelProps;
export function Window(props: WindowProps) {
- const [local, panelProps] = splitProps(props, ['children']);
+ const [local, panelProps] = splitProps(props, ['children', 'class']);
return (
<Panel
@@ -27,7 +27,7 @@ export function Window(props: WindowProps) {
'grid-template-rows': 'auto auto minmax(0, 1fr) auto',
'grid-template-columns': 'minmax(0, 1fr)',
}}
- class="grid min-h-0 min-w-0"
+ class={cn('grid min-h-0 min-w-0', local.class)}
{...panelProps}
>
{local.children}