fix dashboard timestamp

This commit is contained in:
Karol Wypchlo 2021-03-02 15:10:55 +01:00
parent 4e84706c4d
commit 7402b9b639
1 changed files with 4 additions and 4 deletions

View File

@ -15,7 +15,7 @@ const fetcher = (url) => fetch(url).then((r) => r.json());
export const getServerSideProps = authServerSideProps(); export const getServerSideProps = authServerSideProps();
function SkylinkList({ items = [] }) { function SkylinkList({ items = [], timestamp }) {
return ( return (
<ul className="divide-y divide-gray-200"> <ul className="divide-y divide-gray-200">
{items.slice(0, 3).map((item) => ( {items.slice(0, 3).map((item) => (
@ -72,7 +72,7 @@ function SkylinkList({ items = [] }) {
/> />
</svg> </svg>
<time dateTime={item.downloadedOn}>{dayjs(item.downloadedOn).fromNow()}</time> {item[timestamp] && <time dateTime={item[timestamp]}>{dayjs(item[timestamp]).fromNow()}</time>}
</div> </div>
</div> </div>
</div> </div>
@ -247,7 +247,7 @@ export default function Home() {
{/* This example requires Tailwind CSS v2.0+ */} {/* This example requires Tailwind CSS v2.0+ */}
<div className="bg-white shadow overflow-hidden sm:rounded-md"> <div className="bg-white shadow overflow-hidden sm:rounded-md">
<SkylinkList items={downloads?.items} /> <SkylinkList items={downloads?.items} timestamp="downloadedOn" />
</div> </div>
</div> </div>
<div className="flex flex-col"> <div className="flex flex-col">
@ -255,7 +255,7 @@ export default function Home() {
{/* This example requires Tailwind CSS v2.0+ */} {/* This example requires Tailwind CSS v2.0+ */}
<div className="bg-white shadow overflow-hidden sm:rounded-md"> <div className="bg-white shadow overflow-hidden sm:rounded-md">
<SkylinkList items={uploads?.items} /> <SkylinkList items={uploads?.items} timestamp="uploadedOn" />
</div> </div>
</div> </div>
</div> </div>