Sort library collections by newest part activity.

Extending a clip bumps the whole family to the top of date sorts on the studio and full library.
This commit is contained in:
2026-09-04 22:18:35 -05:00
parent eb0953b0e6
commit 25e7864337
+7 -2
View File
@@ -184,6 +184,11 @@ export function familyRootClip(parts: LibraryClip[]): LibraryClip {
return chronologicalParts(parts)[0] || parts[0]
}
/** Newest part in a family — keeps extended collections at the top of date sorts. */
export function familyActivityAt(parts: Array<{ createdAt?: number }>) {
return parts.reduce((max, part) => Math.max(max, Number(part.createdAt) || 0), 0)
}
export function familyLongestDuration(parts: LibraryClip[]) {
return parts.reduce((max, part) => Math.max(max, Number(part.duration) || 0), 0)
}
@@ -413,7 +418,7 @@ export function buildLibraryEntries(opts: {
: groupClips(clips).map(group => ({
kind: 'clip' as const,
key: group.key,
createdAt: group.head.createdAt,
createdAt: familyActivityAt(group.parts),
name: collectionTitle(group),
group
}))
@@ -422,7 +427,7 @@ export function buildLibraryEntries(opts: {
: groupStills(stills).map(group => ({
kind: 'still' as const,
key: group.key,
createdAt: group.head.createdAt,
createdAt: familyActivityAt(group.parts),
name: stillCollectionTitle(group),
stillGroup: group
}))