Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fic(ui): button and window (#3111)
Fake-Userd19d1ebe37d0
diff --git a/js/app/packages/app/component/FatalError.tsx b/js/app/packages/app/component/FatalError.tsxindex 5df0237f48..6e5a94dee8 100644--- a/js/app/packages/app/component/FatalError.tsx+++ b/js/app/packages/app/component/FatalError.tsx@@ -46,10 +46,10 @@ export function FatalError(props: FatalErrorProps) {window.location.href = window.location.origin + '/app';}}>- <HomeIcon /> Home+ <HomeIcon class="size-4" /> Home</Button><Button variant="base" onClick={props.reset}>- <ResetIcon /> Try Again+ <ResetIcon class="size-4" /> Try Again</Button></div></div>diff --git a/js/app/packages/app/component/settings/Appearance.tsx b/js/app/packages/app/component/settings/Appearance.tsxindex 4487b00275..3ae98910fc 100644--- a/js/app/packages/app/component/settings/Appearance.tsx+++ b/js/app/packages/app/component/settings/Appearance.tsx@@ -3,7 +3,7 @@ import { ThemeEditorBasic } from '@theme/components/ThemeEditorBasic';import ThemeTools from '@theme/components/ThemeTools';import ThemeList from '@theme/components/ThemeList';-import { Panel } from '@ui';+import { Window } from '@ui';import { Tabs } from '@core/component/Tabs';import { createSignal, Show } from 'solid-js';import { isMobile } from '@core/mobile/isMobile';@@ -30,46 +30,40 @@ export function Appearance() {'gap': '8px',}}>- <Panel depth={2}>- <div class="flex flex-col h-full overflow-hidden">- <div class="relative flex items-center gap-3 h-10 shrink-0 px-[20px] after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-edge-muted after:content-['']">- <div class="h-full shrink-0">- <Tabs- list={tabList}- value={activeTab()}- defaultValue="basic"- onChange={(value) => setActiveTab(value as EditorTab)}- />- </div>- <Show when={!isMobile()}>- <div class="flex-1 min-w-0 h-full">- <ThemeTools />- </div>- </Show>- </div>-- <Show when={isMobile()}>- <div class="flex items-center px-[20px] py-1.5 border-b border-edge-muted shrink-0 min-w-0 overflow-hidden">- <ThemeTools />- </div>+ <Window depth={2}>+ <Window.Header>+ <Tabs+ list={tabList}+ value={activeTab()}+ defaultValue="basic"+ onChange={(value) => setActiveTab(value as EditorTab)}+ />+ <Show when={!isMobile()}>+ <ThemeTools class="flex-1 min-w-0" /></Show>+ </Window.Header>++ <Show when={isMobile()}>+ <Window.Toolbar>+ <ThemeTools class="flex-1 min-w-0" />+ </Window.Toolbar>+ </Show>- <div class="flex-1 overflow-auto min-h-0">- <Show when={activeTab() === 'basic'}>- <ThemeEditorBasic />- </Show>- <Show when={activeTab() === 'advanced'}>- <ThemeEditorAdvanced />- </Show>- </div>- </div>- </Panel>+ <Window.Body scroll>+ <Show when={activeTab() === 'basic'}>+ <ThemeEditorBasic />+ </Show>+ <Show when={activeTab() === 'advanced'}>+ <ThemeEditorAdvanced />+ </Show>+ </Window.Body>+ </Window>- <div class="grid grid-cols-1 gap-2 overflow-hidden min-h-0">- <Panel depth={2}>+ <Window depth={2}>+ <Window.Body><ThemeList />- </Panel>- </div>+ </Window.Body>+ </Window></div></div>);diff --git a/js/app/packages/core/component/AI/component/input/ChatInput.tsx b/js/app/packages/core/component/AI/component/input/ChatInput.tsxindex b4cba72f27..7ec696c0c1 100644--- a/js/app/packages/core/component/AI/component/input/ChatInput.tsx+++ b/js/app/packages/core/component/AI/component/input/ChatInput.tsx@@ -235,7 +235,7 @@ export function ChatInput(props: ChatInputComponentProps) {id="chat-input-text-area"class={cn('text-sm sm:text-sm text-ink')}classList={{- 'pl-8': !isMultiline(),+ 'pl-12': !isMultiline(),'pr-[48px]': !isMultiline() && isTouchDevice(),'pr-[130px]': !isMultiline() && !isTouchDevice(),'pl-0 pr-0 pb-8': isMultiline(),diff --git a/js/app/packages/theme/components/ThemeTools.tsx b/js/app/packages/theme/components/ThemeTools.tsxindex 43666dd4b4..208b8f93de 100644--- a/js/app/packages/theme/components/ThemeTools.tsx+++ b/js/app/packages/theme/components/ThemeTools.tsx@@ -9,7 +9,7 @@ import IconSave from '@macro-icons/macro-save.svg';import { createMemo, Show } from 'solid-js';import { cn } from '@ui/utils/classname';-export function ThemeTools() {+export function ThemeTools(props: { class?: string }) {let themeName!: HTMLDivElement;const defaultThemeName = 'New Theme';@@ -22,17 +22,13 @@ export function ThemeTools() {return (<div+ class={cn('flex items-center overflow-hidden w-full min-w-0', props.class)}style={{'gap': '4.5px' /* (41 - 32) / 2 */,'font-family': 'var(--font-sans)','scrollbar-width': 'none',- 'align-items': 'center',- 'overflow': 'hidden','font-size': '14px','height': '39.5px',- 'display': 'flex',- 'width': '100%',- 'min-width': '0',}}><div style={{ flex: 1 }}/>diff --git a/js/app/packages/ui/components/Panel.tsx b/js/app/packages/ui/components/Panel.tsxindex 7c53719583..427df073e2 100644--- a/js/app/packages/ui/components/Panel.tsx+++ b/js/app/packages/ui/components/Panel.tsx@@ -1,11 +1,11 @@-import { cn } from '../utils/classname';import { splitProps, type JSX } from 'solid-js';+import { cn } from '../utils/classname';import { Layer } from './Layer';export type PanelProps = JSX.HTMLAttributes<HTMLDivElement> & {+ depth?: 0 | 1 | 2 | 3 | 4 | 5;highlightColor?: string;active?: boolean;- depth?: 0 | 1 | 2 | 3 | 4 | 5;hidden?: boolean;};diff --git a/js/app/packages/ui/components/Scroll.tsx b/js/app/packages/ui/components/Scroll.tsxnew file mode 100644index 0000000000..e69de29bb2diff --git a/js/app/packages/ui/components/Window.tsx b/js/app/packages/ui/components/Window.tsxnew file mode 100644index 0000000000..c5fcc4e194--- /dev/null+++ b/js/app/packages/ui/components/Window.tsx@@ -0,0 +1,88 @@+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';++/**+ * ```tsx+ * <Window>+ * <Window.Header>Title</Window.Header>+ * <Window.Toolbar>...</Window.Toolbar>+ * <Window.Body>...</Window.Body>+ * <Window.Footer>...</Window.Footer>+ * </Window>+ * ```+ */++export type WindowProps = PanelProps;++export function Window(props: WindowProps) {+ const [local, panelProps] = splitProps(props, ['children']);++ return (+ <Panel+ style={{+ 'grid-template-areas': '"header" "toolbar" "body" "footer"',+ 'grid-template-rows': 'auto auto minmax(0, 1fr) auto',+ 'grid-template-columns': 'minmax(0, 1fr)',+ }}+ class="grid min-h-0 min-w-0"+ {...panelProps}+ >+ {local.children}+ </Panel>+ );+}++type SlotProps = ParentProps<{ class?: string }>;++Window.Header = (props: SlotProps) => (+ <Show when={props.children}>+ <div+ class={cn('flex h-10 items-center gap-1 border-b border-edge-muted px-5', props.class)}+ style={{ 'grid-area': 'header' }}+ >+ {props.children}+ </div>+ </Show>+);++Window.Toolbar = (props: SlotProps) => (+ <Show when={props.children}>+ <div+ class={cn('flex h-10 items-center gap-1 border-b border-edge-muted px-5', props.class)}+ style={{ 'grid-area': 'toolbar' }}+ >+ {props.children}+ </div>+ </Show>+);++type BodyProps = ParentProps<{ class?: string; scroll?: boolean }>;++Window.Body = (props: BodyProps) => (+ <Show when={props.children}>+ <div+ class={cn(+ 'relative min-h-0 min-w-0',+ props.scroll ? 'overflow-auto' : 'overflow-hidden',+ props.class,+ )}+ style={{ 'grid-area': 'body' }}+ >+ {props.children}+ </div>+ </Show>+);++Window.Footer = (props: SlotProps) => (+ <Show when={props.children}>+ <div+ class={cn('flex h-10 items-center gap-1 border-t border-edge-muted px-5', props.class)}+ style={{ 'grid-area': 'footer' }}+ >+ {props.children}+ </div>+ </Show>+);diff --git a/js/app/packages/ui/index.ts b/js/app/packages/ui/index.tsindex 8eeaff31ab..ae0f4e1fcf 100644--- a/js/app/packages/ui/index.ts+++ b/js/app/packages/ui/index.ts@@ -10,10 +10,15 @@ export {export { SegmentedControl } from './components/SegmentedControl';export { TabbedControl } from './components/TabbedControl';export { Keyboard } from './components/Keyboard';+export { Dialog } from './components/Dialog';+export { Window } from './components/Window';export { Button } from './components/Button';export { Layer } from './components/Layer';export { Panel } from './components/Panel';-export { Dialog, type DialogProps } from './components/Dialog';++/* types */+export type { DialogProps } from './components/Dialog';+export type { WindowProps } from './components/Window';/* utils */export { cn } from './utils/classname';