feat: comments
fix: use select instead of dropdown for filter on /market
This commit is contained in:
parent
800b5d1a09
commit
bd05b269fe
22 changed files with 2715 additions and 97 deletions
|
|
@ -93,7 +93,7 @@ export function formatRelativeTime(timestamp: string | Date): string {
|
|||
|
||||
if (seconds < 60) return `${seconds}s`;
|
||||
if (minutes < 60) return `${minutes}m`;
|
||||
|
||||
|
||||
if (hours < 24) {
|
||||
const extraMinutes = minutes % 60;
|
||||
return extraMinutes === 0 ? `${hours}hr` : `${hours}hr ${extraMinutes}m`;
|
||||
|
|
@ -125,4 +125,18 @@ export function formatRelativeTime(timestamp: string | Date): string {
|
|||
return remainingMonths === 0 ? `${years}y` : `${years}y ${remainingMonths}m`;
|
||||
}
|
||||
|
||||
export function formatTimeAgo(date: string) {
|
||||
const now = new Date();
|
||||
const commentDate = new Date(date);
|
||||
const diffMs = now.getTime() - commentDate.getTime();
|
||||
const diffMins = Math.floor(diffMs / (1000 * 60));
|
||||
const diffHours = Math.floor(diffMs / (1000 * 60 * 60));
|
||||
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
||||
|
||||
if (diffMins < 1) return 'Just now';
|
||||
if (diffMins < 60) return `${diffMins}m ago`;
|
||||
if (diffHours < 24) return `${diffHours}h ago`;
|
||||
return `${diffDays}d ago`;
|
||||
}
|
||||
|
||||
export const formatMarketCap = formatValue;
|
||||
|
|
|
|||
Reference in a new issue