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
fix(icon): improve channel icon animation (#3979)
Aidan Holloway-Bidwell8b312a681d4f
diff --git a/js/app/packages/app/component/mobile/MobileDock.tsx b/js/app/packages/app/component/mobile/MobileDock.tsxindex 48b3bda212..8c19a5fc61 100644--- a/js/app/packages/app/component/mobile/MobileDock.tsx+++ b/js/app/packages/app/component/mobile/MobileDock.tsx@@ -1,6 +1,7 @@import type { ListView } from '@app/constants/list-views';import { globalSplitManager } from '@app/signal/splitLayout';import { hapticImpact } from '@core/mobile/haptics';+import { ICON_ANIMATION_DURATION_MS } from '@icon/animation';import { AnimatedCallIcon } from '@icon/wide-call';import { AnimatedChannelIcon } from '@icon/wide-channel';import { AnimatedEmailIcon } from '@icon/wide-email';@@ -14,8 +15,6 @@ import { type Component, createSignal, type JSX, Show } from 'solid-js';import { Dynamic } from 'solid-js/web';import { useSplitLayout } from '../split-layout/layout';-const ICON_ANIMATION_DURATION_MS = 500;-type MobileDockButtonProps = {icon: Component<JSX.SvgSVGAttributes<SVGSVGElement> | { triggerAnimation?: boolean }diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-mobile-create-button.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-mobile-create-button.tsxindex 826fe4f301..873432bc92 100644--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-mobile-create-button.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-mobile-create-button.tsx@@ -1,6 +1,7 @@import { useAnalytics } from '@app/component/analytics-context';import type { ListView } from '@app/constants/list-views';import { hapticImpact } from '@core/mobile/haptics';+import { ICON_ANIMATION_DURATION_MS } from '@icon/animation';import { AnimatedChannelIcon } from '@icon/wide-channel';import { AnimatedEmailIcon } from '@icon/wide-email';import { AnimatedPlusIcon } from '@icon/wide-plus';@@ -22,8 +23,6 @@ import {MOBILE_FLOATING_BUTTON_VISIBLE,} from './soup-view-mobile-floating-motion';-const ICON_ANIMATION_DURATION_MS = 500;-type IconComponent = Component<JSX.SvgSVGAttributes<SVGSVGElement> | { triggerAnimation?: boolean }>;diff --git a/js/app/packages/icon/animation.ts b/js/app/packages/icon/animation.tsnew file mode 100644index 0000000000..fe513022a1--- /dev/null+++ b/js/app/packages/icon/animation.ts@@ -0,0 +1,6 @@+// How long mobile tap targets hold the `.animating` class after a press before clearing+// it (the animated icons are one-shot CSS animations driven by that class). Shared by all+// consumers that pulse an animated icon on tap, so the pulse window stays in sync and is+// long enough to cover the longest one-shot icon animation (currently the channel icon's+// 0.625s expand).+export const ICON_ANIMATION_DURATION_MS = 625;diff --git a/js/app/packages/icon/wide-channel.tsx b/js/app/packages/icon/wide-channel.tsxindex 52fba5bf25..a725e0dad5 100644--- a/js/app/packages/icon/wide-channel.tsx+++ b/js/app/packages/icon/wide-channel.tsx@@ -1,12 +1,21 @@-import { createUniqueId } from 'solid-js';+// One-shot "expand & reconverge" animation, driven by the .animating class (toggled by+// the triggerAnimation prop, same as the other animated icons). Each line moves radially+// outward from the icon's center, then eases back to rest with a slight overshoot — the+// hash briefly expands and reconverges.+//+// Outward directions (radial from center ~(12, 8), so the hash opens up symmetrically):+// channel-h-top up (top bar separates upward)+// channel-h-bottom down (bottom bar separates downward)+// channel-v-left left (left bar separates leftward)+// channel-v-right right (right bar separates rightward)+//+// Built on `transform` (not `d` morphing), so unlike the old version it animates in+// Safari/WebKit too (incl. the macOS Tauri WKWebView).export const AnimatedChannelIcon = (props: {triggerAnimation?: boolean;class?: string;}) => {- // Unique clipPath id so multiple instances on a page don't collide.- const clipId = `channel-clip-${createUniqueId()}`;-return (<svgwidth="100%"@@ -18,53 +27,50 @@ export const AnimatedChannelIcon = (props: {stroke-linecap="round"stroke-linejoin="round"xmlns="http://www.w3.org/2000/svg"- overflow="hidden"+ overflow="visible"class={`animated-channel-icon ${props.triggerAnimation ? 'animating' : ''} ${props.class ?? ''}`}>{/*<title>Channel icon</title>*/}<style>{`- @keyframes channel-zip-h-top {- 0%, 15% { transform: translate(-26px, 0); }- 100% { transform: translate(0, 0); }+ /* Each line eases out to its peak (ease-out), then reconverges with a slight+ overshoot past rest before settling (easeOutBack). */+ @keyframes channel-expand-up {+ 0% { transform: translate(0, 0); animation-timing-function: ease-out; }+ 45% { transform: translate(0, -2px); animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }+ 100% { transform: translate(0, 0); }}- @keyframes channel-zip-h-bottom {- 0%, 15% { transform: translate(26px, 0); }- 100% { transform: translate(0, 0); }+ @keyframes channel-expand-down {+ 0% { transform: translate(0, 0); animation-timing-function: ease-out; }+ 45% { transform: translate(0, 2px); animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }+ 100% { transform: translate(0, 0); }}- @keyframes channel-zip-v-left {- 0%, 15% { transform: translate(-8px, 24px); }- 100% { transform: translate(0, 0); }+ @keyframes channel-expand-left {+ 0% { transform: translate(0, 0); animation-timing-function: ease-out; }+ 45% { transform: translate(-2px, 0); animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }+ 100% { transform: translate(0, 0); }}- @keyframes channel-zip-v-right {- 0%, 15% { transform: translate(8px, -24px); }- 100% { transform: translate(0, 0); }+ @keyframes channel-expand-right {+ 0% { transform: translate(0, 0); animation-timing-function: ease-out; }+ 45% { transform: translate(2px, 0); animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }+ 100% { transform: translate(0, 0); }}- /* easeOutBack: the 15% -> 100% segment zips in then overshoots past rest and- settles. The 0% -> 15% segment holds (both keyframes share the start offset). */.animated-channel-icon.animating .channel-h-top {- animation: channel-zip-h-top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;+ animation: channel-expand-up 0.625s forwards;}.animated-channel-icon.animating .channel-h-bottom {- animation: channel-zip-h-bottom 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;+ animation: channel-expand-down 0.625s forwards;}.animated-channel-icon.animating .channel-v-left {- animation: channel-zip-v-left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;+ animation: channel-expand-left 0.625s forwards;}.animated-channel-icon.animating .channel-v-right {- animation: channel-zip-v-right 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;+ animation: channel-expand-right 0.625s forwards;}`}</style>- <clipPath id={clipId}>- <rect x="0" y="-4" width="24" height="24" />- </clipPath>- <g clip-path={`url(#${clipId})`}>- {/* Horizontals shortened ~1u on the edge-touching end so the round caps stay- inside the clip box at rest (M2 5H24 -> H23, M0 11H22 -> M1). */}- <path class="channel-h channel-h-top" d="M2 5H23" />- <path class="channel-h channel-h-bottom" d="M1 11H22" />- <path class="channel-v channel-v-left" d="M6.5 15.5L11.5 0.5" />- <path class="channel-v channel-v-right" d="M12.5 15.5L17.5 0.5" />- </g>+ <path class="channel-h channel-h-top" d="M2 5H24" />+ <path class="channel-h channel-h-bottom" d="M0 11H22" />+ <path class="channel-v channel-v-left" d="M6.5 15.5L11.5 0.5" />+ <path class="channel-v channel-v-right" d="M12.5 15.5L17.5 0.5" /></svg>);};