Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

MUL-9037: feat(comments): show comment images as thumbnails, with a setting for full size (#10372)

Jiayuan Zhangad9e7dd3e1fa
diff --git a/apps/desktop/src/renderer/src/components/daemon-localization.test.tsx b/apps/desktop/src/renderer/src/components/daemon-localization.test.tsx
index 03349d8424..70e05d50c2 100644
--- a/apps/desktop/src/renderer/src/components/daemon-localization.test.tsx
+++ b/apps/desktop/src/renderer/src/components/daemon-localization.test.tsx
@@ -59,7 +59,7 @@ describe("Desktop daemon localization with real zh-Hans resources", () => {
"登录时自动启动。",
),
).toBeInTheDocument();
- const command = screen.getByText("multica daemon stop");
+ const command = await screen.findByText("multica daemon stop");
expect(command.closest("p")).toHaveTextContent(/multica daemon stop。$/);
});
diff --git a/packages/core/issues/stores/comment-composer-store.test.ts b/packages/core/issues/stores/comment-composer-store.test.ts
index f33335aa59..bf91dfc843 100644
--- a/packages/core/issues/stores/comment-composer-store.test.ts
+++ b/packages/core/issues/stores/comment-composer-store.test.ts
@@ -23,7 +23,7 @@ beforeAll(() => {
describe("comment composer store", () => {
beforeEach(() => {
- useCommentComposerStore.setState({ sticky: true, runningAgentReply: "steer" });
+ useCommentComposerStore.setState({ sticky: true, runningAgentReply: "steer", imageLayout: "thumbnails" });
});
it("toggleSticky flips the preference", () => {
@@ -44,6 +44,13 @@ describe("comment composer store", () => {
it("keeps steering as the default for preferences saved before the option existed", async () => {
localStorage.setItem("multica_comment_composer", JSON.stringify({ state: { sticky: false }, version: 0 }));
await useCommentComposerStore.persist.rehydrate();
- expect(useCommentComposerStore.getState()).toMatchObject({ sticky: false, runningAgentReply: "steer" });
+ expect(useCommentComposerStore.getState()).toMatchObject({ sticky: false, runningAgentReply: "steer", imageLayout: "thumbnails" });
+ });
+
+ it("shows comment images as thumbnails by default and remembers full size", () => {
+ expect(useCommentComposerStore.getState().imageLayout).toBe("thumbnails");
+ useCommentComposerStore.getState().setImageLayout("full");
+ expect(useCommentComposerStore.getState().imageLayout).toBe("full");
+ expect(JSON.parse(localStorage.getItem("multica_comment_composer")!).state.imageLayout).toBe("full");
});
});
diff --git a/packages/core/issues/stores/comment-composer-store.ts b/packages/core/issues/stores/comment-composer-store.ts
index bad9558132..8b4ac87f4d 100644
--- a/packages/core/issues/stores/comment-composer-store.ts
+++ b/packages/core/issues/stores/comment-composer-store.ts
@@ -11,19 +11,28 @@ import { defaultStorage } from "../../platform/storage";
export type RunningAgentReply = "steer" | "after_run";
/**
- * Personal preferences for the issue-detail comment composer.
+ * How images in the issue timeline's comments lay out: `thumbnails` keeps
+ * them small (attached images in a row, body images height-capped) and opens
+ * the full size in the viewer; `full` shows every image at its full size.
+ */
+export type CommentImageLayout = "thumbnails" | "full";
+
+/**
+ * Personal preferences for the issue-detail comment composer and timeline.
*
* `sticky` pins the bottom comment bar to the scroll viewport so it stays
* reachable while reading a long timeline. `runningAgentReply` picks the
- * default for a reply to a running agent. Both are personal habits (like
- * theme), so they persist globally via `defaultStorage` rather than
- * per-workspace storage.
+ * default for a reply to a running agent. `imageLayout` picks how comment
+ * images lay out. All are personal habits (like theme), so they persist
+ * globally via `defaultStorage` rather than per-workspace storage.
*/
interface CommentComposerStore {
sticky: boolean;
runningAgentReply: RunningAgentReply;
+ imageLayout: CommentImageLayout;
toggleSticky: () => void;
setRunningAgentReply: (value: RunningAgentReply) => void;
+ setImageLayout: (value: CommentImageLayout) => void;
}
export const useCommentComposerStore = create<CommentComposerStore>()(
@@ -31,8 +40,10 @@ export const useCommentComposerStore = create<CommentComposerStore>()(
(set) => ({
sticky: true,
runningAgentReply: "steer",
+ imageLayout: "thumbnails",
toggleSticky: () => set((s) => ({ sticky: !s.sticky })),
setRunningAgentReply: (runningAgentReply) => set({ runningAgentReply }),
+ setImageLayout: (imageLayout) => set({ imageLayout }),
}),
{
name: "multica_comment_composer",
diff --git a/packages/core/issues/stores/index.ts b/packages/core/issues/stores/index.ts
index 2995aae741..0cf7a764d0 100644
--- a/packages/core/issues/stores/index.ts
+++ b/packages/core/issues/stores/index.ts
@@ -26,7 +26,7 @@ export {
useResolvedExpandStore,
selectExpandedResolved,
} from "./resolved-expand-store";
-export { useCommentComposerStore, type RunningAgentReply } from "./comment-composer-store";
+export { useCommentComposerStore, type CommentImageLayout, type RunningAgentReply } from "./comment-composer-store";
export { useCommentDraftStore, type CommentDraftKey } from "./comment-draft-store";
export {
myIssuesViewStore,
diff --git a/packages/views/editor/styles/attachment.css b/packages/views/editor/styles/attachment.css
index 8e02a6ff03..fa214437b9 100644
--- a/packages/views/editor/styles/attachment.css
+++ b/packages/views/editor/styles/attachment.css
@@ -124,3 +124,79 @@
.image-toolbar button:hover {
background: color-mix(in srgb, white 15%, transparent);
}
+
+/*
+ * Issue-timeline comment images. `data-comment-images` sits on the timeline
+ * and the bottom composer, carrying the personal "Images in comments"
+ * preference ("thumbnails" | "full"). "full" keeps the rules above.
+ *
+ * Thumbnails: attached images sit in a wrapping row at one height and their
+ * own aspect (never cropped); a lone one, and any image in the body, gets a
+ * larger box. Sized figures are capped by width, because capping the height
+ * of an `aspect-ratio` image would stretch it. Click opens the full size.
+ */
+[data-comment-images="thumbnails"] [data-comment-image-list] {
+ flex-direction: row;
+ flex-wrap: wrap;
+ gap: 0.375rem;
+}
+
+[data-comment-images="thumbnails"] [data-comment-image-list] .image-standalone .image-content {
+ max-height: 12.5rem;
+}
+
+[data-comment-images="thumbnails"] [data-comment-image-list] .image-standalone[data-sized] {
+ width: min(var(--image-width), 100%, 12.5rem * var(--image-aspect));
+}
+
+[data-comment-images="thumbnails"] [data-comment-image-list] > .image-node:only-child .image-content {
+ max-width: min(100%, 35rem);
+ max-height: 25rem;
+}
+
+[data-comment-images="thumbnails"] [data-comment-image-list] > .image-node:only-child .image-standalone[data-sized] {
+ width: min(var(--image-width), 100%, 35rem, 25rem * var(--image-aspect));
+}
+
+[data-comment-images="thumbnails"] .image-figure[data-sized]:not(.image-standalone) {
+ width: min(var(--image-width), 100%, 35rem, 25rem * var(--image-aspect));
+}
+
+[data-comment-images="thumbnails"] .image-figure[data-pending]:not(.image-standalone) {
+ max-width: 35rem;
+}
+
+[data-comment-images="thumbnails"] .image-figure:not([data-sized], [data-pending], .image-standalone) .image-content {
+ width: auto;
+ max-width: min(100%, 35rem);
+ max-height: 25rem;
+}
+
+/* A thumbnail can be narrower than its toolbar, so the toolbar grows from
+ the left edge into the open space instead of past the column's edge. */
+[data-comment-images="thumbnails"] [data-comment-image-list] .image-toolbar,
+[data-comment-images] .ProseMirror .image-toolbar {
+ top: 0.25rem;
+ left: 0.25rem;
+ right: auto;
+}
+
+/* Comment composers, whatever the preference: an image keeps its place in
+ the text as a small thumbnail, so what is being written stays in view. */
+[data-comment-images] .ProseMirror .image-node {
+ text-align: start;
+}
+
+[data-comment-images] .ProseMirror .image-figure[data-sized] {
+ width: min(var(--image-width), 100%, 7.5rem * var(--image-aspect));
+}
+
+[data-comment-images] .ProseMirror .image-figure[data-pending] {
+ width: 12rem;
+}
+
+[data-comment-images] .ProseMirror .image-figure:not([data-sized], [data-pending]) .image-content {
+ width: auto;
+ max-width: 100%;
+ max-height: 7.5rem;
+}
diff --git a/packages/views/issues/components/comment-card.tsx b/packages/views/issues/components/comment-card.tsx
index a75cbe0c52..af545545f8 100644
--- a/packages/views/issues/components/comment-card.tsx
+++ b/packages/views/issues/components/comment-card.tsx
@@ -247,15 +247,16 @@ export function AttachmentList({
);
};
- // Every image shows at its full size, one under another, so it reads
- // without opening (MUL-7736). Every other file — HTML too: an uploaded file
- // is a deliverable to open, not part of the text — is a card in a grid, not
- // a full-width row each.
+ // Images stack at full size so they read without opening (MUL-7736), or —
+ // under the timeline's "thumbnails" image preference — sit in a row of
+ // thumbnails (editor/styles/attachment.css, MUL-9037). Every other file —
+ // HTML too: an uploaded file is a deliverable to open, not part of the
+ // text — is a card in a grid, not a full-width row each.
return (
<AttachmentDownloadProvider attachments={attachments}>
<div className={cn("flex flex-col gap-2", className)}>
{images.length > 0 && (
- <div className="flex flex-col items-start gap-2">{images.map(render)}</div>
+ <div data-comment-image-list className="flex flex-col items-start gap-2">{images.map(render)}</div>
)}
{files.length > 0 && (
<div className="grid grid-cols-[repeat(auto-fill,minmax(min(15rem,100%),1fr))] gap-2">
diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsx
index 95954a0e42..67564fe0b1 100644
--- a/packages/views/issues/components/issue-detail.tsx
+++ b/packages/views/issues/components/issue-detail.tsx
@@ -161,6 +161,7 @@ import { memberListOptions, agentListOptions } from "@multica/core/workspace/que
import {
selectExpandedResolved,
useCommentCollapseStore,
+ useCommentComposerStore,
useRecentIssuesStore,
useResolvedExpandStore,
useSubIssuesCollapseStore,
@@ -1615,6 +1616,8 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr
// User preference: pin the bottom comment bar to the scroll viewport. Off
// below `md` regardless of the preference — see the hook.
const stickyComposer = useStickyComposer();
+ // Read by the image rules in editor/styles/attachment.css.
+ const commentImageLayout = useCommentComposerStore((s) => s.imageLayout);
// Mobile shows it only near the top of the page, where it covers the text
// column the least; desktop shows it whenever the latest entry is more than
// a screen away.
@@ -3929,7 +3932,7 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr
<div className="my-8 border-t" />
{/* Activity / Comments */}
- <div>
+ <div data-comment-images={commentImageLayout}>
<div className="flex items-center justify-between">
<div className="flex items-center gap-3">
<h2 className="text-title-sm font-semibold">{t(($) => $.detail.activity_section)}</h2>
@@ -4144,6 +4147,7 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr
<IssueAppRequests issueId={id} highlightId={highlightAppRequestId} highlightToken={highlightRequestToken} />
<div
ref={composerRef}
+ data-comment-images={commentImageLayout}
className={cn(
"mt-4",
stickyComposer &&
diff --git a/packages/views/locales/en/settings.json b/packages/views/locales/en/settings.json
index f5f1e54db6..16d38be539 100644
--- a/packages/views/locales/en/settings.json
+++ b/packages/views/locales/en/settings.json
@@ -170,6 +170,12 @@
"after_run": "Start after this run",
"hint": "Sets the default only. You can still change it for any message before sending."
},
+ "comment_images": {
+ "title": "Images in comments",
+ "thumbnails": "Thumbnails",
+ "full": "Full size",
+ "hint": "Thumbnails keep long threads short; click an image to see it full size."
+ },
"comments_title": "Comments & chat",
"region_title": "Language & region",
"issue_fields_title": "Fields shown when creating issues",
diff --git a/packages/views/locales/es/settings.json b/packages/views/locales/es/settings.json
index 09f564cb90..ec13a2c0dd 100644
--- a/packages/views/locales/es/settings.json
+++ b/packages/views/locales/es/settings.json
@@ -170,6 +170,12 @@
"after_run": "Empezar tras esta ejecución",
"hint": "Solo establece el valor predeterminado. Puedes cambiarlo para cualquier mensaje antes de enviarlo."
},
+ "comment_images": {
+ "title": "Imágenes en comentarios",
+ "thumbnails": "Miniaturas",
+ "full": "Tamaño completo",
+ "hint": "Las miniaturas acortan los hilos largos; haz clic en una imagen para verla a tamaño completo."
+ },
"comments_title": "Comentarios",
"issue_fields": {
"field": "Campo",
diff --git a/packages/views/locales/fr/settings.json b/packages/views/locales/fr/settings.json
index 6c230605df..958913f869 100644
--- a/packages/views/locales/fr/settings.json
+++ b/packages/views/locales/fr/settings.json
@@ -170,6 +170,12 @@
"after_run": "Démarrer après cette exécution",
"hint": "Définit seulement le choix par défaut. Vous pouvez le modifier pour chaque message avant l'envoi."
},
+ "comment_images": {
+ "title": "Images dans les commentaires",
+ "thumbnails": "Miniatures",
+ "full": "Taille réelle",
+ "hint": "Les miniatures raccourcissent les longs fils ; cliquez sur une image pour l’afficher en taille réelle."
+ },
"comments_title": "Commentaires et discussion",
"region_title": "Langue et région",
"issue_fields_title": "Champs affichés à la création de tâches",
diff --git a/packages/views/locales/ja/settings.json b/packages/views/locales/ja/settings.json
index e78b5a4cd7..a24dd96503 100644
--- a/packages/views/locales/ja/settings.json
+++ b/packages/views/locales/ja/settings.json
@@ -169,6 +169,12 @@
"after_run": "この実行の後に開始",
"hint": "既定の動作だけを決めます。送信前にメッセージごとに変更できます。"
},
+ "comment_images": {
+ "title": "コメント内の画像",
+ "thumbnails": "サムネイル",
+ "full": "元のサイズ",
+ "hint": "サムネイルにすると長いスレッドも短く収まります。画像をクリックすると元のサイズで表示します。"
+ },
"comments_title": "コメントとチャット",
"region_title": "言語と地域",
"issue_fields_title": "タスク作成時に表示するフィールド",
diff --git a/packages/views/locales/ko/settings.json b/packages/views/locales/ko/settings.json
index 4c5bc4154b..9f176c1bc9 100644
--- a/packages/views/locales/ko/settings.json
+++ b/packages/views/locales/ko/settings.json
@@ -169,6 +169,12 @@
"after_run": "이번 실행 후 시작",
"hint": "기본값만 정합니다. 보내기 전에 메시지마다 바꿀 수 있습니다."
},
+ "comment_images": {
+ "title": "댓글 속 이미지",
+ "thumbnails": "썸네일",
+ "full": "원본 크기",
+ "hint": "썸네일로 보면 긴 스레드도 짧게 유지됩니다. 이미지를 클릭하면 원본 크기로 볼 수 있습니다."
+ },
"comments_title": "댓글 및 채팅",
"region_title": "언어 및 지역",
"issue_fields_title": "태스크 생성 시 표시할 필드",
diff --git a/packages/views/locales/ru/settings.json b/packages/views/locales/ru/settings.json
index dd2204ff64..9a1757916a 100644
--- a/packages/views/locales/ru/settings.json
+++ b/packages/views/locales/ru/settings.json
@@ -171,6 +171,12 @@
"after_run": "Начать после этого запуска",
"hint": "Задаёт только значение по умолчанию. Вы всегда можете изменить его для любого сообщения перед отправкой."
},
+ "comment_images": {
+ "title": "Изображения в комментариях",
+ "thumbnails": "Миниатюры",
+ "full": "Полный размер",
+ "hint": "Миниатюры делают длинные обсуждения короче; нажмите на изображение, чтобы открыть его в полном размере."
+ },
"comments_title": "Комментарии и чат",
"region_title": "Язык и регион",
"issue_fields_title": "Поля, отображаемые при создании задач",
diff --git a/packages/views/locales/zh-Hans/settings.json b/packages/views/locales/zh-Hans/settings.json
index 519f785ebd..beaf172459 100644
--- a/packages/views/locales/zh-Hans/settings.json
+++ b/packages/views/locales/zh-Hans/settings.json
@@ -169,6 +169,12 @@
"after_run": "本轮结束后开始",
"hint": "只决定默认选项,每条消息发送前仍可单独修改。"
},
+ "comment_images": {
+ "title": "评论中的图片",
+ "thumbnails": "缩略图",
+ "full": "原尺寸",
+ "hint": "缩略图让长讨论更紧凑,点击图片可查看原图。"
+ },
"comments_title": "评论与聊天",
"region_title": "语言与地区",
"issue_fields_title": "创建任务时显示的字段",
diff --git a/packages/views/locales/zh-Hant/settings.json b/packages/views/locales/zh-Hant/settings.json
index ccfc098387..2ac5b77f81 100644
--- a/packages/views/locales/zh-Hant/settings.json
+++ b/packages/views/locales/zh-Hant/settings.json
@@ -169,6 +169,12 @@
"after_run": "本輪結束後開始",
"hint": "只決定預設選項,每條訊息傳送前仍可單獨修改。"
},
+ "comment_images": {
+ "title": "留言中的圖片",
+ "thumbnails": "縮圖",
+ "full": "原尺寸",
+ "hint": "縮圖讓長討論更精簡,點擊圖片可查看原圖。"
+ },
"comments_title": "評論與聊天",
"region_title": "語言與地區",
"issue_fields_title": "建立任務時顯示的欄位",
diff --git a/packages/views/settings/components/preferences-tab.tsx b/packages/views/settings/components/preferences-tab.tsx
index 8737e3d6e0..5ec34ee38f 100644
--- a/packages/views/settings/components/preferences-tab.tsx
+++ b/packages/views/settings/components/preferences-tab.tsx
@@ -29,6 +29,7 @@ import { useAuthStore } from "@multica/core/auth";
import { useChatStore } from "@multica/core/chat";
import {
useCommentComposerStore,
+ type CommentImageLayout,
type RunningAgentReply,
} from "@multica/core/issues/stores";
import {
@@ -86,6 +87,7 @@ export function PreferencesTab() {
<SettingsCard>
<StickyCommentBarRow />
<RunningAgentReplyRow />
+ <CommentImageLayoutRow />
<FloatingChatRow />
<QuickChatAgentRow />
</SettingsCard>
@@ -218,6 +220,32 @@ function RunningAgentReplyRow() {
);
}
+function CommentImageLayoutRow() {
+ const { t } = useT("settings");
+ const value = useCommentComposerStore((s) => s.imageLayout);
+ const setValue = useCommentComposerStore((s) => s.setImageLayout);
+ const label = t(($) => $.preferences.comment_images.title);
+ return (
+ <SettingsRow
+ anchor="comment-images"
+ label={label}
+ description={t(($) => $.preferences.comment_images.hint)}
+ >
+ <div role="group" aria-label={label}>
+ <SegmentedToggle<CommentImageLayout>
+ value={value}
+ onChange={setValue}
+ buttonClassName="px-3 py-1 text-label"
+ options={[
+ ["thumbnails", t(($) => $.preferences.comment_images.thumbnails)],
+ ["full", t(($) => $.preferences.comment_images.full)],
+ ]}
+ />
+ </div>
+ </SettingsRow>
+ );
+}
+
/**
* What a plain click on an issue card or row opens across the issue views.
* The hint carries the one non-obvious part: Shift+Click opens the other one,
diff --git a/packages/views/settings/components/use-settings-search-index.ts b/packages/views/settings/components/use-settings-search-index.ts
index d69b71bf73..f5e25da4c1 100644
--- a/packages/views/settings/components/use-settings-search-index.ts
+++ b/packages/views/settings/components/use-settings-search-index.ts
@@ -141,6 +141,12 @@ export function useSettingsSearchIndex(
title: t(($) => $.preferences.running_agent_reply.title),
description: t(($) => $.preferences.running_agent_reply.hint),
},
+ {
+ tab: "preferences",
+ anchor: "comment-images",
+ title: t(($) => $.preferences.comment_images.title),
+ description: t(($) => $.preferences.comment_images.hint),
+ },
{
tab: "preferences",
anchor: "chat",