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.

style(sidebar): move sidbar toggle btn back to top (#1949)

Seamusc9945b0f5d51
diff --git a/js/app/packages/app/component/Launcher.tsx b/js/app/packages/app/component/Launcher.tsx
index 5f9af5d872..c92793df44 100644
--- a/js/app/packages/app/component/Launcher.tsx
+++ b/js/app/packages/app/component/Launcher.tsx
@@ -245,7 +245,7 @@ export const CREATABLE_BLOCKS: CreatableBlock[] = [
blockName: 'canvas',
hotkeyToken: TOKENS.create.canvas,
altHotkeyToken: TOKENS.create.canvasNewSplit,
- hotkey: 'c',
+ hotkey: 'n',
keyDownHandler: () => {
createBlock({
blockName: 'canvas',
@@ -636,7 +636,7 @@ const LauncherInner = (props: LauncherInnerProps) => {
<h1 class="font-bold text-ink-muted">Create New</h1>
<p class="gap-2 text-ink-extra-muted text-xs items-center hidden touch:hidden md:flex">
Hold{' '}
- <span class="px-1 py-0.5 rounded-sm h-fit ring ring-edge-muted text-xs grid place-items-center">
+ <span class="px-1 py-0.5 my-1 rounded-sm h-fit ring ring-edge-muted text-xs grid place-items-center">
<Hotkey shortcut="shift" />
</span>
to launch in new split
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index a830ca7272..1aa839ca46 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -15,21 +15,21 @@ import LogoIcon from '@macro-icons/macro-logo.svg';
import PlusIcon from '@phosphor-icons/core/bold/plus-bold.svg?component-solid';
import CommandIcon from '@phosphor-icons/core/assets/regular/command.svg';
import { LIST_VIEW_PATHS, type ListView } from '@app/constants/list-views';
-import { LabelAndHotKey, Tooltip } from '@core/component/Tooltip';
+import { LabelAndHotKey } from '@core/component/Tooltip';
import { setCreateMenuOpen } from '@app/component/Launcher';
import { CommandState } from '@app/component/command';
import { cn } from '@ui/utils/classname';
-import { Button } from '@app/component/next-soup/soup-view/filters-bar/button';
+import { Button } from '@ui/components/Button';
import { useSplitLayout } from '@app/component/split-layout/layout';
import { ChannelsUnreadWidget } from '@app/component/app-sidebar/channels-unread-widget';
import { globalSplitManager } from '@app/signal/splitLayout';
-import { isMobile } from '@core/mobile/isMobile';
import { useSettingsState } from '@core/constant/SettingsState';
import type { ValidHotkey } from '@core/hotkey/types';
import { registerHotkey } from '@core/hotkey/hotkeys';
import { GO_TO_COMMAND_SCOPE, GO_TO_LEADER_KEY } from '@app/constants/hotkeys';
import { ROUTER_BASE } from '@app/constants/routerBase';
import { TOKENS } from '@core/hotkey/tokens';
+import { Hotkey } from '@core/component/Hotkey';
interface SidebarItem {
id: ListView;
@@ -208,8 +208,25 @@ export const AppSidebar = (props: AppSidebarProps) => {
data-slim={isSlim()}
style={{ transition: 'max-width ease-in-out 100ms' }}
>
- <div class="flex items-center justify-between py-2 pl-3 pr-2">
- <LogoIcon class="size-6 text-accent" />
+ <div class="flex items-center justify-between py-2 pl-2 pr-2 relative">
+ <div class="flex items-center group/logo-area w-full">
+ <LogoIcon class="size-6 text-accent transition-opacity duration-75 group-data-[slim=true]/sidebar:opacity-0" />
+ <div class="grow-1 shrink-10 min-w-0" />
+ <Button
+ class="flex items-center justify-center rounded-xs p-0.5 px-2 bg-page [&_svg]:size-4"
+ onClick={() => props.onOpenChange(!isExpanded())}
+ onMouseEnter={() => setSidebarBtnHovering(true)}
+ onMouseLeave={() => setSidebarBtnHovering(false)}
+ tooltip={
+ <LabelAndHotKey
+ label={isExpanded() ? 'Shrink Sidebar' : 'Expand Sidebar'}
+ hotkeyToken={TOKENS.global.toggleSidebar}
+ />
+ }
+ >
+ <AnimatedSidebarIcon triggerAnimation={sidebarBtnHovering()} />
+ </Button>
+ </div>
</div>
<div class="px-2">
@@ -249,50 +266,51 @@ export const AppSidebar = (props: AppSidebarProps) => {
<hr class="border-edge-muted mb-[8px]" />
</div>
- <div class=" w-full px-2 flex flex-col gap-1">
- <Tooltip
- class="w-full"
- tooltip={<LabelAndHotKey label="Create new" shortcut="c" />}
+ <div class=" w-full px-2 flex flex-col">
+ <Button
+ class="flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-xs py-1"
+ variant="ghost"
+ tooltip={
+ <LabelAndHotKey
+ label="Create new"
+ hotkeyToken={TOKENS.global.createCommand}
+ />
+ }
+ onClick={handleCreateClick}
>
- <Button
- class="flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-xs"
- variant="ghost"
- size="sm"
- onClick={handleCreateClick}
- >
- <PlusIcon class="size-4 shrink-0" />
- <span class="whitespace-nowrap group-data-[slim=true]/sidebar:invisible">
- Create
- </span>
- </Button>
- </Tooltip>
-
- <Show when={!isMobile()}>
- <Tooltip
- class="w-full"
- tooltip={
- <LabelAndHotKey
- label="Command palette"
- hotkeyToken={TOKENS.global.commandMenu}
- />
- }
- >
- <Button
- class="flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-xs"
- variant="ghost"
- size="sm"
- onClick={handleCommandPaletteClick}
- >
- <CommandIcon class="size-4 shrink-0" />
- <span class="whitespace-nowrap group-data-[slim=true]/sidebar:invisible">
- Command
- </span>
- </Button>
- </Tooltip>
- </Show>
-
- <Tooltip
- class="w-full"
+ <PlusIcon class="size-4 shrink-0" />
+ <span class="whitespace-nowrap group-data-[slim=true]/sidebar:invisible">
+ Create
+ </span>
+ <div class="text-[0.625rem] text-ink-extra-muted/50 rounded-sm ml-auto border border-edge-muted px-1.5 py-0.25 -my-1 group-data-[slim=true]/sidebar:invisible">
+ <Hotkey token={TOKENS.global.createCommand} class="flex gap-1" />
+ </div>
+ </Button>
+
+ <Button
+ class="flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-xs py-1"
+ variant="ghost"
+ tooltip={
+ <LabelAndHotKey
+ label="Command palette"
+ hotkeyToken={TOKENS.global.commandMenu}
+ />
+ }
+ onClick={handleCommandPaletteClick}
+ >
+ <CommandIcon class="size-4 shrink-0" />
+ <span class="whitespace-nowrap group-data-[slim=true]/sidebar:invisible">
+ Command
+ </span>
+ <div class="text-[0.625rem] text-ink-extra-muted/50 rounded-sm ml-auto border border-edge-muted px-1.5 py-0.25 -my-1 group-data-[slim=true]/sidebar:invisible">
+ <Hotkey token={TOKENS.global.commandMenu} class="flex gap-1" />
+ </div>
+ </Button>
+
+ <Button
+ class="flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-xs py-1"
+ variant="ghost"
+ onClick={toggleSettings}
tooltip={
<LabelAndHotKey
label="Settings"
@@ -300,46 +318,14 @@ export const AppSidebar = (props: AppSidebarProps) => {
/>
}
>
- <Button
- class="flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-xs"
- variant="ghost"
- size="sm"
- onClick={toggleSettings}
- >
- <GearIcon class="size-4 shrink-0" />
- <span class="whitespace-nowrap group-data-[slim=true]/sidebar:invisible">
- Settings
- </span>
- </Button>
- </Tooltip>
-
- <Show when={!isMobile()}>
- <Tooltip
- class="w-full"
- tooltip={
- <LabelAndHotKey
- label={isSlim() ? 'Expand sidebar' : 'Shrink Sidebar'}
- hotkeyToken={TOKENS.global.toggleSidebar}
- />
- }
- >
- <Button
- class="flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-xs"
- variant="ghost"
- size="sm"
- onClick={() => props.onOpenChange(isSlim())}
- onMouseEnter={() => setSidebarBtnHovering(true)}
- onMouseLeave={() => setSidebarBtnHovering(false)}
- >
- <div class="shrink-0 [&_svg]:size-4">
- <AnimatedSidebarIcon triggerAnimation={sidebarBtnHovering()} />
- </div>
- <span class="whitespace-nowrap group-data-[slim=true]/sidebar:invisible">
- Sidebar
- </span>
- </Button>
- </Tooltip>
- </Show>
+ <GearIcon class="size-4 shrink-0" />
+ <span class="whitespace-nowrap group-data-[slim=true]/sidebar:invisible">
+ Settings
+ </span>
+ <div class="text-[0.625rem] text-ink-extra-muted/50 rounded-sm ml-auto border border-edge-muted px-1.5 py-0.25 -my-1 group-data-[slim=true]/sidebar:invisible">
+ <Hotkey token={TOKENS.global.toggleSettings} class="flex gap-1" />
+ </div>
+ </Button>
</div>
</div>
);
@@ -375,9 +361,8 @@ const SidebarLink = (props: SidebarLinkProps) => {
as="a"
draggable={false}
variant="ghost"
- size="sm"
class={cn(
- 'flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-xs',
+ 'flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-xs py-1',
isActive() && 'bg-ink/7 not-disabled:hover:bg-ink/15 text-ink'
)}
href={`${ROUTER_BASE}/component${props.href}`}
diff --git a/js/app/packages/block-channel/component/BaseInput.tsx b/js/app/packages/block-channel/component/BaseInput.tsx
index e132c6f864..3d6d20606d 100644
--- a/js/app/packages/block-channel/component/BaseInput.tsx
+++ b/js/app/packages/block-channel/component/BaseInput.tsx
@@ -588,7 +588,7 @@ export function BaseInput(props: BaseInputProps) {
<Button
ref={setAttachMenuAnchorRef}
// We use onPointerDown here to integrate correctly with attach menu onMouseDown behavior.
- onPointerDown={(e) => {
+ onPointerDown={(e: PointerEvent) => {
e.preventDefault();
e.stopPropagation();
setShowAttachMenu((prev) => !prev);
diff --git a/js/app/packages/core/constant/featureFlags.ts b/js/app/packages/core/constant/featureFlags.ts
index 650fd5c7d0..5b697f8da5 100644
--- a/js/app/packages/core/constant/featureFlags.ts
+++ b/js/app/packages/core/constant/featureFlags.ts
@@ -129,6 +129,6 @@ export const ENABLE_AI_AUTO_TAB_ATTACHMENTS = true;
export const ENABLE_FEATURED_SEARCH_RESULTS = true;
-export const ENABLE_NEW_CHANNELS = true;
+export const ENABLE_NEW_CHANNELS = false;
export const ENABLE_PROXY_EMAIL_IMAGES = true;
diff --git a/js/app/packages/ui/components/Button.tsx b/js/app/packages/ui/components/Button.tsx
index fb3212f665..304f2a021e 100644
--- a/js/app/packages/ui/components/Button.tsx
+++ b/js/app/packages/ui/components/Button.tsx
@@ -1,6 +1,8 @@
+import { Button as KButton, type ButtonRootProps } from '@kobalte/core/button';
+import type { PolymorphicProps } from '@kobalte/core/polymorphic';
import { cn } from '@ui/utils/classname';
import { Tooltip } from 'core/component/Tooltip';
-import { type JSX, type ParentComponent, splitProps } from 'solid-js';
+import { type JSX, splitProps, type ValidComponent } from 'solid-js';
export type ButtonVariant =
| 'primary'
@@ -13,10 +15,15 @@ export type ButtonVariant =
export type ButtonSize = 'sm' | 'md' | 'lg' | 'icon-sm' | 'icon-md' | 'icon-lg';
-type ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & {
+export type ButtonProps<T extends ValidComponent = 'button'> = PolymorphicProps<
+ T,
+ ButtonRootProps<T>
+> & {
variant?: ButtonVariant;
size?: ButtonSize;
tooltip?: JSX.Element;
+ class?: string;
+ children?: JSX.Element;
};
const variantStyles: Record<ButtonVariant, string> = {
@@ -47,9 +54,13 @@ const sizeStyles: Record<ButtonSize, string> = {
/**
* ### The basic button component. When in doubt, use Button.
*
- * @param props.variant - primary, secondary, tertiary (default), destructive, ghost, or link.
+ * Supports polymorphism via Kobalte's `as` prop — render as any element or component
+ * while retaining button styles and behaviour.
+ *
+ * @param props.variant - primary, secondary, tertiary, destructive, ghost (default), link, or accent.
* @param props.size - sm, md (default), lg, icon-sm, icon-md, or icon-lg.
* @param props.tooltip - Optional tooltip content to display when hovering over the button.
+ * @param props.as - Override the rendered element (e.g. `"a"` or a router `<Link>` component).
*
* @example
* <Button variant="primary" disabled>
@@ -57,51 +68,55 @@ const sizeStyles: Record<ButtonSize, string> = {
* </Button>
*
* @example
+ * // Render as an anchor link
+ * <Button as="a" href="/dashboard" variant="secondary">
+ * Go to Dashboard
+ * </Button>
+ *
+ * @example
* // Icon button wrapped in Tooltip with Hotkey
* <Button
* variant="primary"
* size="icon-md"
- * tooltip={<LabelAndHotKey label="Save" shortcut='cmd+s' />}
+ * tooltip={<LabelAndHotKey label="Save" shortcut="cmd+s" />}
* >
- * <ClipboardIcon />
+ * <ClipboardIcon />
* </Button>
- *
*/
-export const Button: ParentComponent<ButtonProps> = (props) => {
- const [local, buttonAttributes] = splitProps(props, [
+export const Button = <T extends ValidComponent = 'button'>(
+ props: ButtonProps<T>
+) => {
+ const [local, others] = splitProps(props as ButtonProps<'button'>, [
'variant',
'size',
'class',
'children',
'tooltip',
- 'type',
]);
const variant = () => local.variant ?? 'ghost';
const size = () => local.size ?? 'md';
- function MaybeWrapInTooltip(props: { children: JSX.Element }) {
- if (!local.tooltip) return props.children;
-
- return <Tooltip tooltip={local.tooltip}>{props.children}</Tooltip>;
+ function MaybeWrapInTooltip(wrapProps: { children: JSX.Element }) {
+ if (!local.tooltip) return wrapProps.children;
+ return <Tooltip tooltip={local.tooltip}>{wrapProps.children}</Tooltip>;
}
return (
<MaybeWrapInTooltip>
- <button
- type={local.type ?? 'button'}
+ <KButton
class={cn(
'relative inline-flex items-center justify-center font-medium leading-none border border-transparent',
- 'disabled:cursor-not-allowed',
+ 'data-[disabled]:cursor-not-allowed',
'touch:min-h-11 touch:min-w-11 touch:[&_svg]:size-6',
variantStyles[variant()],
sizeStyles[size()],
local.class
)}
- {...buttonAttributes}
+ {...others}
>
{local.children}
- </button>
+ </KButton>
</MaybeWrapInTooltip>
);
};