Skip to content

Commit 2ede7db

Browse files
Merge remote-tracking branch 'origin/main' into fix/issue-29753
2 parents 4204569 + f6503f0 commit 2ede7db

4 files changed

Lines changed: 26 additions & 6 deletions

File tree

‎apps/mobile/src/components/ui/Button.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface ButtonProps {
1414
readonly loading?: boolean;
1515
readonly tone?: "primary" | "secondary" | "danger" | "text" | "contrast";
1616
readonly fullWidth?: boolean;
17+
readonly size?: "default" | "compact";
1718
}
1819

1920
const TONE_CLASS_NAMES = {
@@ -36,7 +37,8 @@ export function Button(props: ButtonProps) {
3637
disabled={disabled}
3738
onPress={props.onPress}
3839
className={cn(
39-
"min-h-12 flex-row items-center justify-center gap-2 rounded-full px-6 active:opacity-70",
40+
"flex-row items-center justify-center gap-2 rounded-full active:opacity-70",
41+
props.size === "compact" ? "min-h-10 px-5" : "min-h-12 px-6",
4042
props.fullWidth ? "w-full" : "self-start",
4143
disabled ? "bg-subtle-strong" : containerClassName,
4244
)}

‎apps/mobile/src/components/ui/Toast.tsx‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { cn } from "../../lib/cn";
12
import { MOBILE_MOTION, MOBILE_SHAPE } from "../../lib/designTokens";
23
import { useCallback, useEffect, useLayoutEffect, useState } from "react";
34
import { AccessibilityInfo, Platform, StyleSheet, View, useWindowDimensions } from "react-native";
@@ -45,15 +46,19 @@ export function Toast(props: ToastProps) {
4546
function ToastContent(props: ToastProps & { readonly glassReady?: boolean }) {
4647
const { fontScale } = useWindowDimensions();
4748
const { colorScheme } = useControlTheme();
48-
const borderRadius = Platform.OS === "ios" ? 31 : MOBILE_SHAPE.toast;
49+
const borderRadius = Platform.OS === "ios" ? 28 : MOBILE_SHAPE.toast;
4950
// Explicit single-line notices reserve the action's width and truncate the text.
5051
const inlineAction = props.singleLine || (!props.description && fontScale < 1.5);
5152
const message =
5253
props.singleLine && props.description
5354
? `${props.message}: ${props.description}`
5455
: props.message;
5556
const action = props.action ? (
56-
<Button label={props.action.label} onPress={props.action.onPress} />
57+
<Button
58+
label={props.action.label}
59+
onPress={props.action.onPress}
60+
size={Platform.OS === "ios" ? "compact" : "default"}
61+
/>
5762
) : null;
5863
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- announces the toast message to VoiceOver through AccessibilityInfo
5964
useEffect(() => {
@@ -64,10 +69,16 @@ function ToastContent(props: ToastProps & { readonly glassReady?: boolean }) {
6469
key={props.glassReady === false ? "entering" : "settled"}
6570
chrome={Platform.OS === "ios" && colorScheme === "dark" ? "none" : undefined}
6671
tintColor={Platform.OS === "ios" ? null : undefined}
67-
className={Platform.OS === "ios" ? "bg-transparent p-3" : "p-3"}
72+
className={Platform.OS === "ios" ? "bg-transparent p-2" : "p-3"}
6873
style={{ borderRadius }}
6974
>
70-
<View className="flex-row items-center gap-3">
75+
<View
76+
className={cn(
77+
"flex-row items-center gap-3",
78+
// Match the leading inset to the action label's, which sits inside the button's padding.
79+
Platform.OS === "ios" && inlineAction && action && "pl-5",
80+
)}
81+
>
7182
{props.busy ? (
7283
<AppActivityIndicator />
7384
) : (

‎apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,6 +2522,7 @@ it("keeps workspace PDF scroll and zoom after reloads", async () => {
25222522
const { preview, urls } = fixture;
25232523
await using screen = await render(preview(urls.original, "one"));
25242524
await expect.element(screen.getByText("1 / 3 pages", { exact: true })).toBeVisible();
2525+
using workers = vi.spyOn(window, "Worker");
25252526
await screen.getByRole("button", { name: "Next page", exact: true }).click();
25262527
await vi.waitFor(() => expect(screen.container.textContent).toContain("2 / 3 pages"));
25272528
await screen.getByRole("button", { name: "Next page", exact: true }).click();
@@ -2576,6 +2577,7 @@ it("keeps workspace PDF scroll and zoom after reloads", async () => {
25762577
expect(region().scrollTop).toBe(0);
25772578
expect(region().scrollLeft).toBe(0);
25782579
});
2580+
expect(workers).not.toHaveBeenCalled();
25792581
});
25802582

25812583
it("clamps workspace PDF scroll when pages shrink or disappear", async () => {

‎apps/web/src/components/files/pdfDocument.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getDocument, GlobalWorkerOptions } from "pdfjs-dist";
1+
import { getDocument, GlobalWorkerOptions, PDFWorker } from "pdfjs-dist";
22
import workerUrl from "pdfjs-dist/build/pdf.worker.min.mjs?url";
33
import fallbackUrl from "pdfjs-dist/wasm/openjpeg_nowasm_fallback.js?url";
44

@@ -31,8 +31,13 @@ export class BinaryDataFactory {
3131
}
3232
}
3333

34+
// Without a shared worker, pdf.js starts a worker and recompiles its 1.3 MB script for every document.
35+
let worker: PDFWorker | undefined;
36+
3437
export function openPdf(bytes: ArrayBuffer) {
38+
worker ??= new PDFWorker();
3539
return getDocument({
40+
worker,
3641
data: new Uint8Array(bytes),
3742
useSystemFonts: true,
3843
useWorkerFetch: false,

0 commit comments

Comments
 (0)