diff --git a/entrypoints/sidepanel/components/EditDialog.tsx b/entrypoints/sidepanel/components/EditDialog.tsx index a863891..aa70c30 100644 --- a/entrypoints/sidepanel/components/EditDialog.tsx +++ b/entrypoints/sidepanel/components/EditDialog.tsx @@ -74,7 +74,7 @@ export default function EditDialog(props: GroupEditDialogProps): ReactElement contentBefore={ } disabled={ color === "pinned" } placeholder={ - props.type === "collection" ? getCollectionTitle(props.collection) : "" + props.type === "collection" ? getCollectionTitle(props.collection, true) : "" } value={ color === "pinned" ? i18n.t("groups.pinned") : title } onChange={ (_, e) => setTitle(e.value) } /> diff --git a/entrypoints/sidepanel/utils/getCollectionTitle.ts b/entrypoints/sidepanel/utils/getCollectionTitle.ts index aa55bc2..c6eb39e 100644 --- a/entrypoints/sidepanel/utils/getCollectionTitle.ts +++ b/entrypoints/sidepanel/utils/getCollectionTitle.ts @@ -1,8 +1,10 @@ import { CollectionItem } from "@/models/CollectionModels"; -export function getCollectionTitle(collection?: CollectionItem): string +export function getCollectionTitle(collection?: CollectionItem, useTimestamp?: boolean): string { - return collection?.title - || new Date(collection?.timestamp ?? Date.now()) - .toLocaleDateString(browser.i18n.getUILanguage(), { year: "numeric", month: "short", day: "numeric" }); + if (collection?.title !== undefined && useTimestamp !== true) + return collection.title; + + return new Date(collection?.timestamp ?? Date.now()) + .toLocaleDateString(browser.i18n.getUILanguage(), { year: "numeric", month: "short", day: "numeric" }); }