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(email): mark done button inside email block (#4939)

Peter Chinman2e83928d7646
diff --git a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
index 39947d1ae1..df61e298e3 100644
--- a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
+++ b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
@@ -243,7 +243,7 @@ function SoupNavigationButtons() {
return (
<Show when={shouldShow()}>
- <div class="flex items-center gap-0.5 pl-1">
+ <div class="flex items-center gap-0.5">
<Button
class="p-1 rounded-lg"
label="Previous item"
diff --git a/apps/web/src/features/block-email/component/BottomReplyButtons.tsx b/apps/web/src/features/block-email/component/BottomReplyButtons.tsx
index e437b21fe3..03f51e1286 100644
--- a/apps/web/src/features/block-email/component/BottomReplyButtons.tsx
+++ b/apps/web/src/features/block-email/component/BottomReplyButtons.tsx
@@ -5,6 +5,7 @@ import { useEmail } from '@core/context/user';
import { isMobile } from '@core/mobile/isMobile';
import ArrowBendUpLeft from '@phosphor/arrow-bend-up-left.svg';
import ArrowBendUpRight from '@phosphor/arrow-bend-up-right.svg';
+import CheckIcon from '@phosphor/check.svg';
import type { ApiMessage } from '@service-email/generated/schemas';
import { createCallback } from '@solid-primitives/rootless';
import { Button, cn } from '@ui';
@@ -16,7 +17,8 @@ import { openEmailReplyComposerForMessage } from './emailReplyActions';
function ReplyActionButton(props: {
icon: Component<{ class?: string }>;
- label: string;
+ label?: string;
+ ariaLabel?: string;
onClick: () => void;
}) {
return (
@@ -27,6 +29,7 @@ function ReplyActionButton(props: {
// Button's own Layer would reset it.)
depth={isMobile() ? 3 : undefined}
variant="base"
+ aria-label={props.ariaLabel ?? props.label}
class={cn(
// Island pills when floating in the mobile accessory region.
'mobile:island mobile:h-8 mobile:rounded-full mobile:border-0'
@@ -34,7 +37,9 @@ function ReplyActionButton(props: {
onClick={props.onClick}
>
<props.icon class="size-4 shrink-0" />
- <span>{props.label}</span>
+ <Show when={props.label}>
+ <span>{props.label}</span>
+ </Show>
</Button>
);
}
@@ -62,6 +67,10 @@ export function BottomReplyButtons(props: { lastMessage: ApiMessage }) {
return email ? inboxIconProps(email) : { email: '' };
};
+ const markDone = () => {
+ ctx.archiveThread();
+ };
+
return (
<Show
when={isMobile()}
@@ -85,16 +94,24 @@ export function BottomReplyButtons(props: { lastMessage: ApiMessage }) {
>
<FloatRegionOrInline region="accessory">
<div class="w-full p-2 pb-2 pt-4 mobile:px-(--mobile-chrome-gutter) mobile:py-0">
- <div class="flex flex-row items-center gap-2 mobile:pointer-events-auto">
- <ReplyActionButton
- icon={ArrowBendUpLeft}
- label="Reply"
- onClick={open('reply-all')}
- />
+ <div class="flex flex-row items-center gap-2 justify-between mobile:pointer-events-auto">
+ <div class="flex flex-row items-center gap-2">
+ <ReplyActionButton
+ icon={ArrowBendUpLeft}
+ label="Reply"
+ onClick={open('reply-all')}
+ />
+ <ReplyActionButton
+ icon={ArrowBendUpRight}
+ label="Forward"
+ onClick={open('forward')}
+ />
+ </div>
+
<ReplyActionButton
- icon={ArrowBendUpRight}
- label="Forward"
- onClick={open('forward')}
+ icon={CheckIcon}
+ ariaLabel="Mark done"
+ onClick={markDone}
/>
</div>
</div>
diff --git a/apps/web/src/features/block-email/component/TopBar.tsx b/apps/web/src/features/block-email/component/TopBar.tsx
index 96401bc838..aae8875c8e 100644
--- a/apps/web/src/features/block-email/component/TopBar.tsx
+++ b/apps/web/src/features/block-email/component/TopBar.tsx
@@ -12,7 +12,10 @@ import type { BlockTool } from '@components/app/ResponsiveBlockToolbar';
import { ResponsiveBlockToolbar } from '@components/app/ResponsiveBlockToolbar';
import { useSidePanel } from '@components/app/side-panel';
import { SplitFileMenu } from '@components/app/split-layout/components/SplitFileMenu';
-import { SplitHeaderLeft } from '@components/app/split-layout/components/SplitHeader';
+import {
+ SplitHeaderLeft,
+ SplitHeaderRight,
+} from '@components/app/split-layout/components/SplitHeader';
import {
SplitHeaderBadge,
SplitTitleFileMenu,
@@ -37,6 +40,7 @@ import ProhibitIcon from '@phosphor/prohibit.svg';
import TrashIcon from '@phosphor/trash.svg';
import ArrowCounterClockwise from '@phosphor-icons/core/regular/arrow-counter-clockwise.svg?component-solid';
import { useEmailLinksQuery } from '@queries/email/link';
+import { Button } from '@ui';
import { onCleanup, Show } from 'solid-js';
import { useEmailContext } from './EmailContext';
@@ -82,6 +86,17 @@ export function TopBar(props: {
return links.some((link) => link.id === thread.link_id);
};
+ const markDone = () => {
+ // Prefer the active Mark done command so it drives soup navigation and
+ // notifications; fall back to archiving the thread directly.
+ const command = getActiveCommandByToken(TOKENS.entity.action.markDone);
+ if (command) {
+ runCommand(command);
+ } else {
+ emailCtx.archiveThread();
+ }
+ };
+
const trashThread = () => {
const thread = emailCtx.thread();
if (!thread?.db_id) return;
@@ -153,14 +168,7 @@ export function TopBar(props: {
{
label: 'Mark done',
icon: CheckIcon,
- action: () => {
- const command = getActiveCommandByToken(TOKENS.entity.action.markDone);
- if (command) {
- runCommand(command);
- } else {
- emailCtx.archiveThread();
- }
- },
+ action: markDone,
condition: isOwnThread,
},
{
@@ -236,6 +244,23 @@ export function TopBar(props: {
</Show>
</SplitTitleFileMenu>
+ {/* Desktop-only Mark done button, sitting just left of the Previous item
+ caret. On mobile this action lives in the bottom reply bar instead. */}
+ <Show when={!isMobile()}>
+ <SplitHeaderRight>
+ <Show when={isOwnThread()}>
+ <Button
+ class="p-1 rounded-lg"
+ label="Mark done"
+ hotkey={TOKENS.entity.action.markDone}
+ onClick={markDone}
+ >
+ <CheckIcon class="size-4" />
+ </Button>
+ </Show>
+ </SplitHeaderRight>
+ </Show>
+
<ResponsiveBlockToolbar
tools={tools}
ops={[]}