-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Alexandru Matei <[email protected]>
- Loading branch information
1 parent
e1a6fc8
commit 28d0779
Showing
13 changed files
with
231 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./balances"; | ||
export * from "./deposits"; | ||
export * from "./stats-page"; |
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,19 @@ | ||
import { NextFunction, Response } from "express"; | ||
import { StatsPageService } from "../services/stats-page"; | ||
|
||
export class StatsPageController { | ||
constructor(private statsPageService: StatsPageService) {} | ||
|
||
public getStatsPage = async ( | ||
req: Request, | ||
res: Response, | ||
next: NextFunction, | ||
) => { | ||
try { | ||
const data = await this.statsPageService.getStatsPageData(); | ||
res.render(`${__dirname}/../views/pages/index`, data); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}; | ||
} |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * as deposits from "./deposits"; | ||
export * as balances from "./balances"; | ||
export * as statsPage from "./stats-page"; |
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 { NextFunction, Router, Request, Response } from "express"; | ||
import { DataSource } from "@repo/indexer-database"; | ||
import { StatsPageService } from "../services"; | ||
import { StatsPageController } from "../controllers"; | ||
|
||
export function getRouter(db: DataSource): Router { | ||
const router = Router(); | ||
const statsPageService = new StatsPageService(db); | ||
const statsPageController = new StatsPageController(statsPageService); | ||
router.get("/pages/stats", statsPageController.getStatsPage as any); | ||
return router; | ||
} |
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 +1,2 @@ | ||
export * as deposits from "./deposits"; | ||
export * from "./stats-page"; |
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,14 @@ | ||
import { DataSource, entities } from "@repo/indexer-database"; | ||
|
||
export class StatsPageService { | ||
constructor(private db: DataSource) {} | ||
|
||
public async getStatsPageData() { | ||
const bundles = await this.db.getRepository(entities.Bundle).find({ | ||
relations: { proposal: true }, | ||
order: { proposal: { blockNumber: "DESC" } }, | ||
take: 6, | ||
}); | ||
return { bundles }; | ||
} | ||
} |
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,39 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<%- include('../partials/head'); %> | ||
</head> | ||
|
||
<body> | ||
<%- include('../partials/header'); %> | ||
<h1>Recent Bundles</h1> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Block</th> | ||
<th>Status</th> | ||
<th>Transaction</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% bundles.forEach(function(bundle) { %> | ||
<tr> | ||
<td> | ||
<%=bundle.proposal.blockNumber%> | ||
</td> | ||
<td class=<%= bundle.status == 'Executed' ? "green" : "" %>> | ||
<%=bundle.status%> | ||
</td> | ||
<td> | ||
<a href="https://etherscan.io/tx/<%= bundle.proposal.transactionHash %>" target="_blank"> | ||
<%=bundle.proposal.transactionHash%> | ||
</a> | ||
</td> | ||
</tr> | ||
<% }); %> | ||
</tbody> | ||
</table> | ||
</body> | ||
|
||
</html> |
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,77 @@ | ||
<meta charset="UTF-8"> | ||
<title>Across Indexer</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Barlow&display=swap" rel="stylesheet"> | ||
<style> | ||
* { | ||
box-sizing: border-box; | ||
line-height: 1.5; | ||
font-family: "Barlow", sans-serif; | ||
font-weight: 400; | ||
font-style: normal; | ||
-webkit-font-smoothing: antialiased; | ||
} | ||
body { | ||
background-color: #2d2e33; | ||
color: #e0f3ff; | ||
} | ||
header { | ||
display: flex; | ||
align-items: center; | ||
gap: 16px; | ||
} | ||
h1 { | ||
font-size: 1.125rem; | ||
line-height: 1.625rem; | ||
color: rgb(224, 243, 255); | ||
text-transform: capitalize; | ||
} | ||
table { | ||
border-collapse: collapse; | ||
border-spacing: 0px; | ||
white-space: nowrap; | ||
table-layout: fixed; | ||
} | ||
tr { | ||
padding: 0px 24px; | ||
} | ||
thead tr { | ||
height: 40px; | ||
background-color: #34353b; | ||
border-radius: 12px 12px 0px 0px; | ||
border: #3e4047 1px solid; | ||
} | ||
tbody tr { | ||
border-width: 0px 1px 1px; | ||
border-style: solid; | ||
border-color: #3e4047; | ||
} | ||
td { | ||
padding: 8px 12px; | ||
} | ||
a { | ||
text-decoration: none; | ||
color: #e0f3ff; | ||
cursor: pointer; | ||
} | ||
a:hover { | ||
text-decoration: underline; | ||
} | ||
.green { | ||
color: #6cf9d8; | ||
} | ||
</style> |
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,9 @@ | ||
<header> | ||
<svg width="32" height="32" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="css-m12n0f"> | ||
<rect width="16" height="16" rx="8" fill="#6CF9D8"></rect> | ||
<path fill-rule="evenodd" clip-rule="evenodd" | ||
d="M3.47516 4.20982L4.25481 3.43018L7.37046 6.54583C7.18137 6.6264 7.00423 6.74381 6.84998 6.89806C6.73052 7.01752 6.63316 7.1507 6.55789 7.29254L3.47516 4.20982ZM6.49918 8.71984L3.42908 11.7899L4.20872 12.5696L7.24758 9.53072C7.10458 9.45523 6.97032 9.35731 6.84998 9.23698C6.69664 9.08364 6.57971 8.90768 6.49918 8.71984ZM8.79442 9.52908L11.7913 12.526L12.571 11.7464L9.54114 8.71651C9.46057 8.9056 9.34316 9.08273 9.18891 9.23698C9.06945 9.35644 8.93626 9.45381 8.79442 9.52908ZM9.48265 7.29565L12.5249 4.25341L11.7453 3.47377L8.67177 6.54725C8.85961 6.62778 9.03557 6.74472 9.18891 6.89806C9.30924 7.01839 9.40716 7.15265 9.48265 7.29565Z" | ||
fill="#2D2E33"></path> | ||
</svg> | ||
<h1>Across Indexer</h1> | ||
</header> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.