aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/record.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/components/record.js')
-rw-r--r--frontend/src/components/record.js56
1 files changed, 0 insertions, 56 deletions
diff --git a/frontend/src/components/record.js b/frontend/src/components/record.js
deleted file mode 100644
index 80e084d..0000000
--- a/frontend/src/components/record.js
+++ /dev/null
@@ -1,56 +0,0 @@
1import React, { useEffect, useRef, useState } from 'react';
2import { useLocation, Link } from "react-router-dom";
3
4import "./record.css"
5
6export default function Record({ name, place, portals, time, date }) {
7 // const {token} = prop;
8 const [record, setRecord] = useState(null);
9 const location = useLocation();
10
11 // useEffect(() => {
12 // console.log(name, place, portals, time, date);
13 // })
14
15 function timeSince() {
16 const now = new Date();
17 const dateNew = new Date(date);
18
19 const secondsPast = Math.floor((now - dateNew) / 1000);
20
21 if (secondsPast < 60) {
22 return `${secondsPast} seconds ago`;
23 }
24 if (secondsPast < 3600) {
25 const minutes = Math.floor(secondsPast / 60);
26 return `${minutes} minutes ago`;
27 }
28 if (secondsPast < 86400) {
29 const hours = Math.floor(secondsPast / 3600);
30 return `${hours} hours ago`;
31 }
32 if (secondsPast < 2592000) {
33 const days = Math.floor(secondsPast / 86400);
34 return `${days} days ago`;
35 }
36 if (secondsPast < 31536000) {
37 const months = Math.floor(secondsPast / 2592000);
38 return `${months} months ago`;
39 }
40 const years = Math.floor(secondsPast / 31536000);
41 return `${years} years ago`;
42 }
43
44 return(
45 <div className='record-container'>
46 <span>{place}</span>
47 <div style={{display: "flex", alignItems: "center"}}>
48 <img style={{height: "40px", borderRadius: "200px"}} src="https://avatars.steamstatic.com/32d110951da2339d8b8d8419bc945d9a2b150b2a_full.jpg"></img>
49 <span style={{paddingLeft: "5px", fontFamily: "BarlowSemiCondensed-SemiBold"}}>{name}</span>
50 </div>
51 <span style={{fontFamily: "BarlowCondensed-Bold", color: "#D980FF"}}>{portals}</span>
52 <span>{time}</span>
53 <span>{timeSince()}</span>
54 </div>
55 )
56}