mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 13:48:40 +00:00
Merge pull request #934 from daslyfe/patterntab_fix
Fix pattern tab not showing patterns without created date
This commit is contained in:
commit
46c2c72637
@ -19,21 +19,20 @@ function classNames(...classes) {
|
||||
|
||||
export function PatternLabel({ pattern } /* : { pattern: Tables<'code'> } */) {
|
||||
const meta = useMemo(() => getMetadata(pattern.code), [pattern]);
|
||||
|
||||
let title = meta.title;
|
||||
if (title == null) {
|
||||
const date = new Date(pattern.created_at);
|
||||
if (isNaN(date)) {
|
||||
return;
|
||||
}
|
||||
if (!isNaN(date)) {
|
||||
title = date.toLocaleDateString();
|
||||
}
|
||||
}
|
||||
if (title == null) {
|
||||
title = pattern.hash;
|
||||
}
|
||||
if (title == null) {
|
||||
title = 'unnamed';
|
||||
}
|
||||
|
||||
return <>{`${pattern.id}: ${title} by ${Array.isArray(meta.by) ? meta.by.join(',') : 'Anonymous'}`}</>;
|
||||
}
|
||||
|
||||
@ -91,6 +90,7 @@ export function PatternsTab({ context }) {
|
||||
const viewingPatternData = parseJSON(viewingPatternStore);
|
||||
|
||||
const { userPatterns, patternFilter } = useSettings();
|
||||
|
||||
const examplePatterns = useExamplePatterns();
|
||||
const collections = examplePatterns.collections;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user