show collection name in pin menu (#4705)

* show collection name in pin menu

* fix: fetching right collection name

* refactor: better variable names

* Update app/actions/definitions/documents.tsx

Co-authored-by: Tom Moor <tom.moor@gmail.com>

* Avoid additional translation

Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
Aditya Sharma
2023-01-15 08:47:25 +05:30
committed by GitHub
parent 0bed01a062
commit 4ca0fc32c1
2 changed files with 12 additions and 2 deletions

View File

@@ -352,7 +352,17 @@ export const duplicateDocument = createAction({
* of the collection for all collection members to see.
*/
export const pinDocumentToCollection = createAction({
name: ({ t }) => t("Pin to collection"),
name: ({ activeDocumentId = "", t, stores }) => {
const selectedDocument = stores.documents.get(activeDocumentId);
const collectionName = selectedDocument
? stores.documents.getCollectionForDocument(selectedDocument)?.name
: t("collection");
return t("Pin to {{collectionName}}", {
collectionName,
});
},
section: DocumentSection,
icon: <PinIcon />,
iconInContextMenu: false,