mirror of
https://github.com/XFox111/TabsAsideExtension.git
synced 2026-04-22 07:58:01 +03:00
fix: show timestamp-based title in edit dialog title placeholder
This commit is contained in:
@@ -74,7 +74,7 @@ export default function EditDialog(props: GroupEditDialogProps): ReactElement
|
|||||||
contentBefore={ <Rename20Regular /> }
|
contentBefore={ <Rename20Regular /> }
|
||||||
disabled={ color === "pinned" }
|
disabled={ color === "pinned" }
|
||||||
placeholder={
|
placeholder={
|
||||||
props.type === "collection" ? getCollectionTitle(props.collection) : ""
|
props.type === "collection" ? getCollectionTitle(props.collection, true) : ""
|
||||||
}
|
}
|
||||||
value={ color === "pinned" ? i18n.t("groups.pinned") : title }
|
value={ color === "pinned" ? i18n.t("groups.pinned") : title }
|
||||||
onChange={ (_, e) => setTitle(e.value) } />
|
onChange={ (_, e) => setTitle(e.value) } />
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { CollectionItem } from "@/models/CollectionModels";
|
import { CollectionItem } from "@/models/CollectionModels";
|
||||||
|
|
||||||
export function getCollectionTitle(collection?: CollectionItem): string
|
export function getCollectionTitle(collection?: CollectionItem, useTimestamp?: boolean): string
|
||||||
{
|
{
|
||||||
return collection?.title
|
if (collection?.title !== undefined && useTimestamp !== true)
|
||||||
|| new Date(collection?.timestamp ?? Date.now())
|
return collection.title;
|
||||||
.toLocaleDateString(browser.i18n.getUILanguage(), { year: "numeric", month: "short", day: "numeric" });
|
|
||||||
|
return new Date(collection?.timestamp ?? Date.now())
|
||||||
|
.toLocaleDateString(browser.i18n.getUILanguage(), { year: "numeric", month: "short", day: "numeric" });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user