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: dashboard #23

Merged
merged 34 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0828ca9
initialize dashboard package
ugur-eren Feb 26, 2025
c3db762
setup landing page structure
ugur-eren Feb 26, 2025
fe84046
create line chart using chart.js
ugur-eren Feb 26, 2025
2066029
landing page heading section
ugur-eren Feb 26, 2025
4c319a5
use $-prefixed props for styled components
ugur-eren Feb 26, 2025
25766c0
table & pending section
ugur-eren Feb 26, 2025
bc94010
use bootstrap grid system
ugur-eren Feb 26, 2025
05f42a0
use theme spacings for bootstrap gutter
ugur-eren Feb 26, 2025
4737ef4
reorganize top section
ugur-eren Feb 27, 2025
99d3c50
use css grid instead of bootstrap
ugur-eren Feb 27, 2025
c474235
sticky table header
ugur-eren Feb 27, 2025
031e916
deposits
ugur-eren Feb 28, 2025
1d6a8f0
ExplorerLink component
ugur-eren Feb 28, 2025
4ae4c4f
reorganize DepositCard
ugur-eren Feb 28, 2025
fa68448
Table component
ugur-eren Feb 28, 2025
4d5c44a
withdrawals
ugur-eren Feb 28, 2025
66c9cb9
operator state integration
ugur-eren Feb 28, 2025
d4b2b75
use ExplorerLink for tx and addresses
ugur-eren Feb 28, 2025
60edbe8
Disable scrollable content
ugur-eren Feb 28, 2025
119e814
TransactionStatus component
ugur-eren Mar 1, 2025
d42df0c
responsive design
ugur-eren Mar 1, 2025
e7f8dd1
state server & fetch error
ugur-eren Mar 1, 2025
3f03552
add readme
ugur-eren Mar 1, 2025
5bc62d9
nextjs & server-sent events for state
ugur-eren Mar 1, 2025
769124f
readme & github actions workflow
ugur-eren Mar 3, 2025
af6ae02
fix github actions workflow
ugur-eren Mar 3, 2025
d4509ef
requested UI changes
ugur-eren Mar 3, 2025
3d3a5a4
make section header visually distinct
ugur-eren Mar 3, 2025
2ccde8a
merkle tree & move explorer links to env
ugur-eren Mar 4, 2025
062ceff
theme switch button & last update
ugur-eren Mar 4, 2025
a4596e3
/state-json page
ugur-eren Mar 4, 2025
6f62eba
fix build error
ugur-eren Mar 4, 2025
f7bfbc1
add envs to github actions workflow
ugur-eren Mar 4, 2025
aa2cd41
use rem instead of px & wrap merkle tree
ugur-eren Mar 4, 2025
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
65 changes: 65 additions & 0 deletions .github/workflows/dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Dashboard

