Skip to content

Commit

Permalink
feat: unique users by protocols and filters (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
pradel authored Mar 18, 2024
1 parent 865aa5c commit 24e656f
Show file tree
Hide file tree
Showing 11 changed files with 494 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ next-env.d.ts

# Local Database
sqlite.db
sqlite.db-*

# Chainhooks
chainhooks.production.json
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ fly deploy --remote-only
```

Finally upload the chainhooks predicates file `chainhooks.production.json` to the [Hiro platform](https://platform.hiro.so/) for your project.

## Download the production database locally

```bash
flyctl ssh issue --agent
flyctl proxy 10022:22
scp -r -P 10022 root@localhost:/data /your/local/path/where/to/copy/data
```
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"next": "14.1.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"recharts": "2.12.3",
"sharp": "0.33.2",
"tailwind-merge": "2.2.1",
"tailwindcss-animate": "1.0.7",
Expand Down
222 changes: 220 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { UniqueUsersBarChart } from "@/components/Stats/UniqueUsersBarChart";
import { TransactionRow } from "@/components/Transaction/TransactionRow";
import { getTransactions, getTransactionsStats } from "@/db/transactions";
import { Card, Container, Heading, Separator, Text } from "@radix-ui/themes";
import { Fragment } from "react";
import { Fragment, Suspense } from "react";

export const dynamic = "force-dynamic";
// TODO
// Cache the page for 60 seconds
// export const revalidate = 60;

export default async function HomePage() {
const transactions = await getTransactions();
const stats = await getTransactionsStats();
const [transactions, stats] = await Promise.all([
getTransactions(),
getTransactionsStats(),
]);

return (
<Container size="2" className="px-4 pb-10 pt-5">
Expand All @@ -30,6 +36,10 @@ export default async function HomePage() {
</Card>
</div>

<Suspense>
<UniqueUsersBarChart />
</Suspense>

<div className="mt-10">
<Heading as="h2" size="3" color="gray">
Transactions
Expand Down
Loading

0 comments on commit 24e656f

Please sign in to comment.