Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/use hypercert api to show reports on homepage #17

Merged
merged 4 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 41 additions & 29 deletions app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,53 @@
import type { MetaFunction } from "@remix-run/node";
import { json, useLoaderData } from "@remix-run/react";
import { fetchReports } from "~/server/impactReportHelpers";
import { Report } from "~/types";

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 = async () => {
const ownerAddress = process.env.HC_OWNER_ADDRESS;
try {
if (!ownerAddress) {
throw new Error("Owner address environment variable is not set");
}
const response = await fetchReports(ownerAddress);
return json(response);
} catch (error) {
console.error(`Failed to load impact reports: ${error}`);
return new Response(
JSON.stringify({ error: "Failed to load impact reports" }),
{
status: 500,
statusText: "Internal Server Error",
},
);
}
};

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>
);
}
37 changes: 0 additions & 37 deletions app/routes/impact-reports.tsx

This file was deleted.

15 changes: 15 additions & 0 deletions vite.config.ts.timestamp-1706631964230-8ff711d0ab27c.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// vite.config.ts
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thebeyondr looking into why this file was generated before i remove it..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey, it has to be removed anyways because the file paths are specific to your machine lol, no prob!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think i should add it to the .gitignore?
here is discussion about dealing with these files, haven't finished reading yet but doesn't seem to have consensus on the best solution

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think i should add it to the .gitignore? here is discussion about dealing with these files, haven't finished reading yet but doesn't seem to have consensus on the best solution

  • There was something in there about node versioning you could check out?
  • Did you notice it happening after you took a particular action?
  • Maybe uninstall and reinstall dependencies?

Also, we're on that discussion thread now lol

import million from "file:///Users/cjrose/Documents/VoiceDeck/app/node_modules/.pnpm/[email protected]/node_modules/million/dist/packages/compiler.mjs";
import { unstable_vitePlugin as remix } from "file:///Users/cjrose/Documents/VoiceDeck/app/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]/node_modules/@remix-run/dev/dist/index.js";
import { defineConfig } from "file:///Users/cjrose/Documents/VoiceDeck/app/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/index.js";
import tsconfigPaths from "file:///Users/cjrose/Documents/VoiceDeck/app/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite-tsconfig-paths/dist/index.mjs";
var vite_config_default = defineConfig({
plugins: [million.vite({ auto: true }), remix(), tsconfigPaths()],
test: {
include: ["./app/**/*.test.ts"]
}
});
export {
vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvVXNlcnMvY2pyb3NlL0RvY3VtZW50cy9Wb2ljZURlY2svYXBwXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCIvVXNlcnMvY2pyb3NlL0RvY3VtZW50cy9Wb2ljZURlY2svYXBwL3ZpdGUuY29uZmlnLnRzXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ltcG9ydF9tZXRhX3VybCA9IFwiZmlsZTovLy9Vc2Vycy9janJvc2UvRG9jdW1lbnRzL1ZvaWNlRGVjay9hcHAvdml0ZS5jb25maWcudHNcIjtpbXBvcnQgbWlsbGlvbiBmcm9tICdtaWxsaW9uL2NvbXBpbGVyJztcbmltcG9ydCB7IHVuc3RhYmxlX3ZpdGVQbHVnaW4gYXMgcmVtaXggfSBmcm9tIFwiQHJlbWl4LXJ1bi9kZXZcIjtcbmltcG9ydCB7IGRlZmluZUNvbmZpZyB9IGZyb20gXCJ2aXRlXCI7XG5pbXBvcnQgdHNjb25maWdQYXRocyBmcm9tIFwidml0ZS10c2NvbmZpZy1wYXRoc1wiO1xuXG5leHBvcnQgZGVmYXVsdCBkZWZpbmVDb25maWcoe1xuICBwbHVnaW5zOiBbbWlsbGlvbi52aXRlKHsgYXV0bzogdHJ1ZSB9KSwgcmVtaXgoKSwgdHNjb25maWdQYXRocygpXSxcbiAgdGVzdDoge1xuICAgICAgICAgIGluY2x1ZGU6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