feat: add proxy check button

This commit is contained in:
zhom
2025-11-25 14:37:17 +04:00
parent cc22384c54
commit 8a1943f84e
13 changed files with 717 additions and 69 deletions
+34
View File
@@ -0,0 +1,34 @@
/**
* Get flag icon CSS class for a country code (ISO 3166-1 alpha-2)
*/
export function getFlagIconClass(countryCode: string): string {
if (!countryCode || countryCode.length !== 2) {
return "";
}
return `fi fi-${countryCode.toLowerCase()}`;
}
/**
* Format relative time (e.g., "2 minutes ago", "1 hour ago")
*/
export function formatRelativeTime(timestamp: number): string {
const now = Math.floor(Date.now() / 1000);
const secondsAgo = now - timestamp;
if (secondsAgo < 60) {
return "just now";
}
const minutesAgo = Math.floor(secondsAgo / 60);
if (minutesAgo < 60) {
return `${minutesAgo} minute${minutesAgo !== 1 ? "s" : ""} ago`;
}
const hoursAgo = Math.floor(minutesAgo / 60);
if (hoursAgo < 24) {
return `${hoursAgo} hour${hoursAgo !== 1 ? "s" : ""} ago`;
}
const daysAgo = Math.floor(hoursAgo / 24);
return `${daysAgo} day${daysAgo !== 1 ? "s" : ""} ago`;
}