-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from VoiceDeck/feat/homepage-show-reports
feat/use hypercert api to show reports on homepage
- Loading branch information
Showing
6 changed files
with
41 additions
and
86 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
2 changes: 1 addition & 1 deletion
2
app/server/impactReportHelpers.test.ts → app/impact-reports.test.ts
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 |
---|---|---|
@@ -1,41 +1,46 @@ | ||
import type { MetaFunction } from "@remix-run/node"; | ||
import type { LoaderFunction, MetaFunction } from "@remix-run/node"; | ||
import { json, useLoaderData } from "@remix-run/react"; | ||
import { Report } from "~/types"; | ||
import { fetchReports } from "../impact-reports.server"; | ||
|
||
export const meta: MetaFunction = () => { | ||
return [ | ||
{ title: "New Remix App" }, | ||
{ name: "description", content: "Welcome to Remix!" }, | ||
{ title: "VoiceDeck" }, | ||
{ name: "description", content: "Welcome to VoiceDeck!" }, | ||
]; | ||
}; | ||
|
||
export const loader: LoaderFunction = async () => { | ||
const ownerAddress = process.env.HC_OWNER_ADDRESS; | ||
if (!ownerAddress) | ||
throw new Error("Owner address environment variable is not set"); | ||
try { | ||
const response = await fetchReports(ownerAddress); | ||
return json(response); | ||
} catch (error) { | ||
console.error(`Failed to load impact reports: ${error}`); | ||
throw new Response("Failed to load impact reports", { status: 500 }); | ||
} | ||
}; | ||
|
||
export default function Index() { | ||
const reports = useLoaderData<typeof loader>(); | ||
return ( | ||
<div> | ||
<h1 className="text-7xl">Welcome to Remix</h1> | ||
<ul> | ||
<li> | ||
<a | ||
target="_blank" | ||
href="https://remix.run/tutorials/blog" | ||
rel="noreferrer" | ||
> | ||
15m Quickstart Blog Tutorial | ||
</a> | ||
</li> | ||
<li> | ||
<a | ||
target="_blank" | ||
href="https://remix.run/tutorials/jokes" | ||
rel="noreferrer" | ||
> | ||
Deep Dive Jokes App Tutorial | ||
</a> | ||
</li> | ||
<li> | ||
<a target="_blank" href="https://remix.run/docs" rel="noreferrer"> | ||
Remix Docs | ||
</a> | ||
</li> | ||
</ul> | ||
<div className="flex flex-col gap-10"> | ||
<h1 className="text-7xl">VoiceDeck</h1> | ||
<h2 className="text-5xl">Reports</h2> | ||
{reports.map((report: Report) => ( | ||
<div key={report.id}> | ||
<div>ID: {report.id}</div> | ||
<div>TTILE: {report.title}</div> | ||
<div>SUMMARY: {report.summary}</div> | ||
<div>IMAGE: {report.image.slice(0, 50)}</div> | ||
<div>STATE: {report.state}</div> | ||
<div>CATEGORY: {report.category}</div> | ||
<div>TOTAL COST: {report.totalCost}</div> | ||
<div>FUNDED SO FAR: {report.fundedSoFar}</div> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.