diff --git a/packages/superdoc/src/assets/styles/tokens.css b/packages/superdoc/src/assets/styles/tokens.css index eab2f841f5..9105f36522 100644 --- a/packages/superdoc/src/assets/styles/tokens.css +++ b/packages/superdoc/src/assets/styles/tokens.css @@ -69,14 +69,14 @@ --sd-action-primary-hover: var(--sd-color-blue-600); /* ─── Component: Comment Dialog ─── */ - --sd-comment-bg: var(--sd-color-gray-100); - --sd-comment-bg-hover: var(--sd-surface-hover); + --sd-comment-bg: #f3f6fd; + --sd-comment-bg-hover: #f3f6fd; --sd-comment-bg-active: var(--sd-surface-card); --sd-comment-bg-resolved: #f0f0f0; --sd-comment-border-active: var(--sd-border-subtle); --sd-comment-radius: var(--sd-radius-lg); --sd-comment-padding: 16px; - --sd-comment-shadow: 0 4px 20px rgba(15, 23, 42, 0.08); + --sd-comment-shadow: 0px 4px 12px 0px rgba(50, 50, 50, 0.15); --sd-comment-max-width: 300px; --sd-comment-min-width: 200px; --sd-comment-separator: var(--sd-border-subtle); diff --git a/packages/superdoc/src/components/CommentsLayer/CommentDialog.test.js b/packages/superdoc/src/components/CommentsLayer/CommentDialog.test.js index 9a4867d27d..43c28a499e 100644 --- a/packages/superdoc/src/components/CommentsLayer/CommentDialog.test.js +++ b/packages/superdoc/src/components/CommentsLayer/CommentDialog.test.js @@ -624,6 +624,13 @@ describe('CommentDialog.vue', () => { commentsStoreStub.activeComment.value = 'tc-parent'; await nextTick(); + // Expand the collapsed thread (>= 2 children triggers collapse) + const collapsedPill = wrapper.find('.collapsed-replies'); + if (collapsedPill.exists()) { + await collapsedPill.trigger('click'); + await nextTick(); + } + const headers = wrapper.findAllComponents(CommentHeaderStub); expect(headers).toHaveLength(3); @@ -696,6 +703,13 @@ describe('CommentDialog.vue', () => { commentsStoreStub.activeComment.value = 'tc-parent'; await nextTick(); + // Expand the collapsed thread (>= 2 children triggers collapse) + const collapsedPill = wrapper.find('.collapsed-replies'); + if (collapsedPill.exists()) { + await collapsedPill.trigger('click'); + await nextTick(); + } + const headers = wrapper.findAllComponents(CommentHeaderStub); expect(headers).toHaveLength(3); expect(headers[0].props('comment').commentId).toBe('tc-parent'); diff --git a/packages/superdoc/src/components/CommentsLayer/CommentDialog.vue b/packages/superdoc/src/components/CommentsLayer/CommentDialog.vue index e4b9f03cd8..e282b98b57 100644 --- a/packages/superdoc/src/components/CommentsLayer/CommentDialog.vue +++ b/packages/superdoc/src/components/CommentsLayer/CommentDialog.vue @@ -207,9 +207,9 @@ watch(isActiveComment, (active) => { } }); -/* ── Step 3: Thread collapse (Google Docs pattern) ── - * >=3 replies → collapse: parent + first reply + "N more replies" + last reply - * <3 replies → show all +/* ── Step 3: Thread collapse ── + * >=2 replies → collapse: parent + "N more replies" + last reply + * <2 replies → show all * Clicking "N more replies" or the card → expand all + activate * Deactivating → re-collapse */ @@ -218,27 +218,26 @@ const childComments = computed(() => comments.value.slice(1)); const shouldCollapseThread = computed(() => { if (threadExpanded.value) return false; - return childComments.value.length >= 3; + return childComments.value.length >= 2; }); const visibleComments = computed(() => { if (!shouldCollapseThread.value) return comments.value; - // Collapsed: parent + first reply + last reply + // Collapsed: parent + last reply const parent = comments.value[0]; - const first = childComments.value[0]; const last = childComments.value[childComments.value.length - 1]; - return [parent, first, last].filter(Boolean); + return [parent, last].filter(Boolean); }); const collapsedReplyCount = computed(() => { if (!shouldCollapseThread.value) return 0; - return childComments.value.length - 2; // first + last are shown + return childComments.value.length - 1; // only last is shown }); const collapsedReplyAuthors = computed(() => { if (!shouldCollapseThread.value) return []; - // Hidden = middle replies (first + last are visible) - const hidden = childComments.value.slice(1, -1); + // Hidden = all replies except last + const hidden = childComments.value.slice(0, -1); const seen = new Set(); return hidden .map((c) => @@ -543,9 +542,9 @@ watch(editingCommentId, (commentId) => { />
- +
- -