title order

This commit is contained in:
Jade (Rose) Rowland 2024-01-21 11:27:48 -05:00
parent d31d154841
commit b1d49552ae

View File

@ -20,9 +20,6 @@ function classNames(...classes) {
export function PatternLabel({ pattern } /* : { pattern: Tables<'code'> } */) {
const meta = useMemo(() => getMetadata(pattern.code), [pattern]);
let title = meta.title;
if (title == null) {
title == pattern.hash;
}
if (title == null) {
const date = new Date(pattern.created_at);
if (isNaN(date)) {
@ -30,6 +27,9 @@ export function PatternLabel({ pattern } /* : { pattern: Tables<'code'> } */) {
}
title = date.toLocaleDateString();
}
if (title == null) {
title = pattern.hash;
}
if (title == null) {
title = 'unnamed';
}