Skip to content

Commit 829e90b

Browse files
authored
feat(web): refine overview activity layout (#61)
1 parent 128f892 commit 829e90b

3 files changed

Lines changed: 69 additions & 7 deletions

File tree

web/src/overview-page.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,23 @@ describe("OverviewPage", () => {
3535
expect(markup).toMatch(/href="\/runs\?service=gmail"/);
3636
});
3737

38+
it("limits recent calls to seven providers", () => {
39+
const providers = Array.from({ length: 8 }, (_, index) =>
40+
provider(`service${index + 1}`, `Service ${index + 1}`, [action(`service${index + 1}.run`, true)]),
41+
);
42+
const runs = providers.map((item, index) => ({
43+
...run(`service-${index + 1}`, true),
44+
service: item.service,
45+
actionId: `${item.service}.run`,
46+
}));
47+
48+
const markup = renderOverview({ ...overviewData, providers, runs });
49+
50+
expect(markup.match(/class="overview-recent-call-row"/g) ?? []).toHaveLength(7);
51+
expect(markup).toContain("Service 7");
52+
expect(markup).not.toContain("Service 8");
53+
});
54+
3855
it("renders service call trend without service navigation links", () => {
3956
const markup = renderOverview({
4057
...overviewData,
@@ -76,6 +93,15 @@ describe("OverviewPage", () => {
7693
expect(markup).toMatch(/href="\/runs\?service=slack"/);
7794
});
7895

96+
it("renders call trend and recent calls in one overview activity row", () => {
97+
const markup = renderOverview();
98+
99+
const activityRow = markup.match(/<section class="content-grid overview-activity-grid">([\s\S]*?)<\/section>/)?.[1];
100+
101+
expect(activityRow ?? "").toContain("overview-call-trend-panel");
102+
expect(activityRow ?? "").toContain("overview-recent-calls-panel");
103+
});
104+
79105
it("does not render duplicate overview metrics", () => {
80106
const markup = renderOverview();
81107

web/src/overview-page.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface CapabilityStatusCellProps {
3232
type CapabilityStatusBadgeTone = "success" | "warning";
3333

3434
const capabilityProviderIconLimit = 4;
35-
const recentCallLimit = 4;
35+
const recentCallLimit = 7;
3636
const callTrendDayCount = 30;
3737
const callTrendServiceLimit = 4;
3838
const callTrendColors = ["var(--chart-1)", "var(--chart-3)", "var(--chart-4)", "var(--chart-5)"] as const;
@@ -114,7 +114,7 @@ export function OverviewPage(props: OverviewPageProps): ReactNode {
114114
</Card>
115115
</section>
116116

117-
<section className="content-grid overview-call-trend-section">
117+
<section className="content-grid overview-activity-grid">
118118
<Card className="list-panel overview-call-trend-panel">
119119
<div className="table-panel-heading">
120120
<h2>{t("overview.callTrend")}</h2>
@@ -184,9 +184,7 @@ export function OverviewPage(props: OverviewPageProps): ReactNode {
184184
</div>
185185
)}
186186
</Card>
187-
</section>
188187

189-
<section className="content-grid overview-recent-calls-section">
190188
<Card className="list-panel overview-recent-calls-panel">
191189
<div className="table-panel-heading">
192190
<h2>{t("overview.recentCalls")}</h2>

web/src/style.css

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,10 +755,17 @@ h3 {
755755
grid-column: 1 / -1;
756756
}
757757

758-
.overview-call-trend-panel,
759-
.overview-recent-calls-panel {
760-
grid-column: 1 / -1;
758+
.overview-activity-grid {
759+
align-items: stretch;
760+
grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr);
761+
}
762+
763+
.list-panel.overview-call-trend-panel,
764+
.list-panel.overview-recent-calls-panel {
765+
display: flex;
766+
flex-direction: column;
761767
gap: 0;
768+
max-height: none;
762769
overflow: hidden;
763770
padding: 0;
764771
}
@@ -1029,6 +1036,10 @@ h3 {
10291036

10301037
.overview-recent-call-list {
10311038
display: grid;
1039+
flex: 1;
1040+
min-height: 0;
1041+
overflow: auto;
1042+
overscroll-behavior: contain;
10321043
}
10331044

10341045
.overview-recent-call-row {
@@ -1129,6 +1140,27 @@ h3 {
11291140
color: var(--muted-foreground);
11301141
}
11311142

1143+
@media (min-width: 1121px) {
1144+
.overview-activity-grid {
1145+
height: clamp(320px, calc(100svh - 418px), 740px);
1146+
}
1147+
1148+
.overview-call-trend-panel,
1149+
.overview-recent-calls-panel,
1150+
.overview-call-trend-body {
1151+
min-height: 0;
1152+
}
1153+
1154+
.overview-call-trend-body {
1155+
flex: 1;
1156+
}
1157+
1158+
.overview-activity-grid .overview-call-trend-chart {
1159+
height: 100%;
1160+
min-height: 260px;
1161+
}
1162+
}
1163+
11321164
@media (prefers-reduced-motion: reduce) {
11331165
.overview-capability-static-icon,
11341166
.overview-capability-provider-icon,
@@ -2449,6 +2481,12 @@ tr:last-child td {
24492481
}
24502482
}
24512483

2484+
@media (max-width: 1120px) {
2485+
.overview-activity-grid {
2486+
grid-template-columns: 1fr;
2487+
}
2488+
}
2489+
24522490
@media (max-width: 960px) {
24532491
.app-shell {
24542492
display: block;

0 commit comments

Comments
 (0)