on:
workflow_dispatch:
push:
paths: [dashboard/**]
branches:
- main
pull_request:
paths: [dashboard/**]
permissions: read-all

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install yarn
run: npm install -g yarn

- name: Prepare L1
run: |
npm install
npm run build
working-directory: l1

- name: Prepare Operator
run: |
npm install
npm run compile
working-directory: operator

- name: Install dependencies
run: yarn install
working-directory: dashboard
env:
# We have to disable immutable installs because the hash of operator will change
YARN_ENABLE_IMMUTABLE_INSTALLS: false

- name: Format Check
run: yarn format:check
working-directory: dashboard

- name: Type Checking
run: yarn ts:check
working-directory: dashboard

- name: Lint
run: yarn lint
working-directory: dashboard

- name: Build the project
run: yarn build
working-directory: dashboard
env:
OPERATOR_STATE_PATH: ./public/state.json
NEXT_PUBLIC_L1_EXPLORER_LINK: https://mempool-testnet.fractalbitcoin.io
NEXT_PUBLIC_L2_EXPLORER_LINK: https://sepolia.voyager.online
4 changes: 4 additions & 0 deletions dashboard/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
OPERATOR_STATE_PATH=./public/state.json # Relative to the root of the dashboard (this file)

NEXT_PUBLIC_L1_EXPLORER_LINK=https://mempool-testnet.fractalbitcoin.io
NEXT_PUBLIC_L2_EXPLORER_LINK=https://sepolia.voyager.online
3 changes: 3 additions & 0 deletions dashboard/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
public
src/vite-env.d.ts
38 changes: 38 additions & 0 deletions dashboard/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* eslint-env node */

// eslint-disable-next-line @typescript-eslint/no-var-requires
const {node: restrictedImports} = require('@uniswap/eslint-config/restrictedImports');
require('@uniswap/eslint-config/load');

/**
* @type {import("eslint").Linter.BaseConfig}
*/
module.exports = {
extends: ['next/core-web-vitals', 'next/typescript', '@uniswap/eslint-config/node'],
plugins: [],

overrides: [
{
files: ['**/*'],
rules: {
'prettier/prettier': ['error', {semi: true}],
'import/no-unused-modules': 'off',
},
},
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'@typescript-eslint/no-restricted-imports': ['error', restrictedImports],
'no-restricted-syntax': [
'error',
{
selector: ':matches(ExportAllDeclaration)',
message: 'Barrel exports bloat the bundle size by preventing tree-shaking.',
},
],
'no-restricted-imports': ['error'],
'react/prop-types': 'off',
},
},
],
};
130 changes: 130 additions & 0 deletions dashboard/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
3 changes: 3 additions & 0 deletions dashboard/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
coverage
public
11 changes: 11 additions & 0 deletions dashboard/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"semi": true,
"singleQuote": true,
"printWidth": 120,
"bracketSpacing": false,
"trailingComma": "all",
"bracketSameLine": false,
"tabWidth": 2,
"useTabs": false,
"endOfLine": "lf"
}
934 changes: 934 additions & 0 deletions dashboard/.yarn/releases/yarn-4.6.0.cjs

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions dashboard/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
enableScripts: false
enableTelemetry: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.6.0.cjs
58 changes: 58 additions & 0 deletions dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Dashboard

This is a dashboard for the [Pontis](https://github.com/Bitcoin-Wildlife-Sanctuary/pontis) project.
It is built using [NextJS](https://nextjs.org/), [React](https://react.dev/), [TypeScript](https://www.typescriptlang.org/).

## Development

### Prepare L1 package

- CD into the `l1` directory
- Run `npm install`
- Run `npm run build`

### Prepare Operator package

- CD into the `operator` directory
- Run `npm install`
- Run `npm run compile`

### Run Dashboard

Create an `.env` file in the root directory of the project and fill in the required values from the `.env.example` file.

Install the dependencies by running:

```bash
yarn install
```

To start the development server, run:

```bash
yarn dev
```

## Deployment

Create an `.env` file in the root directory of the project and fill in the required values from the `.env.example` file.
You can also use production versions of the `.env` file, for example `.env.production`.

To build the project, run:

```bash
yarn build
```

To start the production server, run:

```bash
yarn start
```

## Deployment to Cloud Services (Vercel, Netlify, AWS Amplify etc.)

- Set up the deployment environment variables in the cloud service provider's dashboard.
- Either deploy the project manually or set up automatic deployments from git branches.
- If the project is not recognized as a NextJS project, you may need to set up the build command and the output directory manually.
- Setup build scripts to include the L1 and Operator packages in the build process.
5 changes: 5 additions & 0 deletions dashboard/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
11 changes: 11 additions & 0 deletions dashboard/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type {NextConfig} from 'next';

const nextConfig: NextConfig = {
compiler: {
styledComponents: {
ssr: true,
},
},
};

export default nextConfig;
46 changes: 46 additions & 0 deletions dashboard/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "dashboard",
"version": "0.0.0",
"private": true,
"packageManager": "[email protected]",
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint",
"format:check": "prettier -c \"src/**/*.ts\"",
"format": "prettier --write \"src/**/*.ts\"",
"ts:check": "tsc --noEmit",
"check": "yarn format:check && yarn ts:check"
},
"dependencies": {
"@csstools/normalize.css": "^12.1.1",
"bootstrap": "^5.3.3",
"chart.js": "^4.4.8",
"classnames": "^2.5.1",
"csstype": "^3.1.3",
"next": "15.2.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-json-view": "^1.21.3",
"styled-components": "^6.1.15"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@types/bootstrap": "^5.2.10",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"@uniswap/eslint-config": "^1.2.0",
"eslint": "^8.55.0",
"eslint-config-next": "15.2.0",
"operator": "file:../operator",
"prettier": "^3.5.2",
"typescript": "^5.7.3"
},
"resolutions": {
"styled-components": "^6"
}
}
Loading
Loading