Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fix: number document copies and make duplicate names editable (#3836)

Amruth Pillaia09c1cfb4841
diff --git a/apps/mobile/src/features/document-menu/index.tsx b/apps/mobile/src/features/document-menu/index.tsx
index 0d03ae4d1..41b3480ff 100644
--- a/apps/mobile/src/features/document-menu/index.tsx
+++ b/apps/mobile/src/features/document-menu/index.tsx
@@ -90,11 +90,13 @@ export function DocumentMenu({ id, inChrome = false }: DocumentMenuProps) {
title={t`Duplicate`}
leading="copy"
disabled={operations.busy || printing}
- onPress={() => {
- setName(t`${resume.name} (copy)`.slice(0, 100));
- setSlug("");
- setPanel("duplicate");
- }}
+ onPress={() =>
+ void operations.run(async () => {
+ setName(await client.documents.suggestDuplicateName({ type: "resume", id }));
+ setSlug("");
+ setPanel("duplicate");
+ })
+ }
/>
{/* The library's job copy, from inside the editor (web's builder menu has it too). */}
<ListRow
diff --git a/apps/mobile/src/features/documents/document-sheets.tsx b/apps/mobile/src/features/documents/document-sheets.tsx
index fe888ea3c..f28e98a5b 100644
--- a/apps/mobile/src/features/documents/document-sheets.tsx
+++ b/apps/mobile/src/features/documents/document-sheets.tsx
@@ -8,14 +8,15 @@ import { changedTags, documentRef, sharedTags } from "./filter";
import { useNewDocuments } from "./new-documents";
import { useDocumentOperations } from "./queries";
import { client, orpc } from "@/api/client";
-import { useSession } from "@/auth/session";
+import { getAccountScope, useSession } from "@/auth/session";
import { AddApplicationSheet } from "@/features/applications/add-sheet";
import { shareDocumentPdf } from "@/features/share/files";
import { routes } from "@/routes";
-import { Banner, Button, ChipInput, ListRow, Sheet, Skeleton, Text, TextField, useTheme } from "@/ui";
+import { Banner, Button, ChipInput, ListRow, Sheet, Skeleton, Text, TextField, showToast, useTheme } from "@/ui";
export type DocumentSheet =
| { kind: "menu" | "rename" | "link"; documents: [DocumentSummary] }
+ | { kind: "duplicate"; documents: [DocumentSummary]; name: string }
| { kind: "tags" | "sharing" | "lock"; documents: DocumentSummary[] };
type DocumentSheetsProps = {
@@ -32,7 +33,7 @@ export function DocumentSheets({ value, onClose, onChange, onSelect }: DocumentS
const session = useSession();
const operations = useDocumentOperations();
const first = value.documents[0];
- const [name, setName] = useState(first?.name ?? "");
+ const [name, setName] = useState(value.kind === "duplicate" ? value.name : (first?.name ?? ""));
const shared = sharedTags(value.documents);
const [tags, setTags] = useState(shared);
const [addingJob, setAddingJob] = useState(false);
@@ -45,10 +46,37 @@ export function DocumentSheets({ value, onClose, onChange, onSelect }: DocumentS
const execute = async (task: () => Promise<unknown>) => {
if (await operations.run(task)) onClose();
};
+ const duplicate = async () => {
+ if (!first) return;
+ const scope = getAccountScope();
+ const copyName = name.trim();
+ let copy: DocumentSummary | undefined;
+ const success = await operations.run(async () => {
+ const id =
+ first.type === "resume"
+ ? await client.resume.duplicate({ id: first.id, name: copyName, tags: first.tags })
+ : (await client.coverLetters.duplicate({ id: first.id, name: copyName })).id;
+ useNewDocuments.getState().markNew({ id, type: first.type });
+ copy = { ...first, id, name: copyName, isLocked: false, isPublic: false, hasPassword: false, application: null };
+ });
+ if (!success || !copy || getAccountScope() !== scope) return;
+ const created = copy;
+ onClose();
+ showToast({
+ message: t`Copy created`,
+ action: {
+ label: t`Rename`,
+ onPress: () => {
+ if (getAccountScope() === scope) onChange({ kind: "rename", documents: [created] });
+ },
+ },
+ });
+ };
const targets = value.documents.filter((document) => !document.isLocked);
const titles = {
menu: t`Document options`,
rename: t`Rename`,
+ duplicate: t`Duplicate`,
tags: t`Tags`,
link: t`Link to application`,
sharing: t`Sharing`,
@@ -71,9 +99,12 @@ export function DocumentSheets({ value, onClose, onChange, onSelect }: DocumentS
>
<View style={{ paddingHorizontal: space.s4, gap: space.s3 }}>
{operations.error && <Banner tone="danger" message={operations.error} />}
- {value.documents.some((document) => document.isLocked) && value.kind !== "menu" && value.kind !== "lock" && (
- <Banner tone="warn" message={t`Locked documents were skipped. Unlock them first.`} />
- )}
+ {value.documents.some((document) => document.isLocked) &&
+ value.kind !== "menu" &&
+ value.kind !== "lock" &&
+ value.kind !== "duplicate" && (
+ <Banner tone="warn" message={t`Locked documents were skipped. Unlock them first.`} />
+ )}
{value.kind === "menu" && first && (
<>
<Text variant="title">{first.name}</Text>
@@ -113,16 +144,9 @@ export function DocumentSheets({ value, onClose, onChange, onSelect }: DocumentS
leading="copy"
disabled={operations.busy}
onPress={() =>
- void execute(async () => {
- const id =
- first.type === "resume"
- ? await client.resume.duplicate({
- id: first.id,
- name: t`${first.name} (copy)`.slice(0, 100),
- tags: first.tags,
- })
- : (await client.coverLetters.duplicate({ id: first.id })).id;
- useNewDocuments.getState().markNew({ id, type: first.type });
+ void operations.run(async () => {
+ const suggested = await client.documents.suggestDuplicateName(documentRef(first));
+ onChange({ kind: "duplicate", documents: [first], name: suggested });
})
}
/>
@@ -192,6 +216,24 @@ export function DocumentSheets({ value, onClose, onChange, onSelect }: DocumentS
/>
</>
)}
+ {value.kind === "duplicate" && first && (
+ <>
+ <TextField
+ label={t`Name`}
+ value={name}
+ onChangeText={setName}
+ maxLength={100}
+ editable={!operations.busy}
+ autoFocus
+ />
+ <Button
+ label={t`Duplicate`}
+ loading={operations.busy}
+ disabled={!name.trim()}
+ onPress={() => void duplicate()}
+ />
+ </>
+ )}
{value.kind === "rename" && first && (
<>
<TextField
diff --git a/apps/mobile/src/features/documents/library.tsx b/apps/mobile/src/features/documents/library.tsx
index decdfc313..3dcd76fa9 100644
--- a/apps/mobile/src/features/documents/library.tsx
+++ b/apps/mobile/src/features/documents/library.tsx
@@ -333,15 +333,8 @@ export function DocumentsLibrary({ trashed = false }: DocumentsLibraryProps) {
};
const duplicate = (document: DocumentSummary) =>
operations.run(async () => {
- const id =
- document.type === "resume"
- ? await client.resume.duplicate({
- id: document.id,
- name: t`${document.name} (copy)`.slice(0, 100),
- tags: document.tags,
- })
- : (await client.coverLetters.duplicate({ id: document.id })).id;
- useNewDocuments.getState().markNew({ type: document.type, id });
+ const name = await client.documents.suggestDuplicateName(documentRef(document));
+ setSheet({ kind: "duplicate", documents: [document], name });
});
const clearFilters = () => {
changePage(0);
diff --git a/apps/web/locales/af-ZA.po b/apps/web/locales/af-ZA.po
index b1cef2676..50755d6bb 100644
--- a/apps/web/locales/af-ZA.po
+++ b/apps/web/locales/af-ZA.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Jou gekose lettertipe kan nie {list} wys nie. Dit versk
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Stuur hierdie aansoek en jou Kennis; jou verskaffer kan koste hef."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopie)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/am-ET.po b/apps/web/locales/am-ET.po
index 9ba538f74..db4888122 100644
--- a/apps/web/locales/am-ET.po
+++ b/apps/web/locales/am-ET.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {የመረጡት ፊደል {list} ማሳየት አይች
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}። ይህን ማመልከቻ እና እውቀትዎን ይልካል፤ አቅራቢዎ ሊያስከፍል ይችላል።"
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (ቅጂ)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/ar-SA.po b/apps/web/locales/ar-SA.po
index 421d0ed8d..4ddb63b48 100644
--- a/apps/web/locales/ar-SA.po
+++ b/apps/web/locales/ar-SA.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {لا يمكن للخط الذي اخترته عرض {li
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. يرسل هذا الطلب ومعرفتك؛ وقد يفرض مزوّدك رسومًا."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (نسخة)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/az-AZ.po b/apps/web/locales/az-AZ.po
index 22dacb067..88e2aafc0 100644
--- a/apps/web/locales/az-AZ.po
+++ b/apps/web/locales/az-AZ.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Seçdiyiniz şrift {list} simvolunu göstərə bilmir.
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Bu müraciəti və Biliklərinizi göndərir; provayderiniz ödəniş ala bilər."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (nüsxə)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/bg-BG.po b/apps/web/locales/bg-BG.po
index eb20c12ed..d1b523f36 100644
--- a/apps/web/locales/bg-BG.po
+++ b/apps/web/locales/bg-BG.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Избраният от вас шрифт не може
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Изпраща тази кандидатура и вашите Знания; доставчикът ви може да таксува."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (копие)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/bn-BD.po b/apps/web/locales/bn-BD.po
index 4a7f15f16..96d32b491 100644
--- a/apps/web/locales/bn-BD.po
+++ b/apps/web/locales/bn-BD.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {আপনার নির্বাচিত ফন্
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}। এই আবেদন ও আপনার জ্ঞানভান্ডার পাঠায়; আপনার প্রদানকারী চার্জ নিতে পারে।"
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (কপি)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/ca-ES.po b/apps/web/locales/ca-ES.po
index 1d912e29f..19909e1f0 100644
--- a/apps/web/locales/ca-ES.po
+++ b/apps/web/locales/ca-ES.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {La font seleccionada no pot mostrar {list}. Es mostra c
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Envia aquesta candidatura i els vostres Coneixements; el proveïdor us pot cobrar."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (còpia)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/cs-CZ.po b/apps/web/locales/cs-CZ.po
index a5466efad..fc934cbdc 100644
--- a/apps/web/locales/cs-CZ.po
+++ b/apps/web/locales/cs-CZ.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Vybrané písmo nedokáže zobrazit {list}. Zobrazuje s
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Odešle tuto žádost a vaše Znalosti; váš poskytovatel si může účtovat poplatek."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopie)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/da-DK.po b/apps/web/locales/da-DK.po
index 0b53fcc39..2dac7d8df 100644
--- a/apps/web/locales/da-DK.po
+++ b/apps/web/locales/da-DK.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Din valgte skrifttype kan ikke vise {list}. Det vises s
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Sender denne ansøgning og din Viden; din udbyder kan tage betaling."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopi)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/de-DE.po b/apps/web/locales/de-DE.po
index a94da8df9..5720c6a59 100644
--- a/apps/web/locales/de-DE.po
+++ b/apps/web/locales/de-DE.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Ihre gewählte Schriftart kann {list} nicht darstellen.
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Sendet diese Bewerbung und Ihr Wissen; Ihr Anbieter kann Kosten berechnen."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (Kopie)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/el-GR.po b/apps/web/locales/el-GR.po
index 3236b11d4..865109e0a 100644
--- a/apps/web/locales/el-GR.po
+++ b/apps/web/locales/el-GR.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Η γραμματοσειρά που επιλέξατε
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Στέλνει αυτή την αίτηση και τη Γνώση σας· ο πάροχός σας μπορεί να χρεώσει."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (αντίγραφο)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/en-GB.po b/apps/web/locales/en-GB.po
index 8b5463904..98f435139 100644
--- a/apps/web/locales/en-GB.po
+++ b/apps/web/locales/en-GB.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Your selected font can't display {list}. It shows as
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (copy)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/en-US.po b/apps/web/locales/en-US.po
index a63a56c68..cbd7f0592 100644
--- a/apps/web/locales/en-US.po
+++ b/apps/web/locales/en-US.po
@@ -419,11 +419,6 @@ msgstr "{0, plural, one {Your selected font can't display {list}. It shows as
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (copy)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/es-ES.po b/apps/web/locales/es-ES.po
index d81c80d16..02043cffb 100644
--- a/apps/web/locales/es-ES.po
+++ b/apps/web/locales/es-ES.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {La fuente seleccionada no puede mostrar {list}. Aparece
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Envía esta candidatura y tu Conocimiento; tu proveedor puede cobrarte."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (copia)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/fa-IR.po b/apps/web/locales/fa-IR.po
index 3d816e416..c3997a019 100644
--- a/apps/web/locales/fa-IR.po
+++ b/apps/web/locales/fa-IR.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {فونت انتخاب‌شدهٔ شما نمی‌توا
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. این درخواست و دانسته‌های شما را می‌فرستد؛ ممکن است ارائه‌دهنده‌تان هزینه دریافت کند."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (کپی)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/fi-FI.po b/apps/web/locales/fi-FI.po
index 581336102..7f68e9dfe 100644
--- a/apps/web/locales/fi-FI.po
+++ b/apps/web/locales/fi-FI.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Valitsemasi fontti ei pysty näyttämään merkkiä {li
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Lähettää tämän hakemuksen ja tietopankkisi; palveluntarjoajasi voi veloittaa."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopio)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/fr-FR.po b/apps/web/locales/fr-FR.po
index f6f14bbf0..04c1ab372 100644
--- a/apps/web/locales/fr-FR.po
+++ b/apps/web/locales/fr-FR.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {La police sélectionnée ne peut pas afficher {list}. C
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Envoie cette candidature et vos Connaissances ; votre fournisseur peut facturer."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (copie)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/he-IL.po b/apps/web/locales/he-IL.po
index 26b154ae4..526aa0897 100644
--- a/apps/web/locales/he-IL.po
+++ b/apps/web/locales/he-IL.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {הגופן שבחרת לא יכול להציג את {li
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. שולח את המועמדות הזו ואת מאגר הידע שלך; הספק שלך עשוי לחייב."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (עותק)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/hi-IN.po b/apps/web/locales/hi-IN.po
index ad52b37e7..dce6c3c0f 100644
--- a/apps/web/locales/hi-IN.po
+++ b/apps/web/locales/hi-IN.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {आपका चुना गया फ़ॉन्ट
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}। यह आवेदन और आपका ज्ञानकोश भेजता है; आपका प्रदाता शुल्क ले सकता है।"
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (कॉपी)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/hu-HU.po b/apps/web/locales/hu-HU.po
index 8b4f6683c..f4c164e8c 100644
--- a/apps/web/locales/hu-HU.po
+++ b/apps/web/locales/hu-HU.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {A kiválasztott betűtípus nem tudja megjeleníteni ez
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Elküldi ezt a jelentkezést és a Tudástáradat; a szolgáltatód díjat számolhat fel."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (másolat)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/id-ID.po b/apps/web/locales/id-ID.po
index 251fdacbb..6d8c5bf58 100644
--- a/apps/web/locales/id-ID.po
+++ b/apps/web/locales/id-ID.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Font yang Anda pilih tidak dapat menampilkan {list}. Ka
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Mengirim lamaran ini dan Pengetahuan Anda; penyedia Anda mungkin mengenakan biaya."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (salinan)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/it-IT.po b/apps/web/locales/it-IT.po
index a975f0cf1..4eff5a4aa 100644
--- a/apps/web/locales/it-IT.po
+++ b/apps/web/locales/it-IT.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Il font selezionato non può visualizzare {list}. Viene
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Invia questa candidatura e le tue Conoscenze; il tuo fornitore potrebbe addebitarlo."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (copia)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/ja-JP.po b/apps/web/locales/ja-JP.po
index d509740f2..186bac44b 100644
--- a/apps/web/locales/ja-JP.po
+++ b/apps/web/locales/ja-JP.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {選択したフォントでは {list} を表示でき
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}。この応募とナレッジを送信します。プロバイダーから料金が発生する場合があります。"
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (コピー)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/km-KH.po b/apps/web/locales/km-KH.po
index 98d22c529..27bc2a0fb 100644
--- a/apps/web/locales/km-KH.po
+++ b/apps/web/locales/km-KH.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {ពុម្ពអក្សរដែលអ្នកប
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}។ ផ្ញើពាក្យសុំនេះ និងចំណេះដឹងរបស់អ្នក; អ្នកផ្តល់សេវារបស់អ្នកអាចគិតថ្លៃ។"
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (ចម្លង)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/kn-IN.po b/apps/web/locales/kn-IN.po
index b8ccda7cc..7669cbc16 100644
--- a/apps/web/locales/kn-IN.po
+++ b/apps/web/locales/kn-IN.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {ನೀವು ಆಯ್ಕೆ ಮಾಡಿದ ಫಾಂ
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. ಈ ಅರ್ಜಿ ಮತ್ತು ನಿಮ್ಮ ಜ್ಞಾನವನ್ನು ಕಳುಹಿಸುತ್ತದೆ; ನಿಮ್ಮ ಪೂರೈಕೆದಾರರು ಶುಲ್ಕ ವಿಧಿಸಬಹುದು."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (ನಕಲು)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/ko-KR.po b/apps/web/locales/ko-KR.po
index b24549b4d..b9215472f 100644
--- a/apps/web/locales/ko-KR.po
+++ b/apps/web/locales/ko-KR.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {선택한 글꼴로는 {list}을(를) 표시할 수 없
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. 이 지원 내역과 지식을 전송하며, 제공업체가 요금을 청구할 수 있습니다."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0}(복사본)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/lt-LT.po b/apps/web/locales/lt-LT.po
index 69b4a980c..e5b73aaa3 100644
--- a/apps/web/locales/lt-LT.po
+++ b/apps/web/locales/lt-LT.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Pasirinktas šriftas negali parodyti {list}. Jis rodoma
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Siunčia šią paraišką ir jūsų Žinias; jūsų teikėjas gali imti mokestį."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopija)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/lv-LV.po b/apps/web/locales/lv-LV.po
index b33d2f7ad..eeaf922d8 100644
--- a/apps/web/locales/lv-LV.po
+++ b/apps/web/locales/lv-LV.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, zero {Atlasītais fonts nevar attēlot {list}. Tās tiek rā
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Nosūta šo pieteikumu un jūsu Zināšanas; jūsu nodrošinātājs var iekasēt maksu."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopija)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/ml-IN.po b/apps/web/locales/ml-IN.po
index f4e3ae41f..4a2f0baab 100644
--- a/apps/web/locales/ml-IN.po
+++ b/apps/web/locales/ml-IN.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {നിങ്ങൾ തിരഞ്ഞെടുത്ത
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. ഈ അപേക്ഷയും നിങ്ങളുടെ അറിവും അയയ്ക്കുന്നു; നിങ്ങളുടെ ദാതാവ് നിരക്ക് ഈടാക്കിയേക്കാം."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (പകർപ്പ്)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/mr-IN.po b/apps/web/locales/mr-IN.po
index 25d0659db..24805724a 100644
--- a/apps/web/locales/mr-IN.po
+++ b/apps/web/locales/mr-IN.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {तुम्ही निवडलेला फॉन
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. हा अर्ज आणि तुमचा ज्ञानसंग्रह पाठवते; तुमचा प्रदाता शुल्क आकारू शकतो."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (कॉपी)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/ms-MY.po b/apps/web/locales/ms-MY.po
index 50cb2559d..bc2e2e8af 100644
--- a/apps/web/locales/ms-MY.po
+++ b/apps/web/locales/ms-MY.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Fon pilihan anda tidak dapat memaparkan {list}. Ia dipa
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Menghantar permohonan ini dan Pengetahuan anda; pembekal anda mungkin mengenakan caj."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (salinan)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/ne-NP.po b/apps/web/locales/ne-NP.po
index b15d7f744..0c65b8ec8 100644
--- a/apps/web/locales/ne-NP.po
+++ b/apps/web/locales/ne-NP.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {तपाईंले चयन गरेको फन
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}। यो आवेदन र तपाईंको ज्ञानभण्डार पठाउँछ; तपाईंको प्रदायकले शुल्क लिन सक्छ।"
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (प्रतिलिपि)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/nl-NL.po b/apps/web/locales/nl-NL.po
index 3d7c7c3b8..f2a963797 100644
--- a/apps/web/locales/nl-NL.po
+++ b/apps/web/locales/nl-NL.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Je gekozen lettertype kan {list} niet weergeven. Het wo
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Stuurt deze sollicitatie en uw Kennis; uw aanbieder kan kosten rekenen."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopie)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/no-NO.po b/apps/web/locales/no-NO.po
index 5eaf620cc..2716bda1b 100644
--- a/apps/web/locales/no-NO.po
+++ b/apps/web/locales/no-NO.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Den valgte skrifttypen kan ikke vise {list}. Det vises
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Sender denne søknaden og Kunnskap; leverandøren din kan ta betalt."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopi)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/or-IN.po b/apps/web/locales/or-IN.po
index 3605102e0..2354dd5f3 100644
--- a/apps/web/locales/or-IN.po
+++ b/apps/web/locales/or-IN.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {ଆପଣ ଚୟନ କରିଥିବା ଫଣ୍ଟ
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}। ଏହି ଆବେଦନ ଓ ଆପଣଙ୍କ ଜ୍ଞାନ ପଠାଏ; ଆପଣଙ୍କ ପ୍ରଦାନକାରୀ ଶୁଳ୍କ ନେଇପାରନ୍ତି।"
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (କପି)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/pl-PL.po b/apps/web/locales/pl-PL.po
index 7ea1bf81f..4cecbf059 100644
--- a/apps/web/locales/pl-PL.po
+++ b/apps/web/locales/pl-PL.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Wybrana czcionka nie obsługuje znaku {list}. Wyświetl
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Wysyła tę aplikację i Twoją Wiedzę; dostawca może pobierać opłaty."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopia)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/pt-BR.po b/apps/web/locales/pt-BR.po
index 5d0a6d3ce..2be6c3838 100644
--- a/apps/web/locales/pt-BR.po
+++ b/apps/web/locales/pt-BR.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {A fonte selecionada não consegue exibir {list}. Ele ap
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Envia esta candidatura e seu Conhecimento; seu provedor pode cobrar."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (cópia)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/pt-PT.po b/apps/web/locales/pt-PT.po
index eebaed17a..010b1861b 100644
--- a/apps/web/locales/pt-PT.po
+++ b/apps/web/locales/pt-PT.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {A fonte selecionada não consegue apresentar {list}. Ap
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Envia esta candidatura e o seu Conhecimento; o seu fornecedor pode cobrar."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (cópia)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/ro-RO.po b/apps/web/locales/ro-RO.po
index 0121a9568..6c386583e 100644
--- a/apps/web/locales/ro-RO.po
+++ b/apps/web/locales/ro-RO.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Fontul selectat nu poate afișa {list}. Apare ca “?
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Trimite această candidatură și Cunoștințele dvs.; furnizorul poate percepe o taxă."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (copie)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/ru-RU.po b/apps/web/locales/ru-RU.po
index eae5f37e4..a393c1bab 100644
--- a/apps/web/locales/ru-RU.po
+++ b/apps/web/locales/ru-RU.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Выбранный шрифт не может отоб
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Отправляет эту заявку и ваши Знания; провайдер может взимать плату."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (копия)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/sk-SK.po b/apps/web/locales/sk-SK.po
index bba0b812d..61ff9e2e8 100644
--- a/apps/web/locales/sk-SK.po
+++ b/apps/web/locales/sk-SK.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Vybrané písmo nedokáže zobraziť {list}. Zobrazuje
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Odošle túto žiadosť a vaše Znalosti; váš poskytovateľ si môže účtovať poplatok."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kópia)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/sl-SI.po b/apps/web/locales/sl-SI.po
index 707544f96..dec389879 100644
--- a/apps/web/locales/sl-SI.po
+++ b/apps/web/locales/sl-SI.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Izbrana pisava ne more prikazati {list}. Prikaže se ko
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Pošlje to prijavo in vaše Znanje; vaš ponudnik lahko to zaračuna."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopija)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/sq-AL.po b/apps/web/locales/sq-AL.po
index 22db2e69e..ffd37fe70 100644
--- a/apps/web/locales/sq-AL.po
+++ b/apps/web/locales/sq-AL.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Fonti i zgjedhur nuk mund të shfaqë {list}. Shfaqet s
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Dërgon këtë aplikim dhe Njohuritë tuaja; ofruesi juaj mund t’ju faturojë."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopje)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/sr-SP.po b/apps/web/locales/sr-SP.po
index ca256b95e..9e0e3e202 100644
--- a/apps/web/locales/sr-SP.po
+++ b/apps/web/locales/sr-SP.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Изабрани фонт не може да прика
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Шаље ову пријаву и ваше Знање; ваш провајдер може да наплати."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (копија)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/sv-SE.po b/apps/web/locales/sv-SE.po
index 4972fec43..8176895ef 100644
--- a/apps/web/locales/sv-SE.po
+++ b/apps/web/locales/sv-SE.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Det valda typsnittet kan inte visa {list}. Det visas so
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Skickar den här ansökan och din Kunskap; din leverantör kan ta betalt."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopia)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/ta-IN.po b/apps/web/locales/ta-IN.po
index 190cac781..d8cc1c5e6 100644
--- a/apps/web/locales/ta-IN.po
+++ b/apps/web/locales/ta-IN.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {நீங்கள் தேர்ந்தெடுத
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. இந்த விண்ணப்பத்தையும் உங்கள் அறிவுத் தளத்தையும் அனுப்பும்; உங்கள் வழங்குநர் கட்டணம் வசூலிக்கலாம்."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (நகல்)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/te-IN.po b/apps/web/locales/te-IN.po
index f90d18b5e..17f92a63a 100644
--- a/apps/web/locales/te-IN.po
+++ b/apps/web/locales/te-IN.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {మీరు ఎంచుకున్న ఫాంట
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. ఈ దరఖాస్తును, మీ నాలెడ్జ్‌ను పంపుతుంది; మీ ప్రొవైడర్ ఛార్జ్ చేయవచ్చు."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (కాపీ)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/th-TH.po b/apps/web/locales/th-TH.po
index 71592c589..67deca8fb 100644
--- a/apps/web/locales/th-TH.po
+++ b/apps/web/locales/th-TH.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {ฟอนต์ที่คุณเลือกแส
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel} ส่งใบสมัครนี้และคลังความรู้ของคุณ ผู้ให้บริการอาจเรียกเก็บค่าบริการ"
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (สำเนา)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/tr-TR.po b/apps/web/locales/tr-TR.po
index cbf22266b..733b890ab 100644
--- a/apps/web/locales/tr-TR.po
+++ b/apps/web/locales/tr-TR.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Seçtiğiniz yazı tipi {list} karakterini gösteremiyo
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Bu başvuruyu ve Bilgi Bankanızı gönderir; sağlayıcınız ücret alabilir."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (kopya)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/uk-UA.po b/apps/web/locales/uk-UA.po
index 38390caf9..2f110a07f 100644
--- a/apps/web/locales/uk-UA.po
+++ b/apps/web/locales/uk-UA.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Вибраний шрифт не може відобр
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Надсилає цю заявку та ваші Знання; постачальник може стягнути плату."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (копія)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/uz-UZ.po b/apps/web/locales/uz-UZ.po
index 1eaa4750c..2523e8ecd 100644
--- a/apps/web/locales/uz-UZ.po
+++ b/apps/web/locales/uz-UZ.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Tanlangan shrift {list} belgisini ko‘rsata olmaydi. U
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Ushbu ariza va Bilimlaringizni yuboradi; provayderingiz haq olishi mumkin."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (nusxa)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/vi-VN.po b/apps/web/locales/vi-VN.po
index 29f9f97ac..dba6f6e84 100644
--- a/apps/web/locales/vi-VN.po
+++ b/apps/web/locales/vi-VN.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {Phông chữ bạn chọn không hiển thị được
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}. Gửi hồ sơ ứng tuyển này và Kiến thức của bạn; nhà cung cấp có thể tính phí."
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0} (bản sao)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/zh-CN.po b/apps/web/locales/zh-CN.po
index 76586755c..e7ceee5c8 100644
--- a/apps/web/locales/zh-CN.po
+++ b/apps/web/locales/zh-CN.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {您选择的字体无法显示 {list},它会显示为
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}。将发送此申请和您的知识库;您的提供商可能会收费。"
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0}(副本)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/zh-TW.po b/apps/web/locales/zh-TW.po
index cd320aea0..add9dcac3 100644
--- a/apps/web/locales/zh-TW.po
+++ b/apps/web/locales/zh-TW.po
@@ -424,11 +424,6 @@ msgstr "{0, plural, one {您選擇的字體無法顯示 {list},它會顯示為
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr "{0} · {providerLabel}。將傳送這筆應徵和您的知識庫;您的提供者可能會收費。"
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr "{0}(副本)"
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/locales/zu-ZA.po b/apps/web/locales/zu-ZA.po
index 61e30f40b..4ab4cd847 100644
--- a/apps/web/locales/zu-ZA.po
+++ b/apps/web/locales/zu-ZA.po
@@ -419,11 +419,6 @@ msgstr ""
msgid "{0} · {providerLabel}. Sends this application and your Knowledge; your provider may charge."
msgstr ""
-#. placeholder {0}: document.name
-#: src/features/documents/document-actions.tsx
-msgid "{0} (copy)"
-msgstr ""
-
#. placeholder {0}: current.name
#. placeholder {0}: letter.name
#: src/features/letters/store.ts
diff --git a/apps/web/src/dialogs/resume/index.tsx b/apps/web/src/dialogs/resume/index.tsx
index 4faf5de19..9e014b785 100644
--- a/apps/web/src/dialogs/resume/index.tsx
+++ b/apps/web/src/dialogs/resume/index.tsx
@@ -27,7 +27,7 @@ import { useAppForm } from "@/libs/tanstack-form";
const formSchema = z.object({
id: z.string(),
- name: z.string().min(1).max(64),
+ name: z.string().trim().min(1).max(100),
tags: z.array(z.string()),
});
@@ -54,7 +54,7 @@ export function ResumeDialog({ mode, data }: ResumeDialogProps) {
const form = useAppForm({
defaultValues: {
id: data.id,
- name: isUpdate ? data.name : `${data.name} (Copy)`,
+ name: data.name,
tags: data.tags,
},
validators: { onSubmit: formSchema },
@@ -127,7 +127,7 @@ export function ResumeDialog({ mode, data }: ResumeDialogProps) {
render={
<Input
minLength={1}
- maxLength={64}
+ maxLength={100}
name={field.name}
value={field.state.value}
onBlur={field.handleBlur}
diff --git a/apps/web/src/features/documents/document-actions.tsx b/apps/web/src/features/documents/document-actions.tsx
index b36ab0d90..66c3c7dd3 100644
--- a/apps/web/src/features/documents/document-actions.tsx
+++ b/apps/web/src/features/documents/document-actions.tsx
@@ -1,3 +1,4 @@
+import type { DocumentsSearch } from "./documents-page";
import type { DocumentSummary } from "./filter";
import type { IconName } from "@reactive-resume/ui/components/icon";
import { plural, t } from "@lingui/core/macro";
@@ -32,7 +33,7 @@ import { applicationsListQueryOptions } from "@/features/applications/queries";
import { useDocumentDownload } from "@/features/applications/use-document-download";
import { useShareOrigin } from "@/features/resume/share/use-share-origin";
import { useClosingValue } from "@/hooks/use-closing-value";
-import { useConfirm } from "@/hooks/use-confirm";
+import { useConfirm, usePrompt } from "@/hooks/use-confirm";
import { authClient } from "@/libs/auth/client";
import { toastError } from "@/libs/error-message";
import { orpc } from "@/libs/orpc/client";
@@ -53,6 +54,8 @@ function useRefreshDocuments() {
export function useDocumentActions() {
const confirm = useConfirm();
+ const prompt = usePrompt();
+ const navigate = useNavigate();
const openDialog = useDialogStore((state) => state.openDialog);
const markNew = useNewDocumentsStore((state) => state.markNew);
const refresh = useRefreshDocuments();
@@ -80,13 +83,40 @@ export function useDocumentActions() {
},
duplicate: async (document: DocumentSummary) => {
- const copied =
- document.type === "resume"
- ? duplicateResume.mutateAsync({ id: document.id, name: t`${document.name} (copy)`, tags: document.tags })
- : duplicateLetter.mutateAsync({ id: document.id }).then((letter) => letter.id);
try {
- markNew(await copied);
- toast.add({ description: t`Duplicated “${document.name}”` });
+ const suggested = await orpc.documents.suggestDuplicateName.call(ref(document));
+ const answer = await prompt(t`Duplicate`, {
+ defaultValue: suggested,
+ maxLength: 100,
+ confirmText: t`Duplicate`,
+ });
+ const name = answer?.trim().slice(0, 100);
+ if (!name) return;
+ const id =
+ document.type === "resume"
+ ? await duplicateResume.mutateAsync({ id: document.id, name, tags: document.tags })
+ : (await duplicateLetter.mutateAsync({ id: document.id, name })).id;
+ markNew(id);
+ toast.add({
+ description: t`Duplicated “${document.name}”`,
+ actionProps: {
+ children: t`Rename`,
+ onClick: () => {
+ useNewDocumentsStore.getState().requestRename(id);
+ void navigate({
+ to: "/dashboard",
+ search: (previous: DocumentsSearch) => ({
+ ...previous,
+ q: name,
+ type: document.type,
+ tags: [],
+ public: false,
+ sort: "created",
+ }),
+ });
+ },
+ },
+ });
} catch (error) {
toastError(error, t`Couldn't duplicate the document. Try again.`);
}
diff --git a/apps/web/src/features/documents/document-card.tsx b/apps/web/src/features/documents/document-card.tsx
index a3c7a92e4..50929aa64 100644
--- a/apps/web/src/features/documents/document-card.tsx
+++ b/apps/web/src/features/documents/document-card.tsx
@@ -160,7 +160,13 @@ export function DocumentCard({
disabled = false,
}: DocumentItemProps) {
const openDocument = useOpenDocument();
- const [renaming, setRenaming] = useState(false);
+ const requestedRename = useNewDocumentsStore((state) => state.renameId === document.id);
+ const [localRenaming, setLocalRenaming] = useState(false);
+ const renaming = localRenaming || requestedRename;
+ const setRenaming = (value: boolean) => {
+ setLocalRenaming(value);
+ if (!value && requestedRename) useNewDocumentsStore.getState().requestRename(null);
+ };
const isNew = useNewDocumentsStore((state) => state.ids.includes(document.id)) && !document.trashedAt;
const meta = useDocumentMeta(document);
const recipient = document.recipient;
@@ -300,7 +306,13 @@ export function DocumentRow({
}: DocumentItemProps) {
const { i18n } = useLingui();
const openDocument = useOpenDocument();
- const [renaming, setRenaming] = useState(false);
+ const requestedRename = useNewDocumentsStore((state) => state.renameId === document.id);
+ const [localRenaming, setLocalRenaming] = useState(false);
+ const renaming = localRenaming || requestedRename;
+ const setRenaming = (value: boolean) => {
+ setLocalRenaming(value);
+ if (!value && requestedRename) useNewDocumentsStore.getState().requestRename(null);
+ };
const isNew = useNewDocumentsStore((state) => state.ids.includes(document.id)) && !document.trashedAt;
const menuProps = {
document,
diff --git a/apps/web/src/features/documents/new-documents.ts b/apps/web/src/features/documents/new-documents.ts
index d89407956..dace083d9 100644
--- a/apps/web/src/features/documents/new-documents.ts
+++ b/apps/web/src/features/documents/new-documents.ts
@@ -3,6 +3,8 @@ import { createJSONStorage, persist } from "zustand/middleware";
import { create } from "zustand/react";
type NewDocumentsStore = {
+ renameId: string | null;
+ requestRename: (id: string | null) => void;
/** Documents made on this device that haven't been opened yet; their cards show "New". */
ids: readonly string[];
markNew: (id: string) => void;
@@ -15,6 +17,8 @@ const MAX_REMEMBERED = 50;
export const useNewDocumentsStore = create<NewDocumentsStore>()(
persist(
(set) => ({
+ renameId: null,
+ requestRename: (renameId) => set({ renameId }),
ids: [],
markNew: (id) =>
set((state) => ({ ids: [id, ...state.ids.filter((known) => known !== id)].slice(0, MAX_REMEMBERED) })),
@@ -23,6 +27,7 @@ export const useNewDocumentsStore = create<NewDocumentsStore>()(
}),
{
name: "new-documents",
+ partialize: ({ ids }) => ({ ids }),
// Storage can be unavailable (private windows, blocked site data); the badge is cosmetic, so go without.
storage: createJSONStorage(() => {
try {
diff --git a/apps/web/src/hooks/use-confirm.tsx b/apps/web/src/hooks/use-confirm.tsx
index d396c3e2f..d74eb46d1 100644
--- a/apps/web/src/hooks/use-confirm.tsx
+++ b/apps/web/src/hooks/use-confirm.tsx
@@ -22,6 +22,7 @@ type AskOptions = {
cancelText?: string;
/** Prompts only: the text the field starts with. */
defaultValue?: string;
+ maxLength?: number;
/** An aborted request dismisses its pending confirmation. */
signal?: AbortSignal;
/** Confirmations only: the confirm button must be held, for actions that can't be undone. */
@@ -104,6 +105,7 @@ export function ConfirmDialogProvider({ children }: { children: React.ReactNode
{state.withInput && (
<Input
value={value}
+ maxLength={state.maxLength}
aria-label={state.title}
onChange={(event) => setValue(event.target.value)}
onKeyDown={(event) => {
diff --git a/apps/web/src/routes/builder/$resumeId/-components/document-menu.tsx b/apps/web/src/routes/builder/$resumeId/-components/document-menu.tsx
index f517c2606..b36e6278b 100644
--- a/apps/web/src/routes/builder/$resumeId/-components/document-menu.tsx
+++ b/apps/web/src/routes/builder/$resumeId/-components/document-menu.tsx
@@ -139,7 +139,14 @@ function DocumentMenuItems({ onOpenDialog }: DocumentMenuItemsProps) {
<Icon name="pencil-simple" />
<Trans>Rename…</Trans>
</DropdownMenuItem>
- <DropdownMenuItem onClick={() => openDialog("resume.duplicate", { id, name, slug, tags })}>
+ <DropdownMenuItem
+ onClick={() =>
+ void orpc.documents.suggestDuplicateName
+ .call({ type: "resume", id })
+ .then((suggested) => openDialog("resume.duplicate", { id, name: suggested, slug, tags }))
+ .catch((error: unknown) => toast.add({ type: "error", description: getResumeErrorMessage(error) }))
+ }
+ >
<Icon name="copy" />
<Trans>Duplicate</Trans>
</DropdownMenuItem>
diff --git a/apps/web/src/routes/builder/letter/-components/letter-bar.tsx b/apps/web/src/routes/builder/letter/-components/letter-bar.tsx
index a9f351f72..b85e9f4aa 100644
--- a/apps/web/src/routes/builder/letter/-components/letter-bar.tsx
+++ b/apps/web/src/routes/builder/letter/-components/letter-bar.tsx
@@ -124,7 +124,11 @@ function LetterMenu() {
try {
if (!(await useLetterEditorStore.getState().flush()))
throw new Error(t`Couldn't save your changes. Try again before continuing.`);
- const copy = await client.coverLetters.duplicate({ id });
+ const suggested = await client.documents.suggestDuplicateName({ type: "letter", id });
+ const answer = await prompt(t`Duplicate`, { defaultValue: suggested, maxLength: 100, confirmText: t`Duplicate` });
+ const copyName = answer?.trim().slice(0, 100);
+ if (!copyName) return;
+ const copy = await client.coverLetters.duplicate({ id, name: copyName });
void queryClient.invalidateQueries({ queryKey: orpc.documents.key() });
toast.add({ description: t`Letter duplicated` });
void navigate({ to: "/builder/letter/$coverLetterId", params: { coverLetterId: copy.id } });
diff --git a/docs/guides/managing-documents.mdx b/docs/guides/managing-documents.mdx
index aca68565d..b2b6efb6b 100644
--- a/docs/guides/managing-documents.mdx
+++ b/docs/guides/managing-documents.mdx
@@ -91,13 +91,24 @@ Every card and row has a **⋯** menu. You can also right-click a card or row (o
| **Download PDF** | Downloads the document's current version as a PDF. |
| **Select** | Starts a selection with this document, for actions on several at once. |
| **Rename** | Lets you edit the name in place. |
-| **Duplicate** | Makes a copy named "… (copy)" with the same tags. |
+| **Duplicate** | Asks for a name, suggesting an available numbered name, and copies the document and tags. |
| **Copy for a job…** | Resumes only. Makes a copy linked to a job application. |
| **Link to application…** | Letters only. Links the letter to one of your open applications, or unlinks it. **Add a job…** saves a new one from a link or posting and links it. |
| **Tags…** | Adds or removes tags. |
| **Lock editing** / **Unlock** | Protects the document from changes, or allows them again. |
| **Move to Trash** | Moves the document to Trash, where you can restore it for 30 days. |
+**Duplicate** suggests names such as “Fictional portfolio 2” and “Fictional portfolio 3”, checking your whole library, including Trash. Copying a numbered copy continues the same sequence while its base document is present. You can change the suggested name before saving; **Cancel** creates nothing. Names can contain up to 100 characters. The Android and iPhone apps offer the same naming step.
+
+After duplication, choose **Rename** in the confirmation to edit the new copy. On the web this brings the copy into view and selects its name for inline editing; on Android and iPhone it opens the copy's Rename sheet. The original document keeps its name and content.
+
+<Frame caption="Choose a name before making a copy">
+ <img
+ src="/images/guides/managing-documents/duplicate-name.png"
+ alt="Duplicate dialog suggests Fictional portfolio 2 and offers Cancel and Duplicate"
+ />
+</Frame>
+
## Act on several documents
Tick a document's checkbox (in list view, or on a card's top corner; on touch screens the box is always shown), or choose **Select** from its menu. A bar appears at the bottom of the page, above the tab bar on phones, with **Tags…**, **Sharing** and **Move to Trash**. The page leaves room to scroll the final row above the bar. **Sharing** can lock or unlock documents; public and private links apply to resumes only. **Select this page** adds the rest of the page; the **×** or <kbd>Esc</kbd> clears the selection.
diff --git a/docs/images/guides/managing-documents/duplicate-name.png b/docs/images/guides/managing-documents/duplicate-name.png
new file mode 100644
index 000000000..b7f804636
Binary files /dev/null and b/docs/images/guides/managing-documents/duplicate-name.png differ
diff --git a/docs/spec.json b/docs/spec.json
index b0a52de2a..07bd89af2 100644
--- a/docs/spec.json
+++ b/docs/spec.json
@@ -70101,6 +70101,108 @@
]
}
},
+ "/documents/duplicate-name": {
+ "get": {
+ "operationId": "suggestDuplicateDocumentName",
+ "summary": "Suggest a duplicate name",
+ "description": "Suggests an available numbered name across this account’s documents, including Trash. Reads names only; does not create or reserve a document. Requires authentication.",
+ "tags": [
+ "Documents"
+ ],
+ "parameters": [
+ {
+ "name": "type",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "enum": [
+ "resume",
+ "letter"
+ ],
+ "type": "string",
+ "description": "resume, or letter (a saved cover letter)."
+ },
+ "allowEmptyValue": true,
+ "allowReserved": true
+ },
+ {
+ "name": "id",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "minLength": 1,
+ "description": "The ID of the resume or cover letter."
+ },
+ "allowEmptyValue": true,
+ "allowReserved": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 100
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Structured API error. See status and code; do not branch on message text.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "defined",
+ "code",
+ "status",
+ "message"
+ ],
+ "properties": {
+ "defined": {
+ "type": "boolean"
+ },
+ "code": {
+ "type": "string"
+ },
+ "status": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ },
+ "data": {}
+ }
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "apiKey": []
+ },
+ {
+ "bearerAuth": []
+ },
+ {
+ "cookieAuth": []
+ }
+ ],
+ "x-codeSamples": [
+ {
+ "lang": "bash",
+ "label": "cURL",
+ "source": "curl \"https://rxresu.me/api/openapi/documents/duplicate-name?type=<type>&id=<id>\" --header \"x-api-key: <api-key>\""
+ }
+ ]
+ }
+ },
"/documents/rename": {
"post": {
"operationId": "renameDocument",
@@ -114788,7 +114890,7 @@
"post": {
"operationId": "duplicateResume",
"summary": "Duplicate a resume",
- "description": "Creates a copy of an existing resume with the same data, and the given name and tags. The slug is optional: when omitted it is generated from the name, made unique across the user's resumes, and follows the name until the copy is published. Returns the ID of the duplicated resume. Requires authentication.",
+ "description": "Creates a copy of an existing resume with the same data and tags. When name is omitted, suggests an available numbered name across the account’s documents. The slug is optional: when omitted it is generated from the name, made unique across the user's resumes, and follows the name until the copy is published. Returns the ID of the duplicated resume. Requires authentication.",
"deprecated": true,
"tags": [
"Resumes"
@@ -132366,7 +132468,7 @@
"post": {
"operationId": "createResumeCopy",
"summary": "Duplicate a resume",
- "description": "Creates a copy of an existing resume with the same data, and the given name and tags. The slug is optional: when omitted it is generated from the name, made unique across the user's resumes, and follows the name until the copy is published. Returns the ID of the duplicated resume. Requires authentication.",
+ "description": "Creates a copy of an existing resume with the same data and tags. When name is omitted, suggests an available numbered name across the account’s documents. The slug is optional: when omitted it is generated from the name, made unique across the user's resumes, and follows the name until the copy is published. Returns the ID of the duplicated resume. Requires authentication.",
"tags": [
"Resumes"
],
diff --git a/packages/api/src/dto/documents.ts b/packages/api/src/dto/documents.ts
index 919aa9316..e76645140 100644
--- a/packages/api/src/dto/documents.ts
+++ b/packages/api/src/dto/documents.ts
@@ -86,6 +86,7 @@ export const documentsDto = {
input: z.void(),
output: z.object({ resume: z.number(), letter: z.number(), trash: z.number() }),
},
+ suggestDuplicateName: { input: documentRefSchema, output: z.string().min(1).max(100) },
rename: {
input: documentRefSchema.extend({ name: z.string().trim().min(1).max(100) }),
output: z.void(),
diff --git a/packages/api/src/features/cover-letters/service.ts b/packages/api/src/features/cover-letters/service.ts
index e21e5cde3..cbb667103 100644
--- a/packages/api/src/features/cover-letters/service.ts
+++ b/packages/api/src/features/cover-letters/service.ts
@@ -26,6 +26,7 @@ import {
CurrentClientRequired,
saveProposalApplications,
} from "../agent/proposal-applications";
+import { suggestDuplicateName } from "../documents/naming";
import { lockUser } from "../documents/ownership";
import { resumeService } from "../resume/service";
import { sanitizeCoverLetterHtml } from "./html";
@@ -390,6 +391,7 @@ async function insert(
input: {
userId: string;
name: string;
+ tags?: string[];
recipient: string;
content: string;
greeting?: string | null | undefined;
@@ -416,6 +418,7 @@ async function insert(
.insert(schema.coverLetter)
.values({
...content,
+ tags: input.tags ?? [],
userId: input.userId,
recipient: sanitizeCoverLetterHtml(content.recipient),
content: sanitizeCoverLetterHtml(content.content),
@@ -709,11 +712,17 @@ export const coverLetterService = {
return resolveLinks(await updateRevision(input, { style, sourceResumeId: input.resumeId }), input.userId);
},
duplicate: async (input: OwnedId & { name?: string | undefined }) => {
- const letter = await getRow(input);
+ const [row] = await db
+ .select()
+ .from(schema.coverLetter)
+ .where(and(eq(schema.coverLetter.id, input.id), eq(schema.coverLetter.userId, input.userId)));
+ if (!row) throw new ORPCError("NOT_FOUND");
+ const letter = toLetter(row);
const copy = await insert({
...letter,
+ tags: row.tags,
userId: input.userId,
- name: input.name ?? `${letter.name} (copy)`.slice(0, 100),
+ name: input.name ?? (await suggestDuplicateName({ ...input, type: "letter" })),
// A copy is a new document, not a second owner of the original's application.
sourceApplicationId: null,
});
diff --git a/packages/api/src/features/documents/listing.integration.test.ts b/packages/api/src/features/documents/listing.integration.test.ts
index 41f4b37d9..2bd131dac 100644
--- a/packages/api/src/features/documents/listing.integration.test.ts
+++ b/packages/api/src/features/documents/listing.integration.test.ts
@@ -129,6 +129,28 @@ describe.skipIf(!process.env.COVER_LETTER_TEST_DATABASE_URL)("document SQL pages
expect(await findFreeResumeName("naming", name)).toBe(`${stem} (4)`);
});
+ it("suggests numbered copies across types and Trash while protecting ownership", async () => {
+ await pool.query(`INSERT INTO resume (id,user_id,name) VALUES
+ ('duplicate-source','duplicates','Portfolio'),('duplicate-three','stranger','Portfolio 3');
+ INSERT INTO cover_letter (id,user_id,name,trashed_at) VALUES ('duplicate-two','duplicates','PORTFOLIO 2',now());`);
+ const { documentsRouter } = await import("./router");
+ const client = createRouterClient(documentsRouter, {
+ context: { user: { id: "duplicates" }, resHeaders: new Headers() } as never,
+ });
+ expect(await client.suggestDuplicateName({ type: "resume", id: "duplicate-source" })).toBe("Portfolio 3");
+ await pool.query(`INSERT INTO resume (id,user_id,name) VALUES ('duplicate-copy','duplicates','Portfolio 3')`);
+ expect(await client.suggestDuplicateName({ type: "resume", id: "duplicate-copy" })).toBe("Portfolio 4");
+ await pool.query(`INSERT INTO resume (id,user_id,name) VALUES ('duplicate-year','duplicates','Resume 2026')`);
+ expect(await client.suggestDuplicateName({ type: "resume", id: "duplicate-year" })).toBe("Resume 2026 2");
+ for (const id of ["duplicate-three", "missing", "duplicate-two"]) {
+ await expect(
+ client.suggestDuplicateName({ type: id === "duplicate-two" ? "letter" : "resume", id }),
+ ).rejects.toMatchObject({ code: "NOT_FOUND" });
+ }
+ const count = await pool.query(`SELECT count(*) AS count FROM resume WHERE user_id = 'duplicates'`);
+ expect(count.rows[0].count).toBe("3");
+ });
+
it("filters before paging/counting, uses every tag, searches each field and treats wildcard characters literally", async () => {
for (const q of ["orbital", "DESIGN LEAD", "design"]) {
const page = await api.page({ q, type: "resume", tags: ["design", "shared"], limit: 1, offset: 1 });
diff --git a/packages/api/src/features/documents/naming.ts b/packages/api/src/features/documents/naming.ts
new file mode 100644
index 000000000..ffb694f88
--- /dev/null
+++ b/packages/api/src/features/documents/naming.ts
@@ -0,0 +1,44 @@
+import { ORPCError } from "@orpc/client";
+import { and, eq, isNull } from "drizzle-orm";
+import { db } from "@reactive-resume/db/client";
+import { coverLetter, resume } from "@reactive-resume/db/schema";
+
+/** A name-only lookup across the owner's whole library, independent of the visible page and filters. */
+export async function suggestDuplicateName(input: { userId: string; type: "resume" | "letter"; id: string }) {
+ const table = input.type === "resume" ? resume : coverLetter;
+ const [source] = await db
+ .select({ name: table.name })
+ .from(table)
+ .where(and(eq(table.userId, input.userId), eq(table.id, input.id), isNull(table.trashedAt)));
+ if (!source) throw new ORPCError("NOT_FOUND");
+ const rows = await db
+ .select({ name: resume.name })
+ .from(resume)
+ .where(eq(resume.userId, input.userId))
+ .unionAll(db.select({ name: coverLetter.name }).from(coverLetter).where(eq(coverLetter.userId, input.userId)));
+ const names = new Set(rows.map(({ name }) => name.toLowerCase()));
+ let base = source.name.trim().replace(/(?: \(copy\))+$/i, "");
+ const numbered = /^(.*) ([1-9]\d*)$/.exec(base);
+ if (numbered?.[1]) {
+ const stem = numbered[1];
+ // Recognize copies of a 100-character name too, where the suffix displaced the end of the original.
+ const original = rows.find(
+ ({ name }) =>
+ name.toLowerCase() === stem.toLowerCase() ||
+ (name.length === 100 &&
+ name
+ .slice(0, 100 - (base.length - stem.length))
+ .trimEnd()
+ .toLowerCase() === stem.toLowerCase()),
+ );
+ if (original) base = original.name;
+ }
+ for (let number = 2; ; number++) {
+ const suffix = ` ${number}`;
+ const candidate = `${base
+ .slice(0, 100 - suffix.length)
+ .replace(/[\uD800-\uDBFF]$/u, "")
+ .trimEnd()}${suffix}`;
+ if (!names.has(candidate.toLowerCase())) return candidate;
+ }
+}
diff --git a/packages/api/src/features/documents/router.ts b/packages/api/src/features/documents/router.ts
index 8818b82d3..8be53857b 100644
--- a/packages/api/src/features/documents/router.ts
+++ b/packages/api/src/features/documents/router.ts
@@ -2,6 +2,7 @@ import z from "zod";
import { protectedProcedure } from "../../context";
import { documentsDto } from "../../dto/documents";
import { resumeMutationRateLimit } from "../../middleware/rate-limit";
+import { suggestDuplicateName } from "./naming";
import { documentsService } from "./service";
const route = (
@@ -86,6 +87,20 @@ export const documentsRouter = {
.output(documentsDto.counts.output)
.handler(({ context }) => documentsService.counts({ userId: context.user.id })),
+ suggestDuplicateName: protectedProcedure
+ .route(
+ route(
+ "GET",
+ "/documents/duplicate-name",
+ "suggestDuplicateDocumentName",
+ "Suggest a duplicate name",
+ "Suggests an available numbered name across this account’s documents, including Trash. Reads names only; does not create or reserve a document.",
+ ),
+ )
+ .input(documentsDto.suggestDuplicateName.input)
+ .output(documentsDto.suggestDuplicateName.output)
+ .handler(({ context, input }) => suggestDuplicateName({ ...input, userId: context.user.id })),
+
rename: protectedProcedure
.route(route("POST", "/documents/rename", "renameDocument", "Rename a document", "Renames a resume or letter."))
.input(documentsDto.rename.input)
diff --git a/packages/api/src/features/resume/crud.test.ts b/packages/api/src/features/resume/crud.test.ts
index 37c0c67b8..acb3fe1fd 100644
--- a/packages/api/src/features/resume/crud.test.ts
+++ b/packages/api/src/features/resume/crud.test.ts
@@ -175,7 +175,7 @@ describe("resume write route validation", () => {
operation === "create"
? client.create({ name: "Resume", tags: [], slug })
: operation === "duplicate"
- ? client.duplicate({ id: "resume-id", slug })
+ ? client.duplicate({ id: "resume-id", name: "Resume", slug })
: client.update({ id: "resume-id", slug });
await expect(result).rejects.toMatchObject({ code: "INVALID_SLUG", status: 400 });
diff --git a/packages/api/src/features/resume/crud.ts b/packages/api/src/features/resume/crud.ts
index 13133133c..0699521e6 100644
--- a/packages/api/src/features/resume/crud.ts
+++ b/packages/api/src/features/resume/crud.ts
@@ -4,6 +4,7 @@ import { protectedProcedure } from "../../context";
import { resumeDto } from "../../dto/resume";
import { resumeMutationRateLimit } from "../../middleware/rate-limit";
import { paginate } from "../../pagination";
+import { suggestDuplicateName } from "../documents/naming";
import { documentsService } from "../documents/service";
import { createResumeData } from "./initial-data";
import { parseStoredResumeData } from "./resume-data-validation";
@@ -255,7 +256,7 @@ export const crudRouter = {
operationId: "duplicateResume",
summary: "Duplicate a resume",
description:
- "Creates a copy of an existing resume with the same data, and the given name and tags. The slug is optional: when omitted it is generated from the name, made unique across the user's resumes, and follows the name until the copy is published. Returns the ID of the duplicated resume. Requires authentication.",
+ "Creates a copy of an existing resume with the same data and tags. When name is omitted, suggests an available numbered name across the account’s documents. The slug is optional: when omitted it is generated from the name, made unique across the user's resumes, and follows the name until the copy is published. Returns the ID of the duplicated resume. Requires authentication.",
successDescription: "The ID of the duplicated resume.",
})
.input(resumeDto.duplicate.input)
@@ -271,7 +272,7 @@ export const crudRouter = {
return resumeService.create({
userId: context.user.id,
- name: input.name ?? original.name,
+ name: input.name ?? (await suggestDuplicateName({ userId: context.user.id, type: "resume", id: input.id })),
...(input.slug ? { slug: input.slug } : {}),
tags: input.tags ?? original.tags,
locale: context.locale,
diff --git a/tests/e2e/specs/document-duplicate.spec.ts b/tests/e2e/specs/document-duplicate.spec.ts
new file mode 100644
index 000000000..49bf5dcc8
--- /dev/null
+++ b/tests/e2e/specs/document-duplicate.spec.ts
@@ -0,0 +1,126 @@
+import type { APIRequestContext } from "@playwright/test";
+import { expect, test } from "../fixtures/test";
+
+type Kind = "resume" | "letter";
+const endpoint = (kind: Kind) => (kind === "resume" ? "resumes" : "cover-letters");
+async function create(request: APIRequestContext, kind: Kind, name: string) {
+ const response = await request.post(`/api/openapi/${endpoint(kind)}`, {
+ data: { name, ...(kind === "resume" ? { tags: ["portfolio"] } : { content: "<p>Fictional experience.</p>" }) },
+ });
+ await expect(response).toBeOK();
+ const value = await response.json();
+ return (kind === "resume" ? value : value.id) as string;
+}
+async function read(request: APIRequestContext, kind: Kind, id: string) {
+ const response = await request.get(`/api/openapi/${endpoint(kind)}/${id}`);
+ await expect(response).toBeOK();
+ return response.json();
+}
+
+for (const kind of ["resume", "letter"] as const) {
+ test(`${kind} API defaults number repeated and long copies without losing source content`, async ({
+ authPage: page,
+ }) => {
+ const request = page.request;
+ const name = "Fictional portfolio";
+ const id = await create(request, kind, name);
+ const tags = await request.post("/api/openapi/documents/tags", { data: { type: kind, id, tags: ["portfolio"] } });
+ await expect(tags).toBeOK();
+ const original = await read(request, kind, id);
+ const duplicate = async (source: string) => {
+ const response = await request.post(`/api/openapi/${endpoint(kind)}/${source}/duplicate`, { data: {} });
+ await expect(response).toBeOK();
+ const value = await response.json();
+ return kind === "resume" ? (value as string) : (value.id as string);
+ };
+ const two = await duplicate(id);
+ expect((await read(request, kind, two)).name).toBe(`${name} 2`);
+ const three = await duplicate(two);
+ const copy = await read(request, kind, three);
+ expect(copy.name).toBe(`${name} 3`);
+ const library = await request.get("/api/openapi/documents");
+ await expect(library).toBeOK();
+ expect((await library.json()).find((row: { id: string }) => row.id === three).tags).toEqual(["portfolio"]);
+ if (kind === "resume") {
+ expect(copy.data).toEqual(original.data);
+ } else {
+ expect(copy.content).toBe(original.content);
+ expect(copy.style).toEqual(original.style);
+ }
+ const longName = "A".repeat(97) + "😀Z";
+ const long = await create(request, kind, longName);
+ const longTwo = await duplicate(long);
+ expect((await read(request, kind, longTwo)).name).toBe(`${"A".repeat(97)} 2`);
+ const longThree = await duplicate(longTwo);
+ expect((await read(request, kind, longThree)).name).toBe(`${"A".repeat(97)} 3`);
+ });
+
+ test(`${kind} builder duplicate uses the same numbered suggestion and accepts a long name`, async ({
+ authPage: page,
+ }) => {
+ const sourceName = "Fictional portfolio ".repeat(5).slice(0, 95);
+ const id = await create(page.request, kind, sourceName);
+ await page.goto(kind === "resume" ? `/builder/${id}` : `/builder/letter/${id}`);
+ await page.getByRole("button", { name: /^Document menu:/ }).click();
+ await page.getByRole("menuitem", { name: "Duplicate", exact: true }).click();
+ const dialog = page.getByRole(kind === "resume" ? "dialog" : "alertdialog", {
+ name: kind === "resume" ? "Duplicate resume" : "Duplicate",
+ exact: true,
+ });
+ const input = dialog.getByRole("textbox").first();
+ await expect(input).toHaveValue(`${sourceName.trim()} 2`);
+ const copyName = "Fictional renamed portfolio ".repeat(4).slice(0, 100).trim();
+ await input.fill(copyName);
+ await dialog.getByRole("button", { name: "Duplicate", exact: true }).click();
+ await expect(page).toHaveTitle(`${copyName} | Reactive Resume`);
+ const copyId = page.url().split("/").at(-1);
+ if (!copyId) throw new Error("Duplicate editor has no document ID");
+ expect(copyId).not.toBe(id);
+ expect((await read(page.request, kind, copyId)).name).toBe(copyName);
+ expect((await read(page.request, kind, id)).name).toBe(sourceName.trim());
+ });
+
+ test(`${kind} library duplicate asks before saving and toast Rename edits the new copy`, async ({
+ authPage: page,
+ }, testInfo) => {
+ const id = await create(page.request, kind, "Fictional portfolio");
+ const view = kind === "resume" ? "grid" : "list";
+ await page.goto(`/dashboard?view=${view}`);
+ const openDuplicate = async (name: string) => {
+ await page.getByRole("button", { name: `Options for ${name}`, exact: true }).click();
+ await page.getByRole("menuitem", { name: "Duplicate", exact: true }).click();
+ return page.getByRole("alertdialog", { name: "Duplicate", exact: true });
+ };
+ const cancelled = await openDuplicate("Fictional portfolio");
+ await expect(cancelled.getByRole("textbox")).toHaveValue("Fictional portfolio 2");
+ await cancelled.getByRole("button", { name: "Cancel", exact: true }).click();
+ const afterCancel = await page.request.get("/api/openapi/documents");
+ await expect(afterCancel).toBeOK();
+ expect((await afterCancel.json()).map((row: { id: string }) => row.id)).toEqual([id]);
+ const dialog = await openDuplicate("Fictional portfolio");
+ await expect(dialog.getByRole("textbox")).toHaveValue("Fictional portfolio 2");
+ await dialog.screenshot({ path: testInfo.outputPath("duplicate-name.png"), animations: "disabled" });
+ await dialog.getByRole("button", { name: "Duplicate", exact: true }).click();
+ await expect(page.getByRole("button", { name: "Options for Fictional portfolio 2", exact: true })).toBeVisible();
+ const next = await openDuplicate("Fictional portfolio 2");
+ await expect(next.getByRole("textbox")).toHaveValue("Fictional portfolio 3");
+ await next.getByRole("textbox").fill("Fictional custom copy");
+ await next.getByRole("button", { name: "Duplicate", exact: true }).click();
+ await expect(page.getByRole("button", { name: "Options for Fictional custom copy", exact: true })).toBeVisible();
+ await page.getByRole("button", { name: "Rename", exact: true }).last().click();
+ const input = page.getByRole("textbox", { name: "Name", exact: true });
+ await expect(input).toBeFocused();
+ await expect(input).toHaveValue("Fictional custom copy");
+ await input.fill("Fictional renamed copy");
+ await input.press("Enter");
+ await expect
+ .poll(async () => {
+ const response = await page.request.get("/api/openapi/documents");
+ return (await response.json()).map((row: { name: string }) => row.name).sort();
+ })
+ .toEqual(["Fictional portfolio", "Fictional portfolio 2", "Fictional renamed copy"]);
+ await page.goto(`/dashboard?view=${view}`);
+ await expect(page.getByRole("button", { name: "Options for Fictional renamed copy", exact: true })).toBeVisible();
+ expect((await read(page.request, kind, id)).name).toBe("Fictional portfolio");
+ });
+}