Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(workbench): show discussion and sign-in guidance (#19975)

Inneif53aac081535
diff --git a/.agents/skills/compose-atoms/SKILL.md b/.agents/skills/compose-atoms/SKILL.md
index 35527ee61f5..7b29c5675dd 100644
--- a/.agents/skills/compose-atoms/SKILL.md
+++ b/.agents/skills/compose-atoms/SKILL.md
@@ -177,7 +177,7 @@ If the light assembler appears on the importer chain, a static import still exis
| Host | Mounts |
| ----------------------------- | ------------------------------------------------------------------------- |
| In-app `Acceptance/index.tsx` | Identity, goal, inventory, decision, focus workflow, ledger + write slots |
-| Workbench public detail | Identity, goal, inventory only |
+| Workbench public detail | Identity, goal, inventory, discussion with sign-in guidance |
| Portal | Full assembler + `OriginConversationProvider` |
Read `AcceptanceGoal` (read + `editSlot`) and `AcceptanceGoalEdit` (write) for the slot cut. Read `originConversation.tsx` for a host seam. Read workbench `AcceptanceDetail.tsx` for a light assembler.
diff --git a/apps/workbench/scripts/verify-discussion.mjs b/apps/workbench/scripts/verify-discussion.mjs
new file mode 100644
index 00000000000..ee86c7c776c
--- /dev/null
+++ b/apps/workbench/scripts/verify-discussion.mjs
@@ -0,0 +1,60 @@
+import assert from 'node:assert/strict';
+
+import { chromium, expect } from '@playwright/test';
+
+const baseUrl = process.argv[2];
+assert(baseUrl, 'Usage: node scripts/verify-discussion.mjs <running-workbench-url>');
+const acceptanceId = '00000000-0000-4000-8000-000000000001';
+const returnPath = `/acceptance/${acceptanceId}?hl=en-US`;
+const browser = await chromium.launch({ channel: 'chrome', headless: true });
+
+try {
+ const page = await browser.newPage();
+ const errors = [];
+ page.on('pageerror', (error) => errors.push(error.message));
+ await page.route('**/trpc/lambda/acceptance.getBundle?*', (route) =>
+ route.fulfill({
+ json: {
+ result: {
+ data: {
+ json: {
+ acceptance: {
+ id: acceptanceId,
+ requirement: 'Public discussion regression',
+ status: 'accepted',
+ },
+ author: null,
+ canReview: false,
+ checks: [],
+ flows: [],
+ origin: null,
+ rounds: [],
+ subject: { id: 'discussion-regression', title: 'Public discussion regression' },
+ },
+ },
+ },
+ },
+ }),
+ );
+ await page.route('**/trpc/lambda/acceptanceComment.list?*', (route) =>
+ route.fulfill({
+ json: { result: { data: { json: { canApprove: false, canComment: false, items: [] } } } },
+ }),
+ );
+ await page.goto(new URL(returnPath, baseUrl).href);
+ const discussion = page.getByRole('region', { name: 'Discussion', exact: true });
+ await expect(discussion).toBeVisible({ timeout: 30_000 });
+ for (const route of ['signin', 'signup']) {
+ const link = discussion.locator(`a[href^="/${route}?"]`);
+ await expect(link).toBeVisible();
+ const target = new URL(await link.getAttribute('href'), baseUrl);
+ assert.equal(target.searchParams.get('callbackUrl'), returnPath);
+ }
+ await expect(discussion.getByRole('textbox')).toHaveCount(0);
+ await page.setViewportSize({ width: 390, height: 844 });
+ await expect(discussion.locator('a[href^="/signin?"]')).toBeVisible();
+ assert.deepEqual(errors, []);
+ console.log('PASS: Workbench guest discussion, sign-in/sign-up return URLs, mobile layout');
+} finally {
+ await browser.close();
+}
diff --git a/apps/workbench/src/features/acceptance/AcceptanceDetail.tsx b/apps/workbench/src/features/acceptance/AcceptanceDetail.tsx
index a4ddc8c2721..b1dd378e41e 100644
--- a/apps/workbench/src/features/acceptance/AcceptanceDetail.tsx
+++ b/apps/workbench/src/features/acceptance/AcceptanceDetail.tsx
@@ -3,6 +3,7 @@
import { Flexbox } from '@lobehub/ui';
import { Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
+import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router';
import { extractUuid } from '@/features/Acceptance/utils';
@@ -11,6 +12,7 @@ import {
AcceptanceScope,
} from '@/features/Acceptance/Viewer/AcceptanceScope';
import AcceptanceCheckInventory from '@/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory';
+import AcceptanceDiscussion from '@/features/Acceptance/Viewer/Comments/AcceptanceDiscussion';
import AcceptanceGoal from '@/features/Acceptance/Viewer/Header/AcceptanceGoal';
import AcceptanceIdentity from '@/features/Acceptance/Viewer/Header/AcceptanceIdentity';
import AcceptanceShare from '@/features/Acceptance/Viewer/Header/AcceptanceShare';
@@ -64,6 +66,7 @@ const Title = () => {
};
const WorkbenchAcceptanceDetail = () => {
+ const { t } = useTranslation('verify');
const params = useParams<{ acceptanceId: string }>();
const acceptanceId = extractUuid(params.acceptanceId);
if (!acceptanceId) return null;
@@ -87,6 +90,10 @@ const WorkbenchAcceptanceDetail = () => {
</Flexbox>
<AcceptanceGoal />
<AcceptanceCheckInventory />
+ <section aria-label={t('acceptance.comments.title')}>
+ <Text as={'h2'}>{t('acceptance.comments.title')}</Text>
+ <AcceptanceDiscussion />
+ </section>
</Flexbox>
</AcceptanceBundleGate>
</div>