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.

💄 style(acceptance): widen the page and pin the discussion aside to the right edge (#21492)

Arvin Xu5dcb28ca2d45
diff --git a/src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsx b/src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsx
index aec78af582a..e93725bacfb 100644
--- a/src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsx
+++ b/src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsx
@@ -73,7 +73,7 @@ const local = createStaticStyles(({ css }) => ({
color: ${cssVar.colorTextTertiary};
`,
feed: css`
- flex: 999 1 480px;
+ flex: 1;
min-width: 0;
`,
round: css`
@@ -81,11 +81,21 @@ const local = createStaticStyles(({ css }) => ({
margin-block-start: 28px;
}
`,
+ // Measured against its own width, not the window's: the viewer also renders
+ // inside narrower hosts (portal, task detail), where the aside has to drop
+ // below the feed even on a wide screen.
+ container: css`
+ container-type: inline-size;
+ `,
layout: css`
display: flex;
- flex-wrap: wrap;
gap: 32px;
align-items: flex-start;
+
+ @container (width < 720px) {
+ flex-direction: column;
+ align-items: stretch;
+ }
`,
signInPrompt: css`
padding-block: 16px;
@@ -315,41 +325,43 @@ const AcceptanceDiscussion = memo<{ onOpenChecks?: () => void }>(({ onOpenChecks
const ungrouped = sections.length <= 1 && (sections[0]?.roundIndex ?? null) === null;
return (
- <div className={local.layout}>
- <Flexbox className={local.feed}>
- {timeline.length === 0 && (
- <span className={local.empty}>{t('acceptance.comments.empty')}</span>
- )}
- {ungrouped ? (
- <>
- {sections[0]?.entries.map((entry) => renderEntry(entry))}
- {reply}
- </>
- ) : (
- sections.map((section, index) => {
- const key = sectionKey(section);
- const open = toggled[key] ?? (index === 0 || section === anchoredSection);
- return (
- <div className={local.round} key={key}>
- <RoundSection
- open={open}
- section={section}
- onToggle={() => setToggled((state) => ({ ...state, [key]: !open }))}
- >
- {section.entries.map((entry) => renderEntry(entry))}
- </RoundSection>
- {index === 0 && reply}
- </div>
- );
- })
- )}
- </Flexbox>
- <DiscussionAside
- items={items}
- latestRound={data?.rounds.at(-1)?.run.roundIndex ?? undefined}
- status={data?.acceptance.status}
- onOpenChecks={onOpenChecks}
- />
+ <div className={local.container}>
+ <div className={local.layout}>
+ <Flexbox className={local.feed}>
+ {timeline.length === 0 && (
+ <span className={local.empty}>{t('acceptance.comments.empty')}</span>
+ )}
+ {ungrouped ? (
+ <>
+ {sections[0]?.entries.map((entry) => renderEntry(entry))}
+ {reply}
+ </>
+ ) : (
+ sections.map((section, index) => {
+ const key = sectionKey(section);
+ const open = toggled[key] ?? (index === 0 || section === anchoredSection);
+ return (
+ <div className={local.round} key={key}>
+ <RoundSection
+ open={open}
+ section={section}
+ onToggle={() => setToggled((state) => ({ ...state, [key]: !open }))}
+ >
+ {section.entries.map((entry) => renderEntry(entry))}
+ </RoundSection>
+ {index === 0 && reply}
+ </div>
+ );
+ })
+ )}
+ </Flexbox>
+ <DiscussionAside
+ items={items}
+ latestRound={data?.rounds.at(-1)?.run.roundIndex ?? undefined}
+ status={data?.acceptance.status}
+ onOpenChecks={onOpenChecks}
+ />
+ </div>
</div>
);
});
diff --git a/src/features/Acceptance/Viewer/Comments/DiscussionAside.tsx b/src/features/Acceptance/Viewer/Comments/DiscussionAside.tsx
index f3969c8c952..84384d4fa1b 100644
--- a/src/features/Acceptance/Viewer/Comments/DiscussionAside.tsx
+++ b/src/features/Acceptance/Viewer/Comments/DiscussionAside.tsx
@@ -16,18 +16,22 @@ const styles = createStaticStyles(({ css }) => ({
inset-block-start: 20px;
display: flex;
- flex: 1 1 220px;
+ flex: none;
flex-direction: column;
gap: 16px;
- max-width: 264px;
+ width: 296px;
font-size: 13px;
+ @container (width < 720px) {
+ position: static;
+ width: auto;
+ }
+
@media (width <= 767px) {
position: static;
order: -1;
- max-width: none;
}
`,
list: css`
diff --git a/src/features/Acceptance/Viewer/layout.ts b/src/features/Acceptance/Viewer/layout.ts
index 86379bbc089..a372d979ccc 100644
--- a/src/features/Acceptance/Viewer/layout.ts
+++ b/src/features/Acceptance/Viewer/layout.ts
@@ -1,5 +1,7 @@
export const acceptanceContentLayout = {
- maxWidth: 920,
+ // GitHub's PR page width: the discussion keeps a full-width feed beside a
+ // fixed aside that sits on the container's right edge.
+ maxWidth: 1280,
paddingInline: 24,
} as const;