Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a8c67086e | ||
|
|
a84b375f5d | ||
|
|
52358c5bf9 | ||
|
|
c1e68c27c5 | ||
|
|
d4edff9059 | ||
|
|
80febc9993 | ||
|
|
c500c2fae7 | ||
|
|
bc87093588 | ||
|
|
a8bd5e61f3 | ||
|
|
f981986681 | ||
|
|
982991689e | ||
|
|
baa00ba186 | ||
|
|
0456434040 | ||
|
|
285a96c342 | ||
|
|
08c326d745 | ||
|
|
4100e63afe | ||
|
|
6a27923af1 | ||
|
|
8549176f4a | ||
|
|
1f511635cf | ||
|
|
058e7bd509 | ||
|
|
1ed61c7d9d | ||
|
|
3f5717b5ad | ||
|
|
3b9113b9a6 | ||
|
|
6dc446a39e | ||
|
|
c24370c28a | ||
|
|
2a82c9ae19 | ||
|
|
b70c7b41e3 |
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ignoredFiles": [
|
||||
"frontend/editor/src-tauri/icons/icon.png"
|
||||
]
|
||||
}
|
||||
+18
-1
@@ -144,8 +144,10 @@ public class TempFileCleanupService {
|
||||
int directoriesDeletedCount = 0;
|
||||
for (Path directory : registry.getTempDirectories()) {
|
||||
try {
|
||||
if (Files.exists(directory)) {
|
||||
if (Files.exists(directory)
|
||||
&& shouldDeleteRegisteredDirectory(directory, maxAgeMillis)) {
|
||||
GeneralUtils.deleteDirectory(directory);
|
||||
registry.unregisterDirectory(directory);
|
||||
directoriesDeletedCount++;
|
||||
log.debug("Cleaned up temporary directory: {}", directory);
|
||||
}
|
||||
@@ -275,6 +277,21 @@ public class TempFileCleanupService {
|
||||
return totalDeletedCount.get();
|
||||
}
|
||||
|
||||
private boolean shouldDeleteRegisteredDirectory(Path directory, long maxAgeMillis) {
|
||||
if (maxAgeMillis <= 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
long lastModified = Files.getLastModifiedTime(directory).toMillis();
|
||||
return (currentTime - lastModified) > maxAgeMillis;
|
||||
} catch (IOException e) {
|
||||
log.debug("Could not check directory age, skipping cleanup: {}", directory, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the system temp directory path based on configuration or system property. */
|
||||
private Path getSystemTempPath() {
|
||||
String systemTempDir =
|
||||
|
||||
@@ -155,6 +155,7 @@ public class TempFileManager {
|
||||
if (directory != null && Files.isDirectory(directory)) {
|
||||
try {
|
||||
GeneralUtils.deleteDirectory(directory);
|
||||
registry.unregisterDirectory(directory);
|
||||
log.debug("Deleted temp directory: {}", directory.toString());
|
||||
} catch (IOException e) {
|
||||
log.warn("Failed to delete temp directory: {}", directory.toString(), e);
|
||||
|
||||
@@ -85,6 +85,18 @@ public class TempFileRegistry {
|
||||
return directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister a temporary directory from the registry.
|
||||
*
|
||||
* @param directory The directory to unregister
|
||||
*/
|
||||
public void unregisterDirectory(Path directory) {
|
||||
if (directory != null) {
|
||||
tempDirectories.remove(directory);
|
||||
log.debug("Unregistered temp directory: {}", directory.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a third-party temporary file that requires special handling.
|
||||
*
|
||||
|
||||
+19
-1
@@ -176,11 +176,13 @@ class TempFileCleanupServiceMoreTest {
|
||||
class ScheduledCleanup {
|
||||
|
||||
@Test
|
||||
@DisplayName("deletes registered temp directories and reports counts")
|
||||
@DisplayName("deletes stale registered temp directories and reports counts")
|
||||
void deletesRegisteredDirectories() throws IOException {
|
||||
when(tempFileManager.cleanupOldTempFiles(anyLong())).thenReturn(2);
|
||||
Path regDir = Files.createDirectories(tempDir.resolve("registeredDir"));
|
||||
Files.createFile(regDir.resolve("inside.txt"));
|
||||
Files.setLastModifiedTime(
|
||||
regDir, FileTime.fromMillis(System.currentTimeMillis() - 2L * 60 * 60 * 1000));
|
||||
Set<Path> dirs = new HashSet<>();
|
||||
dirs.add(regDir);
|
||||
when(registry.getTempDirectories()).thenReturn(dirs);
|
||||
@@ -193,6 +195,22 @@ class TempFileCleanupServiceMoreTest {
|
||||
verify(tempFileManager).cleanupOldTempFiles(anyLong());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("keeps a fresh registered temp directory")
|
||||
void keepsFreshRegisteredDirectory() throws IOException {
|
||||
when(tempFileManager.cleanupOldTempFiles(anyLong())).thenReturn(0);
|
||||
Path regDir = Files.createDirectories(tempDir.resolve("freshRegisteredDir"));
|
||||
Files.createFile(regDir.resolve("inside.txt"));
|
||||
Set<Path> dirs = new HashSet<>();
|
||||
dirs.add(regDir);
|
||||
when(registry.getTempDirectories()).thenReturn(dirs);
|
||||
lenient().when(registry.contains(any(File.class))).thenReturn(false);
|
||||
|
||||
withIsolatedUserHome(cleanupService::scheduledCleanup);
|
||||
|
||||
assertThat(Files.exists(regDir)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("skips a registered directory that no longer exists")
|
||||
void skipsMissingRegisteredDirectory() {
|
||||
|
||||
@@ -356,6 +356,7 @@ text = "Diese Berechtigungen kontrollieren, was Benutzer mit der PDF machen kön
|
||||
title = "Berechtigungen ändern"
|
||||
|
||||
[addStamp]
|
||||
preview = "Stempelvorschau"
|
||||
tags = "stamp,mark,seal,approved,rejected,confidential,stamp tool,rubber stamp,date stamp,approval stamp,received,void,copy,original"
|
||||
|
||||
[AddStampRequest]
|
||||
@@ -1842,6 +1843,15 @@ export = "Export"
|
||||
accessDenied = "Zugriff verweigert"
|
||||
insufficientPermissions = "Sie haben keine Berechtigung, diese Aktion auszuführen."
|
||||
|
||||
[auth.callback]
|
||||
completing = "Authentifizierung wird abgeschlossen"
|
||||
invalidToken = "OAuth-Anmeldung fehlgeschlagen – ungültiges Token."
|
||||
missingToken = "OAuth-Anmeldung fehlgeschlagen – kein Token empfangen."
|
||||
oauthFailed = "OAuth-Anmeldung fehlgeschlagen. Bitte versuchen Sie es erneut."
|
||||
pleaseWait = "Bitte warten Sie, während wir Ihre Anmeldung abschließen."
|
||||
signedOut = "Sie wurden abgemeldet. Bitte melden Sie sich erneut an."
|
||||
windowMayClose = "Sie können dieses Fenster schließen, sobald der Vorgang abgeschlossen ist."
|
||||
|
||||
[auth.displayName]
|
||||
guest = "Gast"
|
||||
user = "Benutzer"
|
||||
@@ -2824,6 +2834,7 @@ next = "Weiter"
|
||||
preview = "Vorschau"
|
||||
previous = "Zurück"
|
||||
refresh = "Aktualisieren"
|
||||
remaining = "Verbleibend"
|
||||
retry = "Wiederholen"
|
||||
save = "Save"
|
||||
|
||||
@@ -4072,10 +4083,17 @@ discord = "Discord"
|
||||
issues = "GitHub"
|
||||
|
||||
[formFill]
|
||||
allSaved = "Alles gespeichert"
|
||||
extractCsvError = "CSV konnte nicht extrahiert werden"
|
||||
extractXlsxError = "XLSX konnte nicht extrahiert werden"
|
||||
flattenAfterFilling = "Nach dem Ausfüllen ebnen"
|
||||
requiredAbbreviation = "erf."
|
||||
requiredFieldsError = "Bitte füllen Sie alle Pflichtfelder aus"
|
||||
rescanFields = "Felder erneut scannen"
|
||||
rescanFormFields = "Formularfelder erneut scannen"
|
||||
save = "Speichern"
|
||||
saveShortcut = "Strg+S zum Speichern"
|
||||
unsavedChanges = "Nicht gespeicherte Änderungen"
|
||||
|
||||
[formFill.sidebar]
|
||||
close = "Seitenleiste schließen"
|
||||
@@ -4996,7 +5014,21 @@ titleWithOs = "Herunterladen für {{osLabel}}"
|
||||
|
||||
[onboarding.mfa]
|
||||
authenticationCode = "Authentifizierungscode"
|
||||
description = "Schützen Sie Ihr Konto, indem Sie eine Authenticator-App verknüpfen. Scannen Sie den QR-Code oder geben Sie den Einrichtungsschlüssel ein und bestätigen Sie anschließend den sechsstelligen Code."
|
||||
enable = "MFA aktivieren"
|
||||
enableError = "Die Multi-Faktor-Authentifizierung konnte nicht aktiviert werden. Prüfen Sie den Code und versuchen Sie es erneut."
|
||||
enterCode = "Geben Sie den sechsstelligen Code aus Ihrer App ein."
|
||||
enterCodeError = "Geben Sie den Authentifizierungscode ein, um fortzufahren."
|
||||
logout = "Abmelden"
|
||||
openAuthenticator = "Öffnen Sie Google Authenticator, Authy oder 1Password."
|
||||
qrCodeLoading = "Ihr QR-Code wird erstellt…"
|
||||
regenerateQrCode = "QR-Code neu erstellen"
|
||||
scanQrCode = "Scannen Sie den QR-Code oder geben Sie den unten stehenden Einrichtungsschlüssel ein."
|
||||
setupError = "Die Einrichtung der Zwei-Faktor-Authentifizierung konnte nicht gestartet werden. Bitte versuchen Sie es erneut."
|
||||
setupKey = "Einrichtungsschlüssel (manuelle Eingabe)"
|
||||
stepByStep = "Schritt für Schritt"
|
||||
success = "MFA wurde aktiviert. Sie können jetzt fortfahren."
|
||||
title = "Einrichtung der Multi-Faktor-Authentifizierung"
|
||||
|
||||
[onboarding.planOverview]
|
||||
adminBodyLoginDisabled = "Sobald Sie den Login-Modus aktivieren, können Sie Nutzer verwalten, Einstellungen konfigurieren und die Servergesundheit überwachen. Die ersten <strong>{{freeTierLimit}}</strong> Personen auf Ihrem Server nutzen Stirling kostenlos."
|
||||
@@ -9110,6 +9142,11 @@ security = "Sicherheit"
|
||||
telegram = "Telegram"
|
||||
title = "Sicherheit & Authentifizierung"
|
||||
|
||||
[settings.signOut]
|
||||
confirm = "Möchten Sie sich wirklich abmelden?"
|
||||
submit = "Abmelden"
|
||||
title = "Abmelden"
|
||||
|
||||
[settings.team]
|
||||
title = "Team"
|
||||
|
||||
@@ -9726,6 +9763,9 @@ uploadButton = "Auf Server hochladen"
|
||||
title = "Stirling-PDF Survey"
|
||||
|
||||
[swagger]
|
||||
clickHere = "hier klicken"
|
||||
fallback = "Falls die Seite nicht automatisch geöffnet wurde,"
|
||||
opening = "Swagger UI wird in einem neuen Tab geöffnet..."
|
||||
tags = "API,Dokumentation,Swagger,Endpunkte,Entwicklung"
|
||||
title = "API-Dokumentation"
|
||||
|
||||
@@ -10281,9 +10321,11 @@ title = "Attachments"
|
||||
|
||||
[viewer.bookmarks]
|
||||
bookmarkTitle = "Lesezeichentitel"
|
||||
bookmarkTitleRequired = "Ein Lesezeichentitel ist erforderlich"
|
||||
closeSidebar = "Seitenleiste für Lesezeichen schließen"
|
||||
collapseAll = "Alle Lesezeichen einklappen"
|
||||
expandAll = "Alle Lesezeichen ausklappen"
|
||||
searchPlaceholder = "Lesezeichen durchsuchen"
|
||||
|
||||
[viewer.comments]
|
||||
addComment = "Kommentar hinzufügen"
|
||||
|
||||
@@ -230,6 +230,8 @@ title = "How to add images"
|
||||
move = "Move Image"
|
||||
pause = "Pause placement"
|
||||
place = "Place Image"
|
||||
placeMultiple = "Stay in placement mode after each placement"
|
||||
placeMultipleDesc = "Place several images in a row instead of exiting after the first."
|
||||
resume = "Resume placement"
|
||||
|
||||
[addImage.results]
|
||||
@@ -445,6 +447,8 @@ title = "How to add text"
|
||||
move = "Move Text"
|
||||
pause = "Pause placement"
|
||||
place = "Place Text"
|
||||
placeMultiple = "Stay in placement mode after each placement"
|
||||
placeMultipleDesc = "Place several text stamps in a row instead of exiting after the first."
|
||||
resume = "Resume placement"
|
||||
|
||||
[addText.results]
|
||||
@@ -9280,6 +9284,8 @@ title = "How to add signature"
|
||||
move = "Move Signature"
|
||||
pause = "Pause placement"
|
||||
place = "Place Signature"
|
||||
placeMultiple = "Stay in placement mode after each placement"
|
||||
placeMultipleDesc = "Place several signatures in a row instead of exiting after the first."
|
||||
resume = "Resume placement"
|
||||
|
||||
[sign.results]
|
||||
|
||||
@@ -356,6 +356,7 @@ text = "These permissions control what users can do with the PDF. Most effective
|
||||
title = "Change Permissions"
|
||||
|
||||
[addStamp]
|
||||
preview = "Preview Stamp"
|
||||
tags = "stamp,mark,seal,approved,rejected,confidential,stamp tool,rubber stamp,date stamp,approval stamp,received,void,copy,original"
|
||||
|
||||
[AddStampRequest]
|
||||
@@ -1842,6 +1843,15 @@ export = "Export"
|
||||
accessDenied = "Access Denied"
|
||||
insufficientPermissions = "You do not have permission to perform this action."
|
||||
|
||||
[auth.callback]
|
||||
completing = "Completing authentication"
|
||||
invalidToken = "OAuth login failed - invalid token."
|
||||
missingToken = "OAuth login failed - no token received."
|
||||
oauthFailed = "OAuth login failed. Please try again."
|
||||
pleaseWait = "Please wait while we finish signing you in."
|
||||
signedOut = "You have been signed out. Please sign in again."
|
||||
windowMayClose = "You can close this window once it completes."
|
||||
|
||||
[auth.displayName]
|
||||
guest = "Guest"
|
||||
user = "User"
|
||||
@@ -2824,6 +2834,7 @@ next = "Next"
|
||||
preview = "Preview"
|
||||
previous = "Previous"
|
||||
refresh = "Refresh"
|
||||
remaining = "Remaining"
|
||||
retry = "Retry"
|
||||
save = "Save"
|
||||
|
||||
@@ -4072,10 +4083,17 @@ discord = "Discord"
|
||||
issues = "GitHub"
|
||||
|
||||
[formFill]
|
||||
allSaved = "All saved"
|
||||
extractCsvError = "Failed to extract CSV"
|
||||
extractXlsxError = "Failed to extract XLSX"
|
||||
flattenAfterFilling = "Flatten after filling"
|
||||
requiredAbbreviation = "req"
|
||||
requiredFieldsError = "Please fill in all required fields"
|
||||
rescanFields = "Re-scan fields"
|
||||
rescanFormFields = "Re-scan form fields"
|
||||
save = "Save"
|
||||
saveShortcut = "Ctrl+S to save"
|
||||
unsavedChanges = "Unsaved changes"
|
||||
|
||||
[formFill.sidebar]
|
||||
close = "Close sidebar"
|
||||
@@ -5016,7 +5034,21 @@ titleWithOs = "Download for {{osLabel}}"
|
||||
|
||||
[onboarding.mfa]
|
||||
authenticationCode = "Authentication code"
|
||||
description = "Secure your account by linking an authenticator app. Scan the QR code or enter the setup key, then confirm the 6-digit code to finish."
|
||||
enable = "Enable MFA"
|
||||
enableError = "Unable to enable two-factor authentication. Check the code and try again."
|
||||
enterCode = "Enter the 6-digit code from your app."
|
||||
enterCodeError = "Enter the authentication code to continue."
|
||||
logout = "Logout"
|
||||
openAuthenticator = "Open Google Authenticator, Authy, or 1Password."
|
||||
qrCodeLoading = "Generating your QR code…"
|
||||
regenerateQrCode = "Regenerate QR code"
|
||||
scanQrCode = "Scan the QR code or enter the setup key below."
|
||||
setupError = "Unable to start two-factor setup. Please try again."
|
||||
setupKey = "Setup key (manual entry)"
|
||||
stepByStep = "Step-by-step"
|
||||
success = "MFA has been enabled. You can now continue."
|
||||
title = "Multi-Factor Authentication Setup"
|
||||
|
||||
[onboarding.planOverview]
|
||||
adminBodyLoginDisabled = "Once you enable login mode, you can manage users, configure settings, and monitor server health. The first <strong>{{freeTierLimit}}</strong> people on your server get to use Stirling free of charge."
|
||||
@@ -9178,6 +9210,11 @@ security = "Security"
|
||||
telegram = "Telegram"
|
||||
title = "Security & Authentication"
|
||||
|
||||
[settings.signOut]
|
||||
confirm = "Are you sure you want to sign out?"
|
||||
submit = "Sign out"
|
||||
title = "Sign out"
|
||||
|
||||
[settings.team]
|
||||
title = "Team"
|
||||
|
||||
@@ -9794,6 +9831,9 @@ uploadButton = "Upload to Server"
|
||||
title = "Stirling-PDF Survey"
|
||||
|
||||
[swagger]
|
||||
clickHere = "click here"
|
||||
fallback = "If it didn't open automatically,"
|
||||
opening = "Opening Swagger UI in a new tab..."
|
||||
tags = "api,documentation,swagger,endpoints,development"
|
||||
title = "API Documentation"
|
||||
|
||||
@@ -10362,9 +10402,11 @@ title = "Attachments"
|
||||
|
||||
[viewer.bookmarks]
|
||||
bookmarkTitle = "Bookmark title"
|
||||
bookmarkTitleRequired = "Bookmark title is required"
|
||||
closeSidebar = "Close bookmarks sidebar"
|
||||
collapseAll = "Collapse all bookmarks"
|
||||
expandAll = "Expand all bookmarks"
|
||||
searchPlaceholder = "Search bookmarks"
|
||||
|
||||
[viewer.comments]
|
||||
addComment = "Add comment"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 19 KiB |
@@ -26,6 +26,7 @@ import LocalIcon from "@app/components/shared/LocalIcon";
|
||||
import { BASE_PATH, withBasePath } from "@app/constants/app";
|
||||
import styles from "@app/components/onboarding/InitialOnboardingModal/InitialOnboardingModal.module.css";
|
||||
import { MfaSetupResponse } from "@app/responses/Mfa/MfaResponse";
|
||||
import i18n from "@app/i18n";
|
||||
|
||||
interface MFASetupSlideProps {
|
||||
onMfaSetupComplete?: () => void;
|
||||
@@ -62,12 +63,15 @@ function MFASetupContent({ onMfaSetupComplete }: MFASetupSlideProps) {
|
||||
const axiosError = err as { response?: { data?: { error?: string } } };
|
||||
setMfaError(
|
||||
axiosError.response?.data?.error ||
|
||||
"Unable to start two-factor setup. Please try again.",
|
||||
t(
|
||||
"onboarding.mfa.setupError",
|
||||
"Unable to start two-factor setup. Please try again.",
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
setMfaLoading(false);
|
||||
}
|
||||
}, []);
|
||||
}, [t]);
|
||||
|
||||
useEffect(() => {
|
||||
setupCompleteRef.current = setupComplete;
|
||||
@@ -96,7 +100,12 @@ function MFASetupContent({ onMfaSetupComplete }: MFASetupSlideProps) {
|
||||
event.preventDefault();
|
||||
|
||||
if (!mfaSetupCode.trim()) {
|
||||
setMfaError("Enter the authentication code to continue.");
|
||||
setMfaError(
|
||||
t(
|
||||
"onboarding.mfa.enterCodeError",
|
||||
"Enter the authentication code to continue.",
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -110,13 +119,16 @@ function MFASetupContent({ onMfaSetupComplete }: MFASetupSlideProps) {
|
||||
const axiosError = err as { response?: { data?: { error?: string } } };
|
||||
setMfaError(
|
||||
axiosError.response?.data?.error ||
|
||||
"Unable to enable two-factor authentication. Check the code and try again.",
|
||||
t(
|
||||
"onboarding.mfa.enableError",
|
||||
"Unable to enable two-factor authentication. Check the code and try again.",
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
}
|
||||
},
|
||||
[mfaSetupCode, onMfaSetupComplete],
|
||||
[mfaSetupCode, onMfaSetupComplete, t],
|
||||
);
|
||||
|
||||
const isReady = Boolean(mfaSetupData);
|
||||
@@ -138,15 +150,30 @@ function MFASetupContent({ onMfaSetupComplete }: MFASetupSlideProps) {
|
||||
|
||||
<Stack gap="xs">
|
||||
<Text size="sm" fw={600}>
|
||||
Step-by-step
|
||||
{t("onboarding.mfa.stepByStep", "Step-by-step")}
|
||||
</Text>
|
||||
<ol className={styles.mfaSteps}>
|
||||
<li>Open Google Authenticator, Authy, or 1Password.</li>
|
||||
<li>Scan the QR code or enter the setup key below.</li>
|
||||
<li>Enter the 6-digit code from your app.</li>
|
||||
<li>
|
||||
{t(
|
||||
"onboarding.mfa.openAuthenticator",
|
||||
"Open Google Authenticator, Authy, or 1Password.",
|
||||
)}
|
||||
</li>
|
||||
<li>
|
||||
{t(
|
||||
"onboarding.mfa.scanQrCode",
|
||||
"Scan the QR code or enter the setup key below.",
|
||||
)}
|
||||
</li>
|
||||
<li>
|
||||
{t(
|
||||
"onboarding.mfa.enterCode",
|
||||
"Enter the 6-digit code from your app.",
|
||||
)}
|
||||
</li>
|
||||
</ol>
|
||||
<Text size="xs" c="dimmed">
|
||||
Setup key (manual entry)
|
||||
{t("onboarding.mfa.setupKey", "Setup key (manual entry)")}
|
||||
</Text>
|
||||
<TextInput
|
||||
value={mfaSetupData.secret ?? ""}
|
||||
@@ -163,9 +190,10 @@ function MFASetupContent({ onMfaSetupComplete }: MFASetupSlideProps) {
|
||||
<div className={styles.mfaCard}>
|
||||
<Stack gap="md">
|
||||
<Text size="sm" c="dimmed">
|
||||
Secure your account by linking an authenticator app. Scan the QR
|
||||
code or enter the setup key, then confirm the 6-digit code to
|
||||
finish.
|
||||
{t(
|
||||
"onboarding.mfa.description",
|
||||
"Secure your account by linking an authenticator app. Scan the QR code or enter the setup key, then confirm the 6-digit code to finish.",
|
||||
)}
|
||||
</Text>
|
||||
|
||||
{mfaError && (
|
||||
@@ -215,7 +243,7 @@ function MFASetupContent({ onMfaSetupComplete }: MFASetupSlideProps) {
|
||||
onClick={fetchMfaSetup}
|
||||
disabled={mfaLoading || submitting || setupComplete}
|
||||
>
|
||||
Regenerate QR code
|
||||
{t("onboarding.mfa.regenerateQrCode", "Regenerate QR code")}
|
||||
</Button>
|
||||
<Button
|
||||
type="submit"
|
||||
@@ -224,16 +252,19 @@ function MFASetupContent({ onMfaSetupComplete }: MFASetupSlideProps) {
|
||||
!isReady || setupComplete || mfaSetupCode.length < 6
|
||||
}
|
||||
>
|
||||
Enable MFA
|
||||
{t("onboarding.mfa.enable", "Enable MFA")}
|
||||
</Button>
|
||||
<Button variant="secondary" type="button" onClick={onLogout}>
|
||||
Logout
|
||||
{t("onboarding.mfa.logout", "Logout")}
|
||||
</Button>
|
||||
</Group>
|
||||
|
||||
{setupComplete && (
|
||||
<Alert color="green" variant="light">
|
||||
MFA has been enabled. You can now continue.
|
||||
{t(
|
||||
"onboarding.mfa.success",
|
||||
"MFA has been enabled. You can now continue.",
|
||||
)}
|
||||
</Alert>
|
||||
)}
|
||||
</Stack>
|
||||
@@ -249,7 +280,7 @@ export default function MFASetupSlide({
|
||||
}: MFASetupSlideProps = {}): SlideConfig {
|
||||
return {
|
||||
key: "mfa-setup-slide",
|
||||
title: "Multi-Factor Authentication Setup",
|
||||
title: i18n.t("onboarding.mfa.title", "Multi-Factor Authentication Setup"),
|
||||
body: <MFASetupContent onMfaSetupComplete={onMfaSetupComplete} />,
|
||||
background: {
|
||||
gradientStops: ["#059669", "#0891B2"], // Green to teal - security/trust colors
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
import styles from "@app/components/tools/addStamp/StampPreview.module.css";
|
||||
import { PrivateContent } from "@app/components/shared/PrivateContent";
|
||||
import { Button } from "@app/ui/Button";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
type Props = {
|
||||
parameters: AddStampParameters;
|
||||
@@ -29,6 +30,7 @@ export default function StampPreview({
|
||||
file,
|
||||
showQuickGrid,
|
||||
}: Props) {
|
||||
const { t } = useTranslation();
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const [containerSize, setContainerSize] = useState<{
|
||||
width: number;
|
||||
@@ -366,7 +368,9 @@ export default function StampPreview({
|
||||
<div>
|
||||
<div className={styles.previewHeader}>
|
||||
<div className={styles.divider} />
|
||||
<div className={styles.previewLabel}>Preview Stamp</div>
|
||||
<div className={styles.previewLabel}>
|
||||
{t("addStamp.preview", "Preview Stamp")}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
ref={containerRef}
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
Tooltip,
|
||||
Group,
|
||||
Box,
|
||||
Checkbox,
|
||||
} from "@mantine/core";
|
||||
import { Button } from "@app/ui/Button";
|
||||
import { SegmentedControl } from "@app/ui/SegmentedControl";
|
||||
@@ -34,6 +35,7 @@ import {
|
||||
AddSignatureResult,
|
||||
} from "@app/hooks/tools/sign/useSavedSignatures";
|
||||
import { SavedSignaturesSection } from "@app/components/tools/sign/SavedSignaturesSection";
|
||||
import { shouldPausePlacementAfterExit } from "@app/components/tools/sign/placementMode";
|
||||
import { buildSignaturePreview } from "@app/utils/signaturePreview";
|
||||
|
||||
type SignatureDrafts = {
|
||||
@@ -90,7 +92,13 @@ const SignSettings = ({
|
||||
defaultSignatureSource,
|
||||
}: SignSettingsProps) => {
|
||||
const { t } = useTranslation();
|
||||
const { isPlacementMode, signaturesApplied, historyApiRef } = useSignature();
|
||||
const {
|
||||
isPlacementMode,
|
||||
signaturesApplied,
|
||||
historyApiRef,
|
||||
placeMultiple,
|
||||
setPlaceMultiple,
|
||||
} = useSignature();
|
||||
const { activeFileIndex } = useViewer();
|
||||
const [historyAvailability, setHistoryAvailability] = useState({
|
||||
canUndo: false,
|
||||
@@ -821,6 +829,34 @@ const SignSettings = ({
|
||||
onParameterChange,
|
||||
]);
|
||||
|
||||
// After a single placement (when "place multiple" is off) the
|
||||
// SignatureAPIBridge drops out of placement mode. Without pausing here, the
|
||||
// auto-activate effect below would immediately pull the user back into
|
||||
// placement mode - so single placement would never stick and the "place
|
||||
// multiple" checkbox would appear to do nothing.
|
||||
const wasPlacementModeRef = useRef(isPlacementMode);
|
||||
useEffect(() => {
|
||||
const shouldPause = shouldPausePlacementAfterExit({
|
||||
wasInPlacementMode: wasPlacementModeRef.current,
|
||||
isInPlacementMode: isPlacementMode,
|
||||
placeMultiple,
|
||||
signaturesApplied,
|
||||
placementEnabled: shouldEnablePlacement,
|
||||
alreadyPaused: isPlacementManuallyPaused,
|
||||
});
|
||||
wasPlacementModeRef.current = isPlacementMode;
|
||||
|
||||
if (shouldPause) {
|
||||
setPlacementManuallyPaused(true);
|
||||
}
|
||||
}, [
|
||||
isPlacementMode,
|
||||
placeMultiple,
|
||||
signaturesApplied,
|
||||
shouldEnablePlacement,
|
||||
isPlacementManuallyPaused,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!shouldEnablePlacement) {
|
||||
if (isPlacementMode) {
|
||||
@@ -1197,6 +1233,20 @@ const SignSettings = ({
|
||||
<Box style={{ marginLeft: "auto" }}>{placementToggleControl}</Box>
|
||||
</Group>
|
||||
|
||||
<Checkbox
|
||||
checked={placeMultiple}
|
||||
onChange={(event) => setPlaceMultiple(event.currentTarget.checked)}
|
||||
label={translate(
|
||||
"mode.placeMultiple",
|
||||
"Stay in placement mode after each placement",
|
||||
)}
|
||||
description={translate(
|
||||
"mode.placeMultipleDesc",
|
||||
"Place several stamps in a row instead of exiting after the first.",
|
||||
)}
|
||||
disabled={disabled}
|
||||
/>
|
||||
|
||||
<Alert color={placementAlert.color} title={placementAlert.title}>
|
||||
<Text size="sm">{placementAlert.message}</Text>
|
||||
</Alert>
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { shouldPausePlacementAfterExit } from "@app/components/tools/sign/placementMode";
|
||||
|
||||
const baseParams = {
|
||||
wasInPlacementMode: true,
|
||||
isInPlacementMode: false,
|
||||
placeMultiple: false,
|
||||
signaturesApplied: false,
|
||||
placementEnabled: true,
|
||||
alreadyPaused: false,
|
||||
};
|
||||
|
||||
describe("shouldPausePlacementAfterExit", () => {
|
||||
it("pauses after a single placement exits placement mode", () => {
|
||||
expect(shouldPausePlacementAfterExit(baseParams)).toBe(true);
|
||||
});
|
||||
|
||||
it("does not pause while still in placement mode", () => {
|
||||
expect(
|
||||
shouldPausePlacementAfterExit({
|
||||
...baseParams,
|
||||
isInPlacementMode: true,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("does not pause when placement mode was never active", () => {
|
||||
expect(
|
||||
shouldPausePlacementAfterExit({
|
||||
...baseParams,
|
||||
wasInPlacementMode: false,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("does not pause when 'place multiple' is enabled", () => {
|
||||
expect(
|
||||
shouldPausePlacementAfterExit({
|
||||
...baseParams,
|
||||
placeMultiple: true,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("does not pause once signatures have been applied", () => {
|
||||
expect(
|
||||
shouldPausePlacementAfterExit({
|
||||
...baseParams,
|
||||
signaturesApplied: true,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("does not pause when placement is disabled", () => {
|
||||
expect(
|
||||
shouldPausePlacementAfterExit({
|
||||
...baseParams,
|
||||
placementEnabled: false,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("does not re-pause when already paused", () => {
|
||||
expect(
|
||||
shouldPausePlacementAfterExit({
|
||||
...baseParams,
|
||||
alreadyPaused: true,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
interface PausePlacementParams {
|
||||
/** Whether placement mode was active on the previous render. */
|
||||
wasInPlacementMode: boolean;
|
||||
/** Whether placement mode is active now. */
|
||||
isInPlacementMode: boolean;
|
||||
/** User opted into dropping several stamps in a row. */
|
||||
placeMultiple: boolean;
|
||||
/** True once placed signatures have been flattened/applied to the document. */
|
||||
signaturesApplied: boolean;
|
||||
/** Whether a signature is configured and placement is allowed. */
|
||||
placementEnabled: boolean;
|
||||
/** Whether placement is already manually paused. */
|
||||
alreadyPaused: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether placement should be paused after the viewer auto-exits placement mode.
|
||||
*
|
||||
* The SignatureAPIBridge drops out of placement mode after a single stamp is
|
||||
* placed (unless "place multiple" is on). Without pausing, SignSettings' own
|
||||
* auto-activate effect would immediately re-enter placement mode, so single
|
||||
* placement would never stick and the "place multiple" checkbox would appear to
|
||||
* do nothing. We only react to the placement-mode exit (the bridge already
|
||||
* limits auto-exit to stamp placements, never mid-signature ink strokes).
|
||||
*/
|
||||
export function shouldPausePlacementAfterExit(
|
||||
params: PausePlacementParams,
|
||||
): boolean {
|
||||
const justExitedPlacement =
|
||||
params.wasInPlacementMode && !params.isInPlacementMode;
|
||||
|
||||
return (
|
||||
justExitedPlacement &&
|
||||
!params.placeMultiple &&
|
||||
!params.signaturesApplied &&
|
||||
params.placementEnabled &&
|
||||
!params.alreadyPaused
|
||||
);
|
||||
}
|
||||
@@ -328,7 +328,12 @@ export const BookmarkSidebar = ({
|
||||
const handleSubmitAddBookmark = useCallback(async () => {
|
||||
const title = newBookmarkTitle.trim();
|
||||
if (!title) {
|
||||
setAddBookmarkError("Bookmark title is required");
|
||||
setAddBookmarkError(
|
||||
t(
|
||||
"viewer.bookmarks.bookmarkTitleRequired",
|
||||
"Bookmark title is required",
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
// Resolve the file the viewer is currently displaying. activeFileId
|
||||
@@ -695,7 +700,10 @@ export const BookmarkSidebar = ({
|
||||
"viewer.bookmarks.expandAll",
|
||||
"Expand all bookmarks",
|
||||
)}
|
||||
title="Expand all"
|
||||
title={t(
|
||||
"viewer.bookmarks.expandAll",
|
||||
"Expand all bookmarks",
|
||||
)}
|
||||
>
|
||||
<LocalIcon
|
||||
icon="unfold-more"
|
||||
@@ -712,7 +720,10 @@ export const BookmarkSidebar = ({
|
||||
"viewer.bookmarks.collapseAll",
|
||||
"Collapse all bookmarks",
|
||||
)}
|
||||
title="Collapse all"
|
||||
title={t(
|
||||
"viewer.bookmarks.collapseAll",
|
||||
"Collapse all bookmarks",
|
||||
)}
|
||||
>
|
||||
<LocalIcon
|
||||
icon="unfold-less"
|
||||
@@ -732,7 +743,10 @@ export const BookmarkSidebar = ({
|
||||
"viewer.bookmarks.closeSidebar",
|
||||
"Close bookmarks sidebar",
|
||||
)}
|
||||
title="Close bookmarks"
|
||||
title={t(
|
||||
"viewer.bookmarks.closeSidebar",
|
||||
"Close bookmarks sidebar",
|
||||
)}
|
||||
>
|
||||
<LocalIcon icon="close-rounded" width="1.1rem" height="1.1rem" />
|
||||
</ActionIcon>
|
||||
@@ -746,7 +760,10 @@ export const BookmarkSidebar = ({
|
||||
>
|
||||
<TextInput
|
||||
value={searchTerm}
|
||||
placeholder="Search bookmarks"
|
||||
placeholder={t(
|
||||
"viewer.bookmarks.searchPlaceholder",
|
||||
"Search bookmarks",
|
||||
)}
|
||||
onChange={(event) => setSearchTerm(event.currentTarget.value)}
|
||||
leftSection={
|
||||
<LocalIcon icon="search" width="1.1rem" height="1.1rem" />
|
||||
@@ -839,7 +856,10 @@ export const BookmarkSidebar = ({
|
||||
</Text>
|
||||
<TextInput
|
||||
size="xs"
|
||||
placeholder="Bookmark title"
|
||||
placeholder={t(
|
||||
"viewer.bookmarks.bookmarkTitle",
|
||||
"Bookmark title",
|
||||
)}
|
||||
aria-label={t(
|
||||
"viewer.bookmarks.bookmarkTitle",
|
||||
"Bookmark title",
|
||||
|
||||
@@ -350,7 +350,7 @@ export function LayerSidebar({
|
||||
onClick={showAll}
|
||||
disabled={allVisible || isApplying}
|
||||
aria-label={t("viewer.layers.showAll", "Show all layers")}
|
||||
title="Show all"
|
||||
title={t("viewer.layers.showAll", "Show all layers")}
|
||||
>
|
||||
<VisibilityIcon sx={{ fontSize: "1rem" }} />
|
||||
</ActionIcon>
|
||||
@@ -360,7 +360,7 @@ export function LayerSidebar({
|
||||
onClick={hideAll}
|
||||
disabled={allHidden || isApplying}
|
||||
aria-label={t("viewer.layers.hideAll", "Hide all layers")}
|
||||
title="Hide all"
|
||||
title={t("viewer.layers.hideAll", "Hide all layers")}
|
||||
>
|
||||
<VisibilityOffIcon sx={{ fontSize: "1rem" }} />
|
||||
</ActionIcon>
|
||||
@@ -372,7 +372,7 @@ export function LayerSidebar({
|
||||
size="sm"
|
||||
onClick={toggleLayerSidebar}
|
||||
aria-label={t("viewer.layers.closeSidebar", "Close layers sidebar")}
|
||||
title="Close layers"
|
||||
title={t("viewer.layers.closeSidebar", "Close layers sidebar")}
|
||||
>
|
||||
<LocalIcon icon="close-rounded" width="1.1rem" height="1.1rem" />
|
||||
</ActionIcon>
|
||||
|
||||
@@ -16,6 +16,7 @@ import type {
|
||||
import type { SignParameters } from "@app/hooks/tools/sign/useSignParameters";
|
||||
import { useViewer } from "@app/contexts/ViewerContext";
|
||||
import { useDocumentReady } from "@app/components/viewer/hooks/useDocumentReady";
|
||||
import { shouldAutoExitPlacement } from "@app/components/viewer/signaturePlacement";
|
||||
|
||||
/**
|
||||
* Connects the PDF signature (stamp/ink) tools to the shared ViewerContext and SignatureContext.
|
||||
@@ -185,7 +186,16 @@ export const SignatureAPIBridge = forwardRef<
|
||||
isPlacementMode,
|
||||
placementPreviewSize,
|
||||
setSignaturesApplied,
|
||||
placeMultiple,
|
||||
setPlacementMode,
|
||||
} = useSignature();
|
||||
// Track latest placeMultiple in a ref so the long-lived onAnnotationEvent
|
||||
// subscription always reads the current value without re-subscribing on every
|
||||
// toggle change (which would race with mid-flight create events).
|
||||
const placeMultipleRef = useRef(placeMultiple);
|
||||
useEffect(() => {
|
||||
placeMultipleRef.current = placeMultiple;
|
||||
}, [placeMultiple]);
|
||||
const { getZoomState, registerImmediateZoomUpdate } = useViewer();
|
||||
const documentReady = useDocumentReady();
|
||||
const [currentZoom, setCurrentZoom] = useState(
|
||||
@@ -555,6 +565,11 @@ export const SignatureAPIBridge = forwardRef<
|
||||
// Mark signatures as not applied when a new signature is placed
|
||||
if (event.type === "create") {
|
||||
setSignaturesApplied(false);
|
||||
|
||||
if (shouldAutoExitPlacement(annotation, placeMultipleRef.current)) {
|
||||
annotationApi.setActiveTool(null);
|
||||
setPlacementMode(false);
|
||||
}
|
||||
}
|
||||
|
||||
const directData =
|
||||
@@ -576,7 +591,13 @@ export const SignatureAPIBridge = forwardRef<
|
||||
return () => {
|
||||
unsubscribe?.();
|
||||
};
|
||||
}, [annotationApi, storeImageData, setSignaturesApplied, documentReady]);
|
||||
}, [
|
||||
annotationApi,
|
||||
storeImageData,
|
||||
setSignaturesApplied,
|
||||
setPlacementMode,
|
||||
documentReady,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isPlacementMode || !documentReady) {
|
||||
|
||||
@@ -193,7 +193,10 @@ export function ThumbnailSidebar({
|
||||
"viewer.thumbnails.closeSidebar",
|
||||
"Close thumbnails sidebar",
|
||||
)}
|
||||
title="Close thumbnails"
|
||||
title={t(
|
||||
"viewer.thumbnails.closeSidebar",
|
||||
"Close thumbnails sidebar",
|
||||
)}
|
||||
>
|
||||
<LocalIcon icon="close-rounded" width="1.1rem" height="1.1rem" />
|
||||
</ActionIcon>
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { PdfAnnotationSubtype } from "@embedpdf/models";
|
||||
import { shouldAutoExitPlacement } from "@app/components/viewer/signaturePlacement";
|
||||
|
||||
describe("shouldAutoExitPlacement", () => {
|
||||
it("returns true for a stamp annotation when placeMultiple is false", () => {
|
||||
expect(
|
||||
shouldAutoExitPlacement({ type: PdfAnnotationSubtype.STAMP }, false),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("returns false for a stamp annotation when placeMultiple is true", () => {
|
||||
expect(
|
||||
shouldAutoExitPlacement({ type: PdfAnnotationSubtype.STAMP }, true),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for an ink-stroke annotation regardless of placeMultiple", () => {
|
||||
expect(
|
||||
shouldAutoExitPlacement({ type: PdfAnnotationSubtype.INK }, false),
|
||||
).toBe(false);
|
||||
expect(
|
||||
shouldAutoExitPlacement({ type: PdfAnnotationSubtype.INK }, true),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("falls back to annotation.object.type when annotation.type is missing", () => {
|
||||
expect(
|
||||
shouldAutoExitPlacement(
|
||||
{ object: { type: PdfAnnotationSubtype.STAMP } },
|
||||
false,
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("returns false when neither annotation.type nor object.type is present", () => {
|
||||
expect(shouldAutoExitPlacement({}, false)).toBe(false);
|
||||
expect(shouldAutoExitPlacement(null, false)).toBe(false);
|
||||
expect(shouldAutoExitPlacement(undefined, false)).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for FREETEXT, HIGHLIGHT, and other non-stamp types", () => {
|
||||
expect(
|
||||
shouldAutoExitPlacement({ type: PdfAnnotationSubtype.FREETEXT }, false),
|
||||
).toBe(false);
|
||||
expect(
|
||||
shouldAutoExitPlacement({ type: PdfAnnotationSubtype.HIGHLIGHT }, false),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
import { PdfAnnotationSubtype } from "@embedpdf/models";
|
||||
|
||||
interface AutoExitCandidate {
|
||||
type?: unknown;
|
||||
object?: { type?: unknown };
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether placement mode should auto-exit after a `create` annotation event.
|
||||
*
|
||||
* Only stamp annotations trigger auto-exit. Ink strokes also raise `create`
|
||||
* events, but a multi-stroke signature would break if we deactivated the tool
|
||||
* after the first stroke. When `placeMultiple` is true the user has opted in
|
||||
* to dropping several stamps in a row, so we never auto-exit.
|
||||
*/
|
||||
export function shouldAutoExitPlacement(
|
||||
annotation: AutoExitCandidate | null | undefined,
|
||||
placeMultiple: boolean,
|
||||
): boolean {
|
||||
if (placeMultiple) return false;
|
||||
const type = annotation?.type ?? annotation?.object?.type ?? null;
|
||||
return type === PdfAnnotationSubtype.STAMP;
|
||||
}
|
||||
@@ -23,6 +23,10 @@ interface SignatureState {
|
||||
signaturesApplied: boolean;
|
||||
// Size (in screen units) we want newly placed signatures to use
|
||||
placementPreviewSize: { width: number; height: number } | null;
|
||||
// When false (default), placement mode auto-exits after a single stamp is
|
||||
// dropped so users don't accidentally place duplicates. When true, the user
|
||||
// opted into staying in placement mode and can drop multiple stamps in a row.
|
||||
placeMultiple: boolean;
|
||||
}
|
||||
|
||||
// Signature actions interface
|
||||
@@ -42,6 +46,7 @@ interface SignatureActions {
|
||||
setPlacementPreviewSize: (
|
||||
size: { width: number; height: number } | null,
|
||||
) => void;
|
||||
setPlaceMultiple: (enabled: boolean) => void;
|
||||
}
|
||||
|
||||
// Combined context interface
|
||||
@@ -62,6 +67,7 @@ const initialState: SignatureState = {
|
||||
isPlacementMode: false,
|
||||
signaturesApplied: true, // Start as true (no signatures placed yet)
|
||||
placementPreviewSize: null,
|
||||
placeMultiple: false,
|
||||
};
|
||||
|
||||
// Provider component
|
||||
@@ -174,6 +180,13 @@ export const SignatureProvider: React.FC<{ children: ReactNode }> = ({
|
||||
[],
|
||||
);
|
||||
|
||||
const setPlaceMultiple = useCallback((enabled: boolean) => {
|
||||
setState((prev) => ({
|
||||
...prev,
|
||||
placeMultiple: enabled,
|
||||
}));
|
||||
}, []);
|
||||
|
||||
// No auto-activation - all modes use manual buttons
|
||||
|
||||
const contextValue: SignatureContextValue = {
|
||||
@@ -194,6 +207,7 @@ export const SignatureProvider: React.FC<{ children: ReactNode }> = ({
|
||||
getImageData,
|
||||
setSignaturesApplied,
|
||||
setPlacementPreviewSize,
|
||||
setPlaceMultiple,
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
import { test, expect } from "@app/tests/helpers/stub-test-base";
|
||||
import { uploadFiles, dismissTourTooltip } from "@app/tests/helpers/ui-helpers";
|
||||
import type { Page } from "@playwright/test";
|
||||
import path from "path";
|
||||
|
||||
const SAMPLE_PDF = path.join(
|
||||
import.meta.dirname,
|
||||
"../test-fixtures/sample.pdf",
|
||||
);
|
||||
|
||||
const FIRST_PAGE = '[data-page-index="0"]';
|
||||
const pauseButton = (page: Page) =>
|
||||
page.getByRole("button", { name: /pause placement/i });
|
||||
const resumeButton = (page: Page) =>
|
||||
page.getByRole("button", { name: /resume placement/i });
|
||||
|
||||
/**
|
||||
* Reviewer report: on the stamp-style tools the "place multiple" checkbox
|
||||
* "doesn't do anything". Single placement never stuck because, after the
|
||||
* viewer auto-exited placement mode, SignSettings' auto-activate effect
|
||||
* immediately re-entered it. These tests drive a real text-stamp placement and
|
||||
* assert the placement toggle settles into the correct state:
|
||||
* - box off (default): placement exits after one stamp (Resume offered)
|
||||
* - box on: placement stays active across stamps (Pause stays offered)
|
||||
*
|
||||
* Unit coverage of the decision lives in
|
||||
* components/tools/sign/placementMode.test.ts; this spec guards the end-to-end
|
||||
* UX so future refactors don't silently regress it.
|
||||
*/
|
||||
test.describe("AddText place-multiple behaviour", () => {
|
||||
async function enterPlacementMode(page: Page): Promise<void> {
|
||||
await page.goto("/add-text");
|
||||
await page.waitForLoadState("domcontentloaded");
|
||||
await uploadFiles(page, SAMPLE_PDF);
|
||||
await dismissTourTooltip(page);
|
||||
|
||||
// Wait for the PDF to render before configuring the signature. Placement is
|
||||
// activated on text change and only fires once, so the viewer (and its
|
||||
// SignatureAPIBridge) must be mounted first or the activation is lost.
|
||||
await expect(page.locator(FIRST_PAGE).first()).toBeVisible({
|
||||
timeout: 30_000,
|
||||
});
|
||||
|
||||
// Configuring a text signature auto-activates placement mode.
|
||||
await page
|
||||
.getByPlaceholder("Enter the text you want to add")
|
||||
.fill("Reviewer Test");
|
||||
|
||||
// Placement active -> the toggle offers "Pause placement".
|
||||
await expect(pauseButton(page)).toBeVisible({ timeout: 20_000 });
|
||||
}
|
||||
|
||||
test("single placement (default) exits placement mode", async ({ page }) => {
|
||||
await enterPlacementMode(page);
|
||||
|
||||
await page
|
||||
.locator(FIRST_PAGE)
|
||||
.first()
|
||||
.click({ position: { x: 150, y: 150 } });
|
||||
|
||||
// Wait past the 60ms auto-activate window: with the fix the tool stays
|
||||
// exited; without it placement bounces straight back into "Pause" mode.
|
||||
await page.waitForTimeout(750);
|
||||
|
||||
await expect(resumeButton(page)).toBeVisible();
|
||||
await expect(pauseButton(page)).toBeHidden();
|
||||
});
|
||||
|
||||
test("'place multiple' keeps placement active after a placement", async ({
|
||||
page,
|
||||
}) => {
|
||||
await enterPlacementMode(page);
|
||||
|
||||
await page
|
||||
.getByRole("checkbox", {
|
||||
name: /stay in placement mode after each placement/i,
|
||||
})
|
||||
.check();
|
||||
|
||||
await page
|
||||
.locator(FIRST_PAGE)
|
||||
.first()
|
||||
.click({ position: { x: 150, y: 150 } });
|
||||
await page.waitForTimeout(750);
|
||||
|
||||
// Still placing: Pause stays offered, Resume never appears.
|
||||
await expect(pauseButton(page)).toBeVisible();
|
||||
await expect(resumeButton(page)).toBeHidden();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,58 @@
|
||||
import { test, expect } from "@app/tests/helpers/stub-test-base";
|
||||
import { uploadFiles } from "@app/tests/helpers/ui-helpers";
|
||||
import path from "path";
|
||||
|
||||
const SAMPLE_PDF = path.join(
|
||||
import.meta.dirname,
|
||||
"../test-fixtures/sample.pdf",
|
||||
);
|
||||
|
||||
const TOOLS_WITH_PLACEMENT_TOGGLE: Array<{ name: string; url: string }> = [
|
||||
{ name: "AddImage", url: "/add-image" },
|
||||
{ name: "AddText", url: "/add-text" },
|
||||
{ name: "Sign", url: "/sign" },
|
||||
];
|
||||
|
||||
/**
|
||||
* The "place multiple" checkbox is rendered by SignSettings for the three
|
||||
* stamp-style tools (AddImage / AddText / Sign). Behaviour contract:
|
||||
* - Default unchecked: placement mode auto-exits after one stamp
|
||||
* - Toggling on keeps the user in placement mode across multiple stamps
|
||||
* Helper logic is unit-tested in signaturePlacement.test.ts; this spec
|
||||
* verifies the UI contract end-to-end so future SignSettings refactors do
|
||||
* not silently regress the default UX.
|
||||
*/
|
||||
for (const tool of TOOLS_WITH_PLACEMENT_TOGGLE) {
|
||||
test.describe(`${tool.name} placement toggle`, () => {
|
||||
test("renders the 'place multiple' checkbox unchecked by default", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto(tool.url);
|
||||
await page.waitForLoadState("domcontentloaded");
|
||||
await uploadFiles(page, SAMPLE_PDF);
|
||||
|
||||
const placeMultiple = page.getByRole("checkbox", {
|
||||
name: /stay in placement mode after each placement/i,
|
||||
});
|
||||
await expect(placeMultiple).toBeVisible({ timeout: 15_000 });
|
||||
await expect(placeMultiple).not.toBeChecked();
|
||||
});
|
||||
|
||||
test("toggling the 'place multiple' checkbox flips its state", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto(tool.url);
|
||||
await page.waitForLoadState("domcontentloaded");
|
||||
await uploadFiles(page, SAMPLE_PDF);
|
||||
|
||||
const placeMultiple = page.getByRole("checkbox", {
|
||||
name: /stay in placement mode after each placement/i,
|
||||
});
|
||||
await expect(placeMultiple).toBeVisible({ timeout: 15_000 });
|
||||
await placeMultiple.check();
|
||||
await expect(placeMultiple).toBeChecked();
|
||||
await placeMultiple.uncheck();
|
||||
await expect(placeMultiple).not.toBeChecked();
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { BaseToolProps } from "@app/types/tool";
|
||||
import { withBasePath } from "@app/constants/app";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const SwaggerUI: React.FC<BaseToolProps> = () => {
|
||||
const { t } = useTranslation();
|
||||
useEffect(() => {
|
||||
// Redirect to Swagger UI
|
||||
window.open(withBasePath("/swagger-ui/5.21.0/index.html"), "_blank");
|
||||
@@ -10,15 +12,15 @@ const SwaggerUI: React.FC<BaseToolProps> = () => {
|
||||
|
||||
return (
|
||||
<div style={{ textAlign: "center", padding: "2rem" }}>
|
||||
<p>Opening Swagger UI in a new tab...</p>
|
||||
<p>{t("swagger.opening", "Opening Swagger UI in a new tab...")}</p>
|
||||
<p>
|
||||
If it didn't open automatically,{" "}
|
||||
{t("swagger.fallback", "If it didn't open automatically,")}{" "}
|
||||
<a
|
||||
href={withBasePath("/swagger-ui/5.21.0/index.html")}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
click here
|
||||
{t("swagger.clickHere", "click here")}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -204,7 +204,7 @@ const FormFill = (_props: BaseToolProps) => {
|
||||
setTimeout(() => URL.revokeObjectURL(url), 250);
|
||||
} catch (err) {
|
||||
console.error("[FormFill] CSV extraction failed:", err);
|
||||
setSaveError("Failed to extract CSV");
|
||||
setSaveError(t("formFill.extractCsvError", "Failed to extract CSV"));
|
||||
} finally {
|
||||
setExtracting(false);
|
||||
}
|
||||
@@ -223,7 +223,7 @@ const FormFill = (_props: BaseToolProps) => {
|
||||
setTimeout(() => URL.revokeObjectURL(url), 250);
|
||||
} catch (err) {
|
||||
console.error("[FormFill] XLSX extraction failed:", err);
|
||||
setSaveError("Failed to extract XLSX");
|
||||
setSaveError(t("formFill.extractXlsxError", "Failed to extract XLSX"));
|
||||
} finally {
|
||||
setExtracting(false);
|
||||
}
|
||||
@@ -246,7 +246,9 @@ const FormFill = (_props: BaseToolProps) => {
|
||||
if (!currentFile || !isStirlingFile(currentFile)) return;
|
||||
|
||||
if (!validateForm()) {
|
||||
setSaveError("Please fill in all required fields");
|
||||
setSaveError(
|
||||
t("formFill.requiredFieldsError", "Please fill in all required fields"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -641,7 +643,9 @@ const FormFill = (_props: BaseToolProps) => {
|
||||
{field.label || field.name}
|
||||
</span>
|
||||
{field.required && (
|
||||
<span className={styles.fieldRequired}>req</span>
|
||||
<span className={styles.fieldRequired}>
|
||||
{t("formFill.requiredAbbreviation", "req")}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -683,10 +687,10 @@ const FormFill = (_props: BaseToolProps) => {
|
||||
<span className={styles.unsavedDot} />
|
||||
)}
|
||||
{formState.isDirty || flattenChanged
|
||||
? "Unsaved changes"
|
||||
: "All saved"}
|
||||
? t("formFill.unsavedChanges", "Unsaved changes")
|
||||
: t("formFill.allSaved", "All saved")}
|
||||
</span>
|
||||
<span>Ctrl+S to save</span>
|
||||
<span>{t("formFill.saveShortcut", "Ctrl+S to save")}</span>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -73,6 +73,8 @@ export const createStampTool = (config: StampToolConfig) => {
|
||||
signatureApiRef,
|
||||
getImageData,
|
||||
setSignaturesApplied,
|
||||
setPlacementMode,
|
||||
setPlaceMultiple,
|
||||
} = useSignature();
|
||||
const { consumeFiles, selectors } = useFileContext();
|
||||
const {
|
||||
@@ -143,6 +145,18 @@ export const createStampTool = (config: StampToolConfig) => {
|
||||
setSignatureConfig(base.params.parameters);
|
||||
}, [base.params.parameters, setSignatureConfig]);
|
||||
|
||||
// When the tool unmounts (user navigates to a different tool), leave
|
||||
// placement mode and clear any active stamp/ink tool. Otherwise the
|
||||
// placement state and the "place signature" cursor leak into whatever the
|
||||
// user opens next.
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
handleDeactivateSignature();
|
||||
setPlacementMode(false);
|
||||
setPlaceMultiple(false);
|
||||
};
|
||||
}, [handleDeactivateSignature, setPlacementMode, setPlaceMultiple]);
|
||||
|
||||
const handleSaveToSystem = useCallback(async () => {
|
||||
try {
|
||||
unregisterUnsavedChangesChecker();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { Button } from "@app/ui/Button";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import "@app/ui/CodeBlock.css";
|
||||
|
||||
export type CodeLang =
|
||||
@@ -33,6 +34,7 @@ export function CodeBlock({
|
||||
maxHeight = 400,
|
||||
className,
|
||||
}: CodeBlockProps) {
|
||||
const { t } = useTranslation();
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
async function copy() {
|
||||
@@ -64,7 +66,7 @@ export function CodeBlock({
|
||||
onClick={copy}
|
||||
aria-label="Copy code"
|
||||
>
|
||||
{copied ? "Copied" : "Copy"}
|
||||
{copied ? t("common.copied", "Copied!") : t("common.copy", "Copy")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import FileUploadRounded from "@mui/icons-material/FileUploadRounded";
|
||||
import { Button, Modal } from "@app/ui";
|
||||
import "@portal/views/AgentBuilder.css";
|
||||
|
||||
@@ -58,7 +59,7 @@ export function BootstrapDialog({ open, onClose }: BootstrapDialogProps) {
|
||||
onChange={(e) => setFileName(e.target.files?.[0]?.name ?? null)}
|
||||
/>
|
||||
<span className="portal-agents__dropzone-icon" aria-hidden>
|
||||
⇪
|
||||
<FileUploadRounded style={{ fontSize: "1.5rem" }} />
|
||||
</span>
|
||||
<span className="portal-agents__dropzone-text">
|
||||
{fileName ?? t("portal.agentBuilder.bootstrap.dropzoneText")}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import LockRounded from "@mui/icons-material/LockRounded";
|
||||
import { StatusBadge, Table, type TableColumn } from "@app/ui";
|
||||
import { type Extraction, type ReviewDocument } from "@portal/api/documents";
|
||||
import {
|
||||
@@ -55,7 +56,7 @@ export function DocumentExtractions({
|
||||
return (
|
||||
<div className="portal-documents__masked">
|
||||
<span className="portal-documents__masked-icon" aria-hidden>
|
||||
🔒
|
||||
<LockRounded style={{ fontSize: "1.5rem" }} />
|
||||
</span>
|
||||
<p className="portal-documents__masked-text">
|
||||
{t("portal.documents.extractions.masked")}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import ScheduleRounded from "@mui/icons-material/ScheduleRounded";
|
||||
import LockRounded from "@mui/icons-material/LockRounded";
|
||||
import { Banner, Button } from "@app/ui";
|
||||
import { formatCountdown } from "@portal/components/documents/format";
|
||||
|
||||
@@ -26,7 +28,7 @@ export function ElevationBanner({
|
||||
return (
|
||||
<Banner
|
||||
tone="success"
|
||||
icon={<span aria-hidden>⏱</span>}
|
||||
icon={<ScheduleRounded style={{ fontSize: "1.1rem" }} />}
|
||||
title={t("portal.documents.elevation.active.title", {
|
||||
time: formatCountdown(secondsLeft),
|
||||
})}
|
||||
@@ -42,7 +44,7 @@ export function ElevationBanner({
|
||||
return (
|
||||
<Banner
|
||||
tone="warning"
|
||||
icon={<span aria-hidden>🔒</span>}
|
||||
icon={<LockRounded style={{ fontSize: "1.1rem" }} />}
|
||||
title={t("portal.documents.elevation.gated.title")}
|
||||
description={
|
||||
fourEyes
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import LockRounded from "@mui/icons-material/LockRounded";
|
||||
import { Button, Chip, StatusBadge, Table, type TableColumn } from "@app/ui";
|
||||
import {
|
||||
classificationTone,
|
||||
@@ -75,7 +76,7 @@ export function ReviewQueueTable({
|
||||
title={t("portal.documents.table.sensitiveTitle")}
|
||||
aria-label={t("portal.documents.table.sensitiveLabel")}
|
||||
>
|
||||
🔒
|
||||
<LockRounded style={{ fontSize: "0.95rem" }} />
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import AccountTreeRounded from "@mui/icons-material/AccountTreeRounded";
|
||||
import ChevronRightRoundedIcon from "@mui/icons-material/ChevronRightRounded";
|
||||
import {
|
||||
Chip,
|
||||
@@ -31,7 +32,7 @@ export function PipelinesTable({ pipelines, onRowClick }: PipelinesTableProps) {
|
||||
render: (p) => (
|
||||
<div className="portal-pipelines__name-cell">
|
||||
<span className="portal-pipelines__pipe-dot" aria-hidden>
|
||||
⛓
|
||||
<AccountTreeRounded style={{ fontSize: "1.2rem" }} />
|
||||
</span>
|
||||
<div className="portal-pipelines__name-text">
|
||||
<strong>{p.name}</strong>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import FileUploadRounded from "@mui/icons-material/FileUploadRounded";
|
||||
import { Button, EmptyState, Skeleton } from "@app/ui";
|
||||
import { useTier } from "@portal/contexts/TierContext";
|
||||
import { useAsync, useSectionFlags } from "@portal/hooks/useAsync";
|
||||
@@ -41,7 +42,7 @@ export function AgentBuilder() {
|
||||
</div>
|
||||
<Button
|
||||
onClick={() => setBootstrapOpen(true)}
|
||||
leftSection={<span aria-hidden>⇪</span>}
|
||||
leftSection={<FileUploadRounded style={{ fontSize: "1.2rem" }} />}
|
||||
>
|
||||
{t("portal.agentBuilder.bootstrapFromDocument")}
|
||||
</Button>
|
||||
|
||||
@@ -262,6 +262,6 @@ describe("AuthCallback", () => {
|
||||
</BrowserRouter>,
|
||||
);
|
||||
|
||||
expect(getByText("Completing authentication")).toBeInTheDocument();
|
||||
expect(getByText("auth.callback.completing")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
consumePostLoginRedirectPath,
|
||||
springAuth,
|
||||
@@ -7,6 +8,7 @@ import {
|
||||
import { markLoginLandingPending } from "@app/utils/loginLanding";
|
||||
import { handleAuthCallbackSuccess } from "@app/extensions/authCallback";
|
||||
import styles from "@app/routes/AuthCallback.module.css";
|
||||
import i18n from "@app/i18n";
|
||||
|
||||
/**
|
||||
* OAuth Callback Handler
|
||||
@@ -16,6 +18,7 @@ import styles from "@app/routes/AuthCallback.module.css";
|
||||
* We extract it, store in localStorage, and redirect to the home page.
|
||||
*/
|
||||
export default function AuthCallback() {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const processingRef = useRef(false);
|
||||
|
||||
@@ -31,7 +34,12 @@ export default function AuthCallback() {
|
||||
) {
|
||||
navigate("/login", {
|
||||
replace: true,
|
||||
state: { error: "You have been signed out. Please sign in again." },
|
||||
state: {
|
||||
error: i18n.t(
|
||||
"auth.callback.signedOut",
|
||||
"You have been signed out. Please sign in again.",
|
||||
),
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -50,7 +58,12 @@ export default function AuthCallback() {
|
||||
);
|
||||
navigate("/login", {
|
||||
replace: true,
|
||||
state: { error: "OAuth login failed - no token received." },
|
||||
state: {
|
||||
error: i18n.t(
|
||||
"auth.callback.missingToken",
|
||||
"OAuth login failed - no token received.",
|
||||
),
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -67,7 +80,12 @@ export default function AuthCallback() {
|
||||
localStorage.removeItem("stirling_jwt");
|
||||
navigate("/login", {
|
||||
replace: true,
|
||||
state: { error: "OAuth login failed - invalid token." },
|
||||
state: {
|
||||
error: i18n.t(
|
||||
"auth.callback.invalidToken",
|
||||
"OAuth login failed - invalid token.",
|
||||
),
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -93,7 +111,12 @@ export default function AuthCallback() {
|
||||
);
|
||||
navigate("/login", {
|
||||
replace: true,
|
||||
state: { error: "OAuth login failed. Please try again." },
|
||||
state: {
|
||||
error: i18n.t(
|
||||
"auth.callback.oauthFailed",
|
||||
"OAuth login failed. Please try again.",
|
||||
),
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -105,12 +128,20 @@ export default function AuthCallback() {
|
||||
<div className={styles.page}>
|
||||
<div className={styles.card}>
|
||||
<div className={`${styles.icon} ${styles.iconNeutral}`}>...</div>
|
||||
<div className={styles.title}>Completing authentication</div>
|
||||
<div className={styles.title}>
|
||||
{t("auth.callback.completing", "Completing authentication")}
|
||||
</div>
|
||||
<div className={styles.message}>
|
||||
Please wait while we finish signing you in.
|
||||
{t(
|
||||
"auth.callback.pleaseWait",
|
||||
"Please wait while we finish signing you in.",
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.loadingExtra}>
|
||||
You can close this window once it completes.
|
||||
{t(
|
||||
"auth.callback.windowMayClose",
|
||||
"You can close this window once it completes.",
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -109,7 +109,9 @@ export default function Landing() {
|
||||
>
|
||||
<div className="text-center">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto mb-3"></div>
|
||||
<div className="text-gray-600">Loading...</div>
|
||||
<div className="text-gray-600">
|
||||
{t("common.loading", "Loading...")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -302,15 +302,20 @@ const AppConfigModal: React.FC<AppConfigModalProps> = ({
|
||||
<Modal
|
||||
opened={confirmOpen}
|
||||
onClose={() => setConfirmOpen(false)}
|
||||
title="Sign out"
|
||||
title={t("settings.signOut.title", "Sign out")}
|
||||
centered
|
||||
zIndex={Z_INDEX_OVER_SETTINGS_MODAL}
|
||||
>
|
||||
<div className="confirm-modal-content">
|
||||
<Text>Are you sure you want to sign out?</Text>
|
||||
<Text>
|
||||
{t(
|
||||
"settings.signOut.confirm",
|
||||
"Are you sure you want to sign out?",
|
||||
)}
|
||||
</Text>
|
||||
<div className="confirm-modal-buttons">
|
||||
<Button variant="secondary" onClick={() => setConfirmOpen(false)}>
|
||||
Cancel
|
||||
{t("common.cancel", "Cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
accent="danger"
|
||||
@@ -324,7 +329,7 @@ const AppConfigModal: React.FC<AppConfigModalProps> = ({
|
||||
}
|
||||
}}
|
||||
>
|
||||
Sign out
|
||||
{t("settings.signOut.submit", "Sign out")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
createScale,
|
||||
} from "@app/components/shared/charts/utils/d3Utils";
|
||||
import "@app/components/shared/charts/StackedBarChart.css";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export default function StackedBarChart({
|
||||
fractions,
|
||||
@@ -26,6 +27,7 @@ export default function StackedBarChart({
|
||||
animationDurationMs = 900,
|
||||
ariaLabel,
|
||||
}: StackedBarChartProps) {
|
||||
const { t } = useTranslation();
|
||||
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||
const tooltipRef = useRef<HTMLDivElement | null>(null);
|
||||
const hasAnimatedRef = useRef(false);
|
||||
@@ -309,7 +311,7 @@ export default function StackedBarChart({
|
||||
outline: "1px solid var(--api-keys-card-border)",
|
||||
}}
|
||||
/>
|
||||
<Text size="sm">Remaining</Text>
|
||||
<Text size="sm">{t("common.remaining", "Remaining")}</Text>
|
||||
</Group>
|
||||
</Group>
|
||||
)}
|
||||
|
||||
@@ -144,7 +144,7 @@ export const ProfilePictureCropper: React.FC<ProfilePictureCropperProps> = ({
|
||||
>
|
||||
<Stack gap="md">
|
||||
{error && (
|
||||
<Alert color="red" title="Error">
|
||||
<Alert color="red" title={t("common.error", "Error")}>
|
||||
{error}
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user