Improve video view count display and optimize Bunny service integration

Update `formatViews` to handle undefined view counts and instantiate `BunnyService` in `bunny.ts`.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d7424866-83d1-4486-a212-ac12b4c7becf
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/d7424866-83d1-4486-a212-ac12b4c7becf/eEXLcyA
This commit is contained in:
sebastjanartic 2025-08-28 17:30:37 +00:00
parent 65a86b9f65
commit 3481a92615
3 changed files with 5 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -5,7 +5,8 @@ import { type Video } from "@shared/schema";
import go4LogoPath from "@assets/go4_1756394900352.png";
// Helper functions
const formatViews = (views: number): string => {
const formatViews = (views: number | undefined): string => {
if (!views) return '0';
if (views >= 1000000) return `${(views / 1000000).toFixed(1)}M`;
if (views >= 1000) return `${(views / 1000).toFixed(1)}K`;
return views.toString();

View File

@ -228,4 +228,6 @@ export class BunnyService {
return `${baseUrl}?token=${token}&expires=${expires}`;
}
}
}
export const bunnyService = new BunnyService();