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.

chg(tasks): change order of task name, fix(chat): attachment alignment (#2908)

Seamusb79a85e485f7
diff --git a/js/app/packages/core/component/AI/component/message/UserMessage.tsx b/js/app/packages/core/component/AI/component/message/UserMessage.tsx
index 95537263a1..1dedd0a84e 100644
--- a/js/app/packages/core/component/AI/component/message/UserMessage.tsx
+++ b/js/app/packages/core/component/AI/component/message/UserMessage.tsx
@@ -77,7 +77,7 @@ export function UserMessage(props: {
);
return (
- <div class="flex flex-col space-y-2 group">
+ <div class="flex flex-col group">
<Show when={quote()}>
<div class="relative w-full text-xs flex flex-row space-x-2 items-start text-ink-muted">
<div class="flex flex-row items-center space-x-3">
@@ -87,7 +87,7 @@ export function UserMessage(props: {
</div>
</Show>
<Show when={props.message.attachments.length > 0}>
- <div class="flex flex-col space-y-2 w-full px-1 pb-1 mb-2">
+ <div class="flex flex-col flex-wrap justify-end items-end gap-1 w-full px-1 mb-2">
<For each={imageAttachments()}>
{(attachment) => (
<ImagePreview
diff --git a/js/app/packages/core/util/branchName.ts b/js/app/packages/core/util/branchName.ts
index f9d43d44fd..a854f2087f 100644
--- a/js/app/packages/core/util/branchName.ts
+++ b/js/app/packages/core/util/branchName.ts
@@ -13,6 +13,21 @@ const slugify = (title: string): string =>
.replace(/-+/g, '-')
.replace(/^-|-$/g, '');
+const buildBranchName = (shortId: string, documentName: string): string => {
+ const suffix = `macro-${shortId}`;
+ const slug = slugify(documentName);
+ const maxSlugLength = MAX_BRANCH_LENGTH - suffix.length - 1;
+ let truncatedSlug = slug.slice(0, maxSlugLength);
+ if (truncatedSlug.length < slug.length) {
+ const lastBoundary = truncatedSlug.lastIndexOf('-');
+ if (lastBoundary > 0) {
+ truncatedSlug = truncatedSlug.slice(0, lastBoundary);
+ }
+ }
+ truncatedSlug = truncatedSlug.replace(/-+$/, '');
+ return truncatedSlug ? `${truncatedSlug}-${suffix}` : suffix;
+};
+
export const copyBranchNameToClipboard = async (
documentId: string,
documentName: string
@@ -23,12 +38,12 @@ export const copyBranchNameToClipboard = async (
return;
}
const shortId = result[1];
- const slug = slugify(documentName);
- const branchName = `macro-${shortId}${slug ? `-${slug}` : ''}`.slice(
- 0,
- MAX_BRANCH_LENGTH
- );
- await navigator.clipboard.writeText(branchName);
- analytics.track('task_copy_branch_name');
- toast.success('Branch name copied to clipboard');
+ const branchName = buildBranchName(shortId, documentName);
+ try {
+ await navigator.clipboard.writeText(branchName);
+ analytics.track('task_copy_branch_name');
+ toast.success('Branch name copied to clipboard');
+ } catch {
+ toast.failure('Could not copy branch name');
+ }
};