Skip to content

Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.

refactor(analytics): name the Shorts duration rule isShort

spacesdrive71a73244b7ca
diff --git a/frontend/src/features/analytics/shorts/shortsLibrary.ts b/frontend/src/features/analytics/shorts/shortsLibrary.ts
index 95c7911..b920a9c 100644
--- a/frontend/src/features/analytics/shorts/shortsLibrary.ts
+++ b/frontend/src/features/analytics/shorts/shortsLibrary.ts
@@ -31,8 +31,12 @@ export function shortsSortOf(value: string): ShortsSortField {
return SHORTS_SORT_OPTIONS.find(option => option.value === value)?.value ?? 'viewCount';
}
+export function isShort(video: Pick<LibraryVideo, 'durationSeconds'>): boolean {
+ return video.durationSeconds > 0 && video.durationSeconds <= SHORT_MAX_SECONDS;
+}
+
export function shortsOf(videos: LibraryVideo[]): LibraryVideo[] {
- return videos.filter(video => video.durationSeconds > 0 && video.durationSeconds <= SHORT_MAX_SECONDS);
+ return videos.filter(isShort);
}
function sortValue(item: LibraryVideo, field: ShortsSortField): number {