Skip to content
Snippets Groups Projects
Commit f39ff85b authored by Yusuf Akgül's avatar Yusuf Akgül :hatching_chick:
Browse files

Merge branch 'feat.GamesUIFixes' into 'main'

aaaaaaaaa

See merge request !27
parents 53b9dffd afb953c8
No related branches found
No related tags found
1 merge request!27aaaaaaaaa
Pipeline #37006 passed
......@@ -25,4 +25,23 @@ export function formatDate(data: number) {
day: 'numeric',
year: 'numeric'
})
}
\ No newline at end of file
}
export function formatTimeElapsed(createdAt: Date) {
const now = new Date();
const timeDiff = Math.abs(now.getTime() - new Date(createdAt).getTime()); // Difference in milliseconds
const seconds = Math.floor(timeDiff / 1000); // Convert to seconds
const minutes = Math.floor(seconds / 60); // Convert to minutes
const hours = Math.floor(minutes / 60); // Convert to hours
const days = Math.floor(hours / 24); // Convert to days
if (days > 0) {
return new Date(createdAt).toLocaleDateString(); // Show the date if days have passed
} else if (hours > 0) {
return hours + 'h'; // Show hours if hours have passed
} else if (minutes > 0) {
return minutes + 'm'; // Show minutes if minutes have passed
} else {
return seconds + 's'; // Show seconds if seconds have passed
}
}
......@@ -17,6 +17,7 @@
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-scroll-area": "^1.0.4",
"@radix-ui/react-select": "^1.2.2",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.4",
"@t3-oss/env-nextjs": "^0.4.0",
......@@ -1107,6 +1108,29 @@
}
}
},
"node_modules/@radix-ui/react-separator": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@radix-ui/react-separator/-/react-separator-1.0.3.tgz",
"integrity": "sha512-itYmTy/kokS21aiV5+Z56MZB54KrhPgn6eHDKkFeOLR34HMN2s8PaN47qZZAGnvupcjxHaFZnW4pQEh0BvvVuw==",
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/react-primitive": "1.0.3"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-slot": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.0.2.tgz",
......
import { Comment, Like, Post, User } from "@prisma/client";
export interface IPost {
user: Post & {
user: User;
Comment: Comment[];
Like: Like[];
}
export interface IPost extends Post {
user: User;
comments: Comment[];
likes: Like[];
}
export interface IComment extends Comment {
user: User;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment