Refactor SightingItem to display time since sighting; add timeAgo utility function
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { SightingType } from "../../../../utils/types";
|
||||
import { timeAgo } from "../../../../utils/utils";
|
||||
import NumberPlate from "../platePatch/NumberPlate";
|
||||
|
||||
type SightingItemProps = {
|
||||
@@ -7,11 +8,17 @@ type SightingItemProps = {
|
||||
|
||||
const SightingItem = ({ sighting }: SightingItemProps) => {
|
||||
const motion = sighting.motion.toLowerCase() === "away" ? true : false;
|
||||
|
||||
const timeStamp = timeAgo(sighting.timeStampMillis);
|
||||
|
||||
return (
|
||||
<div className="flex flex-row items-center border p-2 mb-2 rounded-lg border-gray-500 justify-between hover:bg-[#233241] hover:cursor-pointer">
|
||||
<div>
|
||||
<div>
|
||||
<span className="font-light border bg-blue-400 text-blue-800 px-2 rounded">{timeStamp}</span>
|
||||
</div>
|
||||
<div className="text-xl">
|
||||
VRM: <span className="font-semibold">{sighting.vrm}</span>
|
||||
<span className="font-semibold">{sighting.vrm}</span>
|
||||
</div>
|
||||
</div>
|
||||
<NumberPlate vrm={sighting.vrm} motion={motion} size="md" />
|
||||
|
||||
Reference in New Issue
Block a user