generated from tantodefi/speedrun-lukso
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
discover profiles, twitter username fix
- Loading branch information
1 parent
8aa1fd7
commit c2e20c8
Showing
6 changed files
with
69 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { NextApiRequest, NextApiResponse } from "next/types"; | ||
import { ups } from "~~/lib/db"; | ||
|
||
type ResponseData = object; | ||
|
||
export default async function Profiles(req: NextApiRequest, res: NextApiResponse<ResponseData>) { | ||
let result = {}; | ||
try { | ||
result = await ups.find({}).sort({ _id: -1 }).toArray(); | ||
} catch (e) {} | ||
res.status(200).json(result); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,48 @@ | ||
import type { NextPage } from "next"; | ||
import { ReactElement, useEffect, useState } from "react"; | ||
import Link from "next/link"; | ||
import axios from "axios"; | ||
import { ProfileCard } from "~~/components"; | ||
import Layout from "~~/components/layout"; | ||
import { NextPageWithLayout } from "~~/pages/_app"; | ||
|
||
// TODO | ||
const Profiles: NextPageWithLayout = () => { | ||
const [isLoading, setIsLoading] = useState(false); | ||
const [profiles, setProfiles] = useState([]); | ||
|
||
const fetchProfiles = () => { | ||
console.log("Fetching tokens..."); | ||
setIsLoading(true); | ||
axios.get("/api/profiles").then(result => { | ||
setProfiles(result.data); | ||
console.log(result.data); | ||
setIsLoading(false); | ||
}); | ||
}; | ||
|
||
useEffect(() => { | ||
fetchProfiles(); | ||
}, []); | ||
|
||
const Profiles: NextPage = () => { | ||
return ( | ||
<div className="px-5 md:px-10 lg:px-20 py-20"> | ||
<div className="flex justify-center items-center mb-20 gap-4"> | ||
<h1 className="text-center text-5xl mb-0 mt-1 font-bold">Discover Profiles</h1> | ||
</div> | ||
|
||
<div className="grid grid-cols-1 xl:grid-cols-3 gap-10"> | ||
TODO | ||
{/* {verifiedProfiles && | ||
verifiedProfiles.map((profile: upRegistryProfile) => ( | ||
<Link href={`/profile/${profile.up}`} key={profile.upLukso}> | ||
<ProfileCard upAddress={profile.upLukso} /> | ||
{!isLoading && | ||
profiles.map((profile: any) => ( | ||
<Link href={`/profile/${profile.up}`} key={profile.up}> | ||
<ProfileCard upAddress={profile.up} /> | ||
</Link> | ||
))} */} | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
Profiles.getLayout = function getLayout(page: ReactElement) { | ||
return <Layout>{page}</Layout>; | ||
}; | ||
|
||
export default Profiles; |