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:
parent
65a86b9f65
commit
3481a92615
BIN
attached_assets/image_1756402192466.png
Normal file
BIN
attached_assets/image_1756402192466.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
@ -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();
|
||||
|
||||
@ -228,4 +228,6 @@ export class BunnyService {
|
||||
|
||||
return `${baseUrl}?token=${token}&expires=${expires}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const bunnyService = new BunnyService();
|
||||
Loading…
Reference in New Issue
Block a user