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(icon): Add animated top sidebar icons (#3560)

Aidan Holloway-Bidwell66cc9648f762
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index fe9043af4f..b3bed8b857 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -51,10 +51,10 @@ import { activateClosestDOMScope } from '@core/hotkey/utils';
import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import LogoIcon from '@icon/macro-logo.svg';
-import SquareSidebarIcon from '@icon/square-sidebar.svg';
+import { AnimatedSquareCommandKIcon } from '@icon/square-command-k';
+import { AnimatedSquareSidebarIcon } from '@icon/square-sidebar';
import { AnimatedCallIcon } from '@icon/wide-call';
import { AnimatedChannelIcon } from '@icon/wide-channel';
-import CommandKIcon from '@icon/wide-command-k.svg';
import { AnimatedEmailIcon } from '@icon/wide-email';
import { AnimatedFileMdIcon } from '@icon/wide-fileMd';
import { AnimatedFolderIcon } from '@icon/wide-folder';
@@ -607,6 +607,36 @@ const SidebarActionButton = (props: SidebarActionButtonProps) => {
);
};
+/**
+ * Compact icon-only button for the sidebar header row. Encapsulates the hover
+ * signal so animated icons play on hover, mirroring `SidebarActionButton`.
+ */
+const SidebarHeaderIconButton = (props: {
+ icon: Component<{ triggerAnimation?: boolean; class?: string }>;
+ label: string;
+ hotkey?: HotkeyToken | HotkeyToken[];
+ disabled?: boolean;
+ onClick: (event: MouseEvent) => void;
+ onMouseDown?: (event: MouseEvent) => void;
+}) => {
+ const [hovering, setHovering] = createSignal(false);
+ return (
+ <Button
+ class="rounded-md p-1 text-ink-extra-muted [&_svg]:size-4"
+ size="icon-sm"
+ label={props.label}
+ hotkey={props.hotkey}
+ disabled={props.disabled}
+ onClick={props.onClick}
+ onMouseDown={props.onMouseDown}
+ onMouseEnter={() => setHovering(true)}
+ onMouseLeave={() => setHovering(false)}
+ >
+ <Dynamic component={props.icon} triggerAnimation={hovering()} />
+ </Button>
+ );
+};
+
type SidebarSettingsWidgetProps = {
isSlim: () => boolean;
onSelect: (tab: SettingsTab) => void;
@@ -877,30 +907,24 @@ export const AppSidebar = (props: AppSidebarProps) => {
<BellIcon />
</Button>
</Show>
- <Button
- class="rounded-md p-1 text-ink-extra-muted"
- size="icon-sm"
+ <SidebarHeaderIconButton
label="Command"
hotkey={TOKENS.global.commandMenu}
onClick={handleCommandPaletteClick}
- >
- <CommandKIcon />
- </Button>
- <Button
- class="rounded-md p-1 text-ink-extra-muted"
- size="icon-sm"
+ icon={AnimatedSquareCommandKIcon}
+ />
+ <SidebarHeaderIconButton
label="New Split"
hotkey={TOKENS.global.createNewSplit}
disabled={!canCreateNewSplit()}
onClick={handleNewSplitClick}
- >
- <AnimatedNewSplitIcon class="size-4" />
- </Button>
+ icon={AnimatedNewSplitIcon}
+ />
</div>
</Show>
- <Button
- class="rounded-md p-1 text-ink-extra-muted [&_svg]:size-4"
- size="icon-sm"
+ <SidebarHeaderIconButton
+ label={isExpanded() ? 'Shrink Sidebar' : 'Expand Sidebar'}
+ hotkey={TOKENS.global.toggleSidebar}
onMouseDown={(e) => {
if (e.button !== 0) return;
e.preventDefault();
@@ -909,11 +933,8 @@ export const AppSidebar = (props: AppSidebarProps) => {
handleSidebarOpenChange(!isExpanded());
globalSplitManager()?.returnFocus();
}}
- label={isExpanded() ? 'Shrink Sidebar' : 'Expand Sidebar'}
- hotkey={TOKENS.global.toggleSidebar}
- >
- <SquareSidebarIcon />
- </Button>
+ icon={AnimatedSquareSidebarIcon}
+ />
</div>
</div>
diff --git a/js/app/packages/icon/wide-command-k.svg b/js/app/packages/icon/square-command-k.svg
similarity index 100%
rename from js/app/packages/icon/wide-command-k.svg
rename to js/app/packages/icon/square-command-k.svg
diff --git a/js/app/packages/icon/square-command-k.tsx b/js/app/packages/icon/square-command-k.tsx
new file mode 100644
index 0000000000..eac69baa42
--- /dev/null
+++ b/js/app/packages/icon/square-command-k.tsx
@@ -0,0 +1,86 @@
+export const AnimatedSquareCommandKIcon = (props: {
+ triggerAnimation?: boolean;
+ class?: string;
+}) => {
+ // Terminal-prompt icon (`>` chevron + input line).
+ // On hover: colors invert (tile fills with ink, strokes flip to surface) and the
+ // input line blinks like a terminal cursor.
+ return (
+ <svg
+ width="100%"
+ height="100%"
+ viewBox="-1.5 -1.88 18 18"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ class={`animated-command-k-icon ${props.triggerAnimation ? 'animating' : ''} ${props.class ?? ''}`}
+ >
+ {/*<title>Animated command-k icon</title>*/}
+ <style>{`
+ .animated-command-k-icon {
+ .ck-bg {
+ opacity: 0;
+ transition: opacity 0.2s ease;
+ }
+ .ck-caret {
+ stroke: currentColor;
+ transition: stroke 0.2s ease;
+ transform-origin: 0px 6.75px;
+ }
+ .ck-input {
+ stroke: currentColor;
+ transition: stroke 0.2s ease;
+ transform-origin: 6px 13.49px;
+ }
+
+ &.animating {
+ .ck-bg { opacity: 1; }
+ .ck-caret {
+ stroke: var(--color-surface);
+ }
+ .ck-input {
+ stroke: var(--color-surface);
+ transform: scaleX(0.8);
+ animation: ck-cursor-blink 1s steps(1, end) infinite;
+ animation-delay: 0.2s;
+ }
+ }
+ }
+
+ @keyframes ck-cursor-blink {
+ 0%, 50% { opacity: 1; }
+ 50.01%, 100% { opacity: 0; }
+ }
+ `}</style>
+
+ {/* Inverted background tile */}
+ <rect
+ class="ck-bg"
+ x="-1.5"
+ y="-1.88"
+ width="18"
+ height="18"
+ rx="2.5"
+ fill="currentColor"
+ />
+
+ {/* Prompt chevron + input line */}
+ <polyline
+ class="ck-caret"
+ points="0.75 0.75 6.75 6.75 0.75 12.75"
+ stroke-width="1.5"
+ stroke-linejoin="round"
+ stroke-linecap="round"
+ />
+ <line
+ class="ck-input"
+ x1="6"
+ y1="13.49"
+ x2="15"
+ y2="13.49"
+ stroke-width="1.5"
+ stroke-linejoin="round"
+ stroke-linecap="round"
+ />
+ </svg>
+ );
+};
diff --git a/js/app/packages/icon/square-sidebar.tsx b/js/app/packages/icon/square-sidebar.tsx
new file mode 100644
index 0000000000..3ea005b392
--- /dev/null
+++ b/js/app/packages/icon/square-sidebar.tsx
@@ -0,0 +1,69 @@
+import { createUniqueId } from 'solid-js';
+
+export const AnimatedSquareSidebarIcon = (props: {
+ triggerAnimation?: boolean;
+ class?: string;
+}) => {
+ const notchMaskId = createUniqueId();
+
+ return (
+ <svg
+ width="100%"
+ height="100%"
+ viewBox="-1.5 -1.5 18 18"
+ fill="currentColor"
+ stroke="none"
+ xmlns="http://www.w3.org/2000/svg"
+ overflow="visible"
+ class={`animated-square-sidebar-icon ${props.triggerAnimation ? 'animating' : ''} ${props.class ?? ''}`}
+ >
+ {/*<title>Animated square sidebar icon</title>*/}
+ <defs>
+ {/* Mask to cut out corner notches */}
+ <mask id={notchMaskId} maskUnits="userSpaceOnUse">
+ <rect x="-10" y="-10" width="100" height="100" fill="white" />
+ {/* Top-left notch */}
+ <rect fill="black" x="-0.5" y="-0.5" width="2" height="2" />
+ {/* Bottom-right notch */}
+ <rect fill="black" x="13.5" y="13.5" width="2" height="2" />
+ </mask>
+ </defs>
+
+ <style>{`
+ @keyframes square-sidebar-slide {
+ 0% { transform: translateX(0); }
+ 25% { transform: translateX(-3px); }
+ 50% { transform: translateX(-3px); }
+ 75% { transform: translateX(0); }
+ 100% { transform: translateX(0); }
+ }
+
+ .animated-square-sidebar-icon.animating .sidebar-divider {
+ animation: square-sidebar-slide 0.6s ease-in-out;
+ }
+ `}</style>
+
+ {/* Outer frame with corner notches */}
+ <rect
+ x="0.75"
+ y="0.75"
+ width="13.5"
+ height="13.5"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="1.5"
+ stroke-linejoin="round"
+ mask={`url(#${notchMaskId})`}
+ />
+
+ {/* Vertical divider — slides left to the frame's interior edge, then back */}
+ <rect
+ class="sidebar-divider"
+ x="4.5"
+ y="0.75"
+ width="1.5"
+ height="13.5"
+ />
+ </svg>
+ );
+};