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.

Jbecke/im sorry seam u were right (#161)

Jacob Beckerman53be3433471e
diff --git a/js/app/packages/app/component/GlobalHotkeys.tsx b/js/app/packages/app/component/GlobalHotkeys.tsx
index dee1ee38f8..fd9c44eb5d 100644
--- a/js/app/packages/app/component/GlobalHotkeys.tsx
+++ b/js/app/packages/app/component/GlobalHotkeys.tsx
@@ -1,7 +1,6 @@
import { useOpenInstructionsMd } from '@core/component/AI/util/instructions';
import { ENABLE_SEARCH_SERVICE } from '@core/constant/featureFlags';
import { TOKENS } from '@core/hotkey/tokens';
-import type { ValidHotkey } from '@core/hotkey/types';
import {
isRightPanelOpen,
useBigChat,
@@ -28,7 +27,7 @@ import {
setKonsoleMode,
toggleKonsoleVisibility,
} from './command/state';
-import { CREATABLE_BLOCKS, toggleCreateMenu } from './dock/CreateMenu';
+import { toggleCreateMenu } from './dock/CreateMenu';
import { fireMacroJump } from './MacroJump';
import {
quickCreateMenuOpenSignal,
@@ -51,7 +50,7 @@ export default function GlobalShortcuts() {
return;
};
- const createScope = registerHotkey({
+ registerHotkey({
hotkeyToken: TOKENS.global.createCommand,
hotkey: 'c',
scopeId: 'global',
@@ -61,28 +60,6 @@ export default function GlobalShortcuts() {
return true;
},
displayPriority: 10,
- activateCommandScope: true,
- });
-
- CREATABLE_BLOCKS.forEach((item) => {
- registerHotkey({
- hotkeyToken: item.hotkeyToken,
- hotkey: item.hotkey,
- scopeId: createScope.commandScopeId,
- description: item.description,
- keyDownHandler: item.keyDownHandler,
- runWithInputFocused: true,
- displayPriority: 10,
- });
- registerHotkey({
- hotkeyToken: item.altHotkeyToken,
- hotkey: `opt+${item.hotkey}` as ValidHotkey,
- scopeId: createScope.commandScopeId,
- description: `${item.description} in new split`,
- keyDownHandler: item.keyDownHandler,
- runWithInputFocused: true,
- displayPriority: 1,
- });
});
const quickCreateScope = registerHotkey({
diff --git a/js/app/packages/app/component/dock/CreateMenu.tsx b/js/app/packages/app/component/dock/CreateMenu.tsx
index 275d84715b..ff0df6edf1 100644
--- a/js/app/packages/app/component/dock/CreateMenu.tsx
+++ b/js/app/packages/app/component/dock/CreateMenu.tsx
@@ -1,25 +1,7 @@
-import type { BlockName } from '@core/block';
-import { EntityIcon, getIconConfig } from '@core/component/EntityIcon';
import { BasicHotkey } from '@core/component/Hotkey';
-import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
-import { pressedKeys } from '@core/hotkey/state';
-import { type HotkeyToken, TOKENS } from '@core/hotkey/tokens';
-import type {
- HotkeyRegistrationOptions,
- ValidHotkey,
-} from '@core/hotkey/types';
-import {
- createCanvasFileFromJsonString,
- createChat,
- createMarkdownFile,
-} from '@core/util/create';
import { createControlledOpenSignal } from '@core/util/createControlledOpenSignal';
-import { ok } from '@core/util/maybeResult';
-import { DropdownMenu } from '@kobalte/core/dropdown-menu';
import MacroCreateIcon from '@macro-icons/macro-create-b.svg';
-import { useCreateProject } from '@service-storage/projects';
-import { createMemo, For, onMount, Show } from 'solid-js';
-import { useSplitLayout } from '../split-layout/layout';
+import { Launcher } from './Launcher';
export const [createMenuOpen, setCreateMenuOpen] = createControlledOpenSignal();
@@ -28,290 +10,16 @@ export const toggleCreateMenu = () => {
setCreateMenuOpen(!isOpen);
};
-const createBlock = async (spec: {
- blockName: BlockName;
- createFn: () => Promise<string | undefined | null | false>;
- loading?: boolean;
-}) => {
- const { replaceSplit, insertSplit } = useSplitLayout();
- const { blockName, createFn, loading } = spec;
-
- const shouldInsert = pressedKeys().has('opt');
-
- // TODO: order matters otherwise closing createMenu steals focus from other paywall modal
- setCreateMenuOpen(false);
-
- if (!loading) {
- const id = await createFn();
- if (!id) return;
-
- // Check if the result is an error before proceeding
- // MaybeResult error format: [ResultError[], null]
- // MaybeResult success format: [null, T]
- // String IDs are returned directly (not wrapped)
- if (Array.isArray(id) && id.length === 2 && id[0] !== null) {
- return;
- }
-
- const block = { type: blockName, id: id as string };
-
- shouldInsert ? insertSplit(block) : replaceSplit(block);
- } else {
- const split = shouldInsert
- ? insertSplit({ type: 'component', id: 'loading' })
- : replaceSplit({ type: 'component', id: 'loading' });
-
- const id = await createFn();
- if (!id) return;
-
- // Check if the result is an error before proceeding
- // MaybeResult error format: [ResultError[], null]
- // MaybeResult success format: [null, T]
- // String IDs are returned directly (not wrapped)
- if (Array.isArray(id) && id.length === 2 && id[0] !== null) {
- split?.goBack();
- return;
- }
-
- const actualId = id as string;
-
- if (!actualId) {
- split?.goBack();
- } else {
- if (split) split.replace({ type: blockName, id: actualId }, true);
- }
- }
-};
-
-const createComponent = async (spec: { componentId: string }) => {
- setCreateMenuOpen(false);
- const { replaceSplit, insertSplit } = useSplitLayout();
- const shouldInsert = pressedKeys().has('opt');
- if (shouldInsert) {
- insertSplit({ type: 'component', id: spec.componentId });
- } else {
- replaceSplit({ type: 'component', id: spec.componentId });
- }
-};
-
-export const CREATABLE_BLOCKS: (Omit<HotkeyRegistrationOptions, 'scopeId'> & {
- blockName: BlockName;
- altHotkeyToken?: HotkeyToken;
-})[] = [
- {
- description: 'Create note',
- blockName: 'md' as BlockName,
- hotkeyToken: TOKENS.create.note,
- altHotkeyToken: TOKENS.create.noteNewSplit,
- hotkey: 'n' as ValidHotkey,
- keyDownHandler: () => {
- createBlock({
- blockName: 'md',
- loading: true,
- createFn: () =>
- createMarkdownFile({
- title: '',
- content: '',
- projectId: undefined,
- }),
- });
- return true;
- },
- },
- {
- description: 'Create email',
- blockName: 'email' as BlockName,
- hotkeyToken: TOKENS.create.email,
- altHotkeyToken: TOKENS.create.emailNewSplit,
- hotkey: 'e' as ValidHotkey,
- keyDownHandler: () => {
- createComponent({ componentId: 'email-compose' });
- return true;
- },
- },
- {
- description: 'Create message',
- blockName: 'channel' as BlockName,
- hotkeyToken: TOKENS.create.message,
- altHotkeyToken: TOKENS.create.messageNewSplit,
- hotkey: 'm' as ValidHotkey,
- keyDownHandler: () => {
- createComponent({ componentId: 'channel-compose' });
- return true;
- },
- },
- {
- description: 'Create AI chat',
- blockName: 'chat' as BlockName,
- hotkeyToken: TOKENS.create.chat,
- altHotkeyToken: TOKENS.create.chatNewSplit,
- hotkey: 'a' as ValidHotkey,
- keyDownHandler: () => {
- createBlock({
- blockName: 'chat',
- createFn: async () => {
- const result = await createChat();
- if ('error' in result) {
- return false;
- }
- return result.chatId;
- },
- });
- return true;
- },
- },
- {
- description: 'Create canvas',
- blockName: 'canvas' as BlockName,
- hotkeyToken: TOKENS.create.canvas,
- altHotkeyToken: TOKENS.create.canvasNewSplit,
- hotkey: 'd' as ValidHotkey,
- keyDownHandler: () => {
- createBlock({
- blockName: 'canvas',
- loading: true,
- createFn: async () => {
- const result = await createCanvasFileFromJsonString({
- json: JSON.stringify({ nodes: [], edges: [] }),
- title: 'New Canvas',
- });
- if ('error' in result) return;
- const [_, id] = ok(result.documentId);
- return id;
- },
- });
- return true;
- },
- },
- {
- description: 'Create project',
- blockName: 'project' as BlockName,
- hotkeyToken: TOKENS.create.project,
- altHotkeyToken: TOKENS.create.projectNewSplit,
- hotkey: 'p' as ValidHotkey,
- keyDownHandler: () => {
- createBlock({
- blockName: 'project',
- createFn: () => {
- const createProject = useCreateProject();
- return createProject({ name: 'New Project' });
- },
- });
- return true;
- },
- },
-];
-
-type MenuItemProps = {
- description: string | (() => string);
- blockName: BlockName;
- index?: number;
- hotkeyToken?: HotkeyToken;
- hotkey?: ValidHotkey | ValidHotkey[];
- keyDownHandler: () => boolean;
-};
-
-function MenuItem(props: MenuItemProps) {
- const selectedColor = getIconConfig(props.blockName ?? 'pdf').foreground;
-
- const description = createMemo(() => {
- const description =
- typeof props.description === 'function'
- ? props.description()
- : props.description;
- return `${description}${pressedKeys().has('opt') ? ' in new split' : ''}`;
- });
-
- const Icon = (props: { blockName: BlockName }) => {
- return (
- <EntityIcon
- targetType={props.blockName}
- size="shrinkFill"
- theme="monochrome"
- />
- );
- };
-
- return (
- <DropdownMenu.Item
- class={`flex justify-between gap-12 px-1.5 py-1 isolate transition-transform ease-click duration-200 text-ink-extra-muted data-highlighted:${selectedColor} data-highlighted:bracket-offset-4`}
- onSelect={props.keyDownHandler}
- >
- <div class="flex gap-1">
- <div class="size-6">
- <Icon blockName={props.blockName} />
- </div>
- <span>{description()}</span>
- </div>
-
- <Show when={props.hotkeyToken}>
- {(token) => <BasicHotkey token={token()} theme="muted" size="base" />}
- </Show>
- </DropdownMenu.Item>
- );
-}
-
-function MenuContent() {
- const [attachHotkeys, createMenuScope] = useHotkeyDOMScope(
- 'create-menu.type',
- true
- );
- let ref!: HTMLDivElement;
-
- registerHotkey({
- hotkeyToken: TOKENS.create.close_menu,
- hotkey: 'c' as ValidHotkey,
- scopeId: createMenuScope,
- description: 'Close the create menu',
- keyDownHandler: () => {
- toggleCreateMenu();
- return true;
- },
- });
-
- onMount(() => {
- if (!ref) return;
- attachHotkeys(ref);
-
- CREATABLE_BLOCKS.forEach((item) => {
- registerHotkey({
- hotkeyToken: item.hotkeyToken,
- hotkey: item.hotkey,
- scopeId: createMenuScope,
- description: item.description,
- keyDownHandler: item.keyDownHandler,
- });
-
- // Alt variant (new split)
- if (item.altHotkeyToken) {
- registerHotkey({
- hotkeyToken: item.altHotkeyToken,
- hotkey: `opt+${item.hotkey}` as ValidHotkey,
- scopeId: createMenuScope,
- description: `${item.description} in new split`,
- keyDownHandler: item.keyDownHandler,
- });
- }
- });
- });
-
- return (
- <DropdownMenu.Content
- class="isolate relative flex flex-col gap-2 bg-dialog -mb-1 p-2 border-2 border-accent w-[16vw] min-w-max bracket-never"
- ref={ref}
- >
- <For each={CREATABLE_BLOCKS}>
- {(item, index) => <MenuItem {...item} index={index() + 1} />}
- </For>
- </DropdownMenu.Content>
- );
-}
-
export function CreateMenu() {
- // onMount(() => setCreateMenuOpen(true))
return (
- <DropdownMenu open={createMenuOpen()} onOpenChange={setCreateMenuOpen}>
- <DropdownMenu.Trigger class="relative flex justify-between items-center gap-2 data-expanded:bg-accent px-3 py-2 border border-edge-muted data-expanded:border-accent **:border-none! font-medium text-ink-muted data-expanded:text-default-bg hover:text-accent text-base bracket-never">
+ <>
+ <button
+ onClick={() => setCreateMenuOpen(true)}
+ class="relative flex justify-between items-center gap-2 data-expanded:bg-accent px-3 py-2 border border-edge-muted data-expanded:border-accent **:border-none! font-medium text-ink-muted data-expanded:text-default-bg hover:text-accent text-base bracket-never"
+ classList={{
+ 'bg-accent text-default-bg': createMenuOpen(),
+ }}
+ >
<span class="flex items-center">
<MacroCreateIcon
class={`h-2.5 ${createMenuOpen() ? 'fill-dialog/70' : 'fill-accent/70 transition-all duration-300'}`}
@@ -321,10 +29,8 @@ export function CreateMenu() {
shortcut="C"
theme={createMenuOpen() ? 'muted' : 'muted'}
/>
- </DropdownMenu.Trigger>
- <DropdownMenu.Portal>
- <MenuContent />
- </DropdownMenu.Portal>
- </DropdownMenu>
+ </button>
+ <Launcher open={createMenuOpen()} onOpenChange={setCreateMenuOpen} />
+ </>
);
}
diff --git a/js/app/packages/app/component/dock/Launcher.tsx b/js/app/packages/app/component/dock/Launcher.tsx
new file mode 100644
index 0000000000..3aedb5b314
--- /dev/null
+++ b/js/app/packages/app/component/dock/Launcher.tsx
@@ -0,0 +1,569 @@
+import type { BlockName } from '@core/block';
+import { getIconConfig } from '@core/component/EntityIcon';
+import { Hotkey } from '@core/component/Hotkey';
+import { PcNoiseGrid } from '@core/component/PcNoiseGrid';
+import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
+import type { HotkeyToken } from '@core/hotkey/tokens';
+import type { CommandDisplayPriority, ValidHotkey } from '@core/hotkey/types';
+import {
+ createCanvasFileFromJsonString,
+ createChat,
+ createCodeFileFromText,
+ createMarkdownFile,
+} from '@core/util/create';
+import { isErr } from '@core/util/maybeResult';
+import { Dialog } from '@kobalte/core/dialog';
+import PixelChat from '@macro-icons/pixel/ai.svg';
+import PixelArrowRight from '@macro-icons/pixel/arrow-right.svg';
+import PixelCanvas from '@macro-icons/pixel/canvas.svg';
+import PixelChannel from '@macro-icons/pixel/channel.svg';
+import PixelCode from '@macro-icons/pixel/code.svg';
+import PixelEmail from '@macro-icons/pixel/email.svg';
+import PixelMd from '@macro-icons/pixel/notes.svg';
+
+import {
+ type Component,
+ createEffect,
+ createSignal,
+ For,
+ onMount,
+ Show,
+} from 'solid-js';
+
+import { type FocusableElement, tabbable } from 'tabbable';
+
+import { useSplitLayout } from '../split-layout/layout';
+
+type LauncherMenuItemProps = {
+ label: string;
+ blockName: BlockName;
+ hotkeyLetter?: string;
+ hotkeyToken: string;
+ hotkey: ValidHotkey;
+ onClick: (e?: MouseEvent) => void | Promise<void>;
+ Icon: Component;
+ displayPriority: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
+ onMouseEnter?: () => void;
+ onFocus?: () => void;
+ focused?: boolean;
+};
+
+const USE_ENTITY_COLORS = true;
+
+const LauncherMenuItem = (props: LauncherMenuItemProps) => {
+ let buttonRef!: HTMLButtonElement;
+
+ createEffect(() => {
+ if (props.focused) {
+ buttonRef?.focus();
+ }
+ });
+
+ const textFg = () =>
+ USE_ENTITY_COLORS
+ ? getIconConfig(props.blockName ?? 'pdf').foreground
+ : 'text-accent';
+
+ return (
+ <button
+ class={`create-menu-${props.label.toLowerCase()} size-32 relative flex flex-col sm:gap-4 gap-2 items-center isolate justify-center bg-panel border border-edge transition-transform ease-click duration-200`}
+ classList={{
+ '-translate-y-2 text-ink bracket-offset-1': props.focused,
+ 'text-ink-extra-muted': !props.focused,
+ }}
+ onClick={props.onClick}
+ onFocus={props.onFocus}
+ onMouseEnter={props.onMouseEnter}
+ tabindex={0}
+ ref={buttonRef}
+ onPointerEnter={() => {
+ buttonRef?.focus();
+ }}
+ >
+ <div
+ class="inset-0 absolute bg-panel opacity-2 mask-b-from-0% mask-b-to-100%"
+ classList={{
+ 'text-ink-extra-muted opacity-2': !props.focused,
+ [textFg() + ' opacity-50']: props.focused,
+ }}
+ >
+ <PcNoiseGrid
+ cellSize={21 / 2}
+ rounding={10}
+ warp={0}
+ freq={0.002}
+ crunch={0.4}
+ size={[0.0, 0.2]}
+ fill={1}
+ stroke={0}
+ speed={[props.focused ? 0.3 : 0, 0]}
+ />
+ </div>
+
+ <div
+ class="absolute size-full inset-0 transition-transform origin-top opacity-20 ease duration-200 mix-blend-color"
+ classList={{
+ [getIconConfig(props.blockName ?? 'pdf').background]: true,
+ 'scale-y-0': !props.focused,
+ 'scale-y-100': props.focused,
+ }}
+ ></div>
+
+ <div class="absolute top-1.5 left-2 font-mono z-1 bg-panel text-accent font-bold">
+ <Hotkey shortcut={props.hotkeyLetter} />
+ </div>
+
+ <div
+ class="absolute size-2 right-2 top-2 z-1 transition-transform ease-click duration-200 transition-color border border-edge/50"
+ classList={{
+ [textFg()]: true,
+ }}
+ style={{ background: props.focused ? 'currentColor' : 'transparent' }}
+ />
+
+ <div class="w-full py-1 px-2 absolute bottom-0 flex flex-row justify-between items-center z-1">
+ <div class="text-sm font-bold uppercase font-stretch-condensed">
+ {props.label}
+ </div>
+ <div class="size-3">
+ <PixelArrowRight />
+ </div>
+ </div>
+
+ <div
+ class="w-1/3 -translate-y-1 transition-all ease-click duration-200"
+ classList={{
+ [textFg()]: props.focused,
+ 'text-edge': !props.focused,
+ 'scale-110': props.focused,
+ }}
+ >
+ <props.Icon />
+ </div>
+ </button>
+ );
+};
+
+type LauncherInnerProps = {
+ onClose: () => void;
+};
+
+const LauncherInner = (props: LauncherInnerProps) => {
+ const { replaceSplit, insertSplit } = useSplitLayout();
+
+ const [attachHotkeys, launcherScope] = useHotkeyDOMScope(
+ 'create-menu.type',
+ true
+ );
+
+ let ref!: HTMLDivElement;
+
+ const [focusedIndex, setFocusedIndex] = createSignal(0);
+
+ const openInSplit = (
+ type: BlockName,
+ id: string,
+ mode: 'current' | 'new'
+ ) => {
+ if (mode === 'new') {
+ insertSplit({
+ type: type,
+ id: id,
+ });
+ } else {
+ replaceSplit({
+ type: type,
+ id: id,
+ });
+ }
+
+ props.onClose();
+ };
+
+ const handleNewCode = async (mode: 'current' | 'new' = 'current') => {
+ const maybeDoc = await createCodeFileFromText({
+ code: 'print("Hello, World!")',
+ extension: 'py',
+ title: 'New Code File',
+ });
+
+ if (isErr(maybeDoc)) {
+ console.error('Failed to create new code:', maybeDoc);
+ return;
+ }
+
+ const [, result] = maybeDoc;
+ if (result?.documentId) {
+ openInSplit('code', result.documentId, mode);
+ }
+ };
+
+ const handleNewNote = async (mode: 'current' | 'new' = 'current') => {
+ const documentId = await createMarkdownFile({
+ title: '',
+ content: '',
+ projectId: undefined,
+ });
+
+ if (documentId) {
+ openInSplit('md', documentId, mode);
+ }
+ };
+
+ const handleNewCanvas = async (mode: 'current' | 'new' = 'current') => {
+ const emptyCanvasJson = JSON.stringify({
+ nodes: [],
+ edges: [],
+ });
+
+ const result = await createCanvasFileFromJsonString({
+ json: emptyCanvasJson,
+ title: 'New Canvas',
+ });
+
+ if ('error' in result) {
+ console.error('Failed to create new canvas:', result.error);
+ return;
+ }
+
+ if (result.documentId) {
+ openInSplit('canvas', result.documentId, mode);
+ }
+ };
+
+ const handleNewChat = async (mode: 'current' | 'new' = 'current') => {
+ const maybeChat = await createChat();
+
+ if (!maybeChat.chatId) {
+ console.error('Failed to create new chat:', maybeChat);
+ return;
+ }
+
+ const { chatId } = maybeChat;
+
+ if (!chatId) return;
+
+ openInSplit('chat', chatId, mode);
+ };
+
+ const handleNewEmail = (mode: 'current' | 'new' = 'current') => {
+ if (mode === 'new') {
+ insertSplit({
+ type: 'component',
+ id: 'email-compose',
+ });
+ } else {
+ replaceSplit({
+ type: 'component',
+ id: 'email-compose',
+ });
+ }
+ props.onClose();
+ };
+
+ const handleNewMessage = (mode: 'current' | 'new' = 'current') => {
+ if (mode === 'new') {
+ insertSplit({
+ type: 'component',
+ id: 'channel-compose',
+ });
+ } else {
+ replaceSplit({
+ type: 'component',
+ id: 'channel-compose',
+ });
+ }
+ props.onClose();
+ };
+
+ const actionHandlers = {
+ note: handleNewNote,
+ email: handleNewEmail,
+ message: handleNewMessage,
+ ai: handleNewChat,
+ canvas: handleNewCanvas,
+ code: handleNewCode,
+ };
+
+ const executeCurrentItem = (mode: 'current' | 'new') => {
+ const currentItem = launcherMenuItems[focusedIndex()];
+
+ if (currentItem) {
+ const handlerKey =
+ currentItem.label.toLowerCase() as keyof typeof actionHandlers;
+
+ if (actionHandlers[handlerKey]) {
+ actionHandlers[handlerKey](mode);
+ }
+ }
+ };
+
+ const launcherMenuItems: LauncherMenuItemProps[] = [
+ {
+ label: 'Note',
+ blockName: 'md',
+ hotkeyLetter: 'n',
+ hotkeyToken: 'global.create.note',
+ hotkey: 'n',
+ onClick: (e) => handleNewNote(e?.altKey ? 'new' : 'current'),
+ Icon: () => <PixelMd class="w-full h-full" />,
+ displayPriority: 5,
+ },
+ {
+ label: 'Email',
+ blockName: 'email',
+ hotkeyLetter: 'e',
+ hotkeyToken: 'global.create.email',
+ hotkey: 'e',
+ onClick: (e) => handleNewEmail(e?.altKey ? 'new' : 'current'),
+ Icon: () => <PixelEmail class="w-full h-full" />,
+ displayPriority: 4,
+ },
+ {
+ label: 'Message',
+ blockName: 'channel',
+ hotkeyLetter: 'm',
+ hotkeyToken: 'global.create.message',
+ hotkey: 'm',
+ onClick: (e) => handleNewMessage(e?.altKey ? 'new' : 'current'),
+ Icon: () => <PixelChannel class="w-full h-full" />,
+ displayPriority: 3,
+ },
+ {
+ label: 'AI',
+ blockName: 'chat',
+ hotkeyLetter: 'a',
+ hotkeyToken: 'global.create.chat',
+ hotkey: 'a',
+ onClick: (e) => handleNewChat(e?.altKey ? 'new' : 'current'),
+ Icon: () => <PixelChat class="w-full h-full" />,
+ displayPriority: 2,
+ },
+ {
+ label: 'Canvas',
+ blockName: 'canvas',
+ hotkeyLetter: 'd',
+ hotkeyToken: 'global.create.canvas',
+ hotkey: 'd',
+ onClick: (e) => handleNewCanvas(e?.altKey ? 'new' : 'current'),
+ Icon: () => <PixelCanvas class="w-full h-full" />,
+ displayPriority: 1,
+ },
+ {
+ label: 'Code',
+ blockName: 'code',
+ hotkeyLetter: 'c',
+ hotkeyToken: 'global.create.code',
+ hotkey: 'c',
+ onClick: (e) => handleNewCode(e?.altKey ? 'new' : 'current'),
+ Icon: () => <PixelCode class="w-full h-full" />,
+ displayPriority: 0,
+ },
+ ];
+
+ const focusMenuItem = (label: string) => {
+ const menuItem = document.querySelector<HTMLElement>(
+ `.create-menu-${label}`
+ );
+
+ if (menuItem) {
+ menuItem.focus();
+ }
+
+ return true;
+ };
+
+ const moveFocus = (delta: -1 | 1) => {
+ const tabbableEls = tabbable(ref);
+ const activeEl = document.activeElement as FocusableElement | null;
+ const activeElIndex = activeEl
+ ? tabbableEls.indexOf(activeEl as FocusableElement)
+ : -1;
+
+ if (activeElIndex === -1 || tabbableEls.length === 0) return false;
+
+ const nextIndex =
+ (activeElIndex + delta + tabbableEls.length) % tabbableEls.length;
+
+ const nextEl = tabbableEls[nextIndex];
+
+ if (!nextEl) return false;
+
+ nextEl.focus();
+
+ setFocusedIndex(nextIndex);
+
+ return true;
+ };
+
+ launcherMenuItems.forEach((item, index) => {
+ const displayPriority: CommandDisplayPriority | undefined =
+ item.displayPriority === 0
+ ? undefined
+ : (item.displayPriority as CommandDisplayPriority);
+
+ const hotkeyConfig: {
+ hotkeyToken?: HotkeyToken;
+ hotkey: ValidHotkey[];
+ scopeId: string;
+ description: string;
+ keyDownHandler: () => boolean;
+ displayPriority: CommandDisplayPriority | undefined;
+ } = {
+ hotkeyToken: item.hotkeyToken as HotkeyToken,
+ hotkey: [item.hotkey],
+ scopeId: launcherScope,
+ description: `Create ${item.label.charAt(0).toUpperCase() + item.label.slice(1).toLowerCase()}`,
+ keyDownHandler: () => {
+ setFocusedIndex(index);
+ item.onClick();
+ return true;
+ },
+ displayPriority,
+ };
+
+ registerHotkey(hotkeyConfig);
+
+ // Register option+letter hotkeys to open in new split
+ registerHotkey({
+ hotkey: `opt+${item.hotkey}` as ValidHotkey,
+ scopeId: launcherScope,
+ description: `Create ${item.label.charAt(0).toUpperCase() + item.label.slice(1).toLowerCase()} in new split`,
+ keyDownHandler: () => {
+ setFocusedIndex(index);
+ item.onClick({ altKey: true } as MouseEvent);
+ return true;
+ },
+ displayPriority,
+ });
+ });
+
+ registerHotkey({
+ hotkey: 'arrowleft',
+ scopeId: launcherScope,
+ description: 'Navigate Left',
+ keyDownHandler: () => moveFocus(-1),
+ });
+
+ registerHotkey({
+ hotkey: 'arrowright' as ValidHotkey,
+ scopeId: launcherScope,
+ description: 'Navigate Right',
+ keyDownHandler: () => moveFocus(1),
+ });
+
+ registerHotkey({
+ hotkey: 'escape',
+ scopeId: launcherScope,
+ description: 'Exit',
+ keyDownHandler: () => {
+ props.onClose();
+ return true;
+ },
+ });
+
+ registerHotkey({
+ hotkey: 'enter',
+ scopeId: launcherScope,
+ description: 'Open in current split',
+ keyDownHandler: () => {
+ executeCurrentItem('current');
+ return true;
+ },
+ runWithInputFocused: true,
+ displayPriority: 7,
+ });
+
+ registerHotkey({
+ hotkey: 'opt+enter' as ValidHotkey,
+ scopeId: launcherScope,
+ description: 'Open in new split',
+ keyDownHandler: () => {
+ executeCurrentItem('new');
+ return true;
+ },
+ runWithInputFocused: true,
+ displayPriority: 8,
+ });
+
+ onMount(() => {
+ if (!ref) return;
+
+ attachHotkeys(ref);
+
+ setTimeout(() => {
+ const firstItem = launcherMenuItems[0];
+
+ if (firstItem) {
+ focusMenuItem(firstItem.label);
+ }
+ }, 0);
+ });
+
+ return (
+ <div>
+ <div
+ class="relative grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-6 gap-3 p-6 isolate bg-menu pattern-edge pattern-dot-3 border border-edge/50 suppress-css-brackets"
+ ref={ref}
+ >
+ <div class="absolute pointer-events-none size-full inset-0 pulse-corners"></div>
+
+ <For each={launcherMenuItems}>
+ {(item, index) => (
+ <LauncherMenuItem
+ {...item}
+ onMouseEnter={() => setFocusedIndex(index())}
+ onFocus={() => setFocusedIndex(index())}
+ focused={focusedIndex() === index()}
+ />
+ )}
+ </For>
+ </div>
+ <div class="col-span-full font-mono text-sm text-ink-muted text-center pt-4">
+ Hold option to open in a new split view
+ </div>
+ </div>
+ );
+};
+
+type LauncherProps = {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+};
+
+export const Launcher = (props: LauncherProps) => {
+ const useJuicedScrim = false;
+
+ return (
+ <Dialog open={props.open} onOpenChange={props.onOpenChange} modal={true}>
+ <Dialog.Portal>
+ <Dialog.Overlay
+ class="fixed inset-0 z-modal bg-modal-overlay"
+ classList={{
+ 'backdrop-filter-[blur(0.5px)]': useJuicedScrim,
+ }}
+ >
+ <Show when={useJuicedScrim}>
+ <div class="absolute pointer-events-none size-full inset-0 bg-modal-overlay text-ink opacity-5">
+ <PcNoiseGrid
+ cellSize={20}
+ crunch={0.379}
+ size={[0, 1]}
+ speed={[0.03, 0.4]}
+ circleMask={1}
+ stroke={1}
+ fill={0}
+ />
+ </div>
+ </Show>
+ </Dialog.Overlay>
+
+ <Dialog.Content>
+ <div class="fixed inset-0 z-modal w-screen h-screen flex items-center justify-center">
+ <LauncherInner onClose={() => props.onOpenChange(false)} />
+ </div>
+ </Dialog.Content>
+ </Dialog.Portal>
+ </Dialog>
+ );
+};
diff --git a/js/app/packages/app/component/dock/PresentModeGlitch.tsx b/js/app/packages/app/component/dock/PresentModeGlitch.tsx
index fe4ee01518..561839a232 100644
--- a/js/app/packages/app/component/dock/PresentModeGlitch.tsx
+++ b/js/app/packages/app/component/dock/PresentModeGlitch.tsx
@@ -40,7 +40,7 @@ export function PresentModeGlitch(props: PresentModeGlitchProps) {
props.onComplete();
}, 200);
timeoutIds.push(id2);
- }, 400);
+ }, 800);
timeoutIds.push(id1);
};
diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsx
index a182a39cdf..d8fe8b9e2f 100644
--- a/js/app/packages/app/component/settings/Settings.tsx
+++ b/js/app/packages/app/component/settings/Settings.tsx
@@ -5,6 +5,7 @@ import {
EXPERIMENTAL_DARK_MODE,
} from '@core/constant/featureFlags';
import {
+ type SettingsTab,
setSettingsOpen,
useSettingsState,
} from '@core/constant/SettingsState';
@@ -13,17 +14,17 @@ import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
import { isMobileWidth } from '@core/mobile/mobileWidth';
import { useOrganizationName } from '@core/user';
import Dialog from '@corvu/dialog';
-import BellRinging from '@icon/regular/bell-ringing.svg';
-import CreditCard from '@icon/regular/credit-card.svg';
-import DeviceMobile from '@icon/regular/device-mobile.svg';
-import CyberMan from '@icon/regular/head-circuit.svg';
-import Palette from '@icon/regular/palette.svg';
-import UserCircle from '@icon/regular/user-circle.svg';
-import UsersThree from '@icon/regular/users-three.svg';
-import XIcon from '@icon/regular/x.svg';
+import { Tabs } from '@kobalte/core/tabs';
import { MacroPermissions, usePermissions } from '@service-gql/client';
import { registerHotkey } from 'core/hotkey/hotkeys';
-import { createSignal, Show } from 'solid-js';
+import {
+ createEffect,
+ createMemo,
+ createSignal,
+ For,
+ onCleanup,
+ Show,
+} from 'solid-js';
import MacroJump from '../MacroJump';
import { Account } from './Account';
import { AiMemory } from './AiMemory/AiMemory';
@@ -35,6 +36,8 @@ import { Subscription } from './Subscription';
export const [viewportOffset, setViewportOffset] = createSignal(0);
+const SCROLL_THRESHOLD = 10;
+
const { track, TrackingEvents } = withAnalytics();
export function Settings() {
const {
@@ -47,6 +50,94 @@ export function Settings() {
const permissions = usePermissions();
const orgName = useOrganizationName();
+ let scrollRef!: HTMLDivElement;
+ let scrollCleanup: (() => void) | undefined;
+ const [leftOpacity, setLeftOpacity] = createSignal(0);
+ const [rightOpacity, setRightOpacity] = createSignal(0);
+ const [indicatorStyle, setIndicatorStyle] = createSignal({
+ left: 0,
+ width: 0,
+ });
+
+ const updateClipIndicators = () => {
+ if (!scrollRef) return;
+ const { scrollLeft, scrollWidth, clientWidth } = scrollRef;
+
+ const leftAmount = Math.min(scrollLeft, SCROLL_THRESHOLD);
+ setLeftOpacity(leftAmount / SCROLL_THRESHOLD);
+
+ const maxScroll = scrollWidth - clientWidth;
+ const remainingScroll = maxScroll - scrollLeft;
+ const rightAmount = Math.min(remainingScroll, SCROLL_THRESHOLD);
+ setRightOpacity(rightAmount / SCROLL_THRESHOLD);
+ };
+
+ const updateIndicatorPosition = (element: HTMLElement) => {
+ if (!scrollRef || !element) return;
+ const listRect = scrollRef.getBoundingClientRect();
+ const tabRect = element.getBoundingClientRect();
+ setIndicatorStyle({
+ left: tabRect.left - listRect.left + scrollRef.scrollLeft,
+ width: tabRect.width,
+ });
+ };
+
+ const setupScrollListeners = (element: HTMLDivElement) => {
+ const listener = (e: WheelEvent) => {
+ e.preventDefault();
+ const { deltaX, deltaY } = e;
+ const delta = Math.abs(deltaX) > Math.abs(deltaY) ? deltaX : deltaY;
+ element.scrollLeft += delta;
+ updateClipIndicators();
+ };
+ const scrollListener = () => {
+ updateClipIndicators();
+ };
+ element.addEventListener('wheel', listener);
+ element.addEventListener('scroll', scrollListener);
+ updateClipIndicators();
+ return () => {
+ element.removeEventListener('wheel', listener);
+ element.removeEventListener('scroll', scrollListener);
+ };
+ };
+
+ onCleanup(() => {
+ if (scrollCleanup) {
+ scrollCleanup();
+ }
+ });
+
+ const settingsTabs = createMemo(() => {
+ const tabs: { value: string; label: string }[] = [];
+
+ if (EXPERIMENTAL_DARK_MODE) {
+ tabs.push({ value: 'Appearance', label: 'Appearance' });
+ }
+
+ tabs.push({ value: 'Account', label: 'Account' });
+
+ if (!orgName() && !isNativeMobilePlatform()) {
+ tabs.push({ value: 'Subscription', label: 'Subscription' });
+ }
+
+ if (orgName() && permissions()?.includes(MacroPermissions.WriteItPanel)) {
+ tabs.push({ value: 'Organization', label: 'Organization' });
+ }
+
+ tabs.push({ value: 'Notification', label: 'Notification' });
+
+ if (isNativeMobilePlatform() && DEV_MODE_ENV) {
+ tabs.push({ value: 'Mobile', label: 'Mobile Dev Tools' });
+ }
+
+ if (ENABLE_AI_MEMORY) {
+ tabs.push({ value: 'AI Memory', label: 'AI Memory' });
+ }
+
+ return tabs;
+ });
+
registerHotkey({
hotkeyToken: TOKENS.global.toggleSettings,
hotkey: 'cmd+;',
@@ -73,258 +164,145 @@ export function Settings() {
<Dialog.Portal>
<Dialog.Overlay class="dialog-overlay fixed inset-0 z-modal-overlay w-full bg-modal-overlay" />
<Dialog.Content
- class="dialog-content bg-dialog text-ink sm:rounded-lg fixed sm:left-1/2 sm:top-1/2 z-modal sm:-translate-x-1/2 sm:-translate-y-1/2 w-dvw sm:w-[75vw] flex flex-col sm:flex-row sm:ring-1 ring-edge sm:shadow-2xl"
+ class="dialog-content bg-dialog text-ink fixed sm:left-1/2 sm:top-1/2 z-modal sm:-translate-x-1/2 sm:-translate-y-1/2 w-dvw sm:w-[90vw] flex flex-col sm:shadow-2xl border-2 border-accent"
style={{
- height: isMobileWidth() ? `calc(100dvh)` : '75dvh',
+ height: isMobileWidth() ? `calc(100dvh)` : '90dvh',
top: isMobileWidth()
? `calc(${viewportOffset()}px + env(safe-area-inset-top))`
: '50%',
}}
ref={settingsContentEl}
>
- <div class="sm:h-full w-full rounded-l-lg sm:flex-1 sm:min-w-[15%] sm:max-w-[20%] bg-edge/15">
- <nav class="relative h-full flex-col sm:border-r border-b border-ink/10">
- <div class="flex justify-between items-center">
- <div class="px-3 py-3 text-xs text-ink-muted font-medium">
- Settings
- </div>
- <Show when={isMobileWidth()}>
- <XIcon
- width={16}
- height={16}
- class="text-ink-muted cursor-default mr-2 ml-1"
- onClick={closeSettings}
- />
- </Show>
- </div>
- <div class="flex flex-col px-2 py-[3px] gap-[3px]">
- {/* Account tab - always shown */}
- <Show when={true}>
- <button
- onClick={() => {
- setActiveTabId('Account');
- track(TrackingEvents.SETTINGS.CHANGETAB, {
- tab: 'Account',
- });
- }}
- class={`
- relative font-medium align-middle select-none
- flex flex-row justify-start items-center
- h-8 hover:bg-hover hover-transition-bg px-1 rounded-md
- ${'Account' === activeTabId() ? 'text-ink cursor-default bg-active' : ''}
- `}
- >
- <div class="line-clamp-1 text-sm flex-grow">
- <div class="flex items-center gap-1">
- <UserCircle class="w-5 h-5" />
- <div>Account</div>
- </div>
- </div>
- </button>
- </Show>
-
- {/* Subscription tab */}
- <Show when={!orgName() && !isNativeMobilePlatform()}>
- <button
- onClick={() => {
- setActiveTabId('Subscription');
- track(TrackingEvents.SETTINGS.CHANGETAB, {
- tab: 'Subscription',
- });
- }}
- class={`
- relative font-medium align-middle select-none
- flex flex-row justify-start items-center
- h-8 hover:bg-hover hover-transition-bg px-1 rounded-md
- ${'Subscription' === activeTabId() ? 'text-ink cursor-default bg-active' : ''}
- `}
- >
- <div class="line-clamp-1 text-sm flex-grow">
- <div class="flex items-center gap-1">
- <CreditCard class="w-5 h-5" />
- <div>Subscription</div>
- </div>
- </div>
- </button>
- </Show>
+ <Tabs
+ value={activeTabId()}
+ onChange={(value: string | undefined) => {
+ if (
+ value &&
+ (value === 'Account' ||
+ value === 'Subscription' ||
+ value === 'Organization' ||
+ value === 'Appearance' ||
+ value === 'Notification' ||
+ value === 'Mobile' ||
+ value === 'AI Memory')
+ ) {
+ setActiveTabId(value as SettingsTab);
+ track(TrackingEvents.SETTINGS.CHANGETAB, { tab: value });
+ }
+ }}
+ class="flex flex-col h-full"
+ >
+ <div class="relative isolate shrink-0">
+ {/* Left clip boundary indicator */}
+ <div
+ class="absolute pointer-events-none left-0 top-px bottom-px w-3 z-2 pattern-diagonal-4 pattern-edge mask-r-from-0% border-l border-edge-muted transition-opacity duration-150"
+ style={{ opacity: leftOpacity() }}
+ />
+ {/* Right clip boundary indicator */}
+ <div
+ class="absolute pointer-events-none right-0 top-px bottom-px w-3 z-2 pattern-diagonal-4 pattern-edge mask-l-from-0% border-r border-edge-muted transition-opacity duration-150"
+ style={{ opacity: rightOpacity() }}
+ />
- {/* Organization tab */}
- <Show
- when={
- orgName() &&
- permissions()?.includes(MacroPermissions.WriteItPanel)
+ <Tabs.List
+ class="flex flex-row suppress-css-brackets h-full bg-panel overflow-x-scroll overscroll-none scrollbar-hidden scroll-shadows-x relative"
+ as="div"
+ ref={(el) => {
+ scrollRef = el;
+ if (el) {
+ scrollCleanup = setupScrollListeners(el);
}
- >
- <button
- onClick={() => {
- setActiveTabId('Organization');
- track(TrackingEvents.SETTINGS.CHANGETAB, {
- tab: 'Organization',
- });
- }}
- class={`
- relative font-medium align-middle select-none
- flex flex-row justify-start items-center
- h-8 hover:bg-hover hover-transition-bg px-1 rounded-md
- ${'Organization' === activeTabId() ? 'text-ink cursor-default bg-active' : ''}
- `}
- >
- <div class="line-clamp-1 text-sm flex-grow">
- <div class="flex items-center gap-1">
- <UsersThree class="w-5 h-5" />
- <div>Organization</div>
- </div>
- </div>
- </button>
- </Show>
+ }}
+ >
+ {/* Sliding indicator line */}
+ <div
+ class="absolute bottom-0 h-px bg-accent z-10 pointer-events-none transition-all duration-150 ease-out"
+ style={{
+ transform: `translateX(${indicatorStyle().left}px)`,
+ width: `${indicatorStyle().width}px`,
+ }}
+ />
- {/* Appearance tab */}
- <Show when={EXPERIMENTAL_DARK_MODE}>
- <button
- onClick={() => {
- setActiveTabId('Appearance');
- track(TrackingEvents.SETTINGS.CHANGETAB, {
- tab: 'Appearance',
- });
- }}
- class={`
- relative font-medium align-middle select-none
- flex flex-row justify-start items-center
- h-8 hover:bg-hover hover-transition-bg px-1 rounded-md
- ${'Appearance' === activeTabId() ? 'text-ink cursor-default bg-active' : ''}
- `}
- >
- <div class="line-clamp-1 text-sm flex-grow">
- <div class="flex items-center gap-1">
- <Palette class="w-5 h-5" />
- <div>Appearance</div>
- </div>
- </div>
- </button>
- </Show>
+ <For each={settingsTabs()}>
+ {({ value, label }, i) => {
+ const isActive = createMemo(() => value === activeTabId());
- {/* Notification tab */}
- <button
- onClick={() => {
- setActiveTabId('Notification');
- track(TrackingEvents.SETTINGS.CHANGETAB, {
- tab: 'Notification',
+ let ref: HTMLDivElement | undefined;
+ createEffect(() => {
+ if (isActive() && ref) {
+ ref.scrollIntoView({
+ inline: 'end',
+ });
+ updateIndicatorPosition(ref);
+ setTimeout(updateClipIndicators, 0);
+ }
});
- }}
- class={`
- relative font-medium align-middle select-none
- flex flex-row justify-start items-center
- h-8 hover:bg-hover hover-transition-bg px-1 rounded-md
- ${'Notification' === activeTabId() ? 'text-ink cursor-default bg-active' : ''}
- `}
- >
- <div class="line-clamp-1 text-sm flex-grow">
- <div class="flex items-center gap-1">
- <BellRinging class="w-5 h-5" />
- <div>Notification</div>
- </div>
- </div>
- </button>
- {/* Mobile tab */}
- <Show when={!!isNativeMobilePlatform() && DEV_MODE_ENV}>
- <button
- onClick={() => {
- setActiveTabId('Mobile');
- track(TrackingEvents.SETTINGS.CHANGETAB, {
- tab: 'Mobile',
- });
- }}
- class={`
- relative font-medium align-middle select-none
- flex flex-row justify-start items-center
- h-8 hover:bg-hover hover-transition-bg px-1 rounded-md
- ${'Mobile' === activeTabId() ? 'text-ink cursor-default bg-active' : ''}
- `}
- >
- <div class="line-clamp-1 text-sm flex-grow">
- <div class="flex items-center gap-1">
- <DeviceMobile class="w-5 h-5" />
- <div>Mobile Dev Tools</div>
- </div>
- </div>
- </button>
- </Show>
- <Show when={ENABLE_AI_MEMORY}>
- <button
- onClick={() => {
- setActiveTabId('AI Memory');
- track(TrackingEvents.SETTINGS.CHANGETAB, {
- tab: 'AI Memory',
- });
- }}
- class={`
- relative font-medium align-middle select-none
- flex flex-row justify-start items-center
- h-8 hover:bg-hover hover-transition-bg px-1 rounded-md
- ${'AI Memory' === activeTabId() ? 'text-ink cursor-default bg-active' : ''}
- `}
- >
- <div class="line-clamp-1 text-sm flex-grow">
- <div class="flex items-center gap-1">
- <CyberMan class="w-5 h-5" />
- <div>AI Memory</div>
- </div>
- </div>
- </button>
- </Show>
- </div>
- </nav>
- </div>
- <div class="flex-1 p-6 overflow-y-scroll">
- {/* Use switch/case approach for the content instead of using tabs array */}
- {(() => {
- switch (activeTabId()) {
- case 'Account':
- return <Account />;
- case 'Subscription':
- return (
- <Show when={!orgName()}>
- <Subscription />
- </Show>
- );
- case 'Organization':
- return (
- <Show
- when={
- orgName() &&
- permissions()?.includes(MacroPermissions.WriteItPanel)
- }
- >
- <Organization />
- </Show>
- );
- case 'Appearance':
- return (
- <Show when={EXPERIMENTAL_DARK_MODE}>
- <Appearance />
- </Show>
- );
- case 'Notification':
- return <Notification />;
+ return (
+ <Tabs.Trigger
+ value={value}
+ ref={ref}
+ tabIndex={-1}
+ class="min-w-12 max-w-[40cqw] shrink-0 text-sm relative h-full flex items-center px-2"
+ classList={{
+ 'z-1 border-y border-edge-muted text-accent text-glow-sm':
+ isActive(),
+ 'border-y border-edge-muted text-ink-disabled hover:text-accent/70 hover-transition-text':
+ !isActive(),
+ }}
+ >
+ <span class="flex items-center gap-1 w-full">
+ <span class="text-xs font-mono opacity-70 mr-0.5">
+ {(i() + 1).toString()}
+ </span>
+ <span class="truncate">{label}</span>
+ </span>
+ </Tabs.Trigger>
+ );
+ }}
+ </For>
+ </Tabs.List>
+ </div>
- case 'Mobile':
- return (
- <Show when={!!isNativeMobilePlatform() && DEV_MODE_ENV}>
- <Mobile />
- </Show>
- );
- case 'AI Memory':
- return (
- <Show when={ENABLE_AI_MEMORY}>
- <AiMemory />
- </Show>
- );
- default:
- return <Account />;
- }
- })()}
- </div>
+ <div class="flex-1 p-6 overflow-y-scroll">
+ <Tabs.Content value="Account" class="h-full">
+ <Account />
+ </Tabs.Content>
+ <Show when={!orgName() && !isNativeMobilePlatform()}>
+ <Tabs.Content value="Subscription" class="h-full">
+ <Subscription />
+ </Tabs.Content>
+ </Show>
+ <Show
+ when={
+ orgName() &&
+ permissions()?.includes(MacroPermissions.WriteItPanel)
+ }
+ >
+ <Tabs.Content value="Organization" class="h-full">
+ <Organization />
+ </Tabs.Content>
+ </Show>
+ <Show when={EXPERIMENTAL_DARK_MODE}>
+ <Tabs.Content value="Appearance" class="h-full">
+ <Appearance />
+ </Tabs.Content>
+ </Show>
+ <Tabs.Content value="Notification" class="h-full">
+ <Notification />
+ </Tabs.Content>
+ <Show when={!!isNativeMobilePlatform() && DEV_MODE_ENV}>
+ <Tabs.Content value="Mobile" class="h-full">
+ <Mobile />
+ </Tabs.Content>
+ </Show>
+ <Show when={ENABLE_AI_MEMORY}>
+ <Tabs.Content value="AI Memory" class="h-full">
+ <AiMemory />
+ </Tabs.Content>
+ </Show>
+ </div>
+ </Tabs>
</Dialog.Content>
<MacroJump tabbableParent={() => settingsContentEl} />
</Dialog.Portal>
diff --git a/js/app/packages/app/public/crosshair-cursor.svg b/js/app/packages/app/public/crosshair-cursor.svg
index ca8fda565e..fce8faff8b 100644
--- a/js/app/packages/app/public/crosshair-cursor.svg
+++ b/js/app/packages/app/public/crosshair-cursor.svg
@@ -1,3 +1,12 @@
+<<<<<<< HEAD
+<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
+ <!-- Horizontal line -->
+ <line x1="0" y1="16" x2="32" y2="16" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
+ <!-- Vertical line -->
+ <line x1="16" y1="0" x2="16" y2="32" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
+ <!-- Center circle -->
+ <circle cx="16" cy="16" r="2" fill="currentColor"/>
+=======
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
<!-- Outer guides with white outline for visibility -->
<line x1="16" y1="2" x2="16" y2="8" stroke="white" stroke-width="2.5" stroke-linecap="round"/>
@@ -18,5 +27,6 @@
<!-- Center dot with white outline -->
<circle cx="16" cy="16" r="2" fill="white"/>
<circle cx="16" cy="16" r="1.5" fill="black"/>
+>>>>>>> d66401546b933e7e781d745cc2e4417cb14f5413
</svg>
diff --git a/js/app/packages/core/constant/SettingsState.tsx b/js/app/packages/core/constant/SettingsState.tsx
index 49ba03b8af..5fb0db7cc6 100644
--- a/js/app/packages/core/constant/SettingsState.tsx
+++ b/js/app/packages/core/constant/SettingsState.tsx
@@ -11,7 +11,7 @@ export type SettingsTab =
export const [settingsOpen, setSettingsOpen] = createSignal(false);
export const [activeTabId, setActiveTabId] =
- createSignal<SettingsTab>('Account');
+ createSignal<SettingsTab>('Appearance');
export const useSettingsState = () => {
const openSettings = (activeTabId?: SettingsTab) => {
@@ -25,7 +25,7 @@ export const useSettingsState = () => {
};
createEffect(() => {
- if (!settingsOpen()) setActiveTabId('Account');
+ if (!settingsOpen()) setActiveTabId('Appearance');
});
return {
diff --git a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
index b85160765c..68ffbf1ef8 100644
--- a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
+++ b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
@@ -1,7 +1,6 @@
import { matches } from '@core/util/match';
import CheckIcon from '@phosphor-icons/core/assets/regular/check.svg';
import { useEmail } from '@service-gql/client';
-import { mergeRefs } from '@solid-primitives/refs';
import { createDraggable, createDroppable } from '@thisbeyond/solid-dnd';
import { getIconConfig } from 'core/component/EntityIcon';
import { StaticMarkdown } from 'core/component/LexicalMarkdown/component/core/StaticMarkdown';
@@ -12,7 +11,6 @@ import { useSplitNavigationHandler } from 'core/util/useSplitNavigationHandler';
import { notificationWithMetadata } from 'notifications/notificationMetadata';
import type { ParentProps, Ref } from 'solid-js';
import {
- createEffect,
createMemo,
createSignal,
For,
@@ -98,7 +96,6 @@ export function EntityWithEverything(
createSignal(false);
const { keydownDataDuringTask } = trackKeydownDuringTask();
- let _tabbableEl!: HTMLDivElement;
const userEmail = useEmail();
// onMount(() => {
@@ -404,9 +401,7 @@ export function EntityWithEverything(
onKeyUp={onKeyUpClick((e) => props.onClick?.(props.entity, e as any))}
role="button"
tabIndex={0}
- ref={mergeRefs(props.ref, (el) => {
- _tabbableEl = el;
- })}
+ ref={props.ref}
>
{/* Left Column Indicator(s) */}
<Show when={props.showLeftColumnIndicator}>
@@ -768,277 +763,6 @@ const createFormattedDate = (timestamp: number) =>
});
});
-let init = true;
-let globalResizeObserver: ResizeObserver | null = null;
-const containerCallbacks = new WeakMap<HTMLElement, () => void>();
-
-const initGlobalResizeObserver = () => {
- if (globalResizeObserver) return;
-
- globalResizeObserver = new ResizeObserver((entries) => {
- for (const entry of entries) {
- const callback = containerCallbacks.get(entry.target as HTMLElement);
- if (callback) {
- callback();
- }
- }
- });
-};
-
-// truncates rightmost child first
-function _truncateChildren(
- containerRef: () => HTMLDivElement | undefined | null
-) {
- const MIN_WIDTH = 80; // Minimum width for collapsed children
-
- createEffect(() => {
- const container = containerRef();
- if (!container) return;
-
- initGlobalResizeObserver();
-
- const setSizes = () => {
- const children = Array.from(container.children) as HTMLElement[];
- if (children.length === 0) return;
-
- const containerWidth = container.getBoundingClientRect().width;
- if (containerWidth === 0) return;
-
- // Store original styles to restore later
- const originalStyles = children.map((child) => ({
- width: child.style.width,
- }));
-
- // microtask callback hell to batch sequential dom read/write ...
- queueMicrotask(() => {
- // Write
- // Temporarily reset all width constraints to measure true natural width
- children.forEach((child) => {
- child.style.width = 'auto';
- });
-
- queueMicrotask(() => {
- // Read
- // Measure natural widths using scrollWidth
- // also forces reflow
- const naturalWidths = children.map((child) => {
- // const width = child.scrollWidth;
- const width = child.scrollWidth;
- // if(entity) {
- // console.log(
- // 'Child scrollWidth:',
- // width,
- // 'Child text:',
- // child.textContent?.trim()
- // );
- // }
- return width;
- });
-
- queueMicrotask(() => {
- // Write
- // Restore original styles immediately
- children.forEach((child, index) => {
- const original = originalStyles[index];
- child.style.width = original.width;
- });
-
- queueMicrotask(() => {
- // Read
- container.offsetHeight;
-
- // Account for gaps between children (gap-2 = 8px)
- const GAP_SIZE = 8;
- const totalNaturalWidth =
- naturalWidths.reduce((sum, w) => sum + w, 0) +
- (children.length - 1) * GAP_SIZE;
-
- // console.log(
- // 'Container width:',
- // containerWidth,
- // 'Total natural width:',
- // totalNaturalWidth,
- // 'Natural widths:',
- // naturalWidths
- // );
-
- // If container is wide enough, use natural widths
- if (containerWidth >= totalNaturalWidth) {
- // console.log('Using natural widths - container is wide enough');
- queueMicrotask(() => {
- children.forEach((child) => {
- child.style.width = 'auto';
- child.style.flexShrink = '';
- });
- });
- return;
- }
-
- // console.log(
- // 'Container too narrow, applying progressive collapse from right to left'
- // );
-
- // Progressive collapse: start from rightmost child and work backwards
- const computedWidths = [...naturalWidths];
-
- // Calculate total width needed (including gaps)
- let totalWidth =
- computedWidths.reduce((sum, w) => sum + w, 0) +
- (computedWidths.length - 1) * GAP_SIZE;
-
- // If total width exceeds container, start collapsing from right
- if (totalWidth > containerWidth) {
- // console.log(`Total width ${totalWidth} exceeds container ${containerWidth}, starting collapse from right`);
-
- // Start from rightmost child and work backwards
- for (let i = computedWidths.length - 1; i >= 0; i--) {
- // console.log(`Child ${i}: natural=${computedWidths[i]}, current total=${totalWidth}`);
-
- // Use the smaller of natural width or MIN_WIDTH
- const effectiveMinWidth = Math.min(
- computedWidths[i],
- MIN_WIDTH
- );
-
- if (computedWidths[i] > effectiveMinWidth) {
- // Calculate how much we need to reduce this child
- const excess = totalWidth - containerWidth;
-
- if (excess > 0) {
- // Reduce this child, but not below its effective minimum
- const reduction = Math.min(
- excess,
- computedWidths[i] - effectiveMinWidth
- );
- computedWidths[i] = Math.max(
- effectiveMinWidth,
- computedWidths[i] - reduction
- );
- totalWidth =
- computedWidths.reduce((sum, w) => sum + w, 0) +
- (computedWidths.length - 1) * GAP_SIZE;
- // console.log(`Reduced child ${i} by ${reduction}px to ${computedWidths[i]}px, new total: ${totalWidth}`);
- }
- }
-
- // Check if we're now within bounds
- if (totalWidth <= containerWidth) {
- // console.log(
- // `Total width ${totalWidth} now fits in container ${containerWidth}`
- // );
- break;
- }
- }
- }
-
- // Second pass: if still not enough space, proportionally reduce all children equally
- let finalTotalWidth =
- computedWidths.reduce((sum, w) => sum + w, 0) +
- (computedWidths.length - 1) * GAP_SIZE;
-
- if (finalTotalWidth > containerWidth) {
- // console.log(
- // 'Still too wide after collapse, applying proportional scaling'
- // );
- const availableWidth =
- containerWidth - (computedWidths.length - 1) * GAP_SIZE;
- const scaleFactor = Math.max(
- 0,
- availableWidth / computedWidths.reduce((sum, w) => sum + w, 0)
- );
-
- computedWidths.forEach((_, i) => {
- computedWidths[i] = Math.max(
- 0,
- computedWidths[i] * scaleFactor
- );
- });
-
- // Recalculate final width
- finalTotalWidth =
- computedWidths.reduce((sum, w) => sum + w, 0) +
- (computedWidths.length - 1) * GAP_SIZE;
- }
-
- // Safety check: ensure we never exceed container width
- if (finalTotalWidth > containerWidth) {
- const _excess = finalTotalWidth - containerWidth;
- const availableForChildren =
- containerWidth - (computedWidths.length - 1) * GAP_SIZE;
-
- // Distribute available width proportionally among children
- const totalChildWidth = computedWidths.reduce(
- (sum, w) => sum + w,
- 0
- );
- const finalScaleFactor = availableForChildren / totalChildWidth;
-
- computedWidths.forEach((_, i) => {
- computedWidths[i] = Math.max(
- 0,
- computedWidths[i] * finalScaleFactor
- );
- });
- }
-
- // console.log('Final computed widths:', computedWidths);
-
- // Apply computed widths to children
- queueMicrotask(() => {
- children.forEach((child, index) => {
- const computedWidth = computedWidths[index];
- const naturalWidth = naturalWidths[index];
-
- // Only set width if it's different from the natural width
- if (Math.abs(computedWidth - naturalWidth) > 0.1) {
- child.style.width = `${computedWidth}px`;
- // the resizing logic is off by 10 pixels or so
- // for now apply shrink in addition, to workaround that issue
- child.style.flexShrink = '1';
- } else {
- // Reset to natural width
- child.style.width = 'auto';
- child.style.flexShrink = '';
- }
- });
- });
- });
- });
- });
- });
- };
-
- // Register this container with the global observer
- containerCallbacks.set(container, setSizes);
- globalResizeObserver!.observe(container);
-
- // Check if fonts are ready and recalculate if needed
- const checkFontsAndRecalculate = async () => {
- if ('fonts' in document) {
- try {
- await document.fonts.ready;
- setTimeout(() => {
- setSizes();
- }, 800);
- } catch (_error) {
- setTimeout(setSizes, 100);
- }
- }
- };
-
- if (init) {
- // Check fonts and recalculate when ready
- checkFontsAndRecalculate();
- init = false;
- }
-
- onCleanup(() => {
- // Unobserve this container and remove its callback
- globalResizeObserver!.unobserve(container);
- });
- });
-}
-
const ITEM_WRAPPER_CLASS = () => {
let input = ITEM_WRAPPER;
const excludeclasses = [