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.

fix[channels]: top bar squish (#2907)

Peter Chinman0e0d05a228e0
diff --git a/js/app/packages/app/component/split-layout/components/SplitLabel.tsx b/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
index 7092e23c55..4f9450b888 100644
--- a/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
@@ -62,6 +62,7 @@ export function SplitLabel(props: {
/** Per-variant fields the block context can't supply (e.g. `channelType`
* for a channel rename). Merged into the args passed to `buildEntityData`. */
renameOverrides?: Partial<BuildEntityDataArgs>;
+ maxDisplayLength?: number;
}) {
const panel = useSplitPanelOrThrow();
const blockId = useBlockId();
@@ -71,6 +72,12 @@ export function SplitLabel(props: {
panel.handle.setDisplayName(props.label);
});
+ const truncatedLabel = () => {
+ if (!props.maxDisplayLength) return props.label;
+ if (props.label.length <= props.maxDisplayLength) return props.label;
+ return props.label.slice(0, props.maxDisplayLength - 3) + '...';
+ };
+
const startEditing = (e: MouseEvent) => {
if (props.lockRename) return;
if (e.type === 'contextmenu') e.preventDefault();
@@ -97,7 +104,7 @@ export function SplitLabel(props: {
onContextMenu={startEditing}
onDblClick={startEditing}
>
- {props.label}
+ {truncatedLabel()}
</span>
);
}
diff --git a/js/app/packages/block-channel/component/Top.tsx b/js/app/packages/block-channel/component/Top.tsx
index e7c786c2ef..37a54841a9 100644
--- a/js/app/packages/block-channel/component/Top.tsx
+++ b/js/app/packages/block-channel/component/Top.tsx
@@ -42,7 +42,7 @@ function TopIcon(props: TopIconProps) {
return (
<Show
when={props.channelType === ChannelTypeEnum.DirectMessage && recipient()}
- fallback={<HashIcon class="w-4 h-4" />}
+ fallback={<HashIcon class="w-4 h-4 shrink-0" />}
>
{(recipient) => {
return (
@@ -85,59 +85,52 @@ export function ChannelTopLeft(props: ChannelTopLeftProps) {
return (
<SplitHeaderLeft>
- <div class="h-full my-auto flex gap-3 justify-start items-center min-w-0">
- <div class="ph-no-capture z-page-overlay relative flex items-center gap-2 max-w-full h-full shrink min-w-0">
- <TopIcon
- channelType={props.channelType}
- participants={props.participants}
- />
- <SplitLabel
- label={channelName() ?? 'New Channel'}
- lockRename={props.lockRename}
- renameOverrides={{ channelType: props.channelType }}
+ <div class="ph-no-capture z-page-overlay relative flex items-center gap-2 max-w-full h-full shrink min-w-15">
+ <TopIcon
+ channelType={props.channelType}
+ participants={props.participants}
+ />
+ <SplitLabel
+ label={channelName() ?? 'New Channel'}
+ lockRename={props.lockRename}
+ renameOverrides={{ channelType: props.channelType }}
+ maxDisplayLength={48}
+ />
+ </div>
+ <Show when={props.tabs && props.activeTab && props.onTabChange}>
+ <Show
+ when={!isMobile()}
+ fallback={
+ <div class="ph-no-capture flex items-center min-w-0 shrink-0 h-full">
+ <Tabs
+ list={iconTabList()}
+ value={props.activeTab}
+ onChange={(value) => props.onTabChange?.(value as ChannelTabId)}
+ />
+ </div>
+ }
+ >
+ <CollapsibleHeaderItem
+ id="channel-tabs"
+ priority={1}
+ containerClass="ph-no-capture min-w-0 shrink-0 h-full"
+ expanded={() => (
+ <Tabs
+ list={[...(props.tabs ?? [])]}
+ value={props.activeTab}
+ onChange={(value) => props.onTabChange?.(value as ChannelTabId)}
+ />
+ )}
+ collapsed={() => (
+ <Tabs
+ list={iconTabList()}
+ value={props.activeTab}
+ onChange={(value) => props.onTabChange?.(value as ChannelTabId)}
+ />
+ )}
/>
- </div>
- <Show when={props.tabs && props.activeTab && props.onTabChange}>
- <Show
- when={!isMobile()}
- fallback={
- <div class="ph-no-capture flex items-center min-w-0 shrink-0 h-full">
- <Tabs
- list={iconTabList()}
- value={props.activeTab}
- onChange={(value) =>
- props.onTabChange?.(value as ChannelTabId)
- }
- />
- </div>
- }
- >
- <CollapsibleHeaderItem
- id="channel-tabs"
- priority={1}
- containerClass="ph-no-capture min-w-0 shrink-0 h-full"
- expanded={() => (
- <Tabs
- list={[...(props.tabs ?? [])]}
- value={props.activeTab}
- onChange={(value) =>
- props.onTabChange?.(value as ChannelTabId)
- }
- />
- )}
- collapsed={() => (
- <Tabs
- list={iconTabList()}
- value={props.activeTab}
- onChange={(value) =>
- props.onTabChange?.(value as ChannelTabId)
- }
- />
- )}
- />
- </Show>
</Show>
- </div>
+ </Show>
</SplitHeaderLeft>
);
}