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.

✨ feat: add AI-readable shared topic transcripts (#20090)

Innei62f7c9007a52
diff --git a/apps/server/src/routers/lambda/__tests__/share.test.ts b/apps/server/src/routers/lambda/__tests__/share.test.ts
index 2137fdf9a33..876f39edca6 100644
--- a/apps/server/src/routers/lambda/__tests__/share.test.ts
+++ b/apps/server/src/routers/lambda/__tests__/share.test.ts
@@ -6,6 +6,17 @@ import { AgentShareModel } from '@/database/models/agentShare';
import { TopicShareModel } from '@/database/models/topicShare';
import { createContextInner } from '@/libs/trpc/lambda/context';
+const queryTopicTranscript = vi.fn();
+const messageModelConstructor = vi.fn();
+vi.mock('@/database/models/message', () => ({
+ MessageModel: class {
+ constructor(...args: unknown[]) {
+ messageModelConstructor(...args);
+ }
+ queryTopicTranscript = queryTopicTranscript;
+ },
+}));
+
vi.mock('@/server/services/agentShare/deliveryStatsCache', () => ({
getCachedDeliveryStats: (_db: unknown, _owner: string, _agent: string, load: () => unknown) =>
load(),
@@ -130,6 +141,70 @@ vi.mock('@/server/featureFlags', () => ({
const { shareRouter } = await import('../share');
describe('shareRouter', () => {
+ describe('getSharedTopicText', () => {
+ beforeEach(() => vi.clearAllMocks());
+
+ it('reads beyond the first page in the share owner workspace and omits subtask text', async () => {
+ vi.mocked(TopicShareModel.findByShareIdWithAccessCheck).mockResolvedValue({
+ ownerId: 'owner',
+ topicId: 'topic',
+ workspaceId: 'workspace',
+ title: 'Shared topic',
+ } as never);
+ const prompts = Array.from({ length: 1000 }, (_, index) => ({
+ content: `Prompt ${index}`,
+ createdAt: new Date(index),
+ id: `${index}`,
+ parentId: index ? `${index - 1}` : null,
+ role: 'user',
+ threadId: null,
+ }));
+ queryTopicTranscript
+ .mockResolvedValueOnce({ items: prompts, total: 1002 })
+ .mockResolvedValueOnce({
+ items: [
+ {
+ content: 'Final answer',
+ createdAt: new Date(1000),
+ id: '1000',
+ parentId: '999',
+ role: 'assistant',
+ },
+ {
+ content: 'Subtask process',
+ createdAt: new Date(1001),
+ id: '1001',
+ role: 'assistant',
+ threadId: 'thread',
+ },
+ ],
+ total: 1002,
+ });
+ const caller = shareRouter.createCaller(await createContextInner({ userId: undefined }));
+ const result = await caller.getSharedTopicText({ shareId: 'public-share' });
+ expect(result.text).toContain('Prompt 0');
+ expect(result.text).toContain('Prompt 999');
+ expect(result.text).toContain('Final answer');
+ expect(result.text).not.toContain('Subtask process');
+ expect(queryTopicTranscript).toHaveBeenLastCalledWith({
+ limit: 1000,
+ offset: 1000,
+ topicId: 'topic',
+ });
+ expect(messageModelConstructor).toHaveBeenCalledWith(expect.anything(), 'owner', 'workspace');
+ });
+
+ it('does not read messages when access is denied', async () => {
+ vi.mocked(TopicShareModel.findByShareIdWithAccessCheck).mockRejectedValue(
+ new TRPCError({ code: 'FORBIDDEN' }),
+ );
+ const caller = shareRouter.createCaller(await createContextInner({ userId: undefined }));
+ await expect(caller.getSharedTopicText({ shareId: 'private-share' })).rejects.toMatchObject({
+ code: 'FORBIDDEN',
+ });
+ expect(queryTopicTranscript).not.toHaveBeenCalled();
+ });
+ });
describe('getSharedAgent', () => {
const agentShare = {
agentAvatar: 'avatar.png',
diff --git a/apps/server/src/routers/lambda/_helpers/sharedTopicText.test.ts b/apps/server/src/routers/lambda/_helpers/sharedTopicText.test.ts
new file mode 100644
index 00000000000..fae29ff93e7
--- /dev/null
+++ b/apps/server/src/routers/lambda/_helpers/sharedTopicText.test.ts
@@ -0,0 +1,51 @@
+import type { UIChatMessage } from '@lobechat/types';
+import { describe, expect, it } from 'vitest';
+
+import { sharedTopicText } from './sharedTopicText';
+
+const message = (
+ id: string,
+ role: UIChatMessage['role'],
+ content: string,
+ parentId?: string,
+ extra: Partial<UIChatMessage> = {},
+): UIChatMessage => ({
+ content,
+ createdAt: Number(id),
+ id,
+ parentId,
+ role,
+ updatedAt: Number(id),
+ ...extra,
+});
+const tools = [
+ { apiName: 'search', arguments: '{}', id: 'call', identifier: 'web', type: 'builtin' as const },
+];
+
+describe('sharedTopicText', () => {
+ it('keeps user prompts and final answers while excluding tools, reasoning and preambles', () => {
+ const result = sharedTopicText([
+ message('1', 'user', 'What happened?'),
+ message('2', 'assistant', 'I will investigate.', '1', { tools }),
+ message('3', 'tool', 'Internal tool output', '2', { tool_call_id: 'call' }),
+ message('4', 'assistant', 'The final conclusion.', '3', {
+ reasoning: { content: 'Private reasoning' },
+ }),
+ message('5', 'user', 'What next?', '4'),
+ message('6', 'assistant', 'The next step.', '5'),
+ ]);
+ expect(result).toBe(
+ '## User\n\nWhat happened?\n\n## Assistant\n\nThe final conclusion.\n\n## User\n\nWhat next?\n\n## Assistant\n\nThe next step.',
+ );
+ });
+
+ it('does not turn an unfinished tool run into a conclusion', () => {
+ expect(
+ sharedTopicText([
+ message('1', 'user', 'Investigate'),
+ message('2', 'assistant', 'I will investigate.', '1'),
+ message('3', 'assistant', 'Still searching.', '2', { tools }),
+ ]),
+ ).toBe('## User\n\nInvestigate');
+ });
+});
diff --git a/apps/server/src/routers/lambda/_helpers/sharedTopicText.ts b/apps/server/src/routers/lambda/_helpers/sharedTopicText.ts
new file mode 100644
index 00000000000..be081c81036
--- /dev/null
+++ b/apps/server/src/routers/lambda/_helpers/sharedTopicText.ts
@@ -0,0 +1,50 @@
+import {
+ parse,
+ partitionAssistantGroupBlocks,
+ splitAssistantGroupFinalAnswer,
+} from '@lobechat/conversation-flow';
+import type { UIChatMessage } from '@lobechat/types';
+
+/** Match the conversation's selected branches, exporting authored answers only. */
+export const sharedTopicText = (messages: UIChatMessage[]): string => {
+ const sections: string[] = [];
+ const append = (role: string, content?: string) => {
+ if (content?.trim()) sections.push(`## ${role}\n\n${content}`);
+ };
+
+ const collect = (items: UIChatMessage[]) => {
+ for (const message of items) {
+ if (message.columns) collect(message.columns.flat());
+ else if (message.members) collect(message.members);
+ else if (message.compressedMessages) collect(parse(message.compressedMessages).flatList);
+ else if (message.role === 'user') append('User', message.content);
+ else if (message.role === 'assistantGroup') {
+ const blocks = message.taskCompletions?.length ? message.taskCompletions : message.children;
+ // Never fall back to pre-tool narration when a run has no final answer.
+ const lastToolIndex = blocks?.findLastIndex((block) => !!block.tools?.length) ?? -1;
+ const { segments } = partitionAssistantGroupBlocks(blocks?.slice(lastToolIndex + 1) ?? [], {
+ isGenerating: false,
+ });
+ const { finalSegments } = splitAssistantGroupFinalAnswer(segments);
+ const content = finalSegments
+ .filter(
+ (segment) =>
+ segment.kind === 'answer' && !segment.block.error && !segment.block.tools?.length,
+ )
+ .map((segment) => (segment.kind === 'answer' ? segment.block.content : ''))
+ .filter(Boolean)
+ .join('\n\n');
+ append('Assistant', content);
+ } else if (
+ (message.role === 'assistant' || message.role === 'supervisor') &&
+ !message.tools?.length &&
+ !message.error &&
+ message.metadata?.scope !== 'sub_agent'
+ )
+ append('Assistant', message.content);
+ }
+ };
+ collect(parse(messages).flatList);
+
+ return sections.join('\n\n');
+};
diff --git a/apps/server/src/routers/lambda/share.ts b/apps/server/src/routers/lambda/share.ts
index d90ee0ab006..8509a3f218f 100644
--- a/apps/server/src/routers/lambda/share.ts
+++ b/apps/server/src/routers/lambda/share.ts
@@ -8,6 +8,7 @@ import {
type SharedAgentDeliveryStats,
type SharedAgentUploadAbility,
type SharedTopicData,
+ type UIChatMessage,
} from '@lobechat/types';
import { TRPCError } from '@trpc/server';
import debug from 'debug';
@@ -17,6 +18,7 @@ import { z } from 'zod';
import { AgentShareModel } from '@/database/models/agentShare';
import { AgentShareProfileModel } from '@/database/models/agentShareProfile';
import { AiModelModel } from '@/database/models/aiModel';
+import { MessageModel } from '@/database/models/message';
import { TopicModel } from '@/database/models/topic';
import { TopicShareModel } from '@/database/models/topicShare';
import type { LobeChatDatabase } from '@/database/type';
@@ -27,6 +29,7 @@ import { AgentService } from '@/server/services/agent';
import { getCachedDeliveryStats } from '@/server/services/agentShare/deliveryStatsCache';
import { assertAgentShareVisitorEnabled } from './_helpers/agentShareFeatureGate';
+import { sharedTopicText } from './_helpers/sharedTopicText';
const log = debug('lobe-server:router:share');
@@ -96,6 +99,46 @@ const resolveVisitorUploadAbility = async (
};
export const shareRouter = router({
+ getSharedTopicText: publicProcedure
+ .use(serverDatabase)
+ .input(z.object({ shareId: z.string().trim().min(1) }))
+ .query(async ({ input, ctx }) => {
+ const share = await TopicShareModel.findByShareIdWithAccessCheck(
+ ctx.serverDB,
+ input.shareId,
+ ctx.userId ?? undefined,
+ );
+ const model = new MessageModel(ctx.serverDB, share.ownerId, share.workspaceId ?? undefined);
+ const messages: UIChatMessage[] = [];
+ let offset = 0;
+ while (true) {
+ const { items, total } = await model.queryTopicTranscript({
+ limit: 1000,
+ offset,
+ topicId: share.topicId,
+ });
+ messages.push(
+ ...items
+ .filter((item) => !item.threadId)
+ .map(
+ (item) =>
+ ({
+ ...item,
+ agentId: item.agentId ?? undefined,
+ content: item.content ?? '',
+ createdAt: item.createdAt.getTime(),
+ updatedAt: item.createdAt.getTime(),
+ parentId: item.parentId ?? undefined,
+ tools: item.tools ?? undefined,
+ }) as UIChatMessage,
+ ),
+ );
+ offset += items.length;
+ if (offset >= total || items.length === 0) break;
+ }
+
+ return { text: sharedTopicText(messages), title: share.title };
+ }),
/**
* Resolve the visitor-facing metadata for an agent share, by its custom
* slug or its raw share id, after enforcing signed-in access.
diff --git a/apps/share/app/routes.ts b/apps/share/app/routes.ts
index d2168087dce..94fd5a0758b 100644
--- a/apps/share/app/routes.ts
+++ b/apps/share/app/routes.ts
@@ -3,6 +3,7 @@ import { index, route, type RouteConfig } from '@react-router/dev/routes';
export default [
index('routes/homeRedirect.tsx'),
route('share/t/:id', 'routes/shareTopic.tsx'),
+ route('share/t/:id/llm.txt', 'routes/shareTopicText.ts'),
route('share/page/:id', 'routes/sharePage.tsx'),
route('share/artifact/:id', 'routes/shareArtifact.tsx'),
route('*', 'routes/catchall.tsx'),
diff --git a/apps/share/app/routes/shareTopicText.test.ts b/apps/share/app/routes/shareTopicText.test.ts
new file mode 100644
index 00000000000..54ccce79091
--- /dev/null
+++ b/apps/share/app/routes/shareTopicText.test.ts
@@ -0,0 +1,49 @@
+// @vitest-environment node
+import { TRPCClientError } from '@trpc/client';
+import type { LoaderFunctionArgs } from 'react-router';
+import { beforeEach, expect, it, vi } from 'vitest';
+
+import { loader } from './shareTopicText';
+
+const query = vi.hoisted(() => vi.fn());
+vi.mock('../lib/serverTrpc', () => ({
+ createServerLambdaClient: () => ({ share: { getSharedTopicText: { query } } }),
+}));
+
+const args = {
+ context: { get: () => ({ env: {} }) },
+ params: { id: 'share-id' },
+ request: new Request('https://lobehub.com/share/t/share-id/llm.txt'),
+} as unknown as LoaderFunctionArgs;
+
+beforeEach(() => vi.resetAllMocks());
+
+it('serves the complete transcript as non-cacheable plain text', async () => {
+ const text = '## User\n\nQuestion\n\n## Assistant\n\nAnswer'.repeat(1001);
+ query.mockResolvedValue({ text, title: 'Topic' });
+ const response = await loader(args);
+ expect(response.status).toBe(200);
+ expect(response.headers.get('Content-Type')).toBe('text/plain; charset=utf-8');
+ expect(response.headers.get('Cache-Control')).toBe('no-store');
+ expect(await response.text()).toBe(`# Topic\n\n${text}`);
+ expect(query).toHaveBeenCalledWith({ shareId: 'share-id' });
+});
+
+it.each([403, 404])(
+ 'preserves access/not-found status %s without exposing diagnostics',
+ async (httpStatus) => {
+ query.mockRejectedValue(
+ TRPCClientError.from({
+ error: {
+ code: -32003,
+ message: 'Internal diagnostic',
+ data: { httpStatus },
+ },
+ }),
+ );
+ const response = await loader(args);
+ expect(response.status).toBe(httpStatus);
+ expect(response.headers.get('Cache-Control')).toBe('no-store');
+ expect(await response.text()).not.toContain('Internal diagnostic');
+ },
+);
diff --git a/apps/share/app/routes/shareTopicText.ts b/apps/share/app/routes/shareTopicText.ts
new file mode 100644
index 00000000000..06d7587af5c
--- /dev/null
+++ b/apps/share/app/routes/shareTopicText.ts
@@ -0,0 +1,26 @@
+import { TRPCClientError } from '@trpc/client';
+import type { LoaderFunctionArgs } from 'react-router';
+
+import { cloudflareContext } from '../lib/cloudflareContext';
+import { createServerLambdaClient } from '../lib/serverTrpc';
+
+export const loader = async ({ context, params, request }: LoaderFunctionArgs) => {
+ const apiBase = context.get(cloudflareContext).env.SHARE_API_BASE as string | undefined;
+ const client = createServerLambdaClient(request, apiBase);
+ const headers = {
+ 'Cache-Control': 'no-store',
+ 'Content-Type': 'text/plain; charset=utf-8',
+ 'X-Content-Type-Options': 'nosniff',
+ };
+
+ try {
+ const { text, title } = await client.share.getSharedTopicText.query({ shareId: params.id! });
+ return new Response([title ? `# ${title}` : '', text].filter(Boolean).join('\n\n'), {
+ headers,
+ });
+ } catch (error) {
+ const status = error instanceof TRPCClientError ? (error.data?.httpStatus ?? 502) : 502;
+ const message = status === 404 ? 'Share not found' : 'Unable to read this shared topic';
+ return new Response(message, { headers, status });
+ }
+};
diff --git a/apps/share/src/features/topic/ExplainTopic.tsx b/apps/share/src/features/topic/ExplainTopic.tsx
new file mode 100644
index 00000000000..1121affabc9
--- /dev/null
+++ b/apps/share/src/features/topic/ExplainTopic.tsx
@@ -0,0 +1,31 @@
+import { Button, toast } from '@lobehub/ui/base-ui';
+import { Sparkles } from 'lucide-react';
+import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+export default function ExplainTopic({ shareId }: { shareId: string }) {
+ const { t } = useTranslation('chat');
+ const [loading, setLoading] = useState(false);
+
+ const copyPrompt = async () => {
+ setLoading(true);
+ try {
+ const url = new URL(
+ `/share/t/${encodeURIComponent(shareId)}/llm.txt`,
+ window.location.origin,
+ );
+ await navigator.clipboard.writeText(t('sharePage.explain.prompt', { url: url.href }));
+ toast.success(t('sharePage.explain.copied'));
+ } catch {
+ toast.error(t('sharePage.explain.failed'));
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ return (
+ <Button icon={Sparkles} loading={loading} onClick={copyPrompt}>
+ {t('sharePage.explain.action')}
+ </Button>
+ );
+}
diff --git a/apps/share/src/features/topic/SharedMessageList.tsx b/apps/share/src/features/topic/SharedMessageList.tsx
index dd55b60902c..fa2b518f3af 100644
--- a/apps/share/src/features/topic/SharedMessageList.tsx
+++ b/apps/share/src/features/topic/SharedMessageList.tsx
@@ -54,7 +54,7 @@ const SharedMessageList = memo<SharedMessageListProps>((props) => {
headerSlot={headerSlot}
itemContent={itemContent}
footerSlot={
- <Flexbox align={'center'} paddingBlock={'16px 80px'} paddingInline={24}>
+ <Flexbox align={'center'} paddingBlock={24} paddingInline={24}>
<Text fontSize={12} style={{ maxWidth: 480, textAlign: 'center' }} type={'secondary'}>
{t('sharePageDisclaimer')}
</Text>
diff --git a/apps/share/src/features/topic/SharedTopicView.tsx b/apps/share/src/features/topic/SharedTopicView.tsx
index 08115eb5cfc..7fd389bc4f1 100644
--- a/apps/share/src/features/topic/SharedTopicView.tsx
+++ b/apps/share/src/features/topic/SharedTopicView.tsx
@@ -10,8 +10,11 @@ import { CONVERSATION_MIN_WIDTH } from '@/const/layoutTokens';
import { shareKeys } from '@/libs/swr/keys';
import { lambdaClient } from '@/libs/trpc/client';
import { loadRouteWithBuiltinToolSurfaces } from '@/spa/initialize/toolSurfaces';
+import { useGlobalStore } from '@/store/global';
+import { systemStatusSelectors } from '@/store/global/selectors';
import { clientOnly } from '../../shell/clientOnly';
+import ExplainTopic from './ExplainTopic';
import TopicAvatar from './TopicAvatar';
import { buildTopicByline } from './topicByline';
@@ -21,6 +24,7 @@ const SharedTopicBody = clientOnly(() =>
const SharedTopicAside = clientOnly(() => import('./SharedTopicAside.client'));
const SharedTopicView = memo(() => {
+ const wideScreen = useGlobalStore(systemStatusSelectors.wideScreen);
const { id } = useParams<{ id: string }>();
const { data, error, isLoading } = useSWR(
@@ -29,9 +33,6 @@ const SharedTopicView = memo(() => {
{ revalidateOnFocus: false },
);
- const marketIdentifier = data?.agentMeta?.marketIdentifier;
- const openUrl = marketIdentifier ? `/community/agent/${marketIdentifier}` : '/community/agent';
-
// Mirror WideScreenContainer's centered column so the pre-hydration document
// matches the hydrated ChatList headerSlot layout instead of hugging the left.
const hero = data ? (
@@ -52,12 +53,13 @@ const SharedTopicView = memo(() => {
return (
<ShareShell
+ actions={id && data?.visibility === 'link' ? <ExplainTopic shareId={id} /> : undefined}
aside={<SharedTopicAside />}
+ contentWidth={wideScreen ? undefined : CONVERSATION_MIN_WIDTH}
error={error}
// The SSR document already carries the hero, and SWR revalidates on mount
// with that data in cache — gating on `isLoading` alone would blank it.
loading={isLoading && !data}
- share={{ avatar: data ? <TopicAvatar data={data} /> : undefined, openUrl }}
title={data?.title}
>
{id && data ? <SharedTopicBody fallback={hero} shareId={id} /> : null}
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index 21e71924824..11f6a042398 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -1619,6 +1619,10 @@
"sharePage.error.unauthorized.action": "Sign In",
"sharePage.error.unauthorized.subtitle": "Please sign in to view this shared topic.",
"sharePage.error.unauthorized.title": "Sign In Required",
+ "sharePage.explain.action": "Copy for AI",
+ "sharePage.explain.copied": "Prompt copied. Paste it into any AI chat.",
+ "sharePage.explain.failed": "Could not copy the prompt. Please try again.",
+ "sharePage.explain.prompt": "Take a look at this conversation. Briefly tell me what it is about and what is worth noticing:\n{{url}}",
"sharePage.menu.copyLink": "Copy Link",
"sharePage.menu.goToLobeHub": "Go to LobeHub",
"sharePage.menu.more": "More",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 314e8a0d498..24f301ab95c 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -1619,6 +1619,10 @@
"sharePage.error.unauthorized.action": "登录",
"sharePage.error.unauthorized.subtitle": "请登录后查看此分享话题。",
"sharePage.error.unauthorized.title": "需要登录",
+ "sharePage.explain.action": "复制给 AI",
+ "sharePage.explain.copied": "已复制,粘贴给任意 AI 即可",
+ "sharePage.explain.failed": "复制失败,请重试",
+ "sharePage.explain.prompt": "帮我看看这段对话,简单说说它在聊什么,有哪些值得注意的内容:\n{{url}}",
"sharePage.menu.copyLink": "复制链接",
"sharePage.menu.goToLobeHub": "前往 LobeHub",
"sharePage.menu.more": "更多",
diff --git a/packages/database/src/models/message.ts b/packages/database/src/models/message.ts
index 6dabb5c54b0..9a5b072bb41 100644
--- a/packages/database/src/models/message.ts
+++ b/packages/database/src/models/message.ts
@@ -266,10 +266,13 @@ export interface QueryMessagesOptions {
}
export interface TopicTranscriptMessage {
+ agentId: string | null;
content: string | null;
createdAt: Date;
+ error: ChatMessageError | null;
id: string;
messageGroupId: string | null;
+ metadata: MessageMetadata | null;
parentId: string | null;
role: string;
threadId: string | null;
@@ -1382,6 +1385,9 @@ export class MessageModel {
const [items, totalResult] = await Promise.all([
this.db
.select({
+ agentId: messages.agentId,
+ error: messages.error,
+ metadata: messages.metadata,
content: messages.content,
createdAt: messages.createdAt,
id: messages.id,
@@ -1405,6 +1411,8 @@ export class MessageModel {
return {
items: items.map(({ tools, ...message }) => ({
...message,
+ error: message.error as ChatMessageError | null,
+ metadata: message.metadata as MessageMetadata | null,
tools: Array.isArray(tools) ? (tools as ChatToolPayload[]) : null,
})),
total: totalResult[0]?.count ?? 0,
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index e7d4a49d8af..8497add9a43 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -1471,6 +1471,11 @@ export default {
'shareModal.withPluginInfo': 'Include Skill Information',
'shareModal.withRole': 'Include Message Role',
'shareModal.withSystemRole': 'Include Agent Profile',
+ 'sharePage.explain.action': 'Copy for AI',
+ 'sharePage.explain.copied': 'Prompt copied. Paste it into any AI chat.',
+ 'sharePage.explain.failed': 'Could not copy the prompt. Please try again.',
+ 'sharePage.explain.prompt':
+ 'Take a look at this conversation. Briefly tell me what it is about and what is worth noticing:\n{{url}}',
'sharePage.actions.tryItYourself': 'Try it yourself',
'sharePage.artifact.share': 'Share',
'sharePage.error.forbidden.subtitle': 'This share is private and not accessible.',
diff --git a/src/business/client/features/ShareShell/index.tsx b/src/business/client/features/ShareShell/index.tsx
index 439b5fcbf1d..a954115f8e6 100644
--- a/src/business/client/features/ShareShell/index.tsx
+++ b/src/business/client/features/ShareShell/index.tsx
@@ -17,8 +17,11 @@ export interface ShareShellShareInfo {
}
export interface ShareShellProps {
+ actions?: ReactNode;
aside?: ReactNode;
children?: ReactNode;
+ /** Centered reading-column width; enables a header that floats in its side gutters. */
+ contentWidth?: number;
error?: unknown;
loading?: boolean;
share?: ShareShellShareInfo;
@@ -47,17 +50,18 @@ export const ShareHero = ({ avatar, byline, title }: ShareHeroProps) => (
</Flexbox>
);
-export default function ShareShell({ aside, children, error, loading }: ShareShellProps) {
+export default function ShareShell({ actions, aside, children, error, loading }: ShareShellProps) {
let body = children;
if (error) body = <ShareErrorView error={error} />;
else if (loading) body = <Loading debugId="share shell" />;
return (
<Flexbox height={'100%'} width={'100%'}>
- <Flexbox horizontal align={'center'} padding={12}>
+ <Flexbox horizontal align={'center'} justify={'space-between'} padding={12}>
<Link style={{ color: 'inherit' }} to="/">
<ProductLogo size={32} />
</Link>
+ {!error && !loading && actions}
</Flexbox>
<Flexbox horizontal flex={1} style={{ overflow: 'hidden' }}>
<Flexbox flex={1} style={{ overflow: 'hidden' }}>