Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/engine/src/format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('formatSummaryComment', () => {
test('shows the status image from the Console when there is one', () => {
const body = formatSummaryComment({ ...base, images: 'https://cloud.appwrite.io' });
expect(body).toContain(
'| `abcdef1` | <picture><source media="(prefers-color-scheme: dark)" srcset="https://cloud.appwrite.io/images/vcs/status-ready-dark.png"><img alt="Reviewed" width="85" align="center" src="https://cloud.appwrite.io/images/vcs/status-ready-light.png"></picture> _Reviewed_ |'
'| `abcdef1` | <picture><source media="(prefers-color-scheme: dark)" srcset="https://cloud.appwrite.io/images/vcs/status-ready-dark.png"><img alt="Reviewed" width="85" align="absmiddle" src="https://cloud.appwrite.io/images/vcs/status-ready-light.png"></picture> _Reviewed_ |'
);
});

Expand Down Expand Up @@ -223,7 +223,7 @@ describe('statusCell', () => {

test('animates the running state and keeps the label', () => {
expect(statusCell('building', 'Reviewing', 'https://cloud.appwrite.io')).toBe(
'<picture><source media="(prefers-color-scheme: dark)" srcset="https://cloud.appwrite.io/images/vcs/status-building-dark.gif"><img alt="Reviewing" width="85" align="center" src="https://cloud.appwrite.io/images/vcs/status-building-light.gif"></picture> _Reviewing_'
'<picture><source media="(prefers-color-scheme: dark)" srcset="https://cloud.appwrite.io/images/vcs/status-building-dark.gif"><img alt="Reviewing" width="85" align="absmiddle" src="https://cloud.appwrite.io/images/vcs/status-building-light.gif"></picture> _Reviewing_'
);
});
});
Expand Down
6 changes: 5 additions & 1 deletion packages/engine/src/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,10 @@ export type StatusImage = 'waiting' | 'building' | 'ready' | 'failed';
* and the label in italics. `images` is the Console's origin; without it, or with no image for
* this state, the cell is the label alone, as Appwrite writes it for providers that cannot show
* images from another host.
*
* The image is `align="absmiddle"` (CSS `vertical-align: middle`), so the label sits on the
* image's centre line. Appwrite's `align="center"` maps to `-webkit-baseline-middle`, which
* puts the image's centre on the text baseline and leaves the label riding high.
*/
export function statusCell(image: StatusImage | null, label: string, images?: string): string {
const text = `_${label}_`;
Expand All @@ -497,7 +501,7 @@ export function statusCell(image: StatusImage | null, label: string, images?: st
const src = (theme: 'light' | 'dark') =>
`${images}/images/vcs/status-${image}-${theme}.${extension}`;
const alt = label.replace(/"/g, '&quot;');
return `<picture><source media="(prefers-color-scheme: dark)" srcset="${src('dark')}"><img alt="${alt}" width="85" align="center" src="${src('light')}"></picture> ${text}`;
return `<picture><source media="(prefers-color-scheme: dark)" srcset="${src('dark')}"><img alt="${alt}" width="85" align="absmiddle" src="${src('light')}"></picture> ${text}`;
}

/** A collapsible section, as Appwrite's deployment comments group Sites and Functions. */
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/src/progress.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test('the status row shows the animated image while running, and the state image
{ headSha: sha, mention: '@hansi', previous: false, images }
);
expect(running).toContain(
'<picture><source media="(prefers-color-scheme: dark)" srcset="https://cloud.appwrite.io/images/vcs/status-building-dark.gif"><img alt="Verifying 2 possible findings" width="85" align="center" src="https://cloud.appwrite.io/images/vcs/status-building-light.gif"></picture> _Verifying 2 possible findings_'
'<picture><source media="(prefers-color-scheme: dark)" srcset="https://cloud.appwrite.io/images/vcs/status-building-dark.gif"><img alt="Verifying 2 possible findings" width="85" align="absmiddle" src="https://cloud.appwrite.io/images/vcs/status-building-light.gif"></picture> _Verifying 2 possible findings_'
);
const image = (status: Parameters<typeof statusBlock>[0]) =>
statusBlock(status, { headSha: sha, mention: '@hansi', previous: true, images }).match(
Expand Down