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(sidebar): sidebar follow up - companies when flagged, call controls (#4700)
Seamus0073c4c2b7e9
diff --git a/js/app/packages/app/component/Layout.tsx b/js/app/packages/app/component/Layout.tsxindex 9184105ce2..ecad6d1a6e 100644--- a/js/app/packages/app/component/Layout.tsx+++ b/js/app/packages/app/component/Layout.tsx@@ -28,6 +28,7 @@ import {createEffect,createMemo,createSignal,+ type JSX,onCleanup,onMount,Show,@@ -102,6 +103,128 @@ export function Layout(props: RouteSectionProps) {);}+function CollapsedSidebarCallWidget(props: { visible: boolean }) {+ const EDGE_GAP = 12;+ const DEFAULT_BOTTOM_GAP = 12;+ const [root, setRoot] = createSignal<HTMLDivElement>();+ const [dragging, setDragging] = createSignal(false);+ const [position, setPosition] = createSignal<{ left: number; top: number }>();++ const clampPosition = (next: { left: number; top: number }) => {+ const el = root();+ if (!el) return next;++ const maxLeft = Math.max(+ EDGE_GAP,+ window.innerWidth - el.offsetWidth - EDGE_GAP+ );+ const maxTop = Math.max(+ EDGE_GAP,+ window.innerHeight - el.offsetHeight - EDGE_GAP+ );++ return {+ left: Math.min(Math.max(next.left, EDGE_GAP), maxLeft),+ top: Math.min(Math.max(next.top, EDGE_GAP), maxTop),+ };+ };++ const resetToDefaultPosition = () => {+ const el = root();+ if (!el) return;+ setPosition(+ clampPosition({+ left: Math.round((window.innerWidth - el.offsetWidth) / 2),+ top: window.innerHeight - el.offsetHeight - DEFAULT_BOTTOM_GAP,+ })+ );+ };++ createEffect(() => {+ if (!props.visible) return;+ requestAnimationFrame(() => resetToDefaultPosition());+ });++ createEffect(() => {+ if (!props.visible || !position()) return;++ const handleResize = () => {+ const next = position();+ if (!next) return;+ setPosition(clampPosition(next));+ };++ window.addEventListener('resize', handleResize);+ window.visualViewport?.addEventListener('resize', handleResize);+ onCleanup(() => {+ window.removeEventListener('resize', handleResize);+ window.visualViewport?.removeEventListener('resize', handleResize);+ });+ });++ const startDrag: JSX.EventHandler<HTMLButtonElement, PointerEvent> = (e) => {+ if (e.button !== 0) return;++ const el = root();+ if (!el) return;++ e.preventDefault();+ const rect = el.getBoundingClientRect();+ const pointerStartX = e.clientX;+ const pointerStartY = e.clientY;+ const origin = { left: rect.left, top: rect.top };++ setDragging(true);+ setPosition(origin);++ const handleMove = (moveEvent: PointerEvent) => {+ setPosition(+ clampPosition({+ left: origin.left + (moveEvent.clientX - pointerStartX),+ top: origin.top + (moveEvent.clientY - pointerStartY),+ })+ );+ };++ const handleUp = () => {+ setDragging(false);+ window.removeEventListener('pointermove', handleMove);+ window.removeEventListener('pointerup', handleUp);+ };++ window.addEventListener('pointermove', handleMove);+ window.addEventListener('pointerup', handleUp);+ };++ return (+ <Show when={props.visible}>+ <div+ ref={setRoot}+ class="fixed z-page-overlay w-72 max-w-[calc(100vw-1.5rem)] pointer-events-auto"+ style={{+ left: position() ? `${position()!.left}px` : '50%',+ top: position() ? `${position()!.top}px` : undefined,+ bottom: position() ? undefined : `${DEFAULT_BOTTOM_GAP}px`,+ transform: position() ? undefined : 'translateX(-50%)',+ }}+ >+ <div class="relative rounded-xl border border-edge-muted bg-surface shadow-menu p-1">+ <button+ type="button"+ aria-label="Drag to move active call controls"+ class={cn(+ 'absolute left-1 right-10 top-1 z-10 h-8 rounded-t-lg rounded-b-md bg-transparent select-none',+ dragging() ? 'cursor-grabbing' : 'cursor-grab'+ )}+ onPointerDown={startDrag}+ />+ <InCallPanel isSlim={() => false} />+ </div>+ </div>+ </Show>+ );+}+function LayoutInner(props: RouteSectionProps) {const isAuthenticated = useIsAuthenticated();const { paywallOpen, showPaywall } = usePaywallState();@@ -266,17 +389,20 @@ function LayoutInner(props: RouteSectionProps) {left: sidebarState() === 'expanded' ? '15.75rem' : '0.75rem',}}>- <Show when={callCtx?.isInCall()}>- <div data-ui="in-call-panel">- <InCallPanel isSlim={() => false} />- </div>- </Show><SidebarActiveCallWidgetsidebarState="expanded"class="rounded-xl border border-edge-muted bg-surface shadow-menu p-1"/></div></Show>+ <CollapsedSidebarCallWidget+ visible={+ isSidebarVisible() &&+ sidebarState() === 'slim' &&+ !!callCtx?.isInCall() &&+ !callCtx?.isCallPage()+ }+ /><Showwhen={isMobile() &&diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsxindex a2b83691e4..488fa92eed 100644--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx@@ -34,6 +34,7 @@ import { LIST_VIEW_PATHS, type ListView } from '@app/constants/list-views';import { useFeatureFlag } from '@app/lib/analytics/posthog';import { useHotkeyInterceptor } from '@app/signal/hotkeyRoot';import { globalSplitManager } from '@app/signal/splitLayout';+import { InCallPanel, useCallContextOptional } from '@channel/Call';import { useHasPaidAccess } from '@core/auth';import { useLogout } from '@core/auth/logout';import { ContextMenuContent, MenuItem } from '@core/component/ContextMenu';@@ -810,6 +811,7 @@ export const AppSidebar = (props: AppSidebarProps) => {const { openSettings, selectTab, settingsOpen } = useSettingsState();const isTabAvailable = useSettingsTabAvailable();const currentTeamQuery = useCurrentTeamQuery();+ const callCtx = useCallContextOptional();const hasPaidAccess = useHasPaidAccess();@@ -973,7 +975,7 @@ export const AppSidebar = (props: AppSidebarProps) => {);const workspaceItems = createMemo(() =>- ['mail', 'documents', 'channels', 'tasks', 'calls', 'agents']+ ['mail', 'documents', 'channels', 'tasks', 'calls', 'agents', 'companies'].map((id) => findLink(id)).filter((link): link is SidebarItem => link !== undefined).map(toSectionItem)@@ -1240,7 +1242,12 @@ export const AppSidebar = (props: AppSidebarProps) => {/></div>- <div class="shrink-0 w-full pt-2">+ <div class="shrink-0 w-full pt-2 flex flex-col gap-2">+ <Show when={isExpandedView() && callCtx?.isInCall()}>+ <div data-ui="sidebar-in-call-panel">+ <InCallPanel isSlim={() => false} />+ </div>+ </Show><SidebarSettingsWidgetisSlim={isSlim}onSelect={openSettingsTab}