Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eda0529dfd | |||
| cb5adfe031 | |||
| 4848b5be97 | |||
| becb87377e | |||
| f149f86155 | |||
| 37ab8fedaa | |||
| 688a95a454 | |||
| d0922eb9a4 | |||
| a7e42053ae | |||
| e0280ead14 | |||
| 855a017033 | |||
| 55e7879849 | |||
| e1fdd52676 | |||
| db52e4471a | |||
| a56a5c3ed8 | |||
| 3031d54272 | |||
| ae63615c7c | |||
| fa8a26e80d | |||
| 3c4d618cc8 | |||
| e8e01c054a | |||
| 76bf2211ca | |||
| 220618f19b | |||
| 8992c189fd | |||
| bc2c0addbb | |||
| b58f01cc2b | |||
| 7e05a56073 | |||
| ad8c8f18eb | |||
| 308ec3dcc0 | |||
| e00918b192 | |||
| 3ff645cab1 | |||
| fff94d9071 | |||
| 7382da8595 | |||
| 519c411db0 | |||
| b0f00a624a | |||
| 9e1036ac29 |
@@ -1,50 +1,20 @@
|
|||||||
'use strict'
|
module.exports = api => {
|
||||||
|
|
||||||
module.exports = function (api) {
|
|
||||||
const targets = '>1% and not ie 11 and not dead'
|
|
||||||
api.cache(true)
|
api.cache(true)
|
||||||
api.cacheDirectory = true
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
presets: [
|
presets: [
|
||||||
|
['@babel/preset-env', { targets: { node: 'current' }, modules: 'commonjs' }],
|
||||||
'@babel/preset-typescript',
|
'@babel/preset-typescript',
|
||||||
[
|
['@babel/preset-react', { runtime: 'automatic' }],
|
||||||
'@babel/preset-env',
|
|
||||||
{
|
|
||||||
targets,
|
|
||||||
modules: false,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
['@babel/preset-react', {runtime: 'automatic' }]
|
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
[
|
|
||||||
"babel-plugin-tsconfig-paths",
|
|
||||||
{
|
|
||||||
"relative": true,
|
|
||||||
"extensions": [
|
|
||||||
".js",
|
|
||||||
".jsx",
|
|
||||||
".ts",
|
|
||||||
".tsx",
|
|
||||||
".es",
|
|
||||||
".es6",
|
|
||||||
".mjs"
|
|
||||||
],
|
|
||||||
"rootDir": ".",
|
|
||||||
"tsconfig": "tsconfig.lib.json",
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"@babel/plugin-proposal-numeric-separator",
|
|
||||||
"syntax-dynamic-import",
|
|
||||||
'@babel/plugin-proposal-class-properties',
|
|
||||||
[
|
[
|
||||||
'@babel/plugin-transform-runtime',
|
'@babel/plugin-transform-runtime',
|
||||||
{
|
{
|
||||||
helpers: false,
|
helpers: false,
|
||||||
regenerator: true
|
regenerator: true,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
{
|
{
|
||||||
"ignores": [
|
"ignores": [
|
||||||
"@testing-library/react",
|
|
||||||
"@types/*",
|
"@types/*",
|
||||||
"@commitlint/config-conventional",
|
"@commitlint/*",
|
||||||
"@babel/*",
|
"@babel/*",
|
||||||
"babel*",
|
"@eslint/*",
|
||||||
|
"@eslint/*",
|
||||||
"eslint*",
|
"eslint*",
|
||||||
"file-loader",
|
|
||||||
"ts-node",
|
|
||||||
"webpack-cli",
|
|
||||||
"buffer",
|
|
||||||
"crypto*",
|
|
||||||
"stream*",
|
|
||||||
"env-paths",
|
"env-paths",
|
||||||
|
"husky",
|
||||||
|
"jest-environment-jsdom",
|
||||||
"open",
|
"open",
|
||||||
"base64-inline-loader",
|
"rimraf",
|
||||||
"sass"
|
"sass",
|
||||||
|
"ts-node",
|
||||||
|
"@vitejs/plugin-react"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# Dependencies and build outputs
|
||||||
|
node_modules
|
||||||
|
build
|
||||||
|
lib
|
||||||
|
|
||||||
|
# Git
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
# CI/CD and tooling
|
||||||
|
.github
|
||||||
|
.husky
|
||||||
|
tests
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
docs
|
||||||
|
*.md
|
||||||
|
LICENSE
|
||||||
|
CODE_OF_CONDUCT.md
|
||||||
|
CODEOWNERS
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
# Environment files
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.development
|
||||||
|
|
||||||
|
# OS files
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
|
||||||
|
# Coverage
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# Dev scripts
|
||||||
|
desktop.mjs
|
||||||
|
utils
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
PORT=3002
|
PORT=3002
|
||||||
REACT_APP_FORMBRICKS_ENV_ID=
|
VITE_BEE_DESKTOP_URL=http://localhost:3054
|
||||||
REACT_APP_FORMBRICKS_APP_URL=
|
VITE_FORMBRICKS_ENV_ID=
|
||||||
|
VITE_FORMBRICKS_APP_URL=
|
||||||
|
VITE_DEFAULT_RPC_URL=
|
||||||
|
VITE_BEE_DESKTOP_ENABLED=
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
{
|
|
||||||
"settings": {
|
|
||||||
"react": {
|
|
||||||
"version": "detect"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"prettier",
|
|
||||||
"plugin:prettier/recommended",
|
|
||||||
"plugin:react/recommended",
|
|
||||||
"react-app",
|
|
||||||
"react-app/jest"
|
|
||||||
],
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"commonjs": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest": true,
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"sourceType": "module",
|
|
||||||
"ecmaVersion": 2018
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"array-bracket-newline": ["error", "consistent"],
|
|
||||||
"strict": ["error", "safe"],
|
|
||||||
"block-scoped-var": "error",
|
|
||||||
"complexity": "warn",
|
|
||||||
"default-case": "error",
|
|
||||||
"dot-notation": "warn",
|
|
||||||
"eqeqeq": "error",
|
|
||||||
"guard-for-in": "warn",
|
|
||||||
"linebreak-style": ["warn", "unix"],
|
|
||||||
"no-alert": "error",
|
|
||||||
"no-case-declarations": "error",
|
|
||||||
"no-console": "error",
|
|
||||||
"no-constant-condition": "error",
|
|
||||||
"no-continue": "warn",
|
|
||||||
"no-div-regex": "error",
|
|
||||||
"no-empty": "warn",
|
|
||||||
"no-empty-pattern": "error",
|
|
||||||
"no-implicit-coercion": "error",
|
|
||||||
"prefer-arrow-callback": "warn",
|
|
||||||
"no-labels": "error",
|
|
||||||
"no-loop-func": "error",
|
|
||||||
"no-nested-ternary": "warn",
|
|
||||||
"no-script-url": "error",
|
|
||||||
"quote-props": ["error", "as-needed"],
|
|
||||||
"require-yield": "error",
|
|
||||||
"max-nested-callbacks": ["error", 4],
|
|
||||||
"max-depth": ["error", 4],
|
|
||||||
"require-await": "error",
|
|
||||||
"space-before-function-paren": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"anonymous": "never",
|
|
||||||
"named": "never",
|
|
||||||
"asyncArrow": "always"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"padding-line-between-statements": [
|
|
||||||
"error",
|
|
||||||
{ "blankLine": "always", "prev": "*", "next": "if" },
|
|
||||||
{ "blankLine": "always", "prev": "*", "next": "function" },
|
|
||||||
{ "blankLine": "always", "prev": "*", "next": "return" }
|
|
||||||
],
|
|
||||||
"no-useless-constructor": "off",
|
|
||||||
"no-dupe-class-members": "off",
|
|
||||||
"no-unused-expressions": "off",
|
|
||||||
"curly": ["error", "multi-line"],
|
|
||||||
"object-curly-spacing": ["error", "always"],
|
|
||||||
"comma-dangle": ["error", "always-multiline"],
|
|
||||||
"@typescript-eslint/no-useless-constructor": "error",
|
|
||||||
"@typescript-eslint/no-unused-expressions": "error",
|
|
||||||
"@typescript-eslint/member-delimiter-style": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"multiline": {
|
|
||||||
"delimiter": "none",
|
|
||||||
"requireLast": true
|
|
||||||
},
|
|
||||||
"singleline": {
|
|
||||||
"delimiter": "semi",
|
|
||||||
"requireLast": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"react/react-in-jsx-scope": "off" // React v17+ does not need React in scope for JSX elements
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": ["*.spec.ts", "*.spec.tsx", "*.test.ts", "*.test.tsx"],
|
|
||||||
"rules": {
|
|
||||||
"max-nested-callbacks": ["error", 10] // allow describe/it/test nesting
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
# Enable version updates for npm
|
# Enable version updates for pnpm
|
||||||
- package-ecosystem: 'npm'
|
- package-ecosystem: 'npm'
|
||||||
# Look for `package.json` and `lock` files in the `root` directory
|
# Look for `package.json` and `lock` files in the `root` directory
|
||||||
directory: '/'
|
directory: '/'
|
||||||
# Check the npm registry for updates every day (weekdays)
|
# Check the npm registry for updates every day (weekdays)
|
||||||
schedule:
|
schedule:
|
||||||
interval: 'weekly'
|
interval: 'weekly'
|
||||||
# Always increase the version in package.json as well (for patch versions by default only package-lock.json i updated)
|
# Always increase the version in package.json as well (for patch versions by default only pnpm-lock.yaml is updated)
|
||||||
versioning-strategy: increase
|
versioning-strategy: increase
|
||||||
|
|||||||
@@ -14,44 +14,57 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [18.x]
|
node-version: [24.x]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REACT_APP_BEE_HOST: https://api.test-node.staging.ethswarm.org/
|
VITE_BEE_HOST: https://api.test-node.staging.ethswarm.org/
|
||||||
REACT_APP_FORMBRICKS_ENV_ID: ${{ secrets.REACT_APP_FORMBRICKS_ENV_ID }}
|
VITE_FORMBRICKS_ENV_ID: ${{ secrets.VITE_FORMBRICKS_ENV_ID }}
|
||||||
REACT_APP_FORMBRICKS_APP_URL: ${{ secrets.REACT_APP_FORMBRICKS_APP_URL }}
|
VITE_FORMBRICKS_APP_URL: ${{ secrets.VITE_FORMBRICKS_APP_URL }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
- name: Install npm deps
|
- name: Setup pnpm cache
|
||||||
run: npm ci
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.pnpm-store
|
||||||
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Commit linting
|
- name: Commit linting
|
||||||
uses: wagoid/commitlint-github-action@v2
|
uses: wagoid/commitlint-github-action@v6
|
||||||
|
with:
|
||||||
|
configFile: ./commitlint.config.cjs
|
||||||
|
|
||||||
- name: Code linting
|
- name: Code linting
|
||||||
run: npm run lint:check
|
run: pnpm run lint
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
|
|
||||||
- name: Dependency check
|
- name: Dependency check
|
||||||
run: npm run depcheck
|
run: pnpm run depcheck
|
||||||
|
|
||||||
- name: Types check
|
- name: Types check
|
||||||
run: npm run check:types
|
run: pnpm run check:types
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: pnpm run build
|
||||||
|
|
||||||
- name: Build Component
|
- name: Build Component
|
||||||
run: npm run build:component
|
run: pnpm run build:component
|
||||||
|
|
||||||
- name: Create preview
|
- name: Create preview
|
||||||
uses: ethersphere/swarm-actions/pr-preview@v1
|
uses: ethersphere/swarm-actions/pr-preview@v1
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
name: Publish on npm
|
name: Publish on npm
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
|
||||||
@@ -11,16 +12,28 @@ jobs:
|
|||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
REACT_APP_FORMBRICKS_ENV_ID: ${{ secrets.REACT_APP_FORMBRICKS_ENV_ID }}
|
VITE_FORMBRICKS_ENV_ID: ${{ secrets.VITE_FORMBRICKS_ENV_ID }}
|
||||||
REACT_APP_FORMBRICKS_APP_URL: ${{ secrets.REACT_APP_FORMBRICKS_APP_URL }}
|
VITE_FORMBRICKS_APP_URL: ${{ secrets.VITE_FORMBRICKS_APP_URL }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 24
|
node-version: 24
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
- run: npm ci
|
- name: Setup pnpm cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.pnpm-store
|
||||||
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-
|
||||||
|
|
||||||
- run: npm publish --provenance --access public
|
- run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- run: pnpm publish --provenance --access public --no-git-checks
|
||||||
|
|||||||
@@ -11,17 +11,27 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REACT_APP_FORMBRICKS_ENV_ID: ${{ secrets.REACT_APP_FORMBRICKS_ENV_ID }}
|
VITE_FORMBRICKS_ENV_ID: ${{ secrets.VITE_FORMBRICKS_ENV_ID }}
|
||||||
REACT_APP_FORMBRICKS_APP_URL: ${{ secrets.REACT_APP_FORMBRICKS_APP_URL }}
|
VITE_FORMBRICKS_APP_URL: ${{ secrets.VITE_FORMBRICKS_APP_URL }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v1
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
version: 10
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 24
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
- run: npm ci
|
- name: Setup pnpm cache
|
||||||
- run: npm run build
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.pnpm-store
|
||||||
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-
|
||||||
|
- run: pnpm install --frozen-lockfile
|
||||||
|
- run: pnpm run build
|
||||||
- run: echo "dashboard.ethswarm.org" > ./build/CNAME
|
- run: echo "dashboard.ethswarm.org" > ./build/CNAME
|
||||||
- name: Deploy to gh-pages
|
- name: Deploy to gh-pages
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
|||||||
@@ -13,24 +13,34 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REACT_APP_FORMBRICKS_ENV_ID: ${{ secrets.REACT_APP_FORMBRICKS_ENV_ID }}
|
VITE_FORMBRICKS_ENV_ID: ${{ secrets.VITE_FORMBRICKS_ENV_ID }}
|
||||||
REACT_APP_FORMBRICKS_APP_URL: ${{ secrets.REACT_APP_FORMBRICKS_APP_URL }}
|
VITE_FORMBRICKS_APP_URL: ${{ secrets.VITE_FORMBRICKS_APP_URL }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [18.x]
|
node-version: [24.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- name: Setup pnpm cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.pnpm-store
|
||||||
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-
|
||||||
|
|
||||||
- name: Install npm deps
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: npm run test
|
run: pnpm run test
|
||||||
|
|||||||
@@ -23,8 +23,13 @@
|
|||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
/**.log
|
||||||
|
|
||||||
|
|
||||||
settings.json
|
settings.json
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
**.tgz
|
**.tgz
|
||||||
|
|
||||||
|
api-key.txt
|
||||||
|
tmp/
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
pnpm exec commitlint --edit "$1"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
pnpm run lint && pnpm run check:types && pnpm run depcheck
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
node_modules
|
||||||
|
yarn.lock
|
||||||
|
package-lock.json
|
||||||
|
dist/
|
||||||
|
pnpm-lock.yaml
|
||||||
|
**/test-data/
|
||||||
|
**.html
|
||||||
|
**.svg
|
||||||
|
build/
|
||||||
|
lib/
|
||||||
|
**/assets/*
|
||||||
@@ -1,5 +1,76 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.35.0](https://github.com/ethersphere/bee-dashboard/compare/v0.34.0...v0.35.0) (2026-04-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add image opening functionality to DownloadActionBar ([3ff645c](https://github.com/ethersphere/bee-dashboard/commit/3ff645cab1b4e9fba0c42ed99e7c3fac7b0ed0ca))
|
||||||
|
* the dashboard sidebar should be collapsible ([fa8a26e](https://github.com/ethersphere/bee-dashboard/commit/fa8a26e80d83d5c794a9d572cf716f0cb484e642))
|
||||||
|
* sync and update with all changes from fork ([519c411](https://github.com/ethersphere/bee-dashboard/commit/519c411db0b37f3d4004366ca267013e2268f8eb))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* swap error caused by invalid id and batchcount
|
||||||
|
* enhance creation messages for admin drive and user drives
|
||||||
|
* identity and wallet creation
|
||||||
|
* asset preview types
|
||||||
|
* fm search unicode text
|
||||||
|
* feed identity and stamp usage
|
||||||
|
* ui display changes
|
||||||
|
* stamp buy and dilute
|
||||||
|
* vite polyfill warning for stream
|
||||||
|
* standard mode postage stamp purchase reserves incorrect size and duration
|
||||||
|
* add syncing message for Bee node and update page state handling
|
||||||
|
* stamp depth and amount validation
|
||||||
|
* add --no-git-checks to pnpm publish command ([37ab8fe](https://github.com/ethersphere/bee-dashboard/commit/37ab8fedaa9fa2f941b84746ec83fe87cf61b014))
|
||||||
|
* add workflow_dispatch trigger to npm publish workflow ([becb873](https://github.com/ethersphere/bee-dashboard/commit/becb87377e506aca0c429439d70e43151025d755))
|
||||||
|
* remove cross-env from prepublishOnly script ([4848b5b](https://github.com/ethersphere/bee-dashboard/commit/4848b5be97a827abeb0ca8156ef53cab0d2f315e))
|
||||||
|
|
||||||
|
## [0.34.0](https://github.com/ethersphere/bee-dashboard/compare/v0.33.5...v0.34.0) (2026-03-20)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add image opening functionality to DownloadActionBar ([3ff645c](https://github.com/ethersphere/bee-dashboard/commit/3ff645cab1b4e9fba0c42ed99e7c3fac7b0ed0ca))
|
||||||
|
* the dashboard sidebar should be collapsible ([fa8a26e](https://github.com/ethersphere/bee-dashboard/commit/fa8a26e80d83d5c794a9d572cf716f0cb484e642))
|
||||||
|
* sync and update with all changes from fork ([519c411](https://github.com/ethersphere/bee-dashboard/commit/519c411db0b37f3d4004366ca267013e2268f8eb))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add error handling and ui notifications for download failures ([b58f01c](https://github.com/ethersphere/bee-dashboard/commit/b58f01cc2b5535ba0ad347d03ae4102e18f637f0))
|
||||||
|
* buy stamp values display ([3031d54](https://github.com/ethersphere/bee-dashboard/commit/3031d54272d51da020d3a3cd7154b969c60e8669))
|
||||||
|
* cannot forget expired drives ([7e05a56](https://github.com/ethersphere/bee-dashboard/commit/7e05a56073a2be306a1394bf5b2e798a1a457c74))
|
||||||
|
* Correct misleading update warning message for desktop version ([bc2c0ad](https://github.com/ethersphere/bee-dashboard/commit/bc2c0addbb685454fbae61d317f2e920d507c07c))
|
||||||
|
* dockerfile build and use compose ([76bf221](https://github.com/ethersphere/bee-dashboard/commit/76bf2211ca75f44255e5696d58072e639a9cd2b0))
|
||||||
|
* download and upload files ([e8e01c0](https://github.com/ethersphere/bee-dashboard/commit/e8e01c054a867447e07a71960d45f9cb36926e61))
|
||||||
|
* filemanager state handling ([855a017](https://github.com/ethersphere/bee-dashboard/commit/855a0170334fb36d8ff119ce96f8c9bdb4294d58))
|
||||||
|
* reflect file rename immediately ([a56a5c3](https://github.com/ethersphere/bee-dashboard/commit/a56a5c3ed8554cf81afc7c6401ca2dc65a8e898d))
|
||||||
|
* rpc: ensure 0x prefix for recipient in sendBzzTransaction and add tests ([fff94d9](https://github.com/ethersphere/bee-dashboard/commit/fff94d907157d0cd4f6e490c450cdc58cefeec31))
|
||||||
|
* sidebar: use swarm-desktop GitHub link when running in desktop mode ([7382da8](https://github.com/ethersphere/bee-dashboard/commit/7382da8595e86230c03dab93aec726cd02cc91ec))
|
||||||
|
* cost values correcting [a7e4205](https://github.com/ethersphere/bee-dashboard/commit/a7e42053ae99990c5e9e782e8fe14326f155730c))
|
||||||
|
* modals are partially cut off in File Manager on Windows (Chrome) ([220618f](https://github.com/ethersphere/bee-dashboard/commit/220618f19bc95b92a0521dc62eb8f5414dfdcbba))
|
||||||
|
* misleading update warning (Desktop vs Dashboard) ([55e7879](https://github.com/ethersphere/bee-dashboard/commit/55e78798492e715ef9aa92262f5aa874aec240b0))
|
||||||
|
* expired admin drive upgrading handling ([e1fdd52](https://github.com/ethersphere/bee-dashboard/commit/e1fdd52676653c65beba06283f07e470d7ee4668))
|
||||||
|
* in case of a synced bee node the Purchase stamp and create drive button is inactive ([e00918b](https://github.com/ethersphere/bee-dashboard/commit/e00918b192f9a916d72df7ed6790eddf908397d3))
|
||||||
|
* newly created drive sometimes appears under “Expired Drives” in Chrome until page refresh and sometimes you have to delete cache in order to appear. ([3c4d618](https://github.com/ethersphere/bee-dashboard/commit/3c4d618cc85b2836a2f794b7da79f4da12205869))
|
||||||
|
* admin drive stucks in "in progress" state and the already existing admin drives are not listed on the initial modal ([ad8c8f1](https://github.com/ethersphere/bee-dashboard/commit/ad8c8f18eb5dabbf64e8059f0fcfe98a68b97eea))
|
||||||
|
* update documentation message for file access clarification ([ae63615](https://github.com/ethersphere/bee-dashboard/commit/ae63615c7ca26896c1114c16dc6a921aa267bc0d))
|
||||||
|
* upload history text align ([3031d54](https://github.com/ethersphere/bee-dashboard/commit/3031d54272d51da020d3a3cd7154b969c60e8669))
|
||||||
|
* upload and drive size error ([8992c18](https://github.com/ethersphere/bee-dashboard/commit/8992c189fd0300b0ee28d44a109c47b633174c06))
|
||||||
|
* use upload and download abort signals ([308ec3d](https://github.com/ethersphere/bee-dashboard/commit/308ec3dcc0ff3806777b89dc99fef669c993bcf7))
|
||||||
|
* use uploadFile for single files to support long filenames and reafactor for linter ([db52e44](https://github.com/ethersphere/bee-dashboard/commit/db52e4471a9519a0aca8a6fd2702a242e03d2a06))
|
||||||
|
* withdraw and deposit buttons style ([3031d54](https://github.com/ethersphere/bee-dashboard/commit/3031d54272d51da020d3a3cd7154b969c60e8669))
|
||||||
|
|
||||||
|
|
||||||
|
## [0.33.5](https://github.com/ethersphere/bee-dashboard/compare/v0.33.4...v0.33.5) (2026-02-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* file-manager and swarm-desktop bugs ([#718](https://github.com/ethersphere/bee-dashboard/issues/718)) ([9e1036a](https://github.com/ethersphere/bee-dashboard/commit/9e1036ac297842055bb91512987b684552b70ca5))
|
||||||
|
|
||||||
## [0.33.4](https://github.com/ethersphere/bee-dashboard/compare/v0.33.3...v0.33.4) (2026-01-26)
|
## [0.33.4](https://github.com/ethersphere/bee-dashboard/compare/v0.33.3...v0.33.4) (2026-01-26)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
FROM node:15.14-alpine AS build
|
FROM node:24-alpine AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
RUN corepack enable && corepack prepare pnpm@10 --activate
|
||||||
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
RUN pnpm install --frozen-lockfile --ignore-scripts
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm ci
|
RUN pnpm run prepare
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
FROM node:15.14-alpine AS final
|
FROM node:24-alpine AS final
|
||||||
RUN npm i -g serve
|
RUN npm install -g serve
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build /src/build .
|
COPY --from=build /src/build .
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
[](https://github.com/RichardLitt/standard-readme)
|
[](https://github.com/RichardLitt/standard-readme)
|
||||||
[](https://github.com/feross/standard)
|
[](https://github.com/feross/standard)
|
||||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fethersphere%2Fbee-dashboard?ref=badge_shield)
|
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fethersphere%2Fbee-dashboard?ref=badge_shield)
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
> An app which helps users to setup their Bee node and do actions like cash out cheques, upload and download files or
|
> An app which helps users to setup their Bee node and do actions like cash out cheques, upload and download files or
|
||||||
@@ -16,11 +16,11 @@ working. Also, no guarantees can be made about its stability, efficiency, and se
|
|||||||
Stay up to date by joining the [official Discord](https://discord.gg/GU22h2utj6) and by keeping an eye on the
|
Stay up to date by joining the [official Discord](https://discord.gg/GU22h2utj6) and by keeping an eye on the
|
||||||
[releases tab](https://github.com/ethersphere/bee-dashboard/releases).
|
[releases tab](https://github.com/ethersphere/bee-dashboard/releases).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
| Node Setup | Upload Files | Download Content | Accounting | Settings | File Manager |
|
| Node Setup | Upload Files | Download Content | Accounting | Settings | File Manager |
|
||||||
| ------------------------------------ | -------------------------------------- | ------------------------------------------ | ----------------------------------------- | ------------------------------------- | ---------------------------------- |
|
| ----------------------------------------- | ------------------------------------------- | ----------------------------------------------- | ---------------------------------------------- | ------------------------------------------ | -------------------------------------------------- |
|
||||||
|  |  |  |  |  |  |
|
|  |  |  |  |  |  |
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@@ -36,10 +36,10 @@ Stay up to date by joining the [official Discord](https://discord.gg/GU22h2utj6)
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
Install globally with npm. We require Node.js's version of at least 12.x and npm v6.x (or yarn v2.x).
|
Install globally with pnpm. We require Node.js's version of at least 24.x and pnpm v10.x, npm v11.x.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm install -g @ethersphere/bee-dashboard
|
pnpm add -g @ethersphere/bee-dashboard
|
||||||
```
|
```
|
||||||
|
|
||||||
For the latest stable version, always use the official npm registry.
|
For the latest stable version, always use the official npm registry.
|
||||||
@@ -79,6 +79,12 @@ docker build . -t bee-dashboard
|
|||||||
docker run --rm -p 127.0.0.1:8080:8080 bee-dashboard
|
docker run --rm -p 127.0.0.1:8080:8080 bee-dashboard
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Alternatively, use Docker Compose:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker compose up
|
||||||
|
```
|
||||||
|
|
||||||
Bee dashboard is now available on [`http://localhost:8080`](http://localhost:8080)
|
Bee dashboard is now available on [`http://localhost:8080`](http://localhost:8080)
|
||||||
|
|
||||||
### Development
|
### Development
|
||||||
@@ -88,9 +94,11 @@ git clone git@github.com:ethersphere/bee-dashboard.git
|
|||||||
|
|
||||||
cd bee-dashboard
|
cd bee-dashboard
|
||||||
|
|
||||||
npm i
|
pnpm install
|
||||||
|
|
||||||
npm start
|
pnpm run init:husky
|
||||||
|
|
||||||
|
pnpm start
|
||||||
```
|
```
|
||||||
|
|
||||||
The Bee Dashboard runs in development mode on [http://localhost:3031/](http://localhost:3031/)
|
The Bee Dashboard runs in development mode on [http://localhost:3031/](http://localhost:3031/)
|
||||||
@@ -100,17 +108,17 @@ The Bee Dashboard runs in development mode on [http://localhost:3031/](http://lo
|
|||||||
The CRA supports to specify "environmental variables" during build time which are then hardcoded into the served static
|
The CRA supports to specify "environmental variables" during build time which are then hardcoded into the served static
|
||||||
files. We support following variables:
|
files. We support following variables:
|
||||||
|
|
||||||
- `REACT_APP_BEE_DESKTOP_ENABLED` (`boolean`) that toggles if the Dashboard is in Desktop mode or not.
|
- `VITE_BEE_DESKTOP_ENABLED` (`boolean`) that toggles if the Dashboard is in Desktop mode or not.
|
||||||
- `REACT_APP_BEE_DESKTOP_URL` (`string`) defines custom URL where the Desktop API is expected. By default, it is same
|
- `VITE_BEE_DESKTOP_URL` (`string`) defines custom URL where the Desktop API is expected. By default, it is same origin
|
||||||
origin under which the Dashboard is served.
|
under which the Dashboard is served.
|
||||||
- `REACT_APP_BEE_HOST` (`string`) defines custom Bee API URL to be used as default one. By default, the
|
- `VITE_BEE_HOST` (`string`) defines custom Bee API URL to be used as default one. By default, the
|
||||||
`http://localhost:1633` is used.
|
`http://localhost:1633` is used.
|
||||||
- `REACT_APP_DEFAULT_RPC_URL` (`string`) defines the default RPC provider URL. Be aware, that his only configures the
|
- `VITE_DEFAULT_RPC_URL` (`string`) defines the default RPC provider URL. Be aware, that his only configures the default
|
||||||
default value. The user can override this in Settings, which is then persisted in local store and has priority over
|
value. The user can override this in Settings, which is then persisted in local store and has priority over the value
|
||||||
the value set in this env. variable. By default `https://xdai.fairdatasociety.org` is used.
|
set in this env. variable. By default `https://xdai.fairdatasociety.org` is used.
|
||||||
- `REACT_APP_FORMBRICKS_ENV_ID` and `REACT_APP_FORMBRICKS_APP_URL` (`string`) configures the
|
- `VITE_FORMBRICKS_ENV_ID` and `VITE_FORMBRICKS_APP_URL` (`string`) configures the [Formbricks](https://formbricks.com/)
|
||||||
[Formbricks](https://formbricks.com/) integration for user feedback collection. If these variables are not set, the
|
integration for user feedback collection. If these variables are not set, the feedback form is not available in the
|
||||||
feedback form is not available in the app.
|
app.
|
||||||
|
|
||||||
#### Swarm Desktop development
|
#### Swarm Desktop development
|
||||||
|
|
||||||
@@ -118,11 +126,11 @@ If you want to develop Bee Dashboard in the Swarm Desktop mode, then spin up `sw
|
|||||||
is initialized (eq. the splash screen disappear) and:
|
is initialized (eq. the splash screen disappear) and:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
echo "REACT_APP_BEE_DESKTOP_URL=http://localhost:3054
|
echo "VITE_BEE_DESKTOP_URL=http://localhost:3054
|
||||||
REACT_APP_BEE_DESKTOP_ENABLED=true" > .env.development.local
|
VITE_BEE_DESKTOP_ENABLED=true" > .env.development.local
|
||||||
|
|
||||||
npm start
|
pnpm start
|
||||||
npm run desktop # This will inject the API key to the Dashboard
|
pnpm run desktop # This will inject the API key to the Dashboard
|
||||||
```
|
```
|
||||||
|
|
||||||
## File Manager
|
## File Manager
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: ['@commitlint/config-conventional'],
|
||||||
|
rules: {
|
||||||
|
'body-max-line-length': [1, 'always', 120],
|
||||||
|
'header-max-length': [2, 'always', 160],
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
extends: ['@commitlint/config-conventional'],
|
|
||||||
rules: {
|
|
||||||
'body-max-line-length': [0, 'always', Infinity], // disable commit body length restriction
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -5,10 +5,14 @@ import open from 'open'
|
|||||||
|
|
||||||
import { readFile } from 'node:fs/promises'
|
import { readFile } from 'node:fs/promises'
|
||||||
import { join } from 'node:path'
|
import { join } from 'node:path'
|
||||||
|
import process from 'node:process'
|
||||||
|
|
||||||
|
const DEFAULT_VITE_DEV_PORT = 3002
|
||||||
|
const desktopPort = process.env.PORT || DEFAULT_VITE_DEV_PORT
|
||||||
const paths = envPaths('Swarm Desktop', { suffix: '' })
|
const paths = envPaths('Swarm Desktop', { suffix: '' })
|
||||||
const apiKey = await readFile(join(paths.data, 'api-key.txt'), { encoding: 'utf-8' })
|
const apiKey = await readFile(join(paths.data, 'api-key.txt'), { encoding: 'utf-8' })
|
||||||
const url = `http://localhost:3001/?v=${apiKey}#/`
|
const url = `http://localhost:${desktopPort}/?v=${apiKey}#/`
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
console.log('Opening: ' + url)
|
console.log('Opening: ' + url)
|
||||||
await open(url)
|
await open(url)
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
services:
|
||||||
|
bee-dashboard:
|
||||||
|
build: .
|
||||||
|
image: ethersphere/bee-dashboard:latest
|
||||||
|
ports:
|
||||||
|
- '127.0.0.1:8080:8080'
|
||||||
|
restart: unless-stopped
|
||||||
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 158 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 150 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
@@ -0,0 +1,21 @@
|
|||||||
|
const js = require('@eslint/js')
|
||||||
|
const ts = require('@typescript-eslint/eslint-plugin')
|
||||||
|
const tsParser = require('@typescript-eslint/parser')
|
||||||
|
const prettier = require('eslint-config-prettier')
|
||||||
|
const importPlugin = require('eslint-plugin-import')
|
||||||
|
const pluginJest = require('eslint-plugin-jest')
|
||||||
|
const prettierPlugin = require('eslint-plugin-prettier')
|
||||||
|
const simpleImportSort = require('eslint-plugin-simple-import-sort')
|
||||||
|
const react = require('eslint-plugin-react')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
js,
|
||||||
|
ts,
|
||||||
|
tsParser,
|
||||||
|
prettier,
|
||||||
|
importPlugin,
|
||||||
|
pluginJest,
|
||||||
|
prettierPlugin,
|
||||||
|
simpleImportSort,
|
||||||
|
react,
|
||||||
|
}
|
||||||
@@ -0,0 +1,260 @@
|
|||||||
|
import * as path from 'path'
|
||||||
|
import { fileURLToPath } from 'url'
|
||||||
|
|
||||||
|
import reactHooks from 'eslint-plugin-react-hooks'
|
||||||
|
import { defineConfig } from 'eslint/config'
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
|
||||||
|
const compat = await import(`${__dirname}/eslint-compat.cjs`)
|
||||||
|
const js = compat.default.js
|
||||||
|
const ts = compat.default.ts
|
||||||
|
const tsParser = compat.default.tsParser
|
||||||
|
const prettier = compat.default.prettier
|
||||||
|
const importPlugin = compat.default.importPlugin
|
||||||
|
const pluginJest = compat.default.pluginJest
|
||||||
|
const prettierPlugin = compat.default.prettierPlugin
|
||||||
|
const simpleImportSort = compat.default.simpleImportSort
|
||||||
|
const react = compat.default.react
|
||||||
|
|
||||||
|
const eslintRecommended = js.configs.recommended
|
||||||
|
|
||||||
|
const typescriptRecommended = {
|
||||||
|
plugins: {
|
||||||
|
'@typescript-eslint': ts,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...ts.configs.recommended.rules,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const importRules = {
|
||||||
|
plugins: {
|
||||||
|
import: importPlugin,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...importPlugin.configs.errors.rules,
|
||||||
|
...importPlugin.configs.warnings.rules,
|
||||||
|
...importPlugin.configs.typescript.rules,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const prettierRecommended = {
|
||||||
|
plugins: {
|
||||||
|
prettier: prettierPlugin,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'prettier/prettier': 'error',
|
||||||
|
...prettier.rules,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
reactHooks.configs.flat.recommended,
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
'**/node_modules/**',
|
||||||
|
'**/dist/**',
|
||||||
|
'eslint.config.mjs',
|
||||||
|
'eslint-compat.cjs',
|
||||||
|
'**/assets/*',
|
||||||
|
'lib/**',
|
||||||
|
'build/**',
|
||||||
|
'**/test-data/**',
|
||||||
|
'ui_samples/**',
|
||||||
|
'commitlint.config.cjs',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
|
||||||
|
settings: {
|
||||||
|
'import/resolver': {
|
||||||
|
typescript: {
|
||||||
|
alwaysTryTypes: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2022,
|
||||||
|
sourceType: 'module',
|
||||||
|
parser: tsParser,
|
||||||
|
globals: {
|
||||||
|
require: 'readonly',
|
||||||
|
window: 'readonly',
|
||||||
|
document: 'readonly',
|
||||||
|
navigator: 'readonly',
|
||||||
|
console: 'readonly',
|
||||||
|
module: 'readonly',
|
||||||
|
__dirname: 'readonly',
|
||||||
|
process: 'readonly',
|
||||||
|
Buffer: 'readonly',
|
||||||
|
React: 'readonly',
|
||||||
|
Event: 'readonly',
|
||||||
|
Element: 'readonly',
|
||||||
|
DataTransfer: 'readonly',
|
||||||
|
CustomEvent: 'readonly',
|
||||||
|
EventListener: 'readonly',
|
||||||
|
AbortController: 'readonly',
|
||||||
|
URLSearchParams: 'readonly',
|
||||||
|
FileList: 'readonly',
|
||||||
|
setTimeout: 'readonly',
|
||||||
|
setInterval: 'readonly',
|
||||||
|
clearTimeout: 'readonly',
|
||||||
|
clearInterval: 'readonly',
|
||||||
|
TextEncoder: 'readonly',
|
||||||
|
TextDecoder: 'readonly',
|
||||||
|
localStorage: 'readonly',
|
||||||
|
fetch: 'readonly',
|
||||||
|
crypto: 'readonly',
|
||||||
|
Metadata: 'readonly',
|
||||||
|
Blob: 'readonly',
|
||||||
|
FilePath: 'readonly',
|
||||||
|
File: 'readonly',
|
||||||
|
HTMLSpanElement: 'readonly',
|
||||||
|
HTMLTextAreaElement: 'readonly',
|
||||||
|
HTMLElement: 'readonly',
|
||||||
|
HTMLInputElement: 'readonly',
|
||||||
|
HTMLDivElement: 'readonly',
|
||||||
|
HTMLImageElement: 'readonly',
|
||||||
|
HTMLAnchorElement: 'readonly',
|
||||||
|
MouseEvent: 'readonly',
|
||||||
|
HTMLButtonElement: 'readonly',
|
||||||
|
MutationObserver: 'readonly',
|
||||||
|
requestAnimationFrame: 'readonly',
|
||||||
|
Node: 'readonly',
|
||||||
|
ReadableStream: 'readonly',
|
||||||
|
FileSystemFileHandle: 'readonly',
|
||||||
|
AbortSignal: 'readonly',
|
||||||
|
WritableStreamDefaultWriter: 'readonly',
|
||||||
|
DOMException: 'readonly',
|
||||||
|
FileSystemDirectoryHandle: 'readonly',
|
||||||
|
URL: 'readonly',
|
||||||
|
DOMRect: 'readonly',
|
||||||
|
Window: 'readonly',
|
||||||
|
prompt: 'readonly',
|
||||||
|
global: 'readonly',
|
||||||
|
FileReader: 'readonly',
|
||||||
|
Image: 'readonly',
|
||||||
|
NodeJS: 'readonly',
|
||||||
|
LatestBeeRelease: 'readonly',
|
||||||
|
KeyboardEvent: 'readonly',
|
||||||
|
cancelAnimationFrame: 'readonly',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
eslintRecommended,
|
||||||
|
typescriptRecommended,
|
||||||
|
importRules,
|
||||||
|
prettierRecommended,
|
||||||
|
prettier,
|
||||||
|
{
|
||||||
|
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
|
||||||
|
plugins: {
|
||||||
|
'@typescript-eslint': ts,
|
||||||
|
'simple-import-sort': simpleImportSort,
|
||||||
|
react: react,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'array-bracket-newline': ['error', 'consistent'],
|
||||||
|
strict: ['error', 'safe'],
|
||||||
|
'block-scoped-var': 'error',
|
||||||
|
complexity: 'warn',
|
||||||
|
'default-case': 'error',
|
||||||
|
'dot-notation': 'warn',
|
||||||
|
eqeqeq: 'error',
|
||||||
|
'guard-for-in': 'warn',
|
||||||
|
'linebreak-style': ['warn', 'unix'],
|
||||||
|
'no-alert': 'error',
|
||||||
|
'no-case-declarations': 'error',
|
||||||
|
'no-console': 'error',
|
||||||
|
'no-constant-condition': 'error',
|
||||||
|
'no-continue': 'warn',
|
||||||
|
'no-div-regex': 'error',
|
||||||
|
'no-empty': 'warn',
|
||||||
|
'no-empty-pattern': 'error',
|
||||||
|
'no-implicit-coercion': 'error',
|
||||||
|
'prefer-arrow-callback': 'warn',
|
||||||
|
'no-labels': 'error',
|
||||||
|
'no-loop-func': 'error',
|
||||||
|
'no-nested-ternary': 'warn',
|
||||||
|
'no-script-url': 'error',
|
||||||
|
'quote-props': ['error', 'as-needed'],
|
||||||
|
'require-yield': 'error',
|
||||||
|
'max-depth': ['error', 4],
|
||||||
|
'require-await': 'error',
|
||||||
|
'space-before-function-paren': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
anonymous: 'never',
|
||||||
|
named: 'never',
|
||||||
|
asyncArrow: 'always',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'padding-line-between-statements': [
|
||||||
|
'error',
|
||||||
|
{ blankLine: 'always', prev: '*', next: 'if' },
|
||||||
|
{ blankLine: 'always', prev: '*', next: 'function' },
|
||||||
|
{ blankLine: 'always', prev: '*', next: 'return' },
|
||||||
|
],
|
||||||
|
'no-useless-constructor': 'off',
|
||||||
|
'no-dupe-class-members': 'off',
|
||||||
|
'no-unused-expressions': 'off',
|
||||||
|
'no-unused-vars': 'off',
|
||||||
|
curly: ['error', 'multi-line'],
|
||||||
|
'object-curly-spacing': ['error', 'always'],
|
||||||
|
'comma-dangle': ['error', 'always-multiline'],
|
||||||
|
'react-hooks/set-state-in-effect': 'off',
|
||||||
|
'@typescript-eslint/no-useless-constructor': 'error',
|
||||||
|
'@typescript-eslint/no-unused-expressions': 'error',
|
||||||
|
'@typescript-eslint/no-dupe-class-members': 'error',
|
||||||
|
'react/react-in-jsx-scope': 'off',
|
||||||
|
'max-nested-callbacks': ['error', 4],
|
||||||
|
'@typescript-eslint/no-explicit-any': 'error',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||||
|
'@typescript-eslint/no-empty-function': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': [
|
||||||
|
'warn',
|
||||||
|
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
|
||||||
|
],
|
||||||
|
'simple-import-sort/imports': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
groups: [
|
||||||
|
['^@?\\w'], // Packages
|
||||||
|
['^\\u0000'], // Side effect imports
|
||||||
|
['^\\.\\.(?!/?$)', '^\\.\\./?$'], // Parent imports
|
||||||
|
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'], // Other relative imports
|
||||||
|
['^.+\\.?(css)$'], // Style imports
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// tests
|
||||||
|
files: ['tests/**/*.{ts,js}', , 'tests/**/*.spec.ts'],
|
||||||
|
rules: {
|
||||||
|
'no-console': 'off',
|
||||||
|
'import/no-commonjs': 'off',
|
||||||
|
'@typescript-eslint/no-require-imports': 'off',
|
||||||
|
'max-nested-callbacks': ['error', 10], // allow describe/it/test nesting
|
||||||
|
'jest/no-disabled-tests': 'warn',
|
||||||
|
'jest/no-focused-tests': 'error',
|
||||||
|
'jest/no-identical-title': 'error',
|
||||||
|
'jest/prefer-to-have-length': 'warn',
|
||||||
|
'jest/valid-expect': 'error',
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
jest: pluginJest,
|
||||||
|
},
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...pluginJest.environments.globals.globals,
|
||||||
|
require: 'readonly',
|
||||||
|
module: 'readonly',
|
||||||
|
exports: 'readonly',
|
||||||
|
XPathResult: 'readonly',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="icon" href="/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<meta name="theme-color" content="#000000" />
|
||||||
|
<meta name="description" content="Bee Dashboard" />
|
||||||
|
<link rel="apple-touch-icon" href="/logo192.png" />
|
||||||
|
<link rel="manifest" href="/manifest.json" />
|
||||||
|
<title>Bee Dashboard</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/index.tsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
module.exports = {
|
||||||
|
testEnvironment: 'jsdom',
|
||||||
|
transform: {
|
||||||
|
'^.+\\.[tj]sx?$': ['babel-jest', { configFile: './.babelrc.js' }],
|
||||||
|
},
|
||||||
|
moduleNameMapper: {
|
||||||
|
'^@/(.*)$': '<rootDir>/src/$1',
|
||||||
|
},
|
||||||
|
transformIgnorePatterns: ['node_modules/'],
|
||||||
|
extensionsToTreatAsEsm: ['.ts', '.tsx', '.jsx'],
|
||||||
|
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
|
||||||
|
modulePathIgnorePatterns: ['<rootDir>/build/'],
|
||||||
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
|
||||||
|
testMatch: ['<rootDir>/tests/**/*.spec.ts'],
|
||||||
|
}
|
||||||
@@ -1,7 +1,140 @@
|
|||||||
{
|
{
|
||||||
"name": "@ethersphere/bee-dashboard",
|
"name": "@ethersphere/bee-dashboard",
|
||||||
"version": "0.33.4",
|
"version": "0.35.0",
|
||||||
"description": "An app which helps users to setup their Bee node and do actions like cash out cheques",
|
"description": "An app which helps users to setup their Bee node and do actions like cash out cheques",
|
||||||
|
"homepage": ".",
|
||||||
|
"bin": {
|
||||||
|
"bee-dashboard": "./serve.js"
|
||||||
|
},
|
||||||
|
"main": "lib/App.cjs.js",
|
||||||
|
"browser": "lib/App.js",
|
||||||
|
"types": "lib/App.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./lib/App.d.ts",
|
||||||
|
"require": "./lib/App.cjs.js",
|
||||||
|
"import": "./lib/App.js",
|
||||||
|
"default": "./lib/App.cjs.js"
|
||||||
|
},
|
||||||
|
"./style.css": "./lib/App.css"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/ethersphere/bee-dashboard/issues/"
|
||||||
|
},
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ethersphere/bee-dashboard.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"prepublishOnly": "NODE_ENV=production pnpm run prepare",
|
||||||
|
"prepare": "pnpm run build && pnpm run build:component",
|
||||||
|
"start": "vite",
|
||||||
|
"desktop": "node ./desktop.mjs",
|
||||||
|
"build": "rimraf ./build && vite build",
|
||||||
|
"build:component": "rimraf ./lib && BUILD_MODE=component vite build",
|
||||||
|
"test": "jest",
|
||||||
|
"test:ui": "node tests/ui/index.js",
|
||||||
|
"serve": "node ./serve.js",
|
||||||
|
"depcheck": "depcheck .",
|
||||||
|
"lint": "eslint . --report-unused-disable-directives --no-cache --max-warnings=5",
|
||||||
|
"lint:fix": "pnpm run lint --fix",
|
||||||
|
"check:types": "tsc --project tsconfig.lib.json",
|
||||||
|
"update-map-data": "node ./utils/update-map-data.js",
|
||||||
|
"init:husky": "pnpm husky install"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">=19",
|
||||||
|
"react-dom": ">=19",
|
||||||
|
"react-router": ">=7",
|
||||||
|
"react-router-dom": ">=7",
|
||||||
|
"tss-react": ">=4"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@emotion/react": "^11.14.0",
|
||||||
|
"@emotion/styled": "^11.14.1",
|
||||||
|
"@ethersphere/bee-js": "^11.1.1",
|
||||||
|
"@formbricks/js": "^4.3.0",
|
||||||
|
"@mui/icons-material": "^7.3.7",
|
||||||
|
"@mui/material": "^7.3.7",
|
||||||
|
"@solarpunkltd/file-manager-lib": "^1.0.8",
|
||||||
|
"axios": "^0.30.2",
|
||||||
|
"bignumber.js": "^9.3.1",
|
||||||
|
"dotted-map": "^2.2.3",
|
||||||
|
"ethers": "^6.16.0",
|
||||||
|
"file-saver": "^2.0.5",
|
||||||
|
"formik": "2.4.9",
|
||||||
|
"formik-mui": "^5.0.0-alpha.1",
|
||||||
|
"jszip": "^3.10.1",
|
||||||
|
"notistack": "^3.0.2",
|
||||||
|
"opener": "1.5.2",
|
||||||
|
"react-dropzone": "^14.4.0",
|
||||||
|
"react-qr-code": "^2.0.18",
|
||||||
|
"react-syntax-highlighter": "16.1.0",
|
||||||
|
"remixicon-react": "^1.0.0",
|
||||||
|
"serve-handler": "6.1.6"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.26.10",
|
||||||
|
"@babel/plugin-transform-runtime": "^7.26.10",
|
||||||
|
"@babel/preset-env": "^7.26.10",
|
||||||
|
"@babel/preset-react": "^7.26.3",
|
||||||
|
"@babel/preset-typescript": "^7.26.10",
|
||||||
|
"@commitlint/cli": "^20.4.1",
|
||||||
|
"@commitlint/config-conventional": "^20.4.1",
|
||||||
|
"@eslint/js": "^9.39.2",
|
||||||
|
"@testing-library/jest-dom": "6.9.1",
|
||||||
|
"@testing-library/react": "16.3.2",
|
||||||
|
"@types/cors": "^2.8.19",
|
||||||
|
"@types/express": "^5.0.6",
|
||||||
|
"@types/file-saver": "2.0.5",
|
||||||
|
"@types/jest": "30.0.0",
|
||||||
|
"@types/react": "^19.2.10",
|
||||||
|
"@types/react-dom": "^19.2.3",
|
||||||
|
"@types/react-router": "5.1.20",
|
||||||
|
"@types/react-router-dom": "5.3.3",
|
||||||
|
"@types/react-syntax-highlighter": "15.5.13",
|
||||||
|
"@typescript-eslint/eslint-plugin": "8.55.0",
|
||||||
|
"@typescript-eslint/parser": "8.55.0",
|
||||||
|
"@vitejs/plugin-react": "^5.1.2",
|
||||||
|
"cors": "^2.8.5",
|
||||||
|
"depcheck": "^1.4.7",
|
||||||
|
"env-paths": "^3.0.0",
|
||||||
|
"eslint": "9.39.2",
|
||||||
|
"eslint-config-prettier": "10.1.8",
|
||||||
|
"eslint-import-resolver-typescript": "^4.4.4",
|
||||||
|
"eslint-plugin-import": "2.32.0",
|
||||||
|
"eslint-plugin-jest": "29.14.0",
|
||||||
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
||||||
|
"eslint-plugin-prettier": "5.5.5",
|
||||||
|
"eslint-plugin-react": "7.37.5",
|
||||||
|
"eslint-plugin-react-hooks": "7.0.1",
|
||||||
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||||
|
"eslint-plugin-testing-library": "7.15.4",
|
||||||
|
"express": "^5.2.1",
|
||||||
|
"husky": "^9.1.7",
|
||||||
|
"jest": "^30.2.0",
|
||||||
|
"jest-environment-jsdom": "^30.2.0",
|
||||||
|
"open": "^11.0.0",
|
||||||
|
"prettier": "3.8.1",
|
||||||
|
"puppeteer": "^24.37.1",
|
||||||
|
"rimraf": "^6.1.2",
|
||||||
|
"sass": "^1.97.3",
|
||||||
|
"ts-node": "^10.9.2",
|
||||||
|
"typescript": "5.9.3",
|
||||||
|
"vite": "^7.3.1",
|
||||||
|
"vite-plugin-dts": "^4.5.4",
|
||||||
|
"vite-plugin-node-polyfills": "^0.25.0",
|
||||||
|
"web-vitals": "5.1.0"
|
||||||
|
},
|
||||||
|
"pnpm": {
|
||||||
|
"onlyBuiltDependencies": [
|
||||||
|
"@parcel/watcher",
|
||||||
|
"esbuild",
|
||||||
|
"puppeteer",
|
||||||
|
"unrs-resolver"
|
||||||
|
]
|
||||||
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"bee",
|
"bee",
|
||||||
"swarm",
|
"swarm",
|
||||||
@@ -11,140 +144,6 @@
|
|||||||
"typescript",
|
"typescript",
|
||||||
"p2p"
|
"p2p"
|
||||||
],
|
],
|
||||||
"homepage": ".",
|
|
||||||
"bin": {
|
|
||||||
"bee-dashboard": "./serve.js"
|
|
||||||
},
|
|
||||||
"main": "lib/App.js",
|
|
||||||
"types": "lib/src/App.d.ts",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/ethersphere/bee-dashboard/issues/"
|
|
||||||
},
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/ethersphere/bee-dashboard.git"
|
|
||||||
},
|
|
||||||
"overrides": {
|
|
||||||
"@fairdatasociety/fdp-storage": {
|
|
||||||
"@ethersphere/bee-js": "^10.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@ethersphere/bee-js": "^10.3.0",
|
|
||||||
"@ethersproject/keccak256": "^5.7.0",
|
|
||||||
"@ethersproject/strings": "^5.7.0",
|
|
||||||
"@fairdatasociety/fdp-storage": "^0.19.0",
|
|
||||||
"@formbricks/js": "^4.2.1",
|
|
||||||
"@material-ui/core": "4.12.3",
|
|
||||||
"@material-ui/icons": "4.11.2",
|
|
||||||
"@material-ui/lab": "4.0.0-alpha.57",
|
|
||||||
"@solarpunkltd/file-manager-lib": "^1.0.4",
|
|
||||||
"axios": "^0.28.1",
|
|
||||||
"bignumber.js": "^9.1.2",
|
|
||||||
"buffer": "^6.0.3",
|
|
||||||
"crypto": "npm:crypto-browserify",
|
|
||||||
"crypto-browserify": "^3.12.0",
|
|
||||||
"dotted-map": "^2.2.3",
|
|
||||||
"ethers": "^5.7.2",
|
|
||||||
"file-saver": "^2.0.5",
|
|
||||||
"formik": "2.2.9",
|
|
||||||
"formik-material-ui": "3.0.1",
|
|
||||||
"jszip": "^3.10.1",
|
|
||||||
"material-ui-dropzone": "3.5.0",
|
|
||||||
"notistack": "^3.0.1",
|
|
||||||
"opener": "1.5.2",
|
|
||||||
"qrcode.react": "1.0.1",
|
|
||||||
"react": ">= 17.0.2",
|
|
||||||
"react-copy-to-clipboard": "^5.1.0",
|
|
||||||
"react-dom": ">= 17.0.2",
|
|
||||||
"react-identicons": "1.2.5",
|
|
||||||
"react-router": "6.2.1",
|
|
||||||
"react-router-dom": "6.2.1",
|
|
||||||
"react-syntax-highlighter": "15.4.4",
|
|
||||||
"remixicon-react": "^1.0.0",
|
|
||||||
"serve-handler": "6.1.3",
|
|
||||||
"stream": "npm:stream-browserify",
|
|
||||||
"stream-browserify": "^3.0.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/core": "^7.24.0",
|
|
||||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
||||||
"@babel/plugin-transform-runtime": "^7.24.0",
|
|
||||||
"@babel/preset-env": "^7.24.0",
|
|
||||||
"@babel/preset-react": "^7.23.3",
|
|
||||||
"@babel/preset-typescript": "^7.23.3",
|
|
||||||
"@commitlint/config-conventional": "14.1.0",
|
|
||||||
"@testing-library/jest-dom": "5.16.4",
|
|
||||||
"@testing-library/react": "12.1.2",
|
|
||||||
"@testing-library/react-hooks": "^8.0.0",
|
|
||||||
"@types/cors": "^2.8.12",
|
|
||||||
"@types/express": "^4.17.13",
|
|
||||||
"@types/file-saver": "2.0.4",
|
|
||||||
"@types/jest": "27.0.2",
|
|
||||||
"@types/qrcode.react": "1.0.2",
|
|
||||||
"@types/react": "17.0.34",
|
|
||||||
"@types/react-copy-to-clipboard": "^5.0.2",
|
|
||||||
"@types/react-dom": "17.0.11",
|
|
||||||
"@types/react-router": "5.1.18",
|
|
||||||
"@types/react-router-dom": "5.3.2",
|
|
||||||
"@types/react-syntax-highlighter": "13.5.2",
|
|
||||||
"@typescript-eslint/eslint-plugin": "5.28.0",
|
|
||||||
"@typescript-eslint/parser": "5.28.0",
|
|
||||||
"babel-eslint": "^10.1.0",
|
|
||||||
"babel-loader": "^8.1.0",
|
|
||||||
"babel-plugin-syntax-dynamic-import": "6.18.0",
|
|
||||||
"babel-plugin-tsconfig-paths": "1.0.2",
|
|
||||||
"base64-inline-loader": "^2.0.1",
|
|
||||||
"cors": "^2.8.5",
|
|
||||||
"depcheck": "^1.4.3",
|
|
||||||
"env-paths": "^3.0.0",
|
|
||||||
"eslint": "8.17.0 ",
|
|
||||||
"eslint-config-prettier": "8.5.0",
|
|
||||||
"eslint-config-react-app": "7.0.1",
|
|
||||||
"eslint-plugin-flowtype": "8.0.3",
|
|
||||||
"eslint-plugin-import": "2.26.0",
|
|
||||||
"eslint-plugin-jest": "26.5.3",
|
|
||||||
"eslint-plugin-jsx-a11y": "6.5.1",
|
|
||||||
"eslint-plugin-prettier": "4.0.0",
|
|
||||||
"eslint-plugin-react": "7.30.0",
|
|
||||||
"eslint-plugin-react-hooks": "4.5.0",
|
|
||||||
"eslint-plugin-testing-library": "5.5.1",
|
|
||||||
"express": "^4.17.3",
|
|
||||||
"file-loader": "6.2.0",
|
|
||||||
"open": "^8.4.0",
|
|
||||||
"prettier": "2.4.1",
|
|
||||||
"puppeteer": "^15.4.0",
|
|
||||||
"react-scripts": "^5.0.1",
|
|
||||||
"rimraf": "^3.0.2",
|
|
||||||
"sass": "^1.91.0",
|
|
||||||
"ts-node": "^10.8.1",
|
|
||||||
"typescript": "4.8.3",
|
|
||||||
"web-vitals": "2.1.2",
|
|
||||||
"webpack": "^5.93.0",
|
|
||||||
"webpack-cli": "^4.10.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": ">= 17.0.2",
|
|
||||||
"react-dom": ">= 17.0.2"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"prepare": "npm run build && npm run build:component",
|
|
||||||
"start": "react-scripts start",
|
|
||||||
"desktop": "node ./desktop.mjs",
|
|
||||||
"build": "react-scripts build",
|
|
||||||
"build:component": "rimraf ./lib && webpack --mode=production && npm run compile:types",
|
|
||||||
"compile:types": "tsc --project tsconfig.lib.json --emitDeclarationOnly --declaration",
|
|
||||||
"test": "react-scripts test",
|
|
||||||
"test:ui": "node ui-test/index.js",
|
|
||||||
"serve": "node ./serve.js",
|
|
||||||
"depcheck": "depcheck .",
|
|
||||||
"lint": "eslint --fix \"src/**/*.ts\" \"src/**/*.tsx\" && prettier --write \"src/**/*.ts\" \"src/**/*.tsx\"",
|
|
||||||
"lint:check": "eslint \"src/**/*.ts\" \"src/**/*.tsx\" && prettier --check \"src/**/*.ts\" \"src/**/*.tsx\"",
|
|
||||||
"check:types": "tsc --project tsconfig.lib.json",
|
|
||||||
"update-map-data": "node ./utils/update-map-data.js",
|
|
||||||
"bee": "npx bee-factory start"
|
|
||||||
},
|
|
||||||
"files": [
|
"files": [
|
||||||
"lib",
|
"lib",
|
||||||
"build",
|
"build",
|
||||||
@@ -163,8 +162,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0.0",
|
"node": ">=24.0.0",
|
||||||
"npm": ">=6.9.0",
|
"npm": ">=11.0.0",
|
||||||
"bee": "1.16.1-8e269c8"
|
"pnpm": ">=10.0.0",
|
||||||
|
"bee": "2.7.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta name="theme-color" content="#000000" />
|
|
||||||
|
|
||||||
<meta name="description" content="Bee Dashboard" />
|
|
||||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
||||||
<!--
|
|
||||||
manifest.json provides metadata used when your web app is installed on a
|
|
||||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
||||||
-->
|
|
||||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Notice the use of %PUBLIC_URL% in the tags above.
|
|
||||||
It will be replaced with the URL of the `public` folder during the build.
|
|
||||||
Only files inside the `public` folder can be referenced from the HTML.
|
|
||||||
|
|
||||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
||||||
work correctly both with client-side routing and a non-root public URL.
|
|
||||||
Learn how to configure a non-root public URL by running `npm run build`.
|
|
||||||
-->
|
|
||||||
<title>Swarm</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
||||||
<div id="root"></div>
|
|
||||||
<!--
|
|
||||||
This HTML file is a template.
|
|
||||||
If you open it directly in the browser, you will see an empty page.
|
|
||||||
|
|
||||||
You can add webfonts, meta tags, or analytics to this file.
|
|
||||||
The build step will place the bundled scripts into the <body> tag.
|
|
||||||
|
|
||||||
To begin the development, run `npm start` or `yarn start`.
|
|
||||||
To create a production bundle, use `npm run build` or `yarn build`.
|
|
||||||
-->
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
{
|
{
|
||||||
|
"rewrites": [{ "source": "**", "destination": "/index.html" }],
|
||||||
"trailingSlash": false,
|
"trailingSlash": false,
|
||||||
"headers": [
|
"headers": [
|
||||||
{
|
{
|
||||||
"source": "*",
|
"source": "*",
|
||||||
"headers" : [{
|
"headers": [
|
||||||
|
{
|
||||||
"key": "Cache-Control",
|
"key": "Cache-Control",
|
||||||
"value": "max-age=3600"
|
"value": "max-age=3600"
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
|
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const handler = require('serve-handler')
|
const handler = require('serve-handler')
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
declare module 'react-identicons' {
|
|
||||||
interface Props {
|
|
||||||
string: string
|
|
||||||
size?: number
|
|
||||||
padding?: number
|
|
||||||
bg?: string
|
|
||||||
fg?: string
|
|
||||||
palette?: string[]
|
|
||||||
count?: number
|
|
||||||
getColor?: () => string
|
|
||||||
}
|
|
||||||
|
|
||||||
const Identicon = (props: Props): JSXElementConstructor => ReactNode //eslint-disable-line @typescript-eslint/no-unused-vars
|
|
||||||
export default Identicon
|
|
||||||
}
|
|
||||||
@@ -15,8 +15,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.App {
|
.App {
|
||||||
font-family: 'iAWriterQuattroV', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
|
font-family:
|
||||||
'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
'iAWriterQuattroV',
|
||||||
|
-apple-system,
|
||||||
|
BlinkMacSystemFont,
|
||||||
|
'Segoe UI',
|
||||||
|
'Roboto',
|
||||||
|
'Oxygen',
|
||||||
|
'Ubuntu',
|
||||||
|
'Cantarell',
|
||||||
|
'Fira Sans',
|
||||||
|
'Droid Sans',
|
||||||
|
'Helvetica Neue',
|
||||||
|
sans-serif;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import CssBaseline from '@material-ui/core/CssBaseline'
|
import CssBaseline from '@mui/material/CssBaseline'
|
||||||
import { ThemeProvider } from '@material-ui/core/styles'
|
import { ThemeProvider } from '@mui/material/styles'
|
||||||
import { SnackbarProvider } from 'notistack'
|
import { SnackbarProvider } from 'notistack'
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
import { HashRouter as Router } from 'react-router-dom'
|
import { HashRouter as Router } from 'react-router-dom'
|
||||||
import './App.css'
|
|
||||||
import Dashboard from './layout/Dashboard'
|
import Dashboard from './layout/Dashboard'
|
||||||
import { Provider as BeeProvider } from './providers/Bee'
|
import { Provider as BeeProvider } from './providers/Bee'
|
||||||
import { Provider as FeedsProvider } from './providers/Feeds'
|
import { Provider as FeedsProvider } from './providers/Feeds'
|
||||||
@@ -17,6 +17,8 @@ import { Provider as BalanceProvider } from './providers/WalletBalance'
|
|||||||
import BaseRouter from './routes'
|
import BaseRouter from './routes'
|
||||||
import { theme } from './theme'
|
import { theme } from './theme'
|
||||||
|
|
||||||
|
import './App.css'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
beeApiUrl?: string
|
beeApiUrl?: string
|
||||||
defaultRpcUrl?: string
|
defaultRpcUrl?: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Collapse from '@material-ui/core/Collapse'
|
import { Alert, AlertTitle } from '@mui/material'
|
||||||
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
import Collapse from '@mui/material/Collapse'
|
||||||
import { Alert, AlertTitle } from '@material-ui/lab'
|
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
const LIMIT = 100000000 // 100 megabytes
|
const LIMIT = 100000000 // 100 megabytes
|
||||||
|
|
||||||
@@ -9,18 +9,16 @@ interface Props {
|
|||||||
files: File[]
|
files: File[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
root: {
|
root: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
marginTop: theme.spacing(2),
|
marginTop: theme.spacing(2),
|
||||||
marginBottom: theme.spacing(2),
|
marginBottom: theme.spacing(2),
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export default function UploadSizeAlert(props: Props): ReactElement | null {
|
export default function UploadSizeAlert(props: Props): ReactElement | null {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
const totalSize = props.files.reduce((previous, current) => previous + current.size, 0)
|
const totalSize = props.files.reduce((previous, current) => previous + current.size, 0)
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
import { createStyles, makeStyles, Theme, Typography } from '@material-ui/core'
|
import { Typography } from '@mui/material'
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
import Check from 'remixicon-react/CheckLineIcon'
|
import Check from 'remixicon-react/CheckLineIcon'
|
||||||
import AlertCircle from 'remixicon-react/ErrorWarningFillIcon'
|
import AlertCircle from 'remixicon-react/ErrorWarningFillIcon'
|
||||||
import Connecting from 'remixicon-react/LinksLineIcon'
|
import Connecting from 'remixicon-react/LinksLineIcon'
|
||||||
import RefreshLine from 'remixicon-react/RefreshLineIcon'
|
import RefreshLine from 'remixicon-react/RefreshLineIcon'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
|
import { CheckState } from '../providers/Bee'
|
||||||
|
|
||||||
import { SwarmButton, SwarmButtonProps } from './SwarmButton'
|
import { SwarmButton, SwarmButtonProps } from './SwarmButton'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -11,12 +15,11 @@ interface Props {
|
|||||||
title: string
|
title: string
|
||||||
subtitle: string
|
subtitle: string
|
||||||
buttonProps: SwarmButtonProps
|
buttonProps: SwarmButtonProps
|
||||||
status: 'ok' | 'error' | 'loading' | 'connecting'
|
status: CheckState
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = (backgroundColor: string) =>
|
const useStyles = (backgroundColor: string) =>
|
||||||
makeStyles((theme: Theme) =>
|
makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
root: {
|
root: {
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
flexBasis: '100px',
|
flexBasis: '100px',
|
||||||
@@ -51,24 +54,25 @@ const useStyles = (backgroundColor: string) =>
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export default function Card({ buttonProps, icon, title, subtitle, status }: Props): ReactElement {
|
export default function Card({ buttonProps, icon, title, subtitle, status }: Props): ReactElement {
|
||||||
const backgroundColor = status === 'error' ? 'white' : '#f3f3f3'
|
const backgroundColor = status === CheckState.ERROR ? 'white' : '#f3f3f3'
|
||||||
const { className, ...rest } = buttonProps
|
const { className, ...rest } = buttonProps
|
||||||
const classes = useStyles(backgroundColor)()
|
const { classes } = useStyles(backgroundColor)()
|
||||||
|
|
||||||
let statusIcon = null
|
let statusIcon = null
|
||||||
|
|
||||||
if (status === 'ok') {
|
if (status === CheckState.OK) {
|
||||||
statusIcon = <Check size="13" color="#09ca6c" />
|
statusIcon = <Check size="13" color="#09ca6c" />
|
||||||
} else if (status === 'error') {
|
} else if (CheckState.STARTING) {
|
||||||
statusIcon = <AlertCircle size="13" color="#f44336" />
|
statusIcon = <RefreshLine size="13" color="#d99400d5" />
|
||||||
} else if (status === 'loading') {
|
} else if (CheckState.CONNECTING) {
|
||||||
statusIcon = <RefreshLine size="13" color="orange" />
|
|
||||||
} else if (status === 'connecting') {
|
|
||||||
statusIcon = <Connecting size="13" color="#0074D9" />
|
statusIcon = <Connecting size="13" color="#0074D9" />
|
||||||
|
} else if (CheckState.WARNING) {
|
||||||
|
statusIcon = <Connecting size="13" color="#cbd900" />
|
||||||
|
} else {
|
||||||
|
statusIcon = <AlertCircle size="13" color="#f44336" />
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import { CircularProgress, Container } from '@material-ui/core'
|
import { CircularProgress, Container } from '@mui/material'
|
||||||
import Button from '@material-ui/core/Button'
|
import Button from '@mui/material/Button'
|
||||||
import Dialog from '@material-ui/core/Dialog'
|
import Dialog from '@mui/material/Dialog'
|
||||||
import DialogActions from '@material-ui/core/DialogActions'
|
import DialogActions from '@mui/material/DialogActions'
|
||||||
import DialogContent from '@material-ui/core/DialogContent'
|
import DialogContent from '@mui/material/DialogContent'
|
||||||
import DialogContentText from '@material-ui/core/DialogContentText'
|
import DialogContentText from '@mui/material/DialogContentText'
|
||||||
import DialogTitle from '@material-ui/core/DialogTitle'
|
import DialogTitle from '@mui/material/DialogTitle'
|
||||||
import { useSnackbar } from 'notistack'
|
import { useSnackbar } from 'notistack'
|
||||||
import { ReactElement, useContext, useState } from 'react'
|
import { ReactElement, useContext, useState } from 'react'
|
||||||
import Zap from 'remixicon-react/FlashlightLineIcon'
|
import Zap from 'remixicon-react/FlashlightLineIcon'
|
||||||
|
|
||||||
import { Context as SettingsContext } from '../providers/Settings'
|
import { Context as SettingsContext } from '../providers/Settings'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -41,7 +42,8 @@ export default function CheckoutModal({ peerId, uncashedAmount }: Props): ReactE
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch((e: Error) => {
|
.catch((e: Error) => {
|
||||||
console.error(e) // eslint-disable-line
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(e)
|
||||||
enqueueSnackbar(<span>Error: {e.message}</span>, { variant: 'error' })
|
enqueueSnackbar(<span>Error: {e.message}</span>, { variant: 'error' })
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import { ChainState } from '@ethersphere/bee-js'
|
import { ChainState } from '@ethersphere/bee-js'
|
||||||
import { useContext, useEffect, useState } from 'react'
|
import { useContext, useEffect, useState } from 'react'
|
||||||
|
|
||||||
import { Context } from '../providers/Settings'
|
import { Context } from '../providers/Settings'
|
||||||
|
|
||||||
import ExpandableListItem from './ExpandableListItem'
|
import ExpandableListItem from './ExpandableListItem'
|
||||||
|
|
||||||
|
const CHAIN_STATE_INTERVAL_MS = 3_000
|
||||||
|
|
||||||
export function ChainSync() {
|
export function ChainSync() {
|
||||||
const { beeApi } = useContext(Context)
|
const { beeApi } = useContext(Context)
|
||||||
const [chainState, setChainState] = useState<ChainState | null>(null)
|
const [chainState, setChainState] = useState<ChainState | null>(null)
|
||||||
@@ -13,8 +17,9 @@ export function ChainSync() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
beeApi.getChainState().then(setChainState).catch(console.error) // eslint-disable-line
|
// eslint-disable-next-line no-console
|
||||||
}, 3_000)
|
beeApi.getChainState().then(setChainState).catch(console.error)
|
||||||
|
}, CHAIN_STATE_INTERVAL_MS)
|
||||||
|
|
||||||
return () => clearInterval(interval)
|
return () => clearInterval(interval)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import type { ReactElement } from 'react'
|
import IconButton from '@mui/material/IconButton'
|
||||||
import IconButton from '@material-ui/core/IconButton'
|
|
||||||
import { CopyToClipboard } from 'react-copy-to-clipboard'
|
|
||||||
import Clipboard from 'remixicon-react/ClipboardLineIcon'
|
|
||||||
import { useSnackbar } from 'notistack'
|
import { useSnackbar } from 'notistack'
|
||||||
|
import type { ReactElement } from 'react'
|
||||||
|
import Clipboard from 'remixicon-react/ClipboardLineIcon'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value: string
|
value: string
|
||||||
@@ -10,14 +9,20 @@ interface Props {
|
|||||||
|
|
||||||
export default function ClipboardCopy({ value }: Props): ReactElement {
|
export default function ClipboardCopy({ value }: Props): ReactElement {
|
||||||
const { enqueueSnackbar } = useSnackbar()
|
const { enqueueSnackbar } = useSnackbar()
|
||||||
const handleCopy = () => enqueueSnackbar(`Copied: ${value}`, { variant: 'success' })
|
|
||||||
|
const handleCopy = async () => {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(value)
|
||||||
|
enqueueSnackbar(`Copied: ${value}`, { variant: 'success' })
|
||||||
|
} catch {
|
||||||
|
enqueueSnackbar('Failed to copy to clipboard', { variant: 'error' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ marginRight: '3px', marginLeft: '3px' }}>
|
<div style={{ marginRight: '3px', marginLeft: '3px' }}>
|
||||||
<IconButton color="primary" size="small" onClick={handleCopy}>
|
<IconButton color="primary" size="small" onClick={handleCopy}>
|
||||||
<CopyToClipboard text={value}>
|
|
||||||
<Clipboard style={{ height: '20px' }} />
|
<Clipboard style={{ height: '20px' }} />
|
||||||
</CopyToClipboard>
|
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,22 +1,20 @@
|
|||||||
import { createStyles, makeStyles, Theme } from '@material-ui/core'
|
import { Close } from '@mui/icons-material'
|
||||||
import { Close } from '@material-ui/icons'
|
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
wrapper: {
|
wrapper: {
|
||||||
padding: theme.spacing(1),
|
padding: theme.spacing(1),
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export function CloseButton({ onClose }: Props): ReactElement {
|
export function CloseButton({ onClose }: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.wrapper} onClick={onClose}>
|
<div className={classes.wrapper} onClick={onClose}>
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { createStyles, makeStyles, Theme } from '@material-ui/core'
|
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: string
|
children: string
|
||||||
prettify?: boolean
|
prettify?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
wrapper: {
|
wrapper: {
|
||||||
overflow: 'scroll',
|
overflow: 'scroll',
|
||||||
background: '#ffffff',
|
background: '#ffffff',
|
||||||
@@ -16,8 +15,7 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
maxHeight: '6em',
|
maxHeight: '6em',
|
||||||
padding: theme.spacing(2),
|
padding: theme.spacing(2),
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
function prettifyString(string: string): string {
|
function prettifyString(string: string): string {
|
||||||
try {
|
try {
|
||||||
@@ -28,7 +26,7 @@ function prettifyString(string: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Code({ children, prettify }: Props): ReactElement {
|
export function Code({ children, prettify }: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.wrapper}>
|
<div className={classes.wrapper}>
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { ReactElement, useContext } from 'react'
|
import { ReactElement, useContext } from 'react'
|
||||||
import TabsContainer from './TabsContainer'
|
|
||||||
import CodeBlock from './CodeBlock'
|
|
||||||
import { Context } from '../providers/Platform'
|
import { Context } from '../providers/Platform'
|
||||||
|
|
||||||
|
import CodeBlock from './CodeBlock'
|
||||||
|
import TabsContainer from './TabsContainer'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
linux: string
|
linux: string
|
||||||
mac: string
|
mac: string
|
||||||
|
|||||||
@@ -1,21 +1,20 @@
|
|||||||
import { createStyles, makeStyles, Typography } from '@material-ui/core'
|
import { Typography } from '@mui/material'
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: (string | ReactElement)[] | (string | ReactElement)
|
children: (string | ReactElement)[] | (string | ReactElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles(() =>
|
const useStyles = makeStyles()(() => ({
|
||||||
createStyles({
|
|
||||||
text: {
|
text: {
|
||||||
color: '#606060',
|
color: '#606060',
|
||||||
fontSize: '0.9rem',
|
fontSize: '0.9rem',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export function DocumentationText({ children }: Props): ReactElement {
|
export function DocumentationText({ children }: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
return <Typography className={classes.text}>{children}</Typography>
|
return <Typography className={classes.text}>{children}</Typography>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ export default class ErrorBoundary extends Component<Props, State> {
|
|||||||
this.errorReporting(error)
|
this.errorReporting(error)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error({ error, errorInfo }) // eslint-disable-line
|
// eslint-disable-next-line no-console
|
||||||
|
console.error({ error, errorInfo })
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): ReactElement {
|
render(): ReactElement {
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
import { Typography } from '@material-ui/core/'
|
|
||||||
import { EthAddress } from '@ethersphere/bee-js'
|
|
||||||
import { ReactElement } from 'react'
|
|
||||||
import Identicon from 'react-identicons'
|
|
||||||
import { BLOCKCHAIN_EXPLORER_URL } from '../constants'
|
|
||||||
import ClipboardCopy from './ClipboardCopy'
|
|
||||||
import { Flex } from './Flex'
|
|
||||||
import QRCodeModal from './QRCodeModal'
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
address: EthAddress | undefined
|
|
||||||
hideBlockie?: boolean
|
|
||||||
transaction?: boolean
|
|
||||||
truncate?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function EthereumAddress(props: Props): ReactElement {
|
|
||||||
return (
|
|
||||||
<Typography component="div" variant="subtitle1">
|
|
||||||
{props.address ? (
|
|
||||||
<Flex>
|
|
||||||
{props.hideBlockie ? null : (
|
|
||||||
<div style={{ paddingTop: '5px', marginRight: '10px' }}>
|
|
||||||
<Identicon size={20} string={props.address.toChecksum()} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div>
|
|
||||||
<a
|
|
||||||
style={
|
|
||||||
props.truncate
|
|
||||||
? {
|
|
||||||
marginRight: '7px',
|
|
||||||
maxWidth: '200px',
|
|
||||||
overflow: 'hidden',
|
|
||||||
textOverflow: 'ellipsis',
|
|
||||||
whiteSpace: 'nowrap',
|
|
||||||
display: 'block',
|
|
||||||
}
|
|
||||||
: { marginRight: '7px' }
|
|
||||||
}
|
|
||||||
href={`${BLOCKCHAIN_EXPLORER_URL}/${props.transaction ? 'tx' : 'address'}/${props.address}`}
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
>
|
|
||||||
{props.address}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<QRCodeModal value={props.address.toChecksum()} label={'Ethereum Address'} />
|
|
||||||
<ClipboardCopy value={props.address.toChecksum()} />
|
|
||||||
</Flex>
|
|
||||||
) : (
|
|
||||||
'-'
|
|
||||||
)}
|
|
||||||
</Typography>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,15 @@
|
|||||||
import { Collapse, ListItem } from '@material-ui/core'
|
import { ExpandLess, ExpandMore } from '@mui/icons-material'
|
||||||
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
import { Collapse, ListItemButton } from '@mui/material'
|
||||||
import { ExpandLess, ExpandMore } from '@material-ui/icons'
|
|
||||||
import { ReactElement, ReactNode, useState } from 'react'
|
import { ReactElement, ReactNode, useState } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
root: {
|
root: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
padding: 0,
|
padding: 0,
|
||||||
margin: 0,
|
margin: 0,
|
||||||
marginTop: theme.spacing(4),
|
marginTop: theme.spacing(4),
|
||||||
'&:first-child': {
|
'&:first-of-type': {
|
||||||
marginTop: 0,
|
marginTop: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -31,8 +30,7 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
infoText: {
|
infoText: {
|
||||||
color: '#c9c9c9',
|
color: '#c9c9c9',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: ReactNode
|
children: ReactNode
|
||||||
@@ -41,7 +39,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ExpandableElement({ children, expandable, defaultOpen }: Props): ReactElement | null {
|
export default function ExpandableElement({ children, expandable, defaultOpen }: Props): ReactElement | null {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
const [open, setOpen] = useState<boolean>(Boolean(defaultOpen))
|
const [open, setOpen] = useState<boolean>(Boolean(defaultOpen))
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
@@ -50,10 +48,10 @@ export default function ExpandableElement({ children, expandable, defaultOpen }:
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`${classes.root} ${classes.rootLevel2}`}>
|
<div className={`${classes.root} ${classes.rootLevel2}`}>
|
||||||
<ListItem button onClick={handleClick} className={classes.header}>
|
<ListItemButton onClick={handleClick} className={classes.header}>
|
||||||
{children}
|
{children}
|
||||||
{open ? <ExpandLess /> : <ExpandMore />}
|
{open ? <ExpandLess /> : <ExpandMore />}
|
||||||
</ListItem>
|
</ListItemButton>
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
<Collapse in={open} timeout="auto" unmountOnExit>
|
||||||
<div className={classes.contentLevel12}>{expandable}</div>
|
<div className={classes.contentLevel12}>{expandable}</div>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { Collapse, ListItem, ListItemText, Typography } from '@material-ui/core'
|
import { ExpandLess, ExpandMore } from '@mui/icons-material'
|
||||||
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
import { Collapse, ListItemButton, ListItemText, Typography } from '@mui/material'
|
||||||
import { ExpandLess, ExpandMore } from '@material-ui/icons'
|
|
||||||
import { ReactElement, ReactNode, useState } from 'react'
|
import { ReactElement, ReactNode, useState } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
import { Flex } from './Flex'
|
import { Flex } from './Flex'
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
root: {
|
root: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
padding: 0,
|
padding: 0,
|
||||||
margin: 0,
|
margin: 0,
|
||||||
marginTop: theme.spacing(4),
|
marginTop: theme.spacing(4),
|
||||||
'&:first-child': {
|
'&:first-of-type': {
|
||||||
marginTop: 0,
|
marginTop: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -29,8 +29,7 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
infoText: {
|
infoText: {
|
||||||
color: '#c9c9c9',
|
color: '#c9c9c9',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children?: ReactNode
|
children?: ReactNode
|
||||||
@@ -41,7 +40,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ExpandableList({ children, label, level, defaultOpen, info }: Props): ReactElement | null {
|
export default function ExpandableList({ children, label, level, defaultOpen, info }: Props): ReactElement | null {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
const [open, setOpen] = useState<boolean>(Boolean(defaultOpen))
|
const [open, setOpen] = useState<boolean>(Boolean(defaultOpen))
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
@@ -64,7 +63,7 @@ export default function ExpandableList({ children, label, level, defaultOpen, in
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`${classes.root} ${rootLevelClass}`}>
|
<div className={`${classes.root} ${rootLevelClass}`}>
|
||||||
<ListItem button onClick={handleClick} className={classes.header}>
|
<ListItemButton onClick={handleClick} className={classes.header}>
|
||||||
<ListItemText primary={<Typography variant={typographyVariant}>{label}</Typography>} />
|
<ListItemText primary={<Typography variant={typographyVariant}>{label}</Typography>} />
|
||||||
<Flex>
|
<Flex>
|
||||||
{!open && (
|
{!open && (
|
||||||
@@ -74,7 +73,7 @@ export default function ExpandableList({ children, label, level, defaultOpen, in
|
|||||||
)}
|
)}
|
||||||
{open ? <ExpandLess /> : <ExpandMore />}
|
{open ? <ExpandLess /> : <ExpandMore />}
|
||||||
</Flex>
|
</Flex>
|
||||||
</ListItem>
|
</ListItemButton>
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
<Collapse in={open} timeout="auto" unmountOnExit>
|
||||||
<div className={contentLevelClass}>{children}</div>
|
<div className={contentLevelClass}>{children}</div>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { Grid, IconButton, Tooltip, Typography } from '@material-ui/core'
|
import { Box, IconButton, Tooltip, Typography } from '@mui/material'
|
||||||
import ListItem from '@material-ui/core/ListItem'
|
import ListItemButton from '@mui/material/ListItemButton'
|
||||||
import { Theme, createStyles, makeStyles } from '@material-ui/core/styles'
|
|
||||||
import { ReactElement, ReactNode } from 'react'
|
import { ReactElement, ReactNode } from 'react'
|
||||||
import Info from 'remixicon-react/InformationLineIcon'
|
import Info from 'remixicon-react/InformationLineIcon'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
header: {
|
header: {
|
||||||
backgroundColor: theme.palette.background.paper,
|
backgroundColor: theme.palette.background.paper,
|
||||||
marginBottom: theme.spacing(0.25),
|
marginBottom: theme.spacing(0.25),
|
||||||
@@ -20,8 +19,7 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
color: theme.palette.primary.main,
|
color: theme.palette.primary.main,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
label?: ReactNode
|
label?: ReactNode
|
||||||
@@ -30,14 +28,19 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ExpandableListItem({ label, value, tooltip }: Props): ReactElement | null {
|
export default function ExpandableListItem({ label, value, tooltip }: Props): ReactElement | null {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem className={classes.header}>
|
<ListItemButton className={classes.header}>
|
||||||
<Grid container direction="row" justifyContent="space-between" alignItems="center">
|
<Box display="flex" flexDirection="row" alignItems="center" width="100%">
|
||||||
{label && <Typography variant="body1">{label}</Typography>}
|
{label && (
|
||||||
|
<Box flex={2}>
|
||||||
|
<Typography variant="body1">{label}</Typography>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
{value && (
|
{value && (
|
||||||
<Typography variant="body2">
|
<Box flex={1} textAlign="right">
|
||||||
|
<Typography variant="body2" component="div">
|
||||||
{value}
|
{value}
|
||||||
{tooltip && (
|
{tooltip && (
|
||||||
<Tooltip title={tooltip} placement="top" arrow>
|
<Tooltip title={tooltip} placement="top" arrow>
|
||||||
@@ -47,8 +50,9 @@ export default function ExpandableListItem({ label, value, tooltip }: Props): Re
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
</Box>
|
||||||
)}
|
)}
|
||||||
</Grid>
|
</Box>
|
||||||
</ListItem>
|
</ListItemButton>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { Grid } from '@material-ui/core'
|
import { Grid } from '@mui/material'
|
||||||
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
|
||||||
import { ReactElement, ReactNode } from 'react'
|
import { ReactElement, ReactNode } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
wrapper: {
|
wrapper: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
@@ -13,15 +12,14 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
marginBottom: theme.spacing(1),
|
marginBottom: theme.spacing(1),
|
||||||
marginRight: theme.spacing(1),
|
marginRight: theme.spacing(1),
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: ReactNode | ReactNode[]
|
children: ReactNode | ReactNode[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ExpandableListItemActions({ children }: Props): ReactElement | null {
|
export default function ExpandableListItemActions({ children }: Props): ReactElement | null {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
if (Array.isArray(children)) {
|
if (Array.isArray(children)) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,26 +1,32 @@
|
|||||||
import { Box, Grid, IconButton, InputBase, ListItem, Typography } from '@material-ui/core'
|
import { Box, IconButton, InputBase, ListItemButton, Typography } from '@mui/material'
|
||||||
import Collapse from '@material-ui/core/Collapse'
|
import Collapse from '@mui/material/Collapse'
|
||||||
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
import React, { ChangeEvent, ReactElement, useState } from 'react'
|
||||||
import { ChangeEvent, ReactElement, useState } from 'react'
|
|
||||||
import type { RemixiconReactIconProps } from 'remixicon-react'
|
import type { RemixiconReactIconProps } from 'remixicon-react'
|
||||||
import Check from 'remixicon-react/CheckLineIcon'
|
import Check from 'remixicon-react/CheckLineIcon'
|
||||||
import X from 'remixicon-react/CloseLineIcon'
|
import X from 'remixicon-react/CloseLineIcon'
|
||||||
import Edit from 'remixicon-react/PencilLineIcon'
|
import Edit from 'remixicon-react/PencilLineIcon'
|
||||||
import Minus from 'remixicon-react/SubtractLineIcon'
|
import Minus from 'remixicon-react/SubtractLineIcon'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
import ExpandableListItemActions from './ExpandableListItemActions'
|
import ExpandableListItemActions from './ExpandableListItemActions'
|
||||||
import ExpandableListItemNote from './ExpandableListItemNote'
|
import ExpandableListItemNote from './ExpandableListItemNote'
|
||||||
import { SwarmButton } from './SwarmButton'
|
import { SwarmButton } from './SwarmButton'
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
header: {
|
header: {
|
||||||
backgroundColor: theme.palette.background.paper,
|
backgroundColor: theme.palette.background.paper,
|
||||||
marginBottom: theme.spacing(0.25),
|
marginBottom: theme.spacing(0.25),
|
||||||
borderLeft: `${theme.spacing(0.25)}px solid rgba(0,0,0,0)`,
|
borderLeft: `${theme.spacing(0.25)} solid rgba(0,0,0,0)`,
|
||||||
wordBreak: 'break-word',
|
wordBreak: 'break-word',
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: theme.palette.background.paper,
|
||||||
|
},
|
||||||
|
'&:focus-within': {
|
||||||
|
backgroundColor: theme.palette.background.paper,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
headerOpen: {
|
headerOpen: {
|
||||||
borderLeft: `${theme.spacing(0.25)}px solid ${theme.palette.primary.main}`,
|
borderLeft: `${theme.spacing(0.25)} solid ${theme.palette.primary.main}`,
|
||||||
},
|
},
|
||||||
copyValue: {
|
copyValue: {
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
@@ -46,8 +52,7 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
MozUserSelect: 'none',
|
MozUserSelect: 'none',
|
||||||
msUserSelect: 'none',
|
msUserSelect: 'none',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
label: string
|
label: string
|
||||||
@@ -65,57 +70,67 @@ interface Props {
|
|||||||
locked?: boolean
|
locked?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ExpandableListItemKey({
|
export default function ExpandableListItemInput({
|
||||||
label,
|
label,
|
||||||
value,
|
value = '',
|
||||||
onConfirm,
|
placeholder,
|
||||||
onChange,
|
helperText,
|
||||||
|
expandedOnly,
|
||||||
confirmLabel,
|
confirmLabel,
|
||||||
confirmLabelDisabled,
|
confirmLabelDisabled,
|
||||||
confirmIcon,
|
confirmIcon,
|
||||||
expandedOnly,
|
|
||||||
helperText,
|
|
||||||
placeholder,
|
|
||||||
loading,
|
loading,
|
||||||
|
onChange,
|
||||||
|
onConfirm,
|
||||||
mapperFn,
|
mapperFn,
|
||||||
locked,
|
locked,
|
||||||
}: Props): ReactElement | null {
|
}: Props): ReactElement | null {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
const [open, setOpen] = useState(Boolean(expandedOnly))
|
const [open, setOpen] = useState(Boolean(expandedOnly))
|
||||||
const [inputValue, setInputValue] = useState<string>(value || '')
|
const [inputValue, setInputValue] = useState<string>(value || '')
|
||||||
const toggleOpen = () => setOpen(!open)
|
const toggleOpen = () => setOpen(!open)
|
||||||
const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {
|
const handleChange = (e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
||||||
|
let newValue = e.target.value
|
||||||
|
|
||||||
if (mapperFn) {
|
if (mapperFn) {
|
||||||
e.target.value = mapperFn(e.target.value)
|
newValue = mapperFn(newValue)
|
||||||
}
|
}
|
||||||
|
setInputValue(newValue)
|
||||||
|
|
||||||
setInputValue(e.target.value.trim())
|
if (onChange) onChange(newValue)
|
||||||
|
|
||||||
if (onChange) onChange(e.target.value.trim())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ListItem className={`${classes.header} ${open ? classes.headerOpen : ''}`}>
|
<ListItemButton className={`${classes.header} ${open ? classes.headerOpen : ''}`}>
|
||||||
<Grid container direction="column" justifyContent="space-between" alignItems="stretch">
|
<Box display="flex" flexDirection="column" width="100%">
|
||||||
<Grid container direction="row" justifyContent="space-between" alignItems="center">
|
<Box display="flex" flexDirection="row" alignItems="center" width="100%">
|
||||||
{label && (
|
{label && (
|
||||||
<Typography variant="body1" className={classes.unselectableLabel}>
|
<Box flex={1} minWidth={0}>
|
||||||
|
<Typography variant="body1" className={classes.unselectableLabel} component="span">
|
||||||
{label}
|
{label}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
<Box flex={3} display="flex" alignItems="center" justifyContent="flex-end" minWidth={0} gap={1}>
|
||||||
|
{!open && value && (
|
||||||
|
<Typography
|
||||||
|
variant="body2"
|
||||||
|
component="span"
|
||||||
|
sx={{ minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}
|
||||||
|
>
|
||||||
|
{value}
|
||||||
|
</Typography>
|
||||||
)}
|
)}
|
||||||
<Typography variant="body2">
|
|
||||||
<div>
|
|
||||||
{!open && value}
|
|
||||||
{!expandedOnly && !locked && (
|
{!expandedOnly && !locked && (
|
||||||
<IconButton size="small" className={classes.copyValue} onClick={toggleOpen}>
|
<IconButton size="small" className={classes.copyValue} onClick={toggleOpen}>
|
||||||
{open ? <Minus strokeWidth={1} /> : <Edit strokeWidth={1} />}
|
{open ? <Minus strokeWidth={1} /> : <Edit strokeWidth={1} />}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
</div>
|
</Box>
|
||||||
</Typography>
|
</Box>
|
||||||
</Grid>
|
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
<Collapse in={open} timeout="auto" unmountOnExit>
|
||||||
|
<Box display="flex" alignItems="center" width="100%" minWidth={0}>
|
||||||
<InputBase
|
<InputBase
|
||||||
value={inputValue}
|
value={inputValue}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
@@ -124,25 +139,36 @@ export default function ExpandableListItemKey({
|
|||||||
className={classes.content}
|
className={classes.content}
|
||||||
autoFocus
|
autoFocus
|
||||||
hidden={locked}
|
hidden={locked}
|
||||||
|
inputProps={{
|
||||||
|
style: {
|
||||||
|
width: '100%',
|
||||||
|
minWidth: 220,
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
overflow: 'hidden',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
},
|
||||||
|
maxLength: 512,
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Collapse>
|
</Box>
|
||||||
</Grid>
|
|
||||||
</ListItem>
|
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
|
||||||
{helperText && <ExpandableListItemNote>{helperText}</ExpandableListItemNote>}
|
{helperText && <ExpandableListItemNote>{helperText}</ExpandableListItemNote>}
|
||||||
|
</Collapse>
|
||||||
|
</Box>
|
||||||
|
</ListItemButton>
|
||||||
|
<Collapse in={open} timeout="auto" unmountOnExit>
|
||||||
<Box mt={2}>
|
<Box mt={2}>
|
||||||
<ExpandableListItemActions>
|
<ExpandableListItemActions>
|
||||||
<SwarmButton
|
<SwarmButton
|
||||||
disabled={
|
disabled={
|
||||||
loading ||
|
loading ||
|
||||||
inputValue === value ||
|
inputValue === value ||
|
||||||
Boolean(confirmLabelDisabled) || // Disable if external validation is provided
|
Boolean(confirmLabelDisabled) ||
|
||||||
(inputValue === '' && value === undefined) // Disable if no initial value was not provided and the field is empty. The undefined check is improtant so that it is possible to submit with empty input in other cases
|
(inputValue === '' && value === undefined)
|
||||||
}
|
}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
iconType={confirmIcon ?? Check}
|
iconType={confirmIcon ?? Check}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (onConfirm) onConfirm(inputValue)
|
onConfirm?.(inputValue.trim())
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{confirmLabel || 'Save'}
|
{confirmLabel || 'Save'}
|
||||||
|
|||||||
@@ -1,21 +1,26 @@
|
|||||||
import { Grid, IconButton, ListItem, Tooltip, Typography } from '@material-ui/core'
|
import { Collapse, Grid, IconButton, ListItemButton, Tooltip, Typography } from '@mui/material'
|
||||||
import Collapse from '@material-ui/core/Collapse'
|
|
||||||
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
|
||||||
import { ReactElement, useState } from 'react'
|
import { ReactElement, useState } from 'react'
|
||||||
import { CopyToClipboard } from 'react-copy-to-clipboard'
|
|
||||||
import Eye from 'remixicon-react/EyeLineIcon'
|
import Eye from 'remixicon-react/EyeLineIcon'
|
||||||
import Minus from 'remixicon-react/SubtractLineIcon'
|
import Minus from 'remixicon-react/SubtractLineIcon'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
import { useClipboardCopy } from '../hooks/useClipboardCopy'
|
||||||
createStyles({
|
|
||||||
|
const useStyles = makeStyles()(theme => ({
|
||||||
header: {
|
header: {
|
||||||
backgroundColor: theme.palette.background.paper,
|
backgroundColor: theme.palette.background.paper,
|
||||||
marginBottom: theme.spacing(0.25),
|
marginBottom: theme.spacing(0.25),
|
||||||
borderLeft: `${theme.spacing(0.25)}px solid rgba(0,0,0,0)`,
|
borderLeft: `${theme.spacing(0.25)} solid rgba(0,0,0,0)`,
|
||||||
wordBreak: 'break-word',
|
wordBreak: 'break-word',
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: theme.palette.background.paper,
|
||||||
|
},
|
||||||
|
'&:focus-within': {
|
||||||
|
backgroundColor: theme.palette.background.paper,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
headerOpen: {
|
headerOpen: {
|
||||||
borderLeft: `${theme.spacing(0.25)}px solid ${theme.palette.primary.main}`,
|
borderLeft: `${theme.spacing(0.25)} solid ${theme.palette.primary.main}`,
|
||||||
},
|
},
|
||||||
copyValue: {
|
copyValue: {
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
@@ -33,8 +38,7 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
keyMargin: {
|
keyMargin: {
|
||||||
marginRight: theme.spacing(1),
|
marginRight: theme.spacing(1),
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
label: string
|
label: string
|
||||||
@@ -57,13 +61,11 @@ const split = (s: string): string[] => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ExpandableListItemKey({ label, value, expanded }: Props): ReactElement | null {
|
export default function ExpandableListItemKey({ label, value, expanded }: Props): ReactElement | null {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
const [open, setOpen] = useState(expanded || false)
|
|
||||||
const [copied, setCopied] = useState(false)
|
|
||||||
const toggleOpen = () => setOpen(!open)
|
|
||||||
|
|
||||||
const tooltipClickHandler = () => setCopied(true)
|
const [open, setOpen] = useState(expanded || false)
|
||||||
const tooltipCloseHandler = () => setCopied(false)
|
const { copied, handleCopy, tooltipCloseHandler } = useClipboardCopy(value)
|
||||||
|
const toggleOpen = () => setOpen(!open)
|
||||||
|
|
||||||
const splitValues = split(value)
|
const splitValues = split(value)
|
||||||
const hasPrefix = isPrefixedHexString(value)
|
const hasPrefix = isPrefixedHexString(value)
|
||||||
@@ -72,17 +74,19 @@ export default function ExpandableListItemKey({ label, value, expanded }: Props)
|
|||||||
}`
|
}`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem className={`${classes.header} ${open ? classes.headerOpen : ''}`}>
|
<ListItemButton className={`${classes.header} ${open ? classes.headerOpen : ''}`}>
|
||||||
<Grid container direction="column" justifyContent="space-between" alignItems="stretch">
|
<Grid container direction="column" justifyContent="space-between" alignItems="stretch" style={{ width: '100%' }}>
|
||||||
<Grid container direction="row" justifyContent="space-between" alignItems="center">
|
<Grid container direction="row" justifyContent="space-between" alignItems="center">
|
||||||
{label && <Typography variant="body1">{label}</Typography>}
|
{label && (
|
||||||
<Typography variant="body2">
|
<Typography variant="body1" component="span">
|
||||||
|
{label}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
<Typography variant="body2" component="span">
|
||||||
{!open && (
|
{!open && (
|
||||||
<span className={classes.copyValue}>
|
<span className={classes.copyValue}>
|
||||||
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
|
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
|
||||||
<CopyToClipboard text={value}>
|
<span onClick={handleCopy}>{value ? spanText : ''}</span>
|
||||||
<span onClick={tooltipClickHandler}>{value ? spanText : ''}</span>
|
|
||||||
</CopyToClipboard>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
@@ -94,9 +98,8 @@ export default function ExpandableListItemKey({ label, value, expanded }: Props)
|
|||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
<Collapse in={open} timeout="auto" unmountOnExit>
|
||||||
<div className={classes.content}>
|
<div className={classes.content}>
|
||||||
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
|
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
|
||||||
<CopyToClipboard text={value}>
|
|
||||||
{/* This has to be wrapped in two spans otherwise either the tooltip or the highlighting does not work*/}
|
{/* This has to be wrapped in two spans otherwise either the tooltip or the highlighting does not work*/}
|
||||||
<span onClick={tooltipClickHandler}>
|
<span onClick={handleCopy}>
|
||||||
<span className={classes.copyValue}>
|
<span className={classes.copyValue}>
|
||||||
{splitValues.map((s, i) => (
|
{splitValues.map((s, i) => (
|
||||||
<Typography variant="body2" key={i} className={classes.keyMargin} component="span">
|
<Typography variant="body2" key={i} className={classes.keyMargin} component="span">
|
||||||
@@ -105,11 +108,10 @@ export default function ExpandableListItemKey({ label, value, expanded }: Props)
|
|||||||
))}
|
))}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</CopyToClipboard>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ListItem>
|
</ListItemButton>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,26 @@
|
|||||||
import { Grid, IconButton, ListItem, Tooltip, Typography } from '@material-ui/core'
|
import { ArrowForward, OpenInNewSharp } from '@mui/icons-material'
|
||||||
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
import { Box, IconButton, ListItemButton, Tooltip, Typography } from '@mui/material'
|
||||||
import { ArrowForward, OpenInNewSharp } from '@material-ui/icons'
|
import { ReactElement } from 'react'
|
||||||
import { ReactElement, useState } from 'react'
|
|
||||||
import CopyToClipboard from 'react-copy-to-clipboard'
|
|
||||||
import { useNavigate } from 'react-router'
|
import { useNavigate } from 'react-router'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
import { useClipboardCopy } from '../hooks/useClipboardCopy'
|
||||||
createStyles({
|
|
||||||
|
const useStyles = makeStyles()(theme => ({
|
||||||
header: {
|
header: {
|
||||||
backgroundColor: theme.palette.background.paper,
|
backgroundColor: theme.palette.background.paper,
|
||||||
marginBottom: theme.spacing(0.25),
|
marginBottom: theme.spacing(0.25),
|
||||||
borderLeft: `${theme.spacing(0.25)}px solid rgba(0,0,0,0)`,
|
borderLeft: `${theme.spacing(0.25)} solid rgba(0,0,0,0)`,
|
||||||
wordBreak: 'break-word',
|
wordBreak: 'break-word',
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: theme.palette.background.paper,
|
||||||
|
},
|
||||||
|
'&:focus-within': {
|
||||||
|
backgroundColor: theme.palette.background.paper,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
headerOpen: {
|
headerOpen: {
|
||||||
borderLeft: `${theme.spacing(0.25)}px solid ${theme.palette.primary.main}`,
|
borderLeft: `${theme.spacing(0.25)} solid ${theme.palette.primary.main}`,
|
||||||
},
|
},
|
||||||
openLinkIcon: {
|
openLinkIcon: {
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
@@ -41,14 +47,18 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
color: theme.palette.primary.main,
|
color: theme.palette.primary.main,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
export enum NavigationType {
|
||||||
|
NEW_WINDOW = 'NEW_WINDOW',
|
||||||
|
HISTORY_PUSH = 'HISTORY_PUSH',
|
||||||
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
label: string
|
label: string
|
||||||
value: string
|
value: string
|
||||||
link?: string
|
link?: string
|
||||||
navigationType?: 'NEW_WINDOW' | 'HISTORY_PUSH'
|
navigationType?: NavigationType
|
||||||
allowClipboard?: boolean
|
allowClipboard?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,20 +66,17 @@ export default function ExpandableListItemLink({
|
|||||||
label,
|
label,
|
||||||
value,
|
value,
|
||||||
link,
|
link,
|
||||||
navigationType = 'NEW_WINDOW',
|
navigationType = NavigationType.NEW_WINDOW,
|
||||||
allowClipboard = true,
|
allowClipboard = true,
|
||||||
}: Props): ReactElement | null {
|
}: Props): ReactElement | null {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
const [copied, setCopied] = useState(false)
|
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
const { copied, handleCopy, tooltipCloseHandler } = useClipboardCopy(value)
|
||||||
const tooltipClickHandler = () => setCopied(true)
|
|
||||||
const tooltipCloseHandler = () => setCopied(false)
|
|
||||||
|
|
||||||
const displayValue = value.length > 22 ? value.slice(0, 19) + '...' : value
|
const displayValue = value.length > 22 ? value.slice(0, 19) + '...' : value
|
||||||
|
|
||||||
function onNavigation() {
|
function onNavigation() {
|
||||||
if (navigationType === 'NEW_WINDOW') {
|
if (navigationType === NavigationType.NEW_WINDOW) {
|
||||||
window.open(link || value)
|
window.open(link || value)
|
||||||
} else {
|
} else {
|
||||||
navigate(link || value)
|
navigate(link || value)
|
||||||
@@ -77,28 +84,26 @@ export default function ExpandableListItemLink({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem className={classes.header}>
|
<ListItemButton className={classes.header} sx={{ width: '100%' }}>
|
||||||
<Grid container direction="column" justifyContent="space-between" alignItems="stretch">
|
<Box display="flex" flexDirection="row" justifyContent="space-between" alignItems="center" width="100%">
|
||||||
<Grid container direction="row" justifyContent="space-between" alignItems="center">
|
|
||||||
{label && <Typography variant="body1">{label}</Typography>}
|
{label && <Typography variant="body1">{label}</Typography>}
|
||||||
|
<Box display="flex" alignItems="center">
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
{allowClipboard && (
|
{allowClipboard && (
|
||||||
<span className={classes.copyValue}>
|
<span className={classes.copyValue}>
|
||||||
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
|
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
|
||||||
<CopyToClipboard text={value}>
|
<span onClick={handleCopy}>{displayValue}</span>
|
||||||
<span onClick={tooltipClickHandler}>{displayValue}</span>
|
|
||||||
</CopyToClipboard>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{!allowClipboard && <span onClick={onNavigation}>{displayValue}</span>}
|
{!allowClipboard && <span onClick={onNavigation}>{displayValue}</span>}
|
||||||
<IconButton size="small" className={classes.openLinkIcon} onClick={onNavigation}>
|
|
||||||
{navigationType === 'NEW_WINDOW' && <OpenInNewSharp strokeWidth={1} />}
|
|
||||||
{navigationType === 'HISTORY_PUSH' && <ArrowForward strokeWidth={1} />}
|
|
||||||
</IconButton>
|
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
<IconButton size="small" className={classes.openLinkIcon} onClick={onNavigation}>
|
||||||
</Grid>
|
{navigationType === NavigationType.NEW_WINDOW && <OpenInNewSharp strokeWidth={1} />}
|
||||||
</ListItem>
|
{navigationType === NavigationType.HISTORY_PUSH && <ArrowForward strokeWidth={1} />}
|
||||||
|
</IconButton>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
</ListItemButton>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
|
import { Typography } from '@mui/material'
|
||||||
|
import ListItemButton from '@mui/material/ListItemButton'
|
||||||
import { ReactElement, ReactNode } from 'react'
|
import { ReactElement, ReactNode } from 'react'
|
||||||
import { makeStyles, Theme, createStyles } from '@material-ui/core/styles'
|
import { makeStyles } from 'tss-react/mui'
|
||||||
import { Typography } from '@material-ui/core'
|
|
||||||
import ListItem from '@material-ui/core/ListItem'
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
header: {
|
header: {
|
||||||
backgroundColor: '#F7F7F7',
|
backgroundColor: '#F7F7F7',
|
||||||
marginBottom: theme.spacing(0.25),
|
marginBottom: theme.spacing(0.25),
|
||||||
@@ -12,21 +11,20 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
typography: {
|
typography: {
|
||||||
color: '#242424',
|
color: '#242424',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children?: ReactNode | ReactNode[]
|
children?: ReactNode | ReactNode[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ExpandableListItemNote({ children }: Props): ReactElement | null {
|
export default function ExpandableListItemNote({ children }: Props): ReactElement | null {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem className={classes.header}>
|
<ListItemButton className={classes.header}>
|
||||||
<Typography variant="body1" className={classes.typography}>
|
<Typography variant="body1" className={classes.typography}>
|
||||||
{children}
|
{children}
|
||||||
</Typography>
|
</Typography>
|
||||||
</ListItem>
|
</ListItemButton>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import { createStyles, makeStyles } from '@material-ui/core'
|
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
const useStyles = makeStyles(() =>
|
const useStyles = makeStyles()(() => ({
|
||||||
createStyles({
|
|
||||||
audio: {
|
audio: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
maxWidth: '250px',
|
maxWidth: '250px',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
interface AudioProps {
|
interface AudioProps {
|
||||||
src: string | undefined
|
src: string | undefined
|
||||||
@@ -17,12 +15,17 @@ interface AudioProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function FitAudio(props: AudioProps): ReactElement {
|
export function FitAudio(props: AudioProps): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
const inlineStyles: Record<string, string> = {}
|
const inlineStyles: Record<string, string> = {}
|
||||||
|
|
||||||
props.maxHeight && (inlineStyles.maxHeight = props.maxHeight)
|
if (props.maxHeight) {
|
||||||
props.maxWidth && (inlineStyles.maxWidth = props.maxWidth)
|
inlineStyles.maxHeight = props.maxHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.maxWidth) {
|
||||||
|
inlineStyles.maxWidth = props.maxWidth
|
||||||
|
}
|
||||||
|
|
||||||
return <audio className={classes.audio} src={props.src} style={inlineStyles} controls />
|
return <audio className={classes.audio} src={props.src} style={inlineStyles} controls />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
import { createStyles, makeStyles } from '@material-ui/core'
|
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
const useStyles = makeStyles(() =>
|
const useStyles = makeStyles()(() => ({
|
||||||
createStyles({
|
|
||||||
image: {
|
image: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
objectFit: 'cover',
|
objectFit: 'cover',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
alt: string
|
alt: string
|
||||||
@@ -19,12 +17,17 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function FitImage(props: Props): ReactElement {
|
export function FitImage(props: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
const inlineStyles: Record<string, string> = {}
|
const inlineStyles: Record<string, string> = {}
|
||||||
|
|
||||||
props.maxHeight && (inlineStyles.maxHeight = props.maxHeight)
|
if (props.maxHeight) {
|
||||||
props.maxWidth && (inlineStyles.maxWidth = props.maxWidth)
|
inlineStyles.maxHeight = props.maxHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.maxWidth) {
|
||||||
|
inlineStyles.maxWidth = props.maxWidth
|
||||||
|
}
|
||||||
|
|
||||||
return <img className={classes.image} alt={props.alt} src={props.src} style={inlineStyles} />
|
return <img className={classes.image} alt={props.alt} src={props.src} style={inlineStyles} />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
import { createStyles, makeStyles } from '@material-ui/core'
|
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
const useStyles = makeStyles(() =>
|
const useStyles = makeStyles()(() => ({
|
||||||
createStyles({
|
|
||||||
video: {
|
video: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
objectFit: 'cover',
|
objectFit: 'cover',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
interface VideoProps {
|
interface VideoProps {
|
||||||
src: string | undefined
|
src: string | undefined
|
||||||
@@ -18,12 +16,17 @@ interface VideoProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function FitVideo(props: VideoProps): ReactElement {
|
export function FitVideo(props: VideoProps): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
const inlineStyles: Record<string, string> = {}
|
const inlineStyles: Record<string, string> = {}
|
||||||
|
|
||||||
props.maxHeight && (inlineStyles.maxHeight = props.maxHeight)
|
if (props.maxHeight) {
|
||||||
props.maxWidth && (inlineStyles.maxWidth = props.maxWidth)
|
inlineStyles.maxHeight = props.maxHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.maxWidth) {
|
||||||
|
inlineStyles.maxWidth = props.maxWidth
|
||||||
|
}
|
||||||
|
|
||||||
return <video className={classes.video} src={props.src} style={inlineStyles} controls />
|
return <video className={classes.video} src={props.src} style={inlineStyles} controls />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { ReactElement, useEffect, useState } from 'react'
|
import { ReactElement, useEffect, useState } from 'react'
|
||||||
|
|
||||||
import { getPrettyDateString } from '../utils/date'
|
import { getPrettyDateString } from '../utils/date'
|
||||||
import { getHistorySafe, HistoryItem, HISTORY_KEYS } from '../utils/local-storage'
|
import { getHistorySafe, HISTORY_KEYS, HistoryItem } from '../utils/localStorage'
|
||||||
|
|
||||||
import ExpandableList from './ExpandableList'
|
import ExpandableList from './ExpandableList'
|
||||||
import ExpandableListItemLink from './ExpandableListItemLink'
|
import ExpandableListItemLink, { NavigationType } from './ExpandableListItemLink'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string
|
title: string
|
||||||
@@ -28,7 +30,7 @@ export function History({ title, localStorageKey }: Props): ReactElement | null
|
|||||||
value={x.name}
|
value={x.name}
|
||||||
link={'/files/hash/' + x.hash}
|
link={'/files/hash/' + x.hash}
|
||||||
key={i}
|
key={i}
|
||||||
navigationType="HISTORY_PUSH"
|
navigationType={NavigationType.HISTORY_PUSH}
|
||||||
allowClipboard={false}
|
allowClipboard={false}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -1,25 +1,24 @@
|
|||||||
import { Box, createStyles, Grid, makeStyles, Typography } from '@material-ui/core'
|
import { ArrowBack } from '@mui/icons-material'
|
||||||
import { ArrowBack } from '@material-ui/icons'
|
import { Box, Grid, Typography } from '@mui/material'
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: string
|
children: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles(() =>
|
const useStyles = makeStyles()(() => ({
|
||||||
createStyles({
|
|
||||||
pressable: {
|
pressable: {
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
},
|
},
|
||||||
icon: {
|
icon: {
|
||||||
color: '#242424',
|
color: '#242424',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export function HistoryHeader({ children }: Props): ReactElement {
|
export function HistoryHeader({ children }: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
function goBack() {
|
function goBack() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { CircularProgress, Grid } from '@material-ui/core'
|
import { CircularProgress, Grid } from '@mui/material'
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
|
||||||
export function Loading(): ReactElement {
|
export function Loading(): ReactElement {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { Peer } from '@ethersphere/bee-js'
|
import type { Peer } from '@ethersphere/bee-js'
|
||||||
import DottedMap, { DottedMapWithoutCountriesLib } from 'dotted-map/without-countries'
|
import DottedMap, { DottedMapWithoutCountriesLib } from 'dotted-map/without-countries'
|
||||||
import { CSSProperties, ReactElement, useContext, useEffect, useState } from 'react'
|
import { CSSProperties, ReactElement, useContext, useEffect, useState } from 'react'
|
||||||
|
|
||||||
import mapData from '../assets/data/map-data.json'
|
import mapData from '../assets/data/map-data.json'
|
||||||
import nodesDb from '../assets/data/nodes-db.json'
|
import nodesDb from '../assets/data/nodes-db.json'
|
||||||
import { Context } from '../providers/Bee'
|
import { Context } from '../providers/Bee'
|
||||||
@@ -18,17 +19,10 @@ interface MapRecord {
|
|||||||
type MapDB = Record<string, MapRecord>
|
type MapDB = Record<string, MapRecord>
|
||||||
|
|
||||||
const fullMapDb = nodesDb as unknown as MapDB
|
const fullMapDb = nodesDb as unknown as MapDB
|
||||||
const deduplicatedRecords = deduplicate(fullMapDb)
|
|
||||||
|
|
||||||
function deduplicate(db: MapDB): MapRecord[] {
|
const deduplicatedRecords = Object.values(
|
||||||
const noDuplicates: Record<string, MapRecord> = {}
|
Object.fromEntries(Object.values(fullMapDb).map(r => [`${r.lat} ${r.lng}`, r])),
|
||||||
|
)
|
||||||
Object.entries(fullMapDb).forEach(([key, record]) => {
|
|
||||||
noDuplicates[`${record.lat} ${record.lng}`] = record
|
|
||||||
})
|
|
||||||
|
|
||||||
return Object.values(noDuplicates)
|
|
||||||
}
|
|
||||||
|
|
||||||
function findIntersection(db: MapDB, peers: Peer[]): MapRecord[] {
|
function findIntersection(db: MapDB, peers: Peer[]): MapRecord[] {
|
||||||
const noDuplicates: Record<string, MapRecord> = {}
|
const noDuplicates: Record<string, MapRecord> = {}
|
||||||
@@ -47,27 +41,45 @@ function addPins(map: DottedMap, pins: MapRecord[], color: string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum PeerColors {
|
||||||
|
Black = '#303030',
|
||||||
|
Green = '#09CA6C',
|
||||||
|
LightGrey = '#dadada',
|
||||||
|
White = '#eaeaea',
|
||||||
|
}
|
||||||
|
|
||||||
const mapPrecomputed = new DottedMap({ map: JSON.parse(mapData) })
|
const mapPrecomputed = new DottedMap({ map: JSON.parse(mapData) })
|
||||||
const mapNoPins = new DottedMap({ map: JSON.parse(mapData) })
|
const mapNoPins = new DottedMap({ map: JSON.parse(mapData) })
|
||||||
addPins(mapPrecomputed, deduplicatedRecords, '#303030')
|
addPins(mapPrecomputed, deduplicatedRecords, PeerColors.Black)
|
||||||
|
|
||||||
const mapSvgOptions: DottedMapWithoutCountriesLib.SvgSettings = { shape: 'hexagon', radius: 0.21, color: '#dadada' }
|
const mapSvgOptions: DottedMapWithoutCountriesLib.SvgSettings = {
|
||||||
|
shape: 'hexagon',
|
||||||
|
radius: 0.21,
|
||||||
|
color: PeerColors.LightGrey,
|
||||||
|
}
|
||||||
|
|
||||||
export default function Card({ style, error }: Props): ReactElement {
|
export default function Card({ style, error }: Props): ReactElement {
|
||||||
const { peers } = useContext(Context)
|
const { peers } = useContext(Context)
|
||||||
const [map, setMap] = useState<string>(mapPrecomputed.getSVG(mapSvgOptions))
|
const [map, setMap] = useState<string>(mapPrecomputed.getSVG(mapSvgOptions))
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Display error map
|
let newSvg: string
|
||||||
if (error) setMap(mapNoPins.getSVG({ ...mapSvgOptions, color: '#eaeaea' }))
|
|
||||||
|
|
||||||
// Display just the base map without any connections
|
|
||||||
if (!peers) return
|
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
newSvg = mapNoPins.getSVG({ ...mapSvgOptions, color: PeerColors.White })
|
||||||
|
} else if (peers) {
|
||||||
const points = findIntersection(fullMapDb, peers)
|
const points = findIntersection(fullMapDb, peers)
|
||||||
const mapNew = Object.create(mapPrecomputed)
|
const mapNew = Object.create(mapPrecomputed)
|
||||||
addPins(mapNew, points, '#09CA6C')
|
addPins(mapNew, points, PeerColors.Green)
|
||||||
setMap(mapNew.getSVG(mapSvgOptions))
|
newSvg = mapNew.getSVG(mapSvgOptions)
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newSvg !== map) {
|
||||||
|
setMap(newSvg)
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [peers, error])
|
}, [peers, error])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import Box from '@mui/material/Box'
|
||||||
|
import LinearProgress, { LinearProgressProps } from '@mui/material/LinearProgress'
|
||||||
|
import Typography from '@mui/material/Typography'
|
||||||
import React, { ReactElement } from 'react'
|
import React, { ReactElement } from 'react'
|
||||||
import LinearProgress, { LinearProgressProps } from '@material-ui/core/LinearProgress'
|
|
||||||
import Typography from '@material-ui/core/Typography'
|
|
||||||
import Box from '@material-ui/core/Box'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
linearProgressProps?: LinearProgressProps
|
linearProgressProps?: LinearProgressProps
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { createStyles, Grid, makeStyles, Typography } from '@material-ui/core'
|
import { Grid, Typography } from '@mui/material'
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
steps: string[]
|
steps: string[]
|
||||||
index: number
|
index: number
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles(() =>
|
const useStyles = makeStyles()(() => ({
|
||||||
createStyles({
|
|
||||||
wrapper: {
|
wrapper: {
|
||||||
height: '52px',
|
height: '52px',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@@ -29,11 +29,10 @@ const useStyles = makeStyles(() =>
|
|||||||
color: '#606060',
|
color: '#606060',
|
||||||
height: '52px',
|
height: '52px',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export function ProgressIndicator({ steps, index }: Props): ReactElement {
|
export function ProgressIndicator({ steps, index }: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
function pickClass(i: number): string {
|
function pickClass(i: number): string {
|
||||||
if (i === index) {
|
if (i === index) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { FilterCenterFocusSharp } from '@mui/icons-material'
|
||||||
|
import { Dialog, DialogTitle, IconButton } from '@mui/material'
|
||||||
import { ReactElement, useState } from 'react'
|
import { ReactElement, useState } from 'react'
|
||||||
import QRCode from 'qrcode.react'
|
import QRCode from 'react-qr-code'
|
||||||
import { IconButton, Dialog, DialogTitle } from '@material-ui/core'
|
|
||||||
import { FilterCenterFocusSharp } from '@material-ui/icons'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value: string
|
value: string
|
||||||
@@ -27,15 +27,7 @@ export default function QRCodeModal(props: Props): ReactElement {
|
|||||||
<Dialog onClose={handleClose} aria-labelledby="simple-dialog-title" open={open}>
|
<Dialog onClose={handleClose} aria-labelledby="simple-dialog-title" open={open}>
|
||||||
<div style={{ padding: '30px', textAlign: 'center' }}>
|
<div style={{ padding: '30px', textAlign: 'center' }}>
|
||||||
<DialogTitle id="simple-dialog-title">{props.label}</DialogTitle>
|
<DialogTitle id="simple-dialog-title">{props.label}</DialogTitle>
|
||||||
<QRCode
|
<QRCode value={props.value} size={150} bgColor={'#ffffff'} fgColor={'#000000'} level={'L'} />
|
||||||
value={props.value}
|
|
||||||
size={150}
|
|
||||||
bgColor={'#ffffff'}
|
|
||||||
fgColor={'#000000'}
|
|
||||||
level={'L'}
|
|
||||||
includeMargin={false}
|
|
||||||
renderAs={'svg'}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,47 +1,99 @@
|
|||||||
import { Box, Divider, Drawer, Grid, List, Link as MUILink, Typography } from '@material-ui/core'
|
|
||||||
import { Theme, createStyles, makeStyles } from '@material-ui/core/styles'
|
|
||||||
import { BeeModes } from '@ethersphere/bee-js'
|
import { BeeModes } from '@ethersphere/bee-js'
|
||||||
import { ReactElement, useContext } from 'react'
|
import { Box, Divider, Drawer, Grid, IconButton, Link as MUILink, List, Tooltip, Typography } from '@mui/material'
|
||||||
|
import { ReactElement, useContext, useState } from 'react'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import FilesIcon from 'remixicon-react/ArrowUpDownLineIcon'
|
import FilesIcon from 'remixicon-react/ArrowUpDownLineIcon'
|
||||||
import FileManagerIcon from 'remixicon-react/FolderOpenLineIcon'
|
|
||||||
import DocsIcon from 'remixicon-react/BookOpenLineIcon'
|
import DocsIcon from 'remixicon-react/BookOpenLineIcon'
|
||||||
import ExternalLinkIcon from 'remixicon-react/ExternalLinkLineIcon'
|
import ExternalLinkIcon from 'remixicon-react/ExternalLinkLineIcon'
|
||||||
|
import FileManagerIcon from 'remixicon-react/FolderOpenLineIcon'
|
||||||
import GithubIcon from 'remixicon-react/GithubFillIcon'
|
import GithubIcon from 'remixicon-react/GithubFillIcon'
|
||||||
import HomeIcon from 'remixicon-react/Home3LineIcon'
|
import HomeIcon from 'remixicon-react/Home3LineIcon'
|
||||||
|
import MenuFoldIcon from 'remixicon-react/MenuFoldLineIcon'
|
||||||
|
import MenuUnfoldIcon from 'remixicon-react/MenuUnfoldLineIcon'
|
||||||
import SettingsIcon from 'remixicon-react/Settings2LineIcon'
|
import SettingsIcon from 'remixicon-react/Settings2LineIcon'
|
||||||
import AccountIcon from 'remixicon-react/Wallet3LineIcon'
|
import AccountIcon from 'remixicon-react/Wallet3LineIcon'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
import DashboardLogo from '../assets/dashboard-logo.svg'
|
import DashboardLogo from '../assets/dashboard-logo.svg'
|
||||||
import DesktopLogo from '../assets/desktop-logo.svg'
|
import DesktopLogo from '../assets/desktop-logo.svg'
|
||||||
import { BEE_DOCS_HOST, GITHUB_BEE_DASHBOARD_URL } from '../constants'
|
import { BEE_DOCS_HOST, GITHUB_BEE_DASHBOARD_URL, GITHUB_BEE_DESKTOP_URL } from '../constants'
|
||||||
import { Context as BeeContext } from '../providers/Bee'
|
import { Context as BeeContext } from '../providers/Bee'
|
||||||
import { Context as SettingsContext } from '../providers/Settings'
|
import { Context as SettingsContext } from '../providers/Settings'
|
||||||
import { ROUTES } from '../routes'
|
import { ROUTES } from '../routes'
|
||||||
|
|
||||||
import SideBarItem from './SideBarItem'
|
import SideBarItem from './SideBarItem'
|
||||||
import SideBarStatus from './SideBarStatus'
|
import SideBarStatus from './SideBarStatus'
|
||||||
|
|
||||||
const drawerWidth = 300
|
const drawerWidth = 300
|
||||||
|
const drawerWidthCollapsed = 72
|
||||||
|
const drawerHeaderHeight = 56
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
root: {
|
root: {
|
||||||
flexWrap: 'nowrap',
|
flexWrap: 'nowrap',
|
||||||
minHeight: '100vh',
|
minHeight: `calc(100vh - ${drawerHeaderHeight}px)`,
|
||||||
paddingTop: theme.spacing(8),
|
|
||||||
paddingBottom: theme.spacing(8),
|
paddingBottom: theme.spacing(8),
|
||||||
},
|
},
|
||||||
drawer: {
|
drawer: {
|
||||||
width: drawerWidth,
|
width: drawerWidth,
|
||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
|
transition: theme.transitions.create('width', {
|
||||||
|
easing: theme.transitions.easing.sharp,
|
||||||
|
duration: theme.transitions.duration.enteringScreen,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
drawerCollapsed: {
|
||||||
|
width: drawerWidthCollapsed,
|
||||||
|
transition: theme.transitions.create('width', {
|
||||||
|
easing: theme.transitions.easing.sharp,
|
||||||
|
duration: theme.transitions.duration.leavingScreen,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
drawerPaper: {
|
drawerPaper: {
|
||||||
width: drawerWidth,
|
width: drawerWidth,
|
||||||
backgroundColor: '#212121',
|
backgroundColor: '#212121',
|
||||||
zIndex: 988,
|
zIndex: 988,
|
||||||
|
overflowX: 'hidden',
|
||||||
|
transition: theme.transitions.create('width', {
|
||||||
|
easing: theme.transitions.easing.sharp,
|
||||||
|
duration: theme.transitions.duration.enteringScreen,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
drawerPaperCollapsed: {
|
||||||
|
width: drawerWidthCollapsed,
|
||||||
|
transition: theme.transitions.create('width', {
|
||||||
|
easing: theme.transitions.easing.sharp,
|
||||||
|
duration: theme.transitions.duration.leavingScreen,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
height: drawerHeaderHeight,
|
||||||
|
borderBottom: '1px solid #2c2c2c',
|
||||||
|
paddingLeft: theme.spacing(2),
|
||||||
|
paddingRight: theme.spacing(2),
|
||||||
|
flexShrink: 0,
|
||||||
},
|
},
|
||||||
logo: {
|
logo: {
|
||||||
marginLeft: theme.spacing(8),
|
flex: 1,
|
||||||
marginRight: theme.spacing(8),
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
overflow: 'hidden',
|
||||||
|
},
|
||||||
|
logoImg: {
|
||||||
|
maxWidth: '100%',
|
||||||
|
display: 'block',
|
||||||
|
},
|
||||||
|
toggleButton: {
|
||||||
|
color: '#9f9f9f',
|
||||||
|
'&:hover': {
|
||||||
|
color: '#f9f9f9',
|
||||||
|
backgroundColor: '#2c2c2c',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
toggleButtonCollapsed: {
|
||||||
|
marginLeft: 'auto',
|
||||||
},
|
},
|
||||||
icon: {
|
icon: {
|
||||||
height: theme.spacing(4),
|
height: theme.spacing(4),
|
||||||
@@ -63,13 +115,13 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export default function SideBar(): ReactElement {
|
export default function SideBar(): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
const { isDesktop } = useContext(SettingsContext)
|
const { isDesktop } = useContext(SettingsContext)
|
||||||
const { nodeInfo } = useContext(BeeContext)
|
const { nodeInfo } = useContext(BeeContext)
|
||||||
|
const [isCollapsed, setIsCollapsed] = useState(false)
|
||||||
|
|
||||||
const navBarItems = [
|
const navBarItems = [
|
||||||
{
|
{
|
||||||
@@ -87,7 +139,7 @@ export default function SideBar(): ReactElement {
|
|||||||
label: 'File Manager',
|
label: 'File Manager',
|
||||||
path: ROUTES.FILEMANAGER,
|
path: ROUTES.FILEMANAGER,
|
||||||
icon: FileManagerIcon,
|
icon: FileManagerIcon,
|
||||||
pathMatcherSubstring: '/filemanager/',
|
pathMatcherSubstring: '/filemanager',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Account',
|
label: 'Account',
|
||||||
@@ -103,13 +155,28 @@ export default function SideBar(): ReactElement {
|
|||||||
]
|
]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Drawer className={classes.drawer} variant="permanent" anchor="left" classes={{ paper: classes.drawerPaper }}>
|
<Drawer
|
||||||
<Grid container direction="column" justifyContent="space-between" className={classes.root}>
|
className={`${classes.drawer} ${isCollapsed ? classes.drawerCollapsed : ''}`}
|
||||||
<Grid className={classes.logo}>
|
variant="permanent"
|
||||||
<Link to={ROUTES.INFO}>
|
anchor="left"
|
||||||
<img alt="swarm" src={isDesktop ? DesktopLogo : DashboardLogo} />
|
classes={{ paper: `${classes.drawerPaper} ${isCollapsed ? classes.drawerPaperCollapsed : ''}` }}
|
||||||
|
>
|
||||||
|
<div className={classes.header}>
|
||||||
|
{!isCollapsed && (
|
||||||
|
<Link to={ROUTES.INFO} className={classes.logo}>
|
||||||
|
<img alt="swarm" className={classes.logoImg} src={isDesktop ? DesktopLogo : DashboardLogo} />
|
||||||
</Link>
|
</Link>
|
||||||
</Grid>
|
)}
|
||||||
|
<Tooltip title={isCollapsed ? 'Expand sidebar' : 'Collapse sidebar'} placement="right">
|
||||||
|
<IconButton
|
||||||
|
onClick={() => setIsCollapsed(!isCollapsed)}
|
||||||
|
className={`${classes.toggleButton} ${isCollapsed ? classes.toggleButtonCollapsed : ''}`}
|
||||||
|
>
|
||||||
|
{isCollapsed ? <MenuUnfoldIcon /> : <MenuFoldIcon />}
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
<Grid container direction="column" justifyContent="space-between" className={classes.root}>
|
||||||
<Grid>
|
<Grid>
|
||||||
<List>
|
<List>
|
||||||
{navBarItems.map(p => (
|
{navBarItems.map(p => (
|
||||||
@@ -120,6 +187,7 @@ export default function SideBar(): ReactElement {
|
|||||||
path={p.path}
|
path={p.path}
|
||||||
pathMatcherSubstring={p.pathMatcherSubstring}
|
pathMatcherSubstring={p.pathMatcherSubstring}
|
||||||
label={p.label}
|
label={p.label}
|
||||||
|
isCollapsed={isCollapsed}
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
))}
|
||||||
@@ -129,32 +197,40 @@ export default function SideBar(): ReactElement {
|
|||||||
<MUILink href={BEE_DOCS_HOST} target="_blank" className={classes.link}>
|
<MUILink href={BEE_DOCS_HOST} target="_blank" className={classes.link}>
|
||||||
<SideBarItem
|
<SideBarItem
|
||||||
iconStart={<DocsIcon className={classes.icon} />}
|
iconStart={<DocsIcon className={classes.icon} />}
|
||||||
iconEnd={<ExternalLinkIcon className={classes.icon} color="#595959" />}
|
iconEnd={!isCollapsed ? <ExternalLinkIcon className={classes.icon} color="#595959" /> : undefined}
|
||||||
label={<span>Docs</span>}
|
label={<span>Docs</span>}
|
||||||
|
isCollapsed={isCollapsed}
|
||||||
/>
|
/>
|
||||||
</MUILink>
|
</MUILink>
|
||||||
</List>
|
</List>
|
||||||
<Divider className={classes.divider} />
|
<Divider className={classes.divider} />
|
||||||
<List>
|
<List>
|
||||||
<MUILink href={GITHUB_BEE_DASHBOARD_URL} target="_blank" className={classes.link}>
|
<MUILink
|
||||||
|
href={isDesktop ? GITHUB_BEE_DESKTOP_URL : GITHUB_BEE_DASHBOARD_URL}
|
||||||
|
target="_blank"
|
||||||
|
className={classes.link}
|
||||||
|
>
|
||||||
<SideBarItem
|
<SideBarItem
|
||||||
iconStart={<GithubIcon className={classes.icon} />}
|
iconStart={<GithubIcon className={classes.icon} />}
|
||||||
iconEnd={<ExternalLinkIcon className={classes.icon} color="#595959" />}
|
iconEnd={!isCollapsed ? <ExternalLinkIcon className={classes.icon} color="#595959" /> : undefined}
|
||||||
label={<span>GitHub</span>}
|
label={<span>GitHub</span>}
|
||||||
|
isCollapsed={isCollapsed}
|
||||||
/>
|
/>
|
||||||
</MUILink>
|
</MUILink>
|
||||||
</List>
|
</List>
|
||||||
<Divider className={classes.divider} />
|
<Divider className={classes.divider} />
|
||||||
|
{!isCollapsed && (
|
||||||
<Box mt={4}>
|
<Box mt={4}>
|
||||||
<Link to={ROUTES.TOP_UP_GIFT_CODE}>
|
<Link to={ROUTES.TOP_UP_GIFT_CODE}>
|
||||||
<Typography align="center">Redeem gift code</Typography>
|
<Typography align="center">Redeem gift code</Typography>
|
||||||
</Link>
|
</Link>
|
||||||
</Box>
|
</Box>
|
||||||
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid>
|
<Grid>
|
||||||
<List>
|
<List>
|
||||||
<Link to={ROUTES.STATUS} className={classes.link}>
|
<Link to={ROUTES.STATUS} className={classes.link}>
|
||||||
<SideBarStatus path={ROUTES.STATUS} />
|
<SideBarStatus path={ROUTES.STATUS} isCollapsed={isCollapsed} />
|
||||||
</Link>
|
</Link>
|
||||||
</List>
|
</List>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { ListItem, ListItemIcon, ListItemText } from '@material-ui/core'
|
import { ListItemButton, ListItemIcon, ListItemText, Tooltip } from '@mui/material'
|
||||||
import { createStyles, makeStyles, Theme, withStyles } from '@material-ui/core/styles'
|
|
||||||
import type { ReactElement, ReactNode } from 'react'
|
import type { ReactElement, ReactNode } from 'react'
|
||||||
import { matchPath, useLocation } from 'react-router-dom'
|
import { matchPath, useLocation } from 'react-router-dom'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
const StyledListItem = withStyles((theme: Theme) => ({
|
const useItemStyles = makeStyles()(theme => ({
|
||||||
root: {
|
root: {
|
||||||
paddingLeft: theme.spacing(4),
|
paddingLeft: theme.spacing(4),
|
||||||
paddingRight: theme.spacing(4),
|
paddingRight: theme.spacing(4),
|
||||||
@@ -13,8 +13,6 @@ const StyledListItem = withStyles((theme: Theme) => ({
|
|||||||
backgroundColor: '#2c2c2c',
|
backgroundColor: '#2c2c2c',
|
||||||
color: '#f9f9f9',
|
color: '#f9f9f9',
|
||||||
},
|
},
|
||||||
},
|
|
||||||
button: {
|
|
||||||
'&:hover': {
|
'&:hover': {
|
||||||
backgroundColor: '#2c2c2c',
|
backgroundColor: '#2c2c2c',
|
||||||
color: '#f9f9f9',
|
color: '#f9f9f9',
|
||||||
@@ -26,18 +24,26 @@ const StyledListItem = withStyles((theme: Theme) => ({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}))(ListItem)
|
rootCollapsed: {
|
||||||
|
justifyContent: 'center',
|
||||||
|
paddingLeft: theme.spacing(1),
|
||||||
|
paddingRight: theme.spacing(1),
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
icon: {
|
icon: {
|
||||||
color: 'inherit',
|
color: 'inherit',
|
||||||
|
minWidth: 0,
|
||||||
},
|
},
|
||||||
activeIcon: {
|
activeIcon: {
|
||||||
color: theme.palette.primary.main,
|
color: theme.palette.primary.main,
|
||||||
|
minWidth: 0,
|
||||||
},
|
},
|
||||||
}),
|
label: {
|
||||||
)
|
marginLeft: theme.spacing(2),
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
iconStart?: ReactNode
|
iconStart?: ReactNode
|
||||||
@@ -45,20 +51,37 @@ interface Props {
|
|||||||
path?: string
|
path?: string
|
||||||
label: ReactNode
|
label: ReactNode
|
||||||
pathMatcherSubstring?: string
|
pathMatcherSubstring?: string
|
||||||
|
isCollapsed?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SideBarItem({ iconStart, iconEnd, path, label, pathMatcherSubstring }: Props): ReactElement {
|
export default function SideBarItem({
|
||||||
const classes = useStyles()
|
iconStart,
|
||||||
|
iconEnd,
|
||||||
|
path,
|
||||||
|
label,
|
||||||
|
pathMatcherSubstring,
|
||||||
|
isCollapsed,
|
||||||
|
}: Props): ReactElement {
|
||||||
|
const { classes } = useStyles()
|
||||||
|
const { classes: itemClasses } = useItemStyles()
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const isSelected = pathMatcherSubstring
|
const isSelected = pathMatcherSubstring
|
||||||
? location.pathname.startsWith(pathMatcherSubstring)
|
? location.pathname.startsWith(pathMatcherSubstring)
|
||||||
: Boolean(path && matchPath(location.pathname, path))
|
: Boolean(path && matchPath(location.pathname, path))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledListItem button selected={isSelected} disableRipple>
|
<Tooltip title={isCollapsed ? label : ''} placement="right">
|
||||||
|
<ListItemButton
|
||||||
|
className={`${itemClasses.root} ${isCollapsed ? itemClasses.rootCollapsed : ''}`}
|
||||||
|
selected={isSelected}
|
||||||
|
disableRipple
|
||||||
|
>
|
||||||
<ListItemIcon className={isSelected ? classes.activeIcon : classes.icon}>{iconStart}</ListItemIcon>
|
<ListItemIcon className={isSelected ? classes.activeIcon : classes.icon}>{iconStart}</ListItemIcon>
|
||||||
<ListItemText primary={label} />
|
{!isCollapsed && <ListItemText primary={label} className={classes.label} />}
|
||||||
|
{!isCollapsed && iconEnd && (
|
||||||
<ListItemIcon className={isSelected ? classes.activeIcon : classes.icon}>{iconEnd}</ListItemIcon>
|
<ListItemIcon className={isSelected ? classes.activeIcon : classes.icon}>{iconEnd}</ListItemIcon>
|
||||||
</StyledListItem>
|
)}
|
||||||
|
</ListItemButton>
|
||||||
|
</Tooltip>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
|
import { ListItemButton, ListItemIcon, ListItemText, Tooltip, Typography } from '@mui/material'
|
||||||
import { ReactElement, useContext } from 'react'
|
import { ReactElement, useContext } from 'react'
|
||||||
import { matchPath, useLocation } from 'react-router-dom'
|
import { matchPath, useLocation } from 'react-router-dom'
|
||||||
import ArrowRight from 'remixicon-react/ArrowRightLineIcon'
|
import ArrowRight from 'remixicon-react/ArrowRightLineIcon'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
import { ListItem, ListItemIcon, ListItemText, Typography } from '@material-ui/core'
|
|
||||||
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
|
||||||
import { Context } from '../providers/Bee'
|
import { Context } from '../providers/Bee'
|
||||||
|
|
||||||
import StatusIcon from './StatusIcon'
|
import StatusIcon from './StatusIcon'
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
icon: {
|
icon: {
|
||||||
color: 'inherit',
|
color: 'inherit',
|
||||||
},
|
},
|
||||||
@@ -18,8 +18,8 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
|
|
||||||
root: {
|
root: {
|
||||||
height: theme.spacing(4),
|
height: theme.spacing(4),
|
||||||
paddingLeft: theme.spacing(1),
|
paddingLeft: theme.spacing(0),
|
||||||
paddingRight: theme.spacing(4),
|
paddingRight: theme.spacing(0),
|
||||||
color: '#f9f9f9',
|
color: '#f9f9f9',
|
||||||
borderLeft: '0px solid rgba(0,0,0,0)',
|
borderLeft: '0px solid rgba(0,0,0,0)',
|
||||||
'&.Mui-selected, &.Mui-selected:hover': {
|
'&.Mui-selected, &.Mui-selected:hover': {
|
||||||
@@ -46,33 +46,62 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
fontSize: '0.9rem',
|
fontSize: '0.9rem',
|
||||||
whiteSpace: 'nowrap',
|
whiteSpace: 'nowrap',
|
||||||
},
|
},
|
||||||
}),
|
rootCollapsed: {
|
||||||
)
|
justifyContent: 'center',
|
||||||
|
paddingLeft: theme.spacing(1),
|
||||||
|
paddingRight: theme.spacing(1),
|
||||||
|
},
|
||||||
|
statusIcon: {
|
||||||
|
marginLeft: '30px',
|
||||||
|
minWidth: 0,
|
||||||
|
},
|
||||||
|
statusIconCollapsed: {
|
||||||
|
marginLeft: 0,
|
||||||
|
minWidth: 0,
|
||||||
|
},
|
||||||
|
statusText: {
|
||||||
|
marginLeft: theme.spacing(2),
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
path?: string
|
path?: string
|
||||||
|
isCollapsed?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SideBarItem({ path }: Props): ReactElement {
|
export default function SideBarItem({ path, isCollapsed }: Props): ReactElement {
|
||||||
const { status, isLoading } = useContext(Context)
|
const { status, isLoading } = useContext(Context)
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const isSelected = Boolean(path && matchPath(location.pathname, path))
|
const isSelected = Boolean(path && matchPath(location.pathname, path))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem
|
<Tooltip title={isCollapsed ? `Node ${status.all}` : ''} placement="right">
|
||||||
button
|
<ListItemButton
|
||||||
classes={{ root: `${classes.root} ${status.all ? '' : classes.rootError}`, button: classes.button }}
|
classes={{
|
||||||
|
root: `${classes.root} ${status.all ? '' : classes.rootError} ${isCollapsed ? classes.rootCollapsed : ''}`,
|
||||||
|
}}
|
||||||
selected={isSelected}
|
selected={isSelected}
|
||||||
disableRipple
|
disableRipple
|
||||||
>
|
>
|
||||||
<ListItemIcon style={{ marginLeft: '30px' }}>
|
<ListItemIcon className={isCollapsed ? classes.statusIconCollapsed : classes.statusIcon}>
|
||||||
<StatusIcon checkState={status.all} isLoading={isLoading} />
|
<StatusIcon checkState={status.all} isLoading={isLoading} />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary={<Typography className={classes.smallerText}>{`Node ${status.all}`}</Typography>} />
|
{!isCollapsed && (
|
||||||
|
<>
|
||||||
|
<ListItemText
|
||||||
|
primary={
|
||||||
|
<Typography
|
||||||
|
className={`${classes.smallerText} ${classes.statusText}`}
|
||||||
|
>{`Node ${status.all}`}</Typography>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<ListItemIcon className={classes.icon}>
|
<ListItemIcon className={classes.icon}>
|
||||||
{status.all ? null : <ArrowRight className={classes.iconSmall} />}
|
{status.all ? null : <ArrowRight className={classes.iconSmall} />}
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
</ListItem>
|
</>
|
||||||
|
)}
|
||||||
|
</ListItemButton>
|
||||||
|
</Tooltip>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,55 @@
|
|||||||
import { Box } from '@material-ui/core'
|
import { Bee, PostageBatch } from '@ethersphere/bee-js'
|
||||||
import Button from '@material-ui/core/Button'
|
import { Box } from '@mui/material'
|
||||||
import Dialog from '@material-ui/core/Dialog'
|
import Button from '@mui/material/Button'
|
||||||
import DialogActions from '@material-ui/core/DialogActions'
|
import Dialog from '@mui/material/Dialog'
|
||||||
import DialogContent from '@material-ui/core/DialogContent'
|
import DialogActions from '@mui/material/DialogActions'
|
||||||
import DialogTitle from '@material-ui/core/DialogTitle'
|
import DialogContent from '@mui/material/DialogContent'
|
||||||
import Input from '@material-ui/core/Input'
|
import DialogTitle from '@mui/material/DialogTitle'
|
||||||
import { BatchId, Bee } from '@ethersphere/bee-js'
|
import Input from '@mui/material/Input'
|
||||||
import { useSnackbar } from 'notistack'
|
import { useSnackbar } from 'notistack'
|
||||||
import { ReactElement, ReactNode, useState } from 'react'
|
import React, { ReactElement, ReactNode, useState } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
interface Props {
|
import { CheckState } from '../providers/Bee'
|
||||||
type: 'Topup' | 'Dilute'
|
|
||||||
icon: ReactNode
|
const useStyles = makeStyles()(theme => ({
|
||||||
bee: Bee
|
buttonSelected: {
|
||||||
stamp: BatchId
|
color: 'white',
|
||||||
|
backgroundColor: theme.palette.primary.main,
|
||||||
|
'&:hover': {
|
||||||
|
color: theme.palette.secondary.main,
|
||||||
|
backgroundColor: 'white',
|
||||||
|
'@media (hover: none)': {
|
||||||
|
color: 'white',
|
||||||
|
backgroundColor: theme.palette.primary.main,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
buttonUnselected: {
|
||||||
|
color: '#dd7700',
|
||||||
|
backgroundColor: 'white',
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
export enum StampExtensionType {
|
||||||
|
Topup = 'Topup',
|
||||||
|
Dilute = 'Dilute',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function StampExtensionModal({ type, icon, bee, stamp }: Props): ReactElement {
|
interface Props {
|
||||||
const [open, setOpen] = useState(false)
|
type: StampExtensionType
|
||||||
const [amount, setAmount] = useState('')
|
icon: ReactNode
|
||||||
|
bee: Bee
|
||||||
|
stamp: PostageBatch
|
||||||
|
status: CheckState
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function StampExtensionModal({ type, icon, bee, stamp, status }: Props): ReactElement {
|
||||||
|
const { classes } = useStyles()
|
||||||
|
const [open, setOpen] = useState<boolean>(false)
|
||||||
|
const [amount, setAmount] = useState<string>('')
|
||||||
const { enqueueSnackbar } = useSnackbar()
|
const { enqueueSnackbar } = useSnackbar()
|
||||||
const label = `${type} ${stamp.toHex().substring(0, 8)}`
|
const label = `${type} ${stamp.batchID.toHex().substring(0, 8)}`
|
||||||
|
|
||||||
const handleClickOpen = (e: React.MouseEvent<HTMLButtonElement>) => {
|
const handleClickOpen = (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
setOpen(true)
|
setOpen(true)
|
||||||
@@ -32,23 +61,65 @@ export default function StampExtensionModal({ type, icon, bee, stamp }: Props):
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleAction = async () => {
|
const handleAction = async () => {
|
||||||
if (type === 'Topup') {
|
if (status !== CheckState.OK) {
|
||||||
|
enqueueSnackbar(`Node connection status is not ${CheckState.OK}: ${status}`, { variant: 'error' })
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === StampExtensionType.Topup) {
|
||||||
|
const isAmountInvalid = BigInt(amount) <= BigInt(0)
|
||||||
|
|
||||||
|
if (isAmountInvalid) {
|
||||||
|
enqueueSnackbar(`Invalid amount: ${amount}, it must be greate than 0`, { variant: 'error' })
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await bee.topUpBatch(stamp, amount)
|
await bee.topUpBatch(stamp.batchID, amount)
|
||||||
enqueueSnackbar(`Successfully topped up stamp, your changes will appear soon`, { variant: 'success' })
|
enqueueSnackbar(`Successfully topped up stamp, your changes will appear soon`, { variant: 'success' })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
enqueueSnackbar(`Failed to topup stamp: ${error || 'Unknown reason'}`, { variant: 'error' })
|
enqueueSnackbar(`Failed to topup stamp: ${error || 'Unknown reason'}`, { variant: 'error' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === StampExtensionType.Dilute) {
|
||||||
|
const newDepth = parseInt(amount, 10)
|
||||||
|
const ttlDays = stamp.duration.toDays()
|
||||||
|
const currentDepth = stamp.depth
|
||||||
|
const maxHalvings = Math.floor(Math.log2(ttlDays)) + currentDepth
|
||||||
|
const isDepthInvalid = newDepth > maxHalvings || newDepth <= currentDepth
|
||||||
|
|
||||||
|
if (isDepthInvalid) {
|
||||||
|
enqueueSnackbar(`Invalid depth: ${newDepth} (${currentDepth} < new depth < ${maxHalvings})`, {
|
||||||
|
variant: 'error',
|
||||||
|
})
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ttlDays <= 2) {
|
||||||
|
enqueueSnackbar(`TTL: ${ttlDays} <= 2 days, cannot dilute stamp (min. TTL is 1 day)`, {
|
||||||
|
variant: 'warning',
|
||||||
|
})
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'Dilute') {
|
|
||||||
try {
|
try {
|
||||||
await bee.diluteBatch(stamp, parseInt(amount, 10))
|
await bee.diluteBatch(stamp.batchID, newDepth)
|
||||||
enqueueSnackbar(`Successfully diluted stamp, your changes will appear soon`, { variant: 'success' })
|
enqueueSnackbar(`Successfully diluted stamp, your changes will appear soon`, { variant: 'success' })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
enqueueSnackbar(`Failed to dilute stamp: ${error || 'Unknown reason'}`, { variant: 'error' })
|
enqueueSnackbar(`Failed to dilute stamp: ${error || 'Unknown reason'}`, { variant: 'error' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enqueueSnackbar(`Failed to extend stamp, unknown operation: ${type}`, { variant: 'error' })
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => {
|
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => {
|
||||||
@@ -57,7 +128,7 @@ export default function StampExtensionModal({ type, icon, bee, stamp }: Props):
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box mb={2}>
|
<Box mb={2}>
|
||||||
<Button variant="contained" onClick={handleClickOpen} startIcon={icon}>
|
<Button className={classes.buttonSelected} variant="contained" onClick={handleClickOpen} startIcon={icon}>
|
||||||
{type}
|
{type}
|
||||||
</Button>
|
</Button>
|
||||||
<Dialog open={open} onClose={handleClose} aria-labelledby="form-dialog-title">
|
<Dialog open={open} onClose={handleClose} aria-labelledby="form-dialog-title">
|
||||||
@@ -68,7 +139,7 @@ export default function StampExtensionModal({ type, icon, bee, stamp }: Props):
|
|||||||
margin="dense"
|
margin="dense"
|
||||||
id="name"
|
id="name"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={type === 'Topup' ? 'Amount to add' : 'New depth to dilute'}
|
placeholder={type === StampExtensionType.Topup ? 'Amount to add' : 'New depth to dilute'}
|
||||||
fullWidth
|
fullWidth
|
||||||
value={amount}
|
value={amount}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
@@ -78,7 +149,14 @@ export default function StampExtensionModal({ type, icon, bee, stamp }: Props):
|
|||||||
<Button onClick={handleClose} color="primary">
|
<Button onClick={handleClose} color="primary">
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button disabled={amount === ''} onClick={handleAction} color="primary">
|
<Button
|
||||||
|
disabled={amount === ''}
|
||||||
|
onClick={async () => {
|
||||||
|
await handleAction()
|
||||||
|
handleClose()
|
||||||
|
}}
|
||||||
|
color="primary"
|
||||||
|
>
|
||||||
{type}
|
{type}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { CircularProgress } from '@material-ui/core'
|
import { CircularProgress } from '@mui/material'
|
||||||
import type { ReactElement } from 'react'
|
import type { ReactElement } from 'react'
|
||||||
|
|
||||||
import { CheckState } from '../providers/Bee'
|
import { CheckState } from '../providers/Bee'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import { createStyles, makeStyles } from '@material-ui/core'
|
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: ReactElement | ReactElement[]
|
children: ReactElement | ReactElement[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles(() =>
|
const useStyles = makeStyles()(() => ({
|
||||||
createStyles({
|
|
||||||
wrapper: {
|
wrapper: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
@@ -21,11 +20,10 @@ const useStyles = makeStyles(() =>
|
|||||||
#ffffff 8px
|
#ffffff 8px
|
||||||
)`,
|
)`,
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export function StripedWrapper({ children }: Props): ReactElement {
|
export function StripedWrapper({ children }: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
return <div className={classes.wrapper}>{children}</div>
|
return <div className={classes.wrapper}>{children}</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Button, ButtonProps, CircularProgress, createStyles, makeStyles } from '@material-ui/core'
|
import { Button, ButtonProps, CircularProgress } from '@mui/material'
|
||||||
import React, { ReactElement } from 'react'
|
import React, { ReactElement } from 'react'
|
||||||
import type { RemixiconReactIconProps } from 'remixicon-react'
|
import type { RemixiconReactIconProps } from 'remixicon-react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
export interface SwarmButtonProps extends ButtonProps {
|
export interface SwarmButtonProps extends ButtonProps {
|
||||||
iconType: React.ComponentType<RemixiconReactIconProps>
|
iconType: React.ComponentType<RemixiconReactIconProps>
|
||||||
@@ -9,8 +10,7 @@ export interface SwarmButtonProps extends ButtonProps {
|
|||||||
variant?: 'text' | 'contained' | 'outlined'
|
variant?: 'text' | 'contained' | 'outlined'
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles(() =>
|
const useStyles = makeStyles()(() => ({
|
||||||
createStyles({
|
|
||||||
button: {
|
button: {
|
||||||
height: '42px',
|
height: '42px',
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
@@ -35,8 +35,7 @@ const useStyles = makeStyles(() =>
|
|||||||
height: '40px',
|
height: '40px',
|
||||||
transform: 'translate(-50%, -50%)',
|
transform: 'translate(-50%, -50%)',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export function SwarmButton({
|
export function SwarmButton({
|
||||||
children,
|
children,
|
||||||
@@ -50,7 +49,7 @@ export function SwarmButton({
|
|||||||
style,
|
style,
|
||||||
...other
|
...other
|
||||||
}: SwarmButtonProps): ReactElement {
|
}: SwarmButtonProps): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
function getIconColor() {
|
function getIconColor() {
|
||||||
if (loading || disabled) {
|
if (loading || disabled) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Box, Dialog, Grid } from '@material-ui/core'
|
import { Box, Dialog, Grid } from '@mui/material'
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Box, Divider } from '@material-ui/core'
|
import { Box, Divider } from '@mui/material'
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
import { createStyles, FormHelperText, makeStyles, MenuItem, Select as MuiSelect, Theme } from '@material-ui/core'
|
import { FormHelperText, MenuItem, Select as MuiSelect, SelectChangeEvent } from '@mui/material'
|
||||||
import { Field } from 'formik'
|
import { Field } from 'formik'
|
||||||
import { Select } from 'formik-material-ui'
|
import { Select } from 'formik-mui'
|
||||||
import { ReactElement, ReactNode } from 'react'
|
import { ReactElement, ReactNode } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
export type SelectEvent = React.ChangeEvent<{
|
export type SelectEvent = SelectChangeEvent<string>
|
||||||
name?: string | undefined
|
|
||||||
value: unknown
|
|
||||||
}>
|
|
||||||
|
|
||||||
function renderValue(value: unknown): ReactNode {
|
function renderValue(value: unknown): ReactNode {
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
@@ -28,13 +26,12 @@ interface Props {
|
|||||||
options: { value: string; label: string }[]
|
options: { value: string; label: string }[]
|
||||||
onChange?: (event: SelectEvent) => void
|
onChange?: (event: SelectEvent) => void
|
||||||
formik?: boolean
|
formik?: boolean
|
||||||
defaultValue?: string
|
value?: string
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
select: {
|
select: {
|
||||||
borderRadius: 0,
|
borderRadius: 0,
|
||||||
background: theme.palette.background.paper,
|
background: theme.palette.background.paper,
|
||||||
@@ -50,11 +47,10 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
option: {
|
option: {
|
||||||
height: '52px',
|
height: '52px',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export function SwarmSelect({
|
export function SwarmSelect({
|
||||||
defaultValue,
|
value,
|
||||||
formik,
|
formik,
|
||||||
name,
|
name,
|
||||||
options,
|
options,
|
||||||
@@ -63,7 +59,7 @@ export function SwarmSelect({
|
|||||||
placeholder,
|
placeholder,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
}: Props): ReactElement {
|
}: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
if (formik) {
|
if (formik) {
|
||||||
return (
|
return (
|
||||||
@@ -76,9 +72,10 @@ export function SwarmSelect({
|
|||||||
name={name}
|
name={name}
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
defaultValue={defaultValue}
|
value={value}
|
||||||
className={classes.select}
|
className={classes.select}
|
||||||
displayEmpty
|
displayEmpty
|
||||||
|
onChange={onChange}
|
||||||
renderValue={(value: unknown) => (value ? renderValue(value) : placeholder)}
|
renderValue={(value: unknown) => (value ? renderValue(value) : placeholder)}
|
||||||
MenuProps={{ MenuListProps: { disablePadding: true }, PaperProps: { square: true } }}
|
MenuProps={{ MenuListProps: { disablePadding: true }, PaperProps: { square: true } }}
|
||||||
>
|
>
|
||||||
@@ -102,7 +99,7 @@ export function SwarmSelect({
|
|||||||
fullWidth
|
fullWidth
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
className={classes.select}
|
className={classes.select}
|
||||||
defaultValue={defaultValue}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
displayEmpty
|
displayEmpty
|
||||||
renderValue={(value: unknown) => (value ? renderValue(value) : placeholder)}
|
renderValue={(value: unknown) => (value ? renderValue(value) : placeholder)}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { createStyles, makeStyles, TextField as SimpleTextField, Theme } from '@material-ui/core'
|
import { TextField as SimpleTextField } from '@mui/material'
|
||||||
import { Field } from 'formik'
|
import { Field } from 'formik'
|
||||||
import { TextField } from 'formik-material-ui'
|
import { TextField } from 'formik-mui'
|
||||||
import { ChangeEvent, ReactElement } from 'react'
|
import { ChangeEvent, ReactElement } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
name: string
|
name: string
|
||||||
@@ -14,8 +15,7 @@ interface Props {
|
|||||||
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void
|
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
field: {
|
field: {
|
||||||
background: theme.palette.background.paper,
|
background: theme.palette.background.paper,
|
||||||
'& fieldset': {
|
'& fieldset': {
|
||||||
@@ -31,8 +31,7 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
borderRadius: 0,
|
borderRadius: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export function SwarmTextInput({
|
export function SwarmTextInput({
|
||||||
name,
|
name,
|
||||||
@@ -44,7 +43,7 @@ export function SwarmTextInput({
|
|||||||
defaultValue,
|
defaultValue,
|
||||||
placeholder,
|
placeholder,
|
||||||
}: Props): ReactElement {
|
}: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
if (formik) {
|
if (formik) {
|
||||||
return (
|
return (
|
||||||
@@ -58,7 +57,7 @@ export function SwarmTextInput({
|
|||||||
variant="filled"
|
variant="filled"
|
||||||
className={classes.field}
|
className={classes.field}
|
||||||
defaultValue={defaultValue || ''}
|
defaultValue={defaultValue || ''}
|
||||||
InputProps={{ disableUnderline: true }}
|
slotProps={{ input: { disableUnderline: true } }}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -74,7 +73,7 @@ export function SwarmTextInput({
|
|||||||
className={classes.field}
|
className={classes.field}
|
||||||
defaultValue={defaultValue || ''}
|
defaultValue={defaultValue || ''}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
InputProps={{ disableUnderline: true }}
|
slotProps={{ input: { disableUnderline: true } }}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { Tab, Tabs } from '@mui/material'
|
||||||
import React, { ReactElement, ReactNode } from 'react'
|
import React, { ReactElement, ReactNode } from 'react'
|
||||||
import { makeStyles, Theme, createStyles } from '@material-ui/core/styles'
|
import { makeStyles } from 'tss-react/mui'
|
||||||
import { Tab, Tabs } from '@material-ui/core'
|
|
||||||
|
|
||||||
interface TabPanelProps {
|
interface TabPanelProps {
|
||||||
children?: ReactNode
|
children?: ReactNode
|
||||||
@@ -18,16 +18,14 @@ function TabPanel(props: TabPanelProps) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
root: {
|
root: {
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
marginTop: theme.spacing(2),
|
marginTop: theme.spacing(2),
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
interface TabsValues {
|
interface TabsValues {
|
||||||
component: ReactNode
|
component: ReactNode
|
||||||
@@ -41,10 +39,10 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function SimpleTabs({ values, index, indexChanged }: Props): ReactElement {
|
export default function SimpleTabs({ values, index, indexChanged }: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
const [value, setValue] = React.useState<number>(index || 0)
|
const [value, setValue] = React.useState<number>(index || 0)
|
||||||
|
|
||||||
const handleChange = (event: React.ChangeEvent<Record<string, never>>, newValue: number) => {
|
const handleChange = (_event: React.SyntheticEvent, newValue: number) => {
|
||||||
if (indexChanged) indexChanged(newValue)
|
if (indexChanged) indexChanged(newValue)
|
||||||
else setValue(newValue)
|
else setValue(newValue)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { createStyles, Grid, makeStyles, Typography } from '@material-ui/core'
|
import { Grid, Typography } from '@mui/material'
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
import { CloseButton } from './CloseButton'
|
import { CloseButton } from './CloseButton'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -7,17 +9,15 @@ interface Props {
|
|||||||
onClose: () => void
|
onClose: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles(() =>
|
const useStyles = makeStyles()(() => ({
|
||||||
createStyles({
|
|
||||||
text: {
|
text: {
|
||||||
color: '#606060',
|
color: '#606060',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export function TitleWithClose({ children, onClose }: Props): ReactElement {
|
export function TitleWithClose({ children, onClose }: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container justifyContent="space-between" alignItems="center">
|
<Grid container justifyContent="space-between" alignItems="center">
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import type { Topology } from '@ethersphere/bee-js'
|
import type { Topology } from '@ethersphere/bee-js'
|
||||||
import type { ReactElement } from 'react'
|
import type { ReactElement } from 'react'
|
||||||
|
|
||||||
import { pickThreshold, ThresholdValues } from '../utils/threshold'
|
import { pickThreshold, ThresholdValues } from '../utils/threshold'
|
||||||
|
|
||||||
import ExpandableListItem from './ExpandableListItem'
|
import ExpandableListItem from './ExpandableListItem'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { Button, Grid, Link as MuiLink, Typography } from '@material-ui/core/'
|
import { Button, Grid, Link as MuiLink, Typography } from '@mui/material'
|
||||||
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
|
||||||
import type { ReactElement } from 'react'
|
import type { ReactElement } from 'react'
|
||||||
import Activity from 'remixicon-react/PulseLineIcon'
|
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import { ROUTES } from '../routes'
|
import Activity from 'remixicon-react/PulseLineIcon'
|
||||||
import { BEE_DISCORD_HOST, BEE_DOCS_HOST } from '../constants'
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
import { BEE_DISCORD_HOST, BEE_DOCS_HOST } from '../constants'
|
||||||
createStyles({
|
import { ROUTES } from '../routes'
|
||||||
|
|
||||||
|
const useStyles = makeStyles()(theme => ({
|
||||||
root: {
|
root: {
|
||||||
height: '100%',
|
height: '100%',
|
||||||
},
|
},
|
||||||
@@ -21,20 +21,19 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
icon: {
|
icon: {
|
||||||
height: '1rem',
|
height: '1rem',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
export default function TroubleshootConnectionCard(): ReactElement {
|
export default function TroubleshootConnectionCard(): ReactElement {
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container direction="column" justifyContent="center" alignItems="center" className={classes.root}>
|
<Grid container direction="column" justifyContent="center" alignItems="center" className={classes.root}>
|
||||||
<Grid item className={classes.content}>
|
<Grid className={classes.content}>
|
||||||
<Typography variant="h1" align="center">
|
<Typography variant="h1" align="center">
|
||||||
Uh oh, it looks like your node is not connected.
|
Uh oh, it looks like your node is not connected.
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item className={classes.content}>
|
<Grid className={classes.content}>
|
||||||
<Typography align="center">
|
<Typography align="center">
|
||||||
Please check your node status to fix the problem. You can also check out the{' '}
|
Please check your node status to fix the problem. You can also check out the{' '}
|
||||||
<MuiLink href={BEE_DOCS_HOST} target="_blank" rel="noreferrer">
|
<MuiLink href={BEE_DOCS_HOST} target="_blank" rel="noreferrer">
|
||||||
@@ -47,7 +46,7 @@ export default function TroubleshootConnectionCard(): ReactElement {
|
|||||||
.
|
.
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item className={classes.content}>
|
<Grid className={classes.content}>
|
||||||
<Typography align="center">
|
<Typography align="center">
|
||||||
<Button
|
<Button
|
||||||
component={Link}
|
component={Link}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { CircularProgress, Grid } from '@material-ui/core'
|
import { CircularProgress, Grid } from '@mui/material'
|
||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
|
||||||
export function Waiting(): ReactElement {
|
export function Waiting(): ReactElement {
|
||||||
|
|||||||
@@ -1,14 +1,45 @@
|
|||||||
import Button from '@material-ui/core/Button'
|
|
||||||
import Dialog from '@material-ui/core/Dialog'
|
|
||||||
import DialogActions from '@material-ui/core/DialogActions'
|
|
||||||
import DialogContent from '@material-ui/core/DialogContent'
|
|
||||||
import DialogContentText from '@material-ui/core/DialogContentText'
|
|
||||||
import DialogTitle from '@material-ui/core/DialogTitle'
|
|
||||||
import FormHelperText from '@material-ui/core/FormHelperText'
|
|
||||||
import Input from '@material-ui/core/Input'
|
|
||||||
import { BZZ, TransactionId } from '@ethersphere/bee-js'
|
import { BZZ, TransactionId } from '@ethersphere/bee-js'
|
||||||
|
import Button from '@mui/material/Button'
|
||||||
|
import Dialog from '@mui/material/Dialog'
|
||||||
|
import DialogActions from '@mui/material/DialogActions'
|
||||||
|
import DialogContent from '@mui/material/DialogContent'
|
||||||
|
import DialogContentText from '@mui/material/DialogContentText'
|
||||||
|
import DialogTitle from '@mui/material/DialogTitle'
|
||||||
|
import FormHelperText from '@mui/material/FormHelperText'
|
||||||
|
import Input from '@mui/material/Input'
|
||||||
import { useSnackbar } from 'notistack'
|
import { useSnackbar } from 'notistack'
|
||||||
import { ReactElement, ReactNode, useState } from 'react'
|
import React, { ReactElement, ReactNode, useState } from 'react'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
|
const useStyles = makeStyles()(theme => ({
|
||||||
|
link: {
|
||||||
|
color: '#dd7700',
|
||||||
|
textDecoration: 'underline',
|
||||||
|
'&:hover': {
|
||||||
|
textDecoration: 'none',
|
||||||
|
|
||||||
|
'@media (hover: none)': {
|
||||||
|
textDecoration: 'none',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
buttonSelected: {
|
||||||
|
color: theme.palette.secondary.main,
|
||||||
|
backgroundColor: 'white',
|
||||||
|
'&:hover': {
|
||||||
|
color: 'white',
|
||||||
|
backgroundColor: theme.palette.primary.main,
|
||||||
|
'@media (hover: none)': {
|
||||||
|
color: theme.palette.secondary.main,
|
||||||
|
backgroundColor: 'white',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
buttonUnselected: {
|
||||||
|
color: theme.palette.secondary.main,
|
||||||
|
backgroundColor: 'white',
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
successMessage: string
|
successMessage: string
|
||||||
@@ -31,6 +62,8 @@ export default function WithdrawDepositModal({
|
|||||||
action,
|
action,
|
||||||
icon,
|
icon,
|
||||||
}: Props): ReactElement {
|
}: Props): ReactElement {
|
||||||
|
const { classes } = useStyles()
|
||||||
|
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const [amount, setAmount] = useState('')
|
const [amount, setAmount] = useState('')
|
||||||
const [amountToken, setAmountToken] = useState<BZZ | null>(null)
|
const [amountToken, setAmountToken] = useState<BZZ | null>(null)
|
||||||
@@ -54,7 +87,8 @@ export default function WithdrawDepositModal({
|
|||||||
setOpen(false)
|
setOpen(false)
|
||||||
enqueueSnackbar(`${successMessage} Transaction ${transactionHash}`, { variant: 'success' })
|
enqueueSnackbar(`${successMessage} Transaction ${transactionHash}`, { variant: 'success' })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e) // eslint-disable-line
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(e)
|
||||||
enqueueSnackbar(`${errorMessage} Error: ${(e as Error).message}`, { variant: 'error' })
|
enqueueSnackbar(`${errorMessage} Error: ${(e as Error).message}`, { variant: 'error' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +111,7 @@ export default function WithdrawDepositModal({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Button variant="contained" onClick={handleClickOpen} startIcon={icon}>
|
<Button variant="contained" onClick={handleClickOpen} startIcon={icon} className={classes.buttonSelected}>
|
||||||
{label}
|
{label}
|
||||||
</Button>
|
</Button>
|
||||||
<Dialog open={open} onClose={handleClose} aria-labelledby="form-dialog-title">
|
<Dialog open={open} onClose={handleClose} aria-labelledby="form-dialog-title">
|
||||||
|
|||||||
@@ -6,8 +6,11 @@ export const BEE_DOCS_HOST = 'https://docs.ethswarm.org/docs/'
|
|||||||
export const BEE_DISCORD_HOST = 'https://discord.gg/eKr9XPv7'
|
export const BEE_DISCORD_HOST = 'https://discord.gg/eKr9XPv7'
|
||||||
export const GITHUB_REPO_URL = 'https://api.github.com/repos/ethersphere/bee'
|
export const GITHUB_REPO_URL = 'https://api.github.com/repos/ethersphere/bee'
|
||||||
export const GITHUB_BEE_DASHBOARD_URL = 'https://github.com/ethersphere/bee-dashboard.git'
|
export const GITHUB_BEE_DASHBOARD_URL = 'https://github.com/ethersphere/bee-dashboard.git'
|
||||||
|
export const GITHUB_BEE_DESKTOP_URL = 'https://github.com/ethersphere/bee-desktop.git'
|
||||||
export const BEE_DESKTOP_LATEST_RELEASE_PAGE = 'https://github.com/ethersphere/bee-desktop/releases/latest'
|
export const BEE_DESKTOP_LATEST_RELEASE_PAGE = 'https://github.com/ethersphere/bee-desktop/releases/latest'
|
||||||
export const BEE_DESKTOP_LATEST_RELEASE_PAGE_API =
|
export const BEE_DESKTOP_LATEST_RELEASE_PAGE_API =
|
||||||
'https://api.github.com/repos/ethersphere/bee-desktop/releases/latest'
|
'https://api.github.com/repos/ethersphere/bee-desktop/releases/latest'
|
||||||
export const DEFAULT_BEE_API_HOST = 'http://localhost:1633'
|
export const DEFAULT_BEE_API_HOST = 'http://localhost:1633'
|
||||||
export const DEFAULT_RPC_URL = 'https://xdai.fairdatasociety.org'
|
export const DEFAULT_RPC_URL = 'https://xdai.fairdatasociety.org'
|
||||||
|
export const MIN_STAMP_DEPTH = 17
|
||||||
|
export const MAX_STAMP_DEPTH = 255
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { BZZ } from '@ethersphere/bee-js'
|
import { BZZ } from '@ethersphere/bee-js'
|
||||||
import { ReactElement, useContext } from 'react'
|
import { ReactElement, useContext } from 'react'
|
||||||
import Download from 'remixicon-react/DownloadLineIcon'
|
import Download from 'remixicon-react/DownloadLineIcon'
|
||||||
|
|
||||||
import WithdrawDepositModal from '../components/WithdrawDepositModal'
|
import WithdrawDepositModal from '../components/WithdrawDepositModal'
|
||||||
import { Context as BeeContext } from '../providers/Bee'
|
import { Context as BeeContext } from '../providers/Bee'
|
||||||
import { Context as SettingsContext } from '../providers/Settings'
|
import { Context as SettingsContext } from '../providers/Settings'
|
||||||
@@ -22,7 +23,7 @@ export default function DepositModal(): ReactElement {
|
|||||||
throw new Error('Bee URL is not valid')
|
throw new Error('Bee URL is not valid')
|
||||||
}
|
}
|
||||||
|
|
||||||
const transactionHash = await beeApi.depositTokens(amount)
|
const transactionHash = await beeApi.depositBZZToChequebook(amount)
|
||||||
refresh()
|
refresh()
|
||||||
|
|
||||||
return transactionHash
|
return transactionHash
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { BZZ } from '@ethersphere/bee-js'
|
import { BZZ } from '@ethersphere/bee-js'
|
||||||
import { ReactElement, useContext } from 'react'
|
import { ReactElement, useContext } from 'react'
|
||||||
import Download from 'remixicon-react/DownloadLineIcon'
|
import Download from 'remixicon-react/DownloadLineIcon'
|
||||||
|
|
||||||
import WithdrawDepositModal from '../components/WithdrawDepositModal'
|
import WithdrawDepositModal from '../components/WithdrawDepositModal'
|
||||||
import { Context as BeeContext } from '../providers/Bee'
|
import { Context as BeeContext } from '../providers/Bee'
|
||||||
import { Context as SettingsContext } from '../providers/Settings'
|
import { Context as SettingsContext } from '../providers/Settings'
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { BZZ } from '@ethersphere/bee-js'
|
import { BZZ } from '@ethersphere/bee-js'
|
||||||
import { ReactElement, useContext } from 'react'
|
import { ReactElement, useContext } from 'react'
|
||||||
import Upload from 'remixicon-react/UploadLineIcon'
|
import Upload from 'remixicon-react/UploadLineIcon'
|
||||||
|
|
||||||
import WithdrawDepositModal from '../components/WithdrawDepositModal'
|
import WithdrawDepositModal from '../components/WithdrawDepositModal'
|
||||||
import { Context as BeeContext } from '../providers/Bee'
|
import { Context as BeeContext } from '../providers/Bee'
|
||||||
import { Context as SettingsContext } from '../providers/Settings'
|
import { Context as SettingsContext } from '../providers/Settings'
|
||||||
@@ -22,7 +23,7 @@ export default function WithdrawModal(): ReactElement {
|
|||||||
throw new Error('Bee URL is not valid')
|
throw new Error('Bee URL is not valid')
|
||||||
}
|
}
|
||||||
|
|
||||||
const transactionHash = await beeApi.withdrawTokens(amount)
|
const transactionHash = await beeApi.withdrawBZZFromChequebook(amount)
|
||||||
refresh()
|
refresh()
|
||||||
|
|
||||||
return transactionHash
|
return transactionHash
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { AllSettlements, Bee, BZZ, LastCashoutActionResponse, PeerBalance, Settlements } from '@ethersphere/bee-js'
|
import { AllSettlements, Bee, BZZ, LastCashoutActionResponse, PeerBalance, Settlements } from '@ethersphere/bee-js'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
import { makeRetriablePromise, unwrapPromiseSettlements } from '../utils'
|
import { makeRetriablePromise, unwrapPromiseSettlements } from '../utils'
|
||||||
|
|
||||||
interface UseAccountingHook {
|
interface UseAccountingHook {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
import { GITHUB_REPO_URL } from '../constants'
|
import { GITHUB_REPO_URL } from '../constants'
|
||||||
import { BeeConfig, getDesktopConfiguration, getLatestBeeDesktopVersion } from '../utils/desktop'
|
import { BeeConfig, getDesktopConfiguration, getLatestBeeDesktopVersion } from '../utils/desktop'
|
||||||
|
|
||||||
@@ -21,6 +22,8 @@ export interface NewDesktopVersionHook {
|
|||||||
newBeeDesktopVersion: string
|
newBeeDesktopVersion: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const REACHABILITY_CHECK_INTERVAL_MS = 10_000
|
||||||
|
|
||||||
export const useBeeDesktop = (isBeeDesktop = false, desktopUrl: string): BeeDesktopHook => {
|
export const useBeeDesktop = (isBeeDesktop = false, desktopUrl: string): BeeDesktopHook => {
|
||||||
const [reachable, setReachable] = useState(false)
|
const [reachable, setReachable] = useState(false)
|
||||||
const [desktopAutoUpdateEnabled, setDesktopAutoUpdateEnabled] = useState<boolean>(true)
|
const [desktopAutoUpdateEnabled, setDesktopAutoUpdateEnabled] = useState<boolean>(true)
|
||||||
@@ -30,6 +33,9 @@ export const useBeeDesktop = (isBeeDesktop = false, desktopUrl: string): BeeDesk
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isBeeDesktop) {
|
if (!isBeeDesktop) {
|
||||||
|
setLoading(false)
|
||||||
|
setError(null)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,16 +51,8 @@ export const useBeeDesktop = (isBeeDesktop = false, desktopUrl: string): BeeDesk
|
|||||||
}
|
}
|
||||||
|
|
||||||
runReachabilityCheck()
|
runReachabilityCheck()
|
||||||
const interval = setInterval(runReachabilityCheck, 10_000)
|
const interval = setInterval(runReachabilityCheck, REACHABILITY_CHECK_INTERVAL_MS)
|
||||||
|
|
||||||
return () => clearInterval(interval)
|
|
||||||
}, [desktopUrl, isBeeDesktop])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!isBeeDesktop) {
|
|
||||||
setLoading(false)
|
|
||||||
setError(null)
|
|
||||||
} else {
|
|
||||||
axios
|
axios
|
||||||
.get(`${desktopUrl}/info`)
|
.get(`${desktopUrl}/info`)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
@@ -68,7 +66,8 @@ export const useBeeDesktop = (isBeeDesktop = false, desktopUrl: string): BeeDesk
|
|||||||
.finally(() => {
|
.finally(() => {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
return () => clearInterval(interval)
|
||||||
}, [desktopUrl, isBeeDesktop])
|
}, [desktopUrl, isBeeDesktop])
|
||||||
|
|
||||||
return { error, isLoading, beeDesktopVersion, desktopAutoUpdateEnabled, reachable }
|
return { error, isLoading, beeDesktopVersion, desktopAutoUpdateEnabled, reachable }
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import { IconButton } from '@mui/material'
|
||||||
|
import { closeSnackbar, useSnackbar } from 'notistack'
|
||||||
|
import { useState } from 'react'
|
||||||
|
import CloseLineIcon from 'remixicon-react/CloseLineIcon'
|
||||||
|
|
||||||
|
export function useClipboardCopy(value: string) {
|
||||||
|
const { enqueueSnackbar } = useSnackbar()
|
||||||
|
const [copied, setCopied] = useState(false)
|
||||||
|
|
||||||
|
const handleCopy = async () => {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(value)
|
||||||
|
setCopied(true)
|
||||||
|
} catch {
|
||||||
|
enqueueSnackbar(`Failed to copy text`, {
|
||||||
|
variant: 'error',
|
||||||
|
action: key => (
|
||||||
|
<IconButton onClick={() => closeSnackbar(key)} size="small" color="inherit">
|
||||||
|
<CloseLineIcon fontSize="small" />
|
||||||
|
</IconButton>
|
||||||
|
),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const tooltipCloseHandler = () => setCopied(false)
|
||||||
|
|
||||||
|
return {
|
||||||
|
copied,
|
||||||
|
handleCopy,
|
||||||
|
tooltipCloseHandler,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +1,21 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import ReactDOM from 'react-dom'
|
import { createRoot } from 'react-dom/client'
|
||||||
|
|
||||||
import App from './App'
|
import App from './App'
|
||||||
import './index.css'
|
|
||||||
import reportWebVitals from './reportWebVitals'
|
import reportWebVitals from './reportWebVitals'
|
||||||
|
|
||||||
const desktopEnabled = process.env.REACT_APP_BEE_DESKTOP_ENABLED === 'true'
|
import './index.css'
|
||||||
const desktopUrl = process.env.REACT_APP_BEE_DESKTOP_URL
|
|
||||||
const beeApiUrl = process.env.REACT_APP_BEE_HOST
|
|
||||||
const defaultRpcUrl = process.env.REACT_APP_DEFAULT_RPC_URL
|
|
||||||
|
|
||||||
ReactDOM.render(
|
const desktopEnabled = import.meta.env.VITE_BEE_DESKTOP_ENABLED === 'true'
|
||||||
|
const desktopUrl = import.meta.env.VITE_BEE_DESKTOP_URL
|
||||||
|
const beeApiUrl = import.meta.env.VITE_BEE_HOST
|
||||||
|
const defaultRpcUrl = import.meta.env.VITE_DEFAULT_RPC_URL
|
||||||
|
|
||||||
|
const root = createRoot(document.getElementById('root') as HTMLElement)
|
||||||
|
root.render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<App isDesktop={desktopEnabled} desktopUrl={desktopUrl} beeApiUrl={beeApiUrl} defaultRpcUrl={defaultRpcUrl} />
|
<App isDesktop={desktopEnabled} desktopUrl={desktopUrl} beeApiUrl={beeApiUrl} defaultRpcUrl={defaultRpcUrl} />
|
||||||
</React.StrictMode>,
|
</React.StrictMode>,
|
||||||
document.getElementById('root'),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// If you want to start measuring performance in your app, pass a function
|
// If you want to start measuring performance in your app, pass a function
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { Button, CircularProgress, Container, IconButton } from '@material-ui/core'
|
import { Button, CircularProgress, Container, IconButton } from '@mui/material'
|
||||||
import { Theme, createStyles, makeStyles } from '@material-ui/core/styles'
|
|
||||||
import { useSnackbar } from 'notistack'
|
import { useSnackbar } from 'notistack'
|
||||||
import React, { ReactElement, useContext, useEffect } from 'react'
|
import React, { ReactElement, useContext, useEffect } from 'react'
|
||||||
|
import { useLocation } from 'react-router-dom'
|
||||||
import CloseIcon from 'remixicon-react/CloseCircleLineIcon'
|
import CloseIcon from 'remixicon-react/CloseCircleLineIcon'
|
||||||
|
import { makeStyles } from 'tss-react/mui'
|
||||||
|
|
||||||
import ErrorBoundary from '../components/ErrorBoundary'
|
import ErrorBoundary from '../components/ErrorBoundary'
|
||||||
import { Flex } from '../components/Flex'
|
import { Flex } from '../components/Flex'
|
||||||
import SideBar from '../components/SideBar'
|
import SideBar from '../components/SideBar'
|
||||||
@@ -10,20 +12,19 @@ import { BEE_DESKTOP_LATEST_RELEASE_PAGE } from '../constants'
|
|||||||
import { useBeeDesktop, useNewBeeDesktopVersion } from '../hooks/apiHooks'
|
import { useBeeDesktop, useNewBeeDesktopVersion } from '../hooks/apiHooks'
|
||||||
import { Context as BeeContext } from '../providers/Bee'
|
import { Context as BeeContext } from '../providers/Bee'
|
||||||
import { Context as SettingsContext } from '../providers/Settings'
|
import { Context as SettingsContext } from '../providers/Settings'
|
||||||
import { useLocation } from 'react-router-dom'
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles()(theme => ({
|
||||||
createStyles({
|
|
||||||
content: {
|
content: {
|
||||||
backgroundColor: theme.palette.background.default,
|
backgroundColor: theme.palette.background.default,
|
||||||
minHeight: '100vh',
|
minHeight: '100vh',
|
||||||
},
|
},
|
||||||
|
|
||||||
fileManagerOn: {
|
fileManagerOn: {
|
||||||
padding: '0px',
|
padding: '0px !important',
|
||||||
|
margin: '0px !important',
|
||||||
|
maxWidth: '100% !important',
|
||||||
},
|
},
|
||||||
}),
|
}))
|
||||||
)
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children?: ReactElement
|
children?: ReactElement
|
||||||
@@ -34,7 +35,7 @@ const Dashboard = (props: Props): ReactElement => {
|
|||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
|
|
||||||
const isFileManagerOn = location.pathname.startsWith('/filemanager')
|
const isFileManagerOn = location.pathname.startsWith('/filemanager')
|
||||||
const classes = useStyles()
|
const { classes } = useStyles()
|
||||||
|
|
||||||
const { isLoading } = useContext(BeeContext)
|
const { isLoading } = useContext(BeeContext)
|
||||||
const { isDesktop, desktopUrl } = useContext(SettingsContext)
|
const { isDesktop, desktopUrl } = useContext(SettingsContext)
|
||||||
@@ -49,7 +50,7 @@ const Dashboard = (props: Props): ReactElement => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (newBeeDesktopVersion !== '') {
|
if (newBeeDesktopVersion !== '') {
|
||||||
enqueueSnackbar(`There is new Swarm Dashboard version ${newBeeDesktopVersion}!`, {
|
enqueueSnackbar(`There is new Swarm Desktop version ${newBeeDesktopVersion}!`, {
|
||||||
variant: 'warning',
|
variant: 'warning',
|
||||||
preventDuplicate: true,
|
preventDuplicate: true,
|
||||||
key: 'desktopNewVersion',
|
key: 'desktopNewVersion',
|
||||||
|
|||||||
@@ -6,10 +6,6 @@
|
|||||||
background: rgb(33, 33, 33);
|
background: rgb(33, 33, 33);
|
||||||
height: 60px;
|
height: 60px;
|
||||||
padding: 10px 16px;
|
padding: 10px 16px;
|
||||||
|
|
||||||
&.is-loading {
|
|
||||||
filter: blur(1px);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.fm-admin-status-bar-left {
|
.fm-admin-status-bar-left {
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
import { ReactElement, useState, useMemo, useEffect, useContext, useCallback } from 'react'
|
|
||||||
import './AdminStatusBar.scss'
|
|
||||||
import { ProgressBar } from '../ProgressBar/ProgressBar'
|
|
||||||
import { Tooltip } from '../Tooltip/Tooltip'
|
|
||||||
import { PostageBatch } from '@ethersphere/bee-js'
|
import { PostageBatch } from '@ethersphere/bee-js'
|
||||||
import { DriveInfo, estimateDriveListMetadataSize } from '@solarpunkltd/file-manager-lib'
|
import { DriveInfo, estimateDriveListMetadataSize } from '@solarpunkltd/file-manager-lib'
|
||||||
|
import { ReactElement, useCallback, useContext, useEffect, useMemo, useState } from 'react'
|
||||||
|
|
||||||
import { Context as FMContext } from '../../../../providers/FileManager'
|
import { Context as FMContext } from '../../../../providers/FileManager'
|
||||||
import { ConfirmModal } from '../ConfirmModal/ConfirmModal'
|
import { Context as SettingsContext } from '../../../../providers/Settings'
|
||||||
import { calculateStampCapacityMetrics } from '../../utils/bee'
|
|
||||||
import { getHumanReadableFileSize } from '../../../../utils/file'
|
import { getHumanReadableFileSize } from '../../../../utils/file'
|
||||||
|
import { FILE_MANAGER_EVENTS, POLLING_TIMEOUT_MS } from '../../constants/common'
|
||||||
|
import { TOOLTIPS } from '../../constants/tooltips'
|
||||||
|
import { useStampPolling } from '../../hooks/useStampPolling'
|
||||||
|
import { calculateStampCapacityMetrics, validateStampStillExists } from '../../utils/bee'
|
||||||
|
import { ConfirmModal } from '../ConfirmModal/ConfirmModal'
|
||||||
|
import { ProgressBar } from '../ProgressBar/ProgressBar'
|
||||||
|
import { Tooltip } from '../Tooltip/Tooltip'
|
||||||
import { UpgradeDriveModal } from '../UpgradeDriveModal/UpgradeDriveModal'
|
import { UpgradeDriveModal } from '../UpgradeDriveModal/UpgradeDriveModal'
|
||||||
import { UpgradeTimeoutModal } from '../UpgradeTimeoutModal/UpgradeTimeoutModal'
|
import { UpgradeTimeoutModal } from '../UpgradeTimeoutModal/UpgradeTimeoutModal'
|
||||||
import { FILE_MANAGER_EVENTS, POLLING_TIMEOUT_MS } from '../../constants/common'
|
|
||||||
import { useStampPolling } from '../../hooks/useStampPolling'
|
import './AdminStatusBar.scss'
|
||||||
|
|
||||||
interface AdminStatusBarProps {
|
interface AdminStatusBarProps {
|
||||||
adminStamp: PostageBatch | null
|
adminStamp: PostageBatch | null
|
||||||
@@ -29,6 +33,7 @@ export function AdminStatusBar({
|
|||||||
setErrorMessage,
|
setErrorMessage,
|
||||||
}: AdminStatusBarProps): ReactElement {
|
}: AdminStatusBarProps): ReactElement {
|
||||||
const { drives, setShowError, refreshStamp } = useContext(FMContext)
|
const { drives, setShowError, refreshStamp } = useContext(FMContext)
|
||||||
|
const { beeApi } = useContext(SettingsContext)
|
||||||
|
|
||||||
const [isUpgradeDriveModalOpen, setIsUpgradeDriveModalOpen] = useState(false)
|
const [isUpgradeDriveModalOpen, setIsUpgradeDriveModalOpen] = useState(false)
|
||||||
const [isUpgradeTimeoutModalOpen, setIsUpgradeTimeoutModalOpen] = useState(false)
|
const [isUpgradeTimeoutModalOpen, setIsUpgradeTimeoutModalOpen] = useState(false)
|
||||||
@@ -174,7 +179,13 @@ export function AdminStatusBar({
|
|||||||
const isBusy = loading || isUpgrading || isCreationInProgress
|
const isBusy = loading || isUpgrading || isCreationInProgress
|
||||||
const blurCls = isBusy ? ' is-loading' : ''
|
const blurCls = isBusy ? ' is-loading' : ''
|
||||||
const statusVerb = isCreationInProgress ? 'Creating' : 'Loading'
|
const statusVerb = isCreationInProgress ? 'Creating' : 'Loading'
|
||||||
const statusText = statusVerb + ' admin drive, please do not reload'
|
const statusText = (
|
||||||
|
<>
|
||||||
|
{statusVerb} admin drive — please do not reload the page.
|
||||||
|
<br />
|
||||||
|
This may take a few minutes.
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
|
||||||
const renderModalsAndOverlays = () => {
|
const renderModalsAndOverlays = () => {
|
||||||
return (
|
return (
|
||||||
@@ -226,17 +237,27 @@ export function AdminStatusBar({
|
|||||||
|
|
||||||
<div>File Manager Available: Until: {expiresAt}</div>
|
<div>File Manager Available: Until: {expiresAt}</div>
|
||||||
|
|
||||||
<Tooltip
|
<Tooltip label={TOOLTIPS.ADMIN_STATUS_WARNING} />
|
||||||
label="The File Manager works only while your storage remains valid. If it expires, all catalogue metadata is
|
|
||||||
permanently lost."
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{renderModalsAndOverlays()}
|
{renderModalsAndOverlays()}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className="fm-admin-status-bar-upgrade-button"
|
className="fm-admin-status-bar-upgrade-button"
|
||||||
onClick={() => !isBusy && actualStamp && adminDrive && setIsUpgradeDriveModalOpen(true)}
|
onClick={async () => {
|
||||||
|
if (!isBusy && actualStamp && adminDrive && beeApi) {
|
||||||
|
const isStampValid = await validateStampStillExists(beeApi, actualStamp.batchID)
|
||||||
|
|
||||||
|
if (!isStampValid) {
|
||||||
|
setErrorMessage?.('The admin drive has expired. Please clear the browser cache and reload the page.')
|
||||||
|
setShowError(true)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsUpgradeDriveModalOpen(true)
|
||||||
|
}
|
||||||
|
}}
|
||||||
aria-disabled={isBusy ? 'true' : 'false'}
|
aria-disabled={isBusy ? 'true' : 'false'}
|
||||||
>
|
>
|
||||||
{isBusy ? 'Working…' : 'Manage'}
|
{isBusy ? 'Working…' : 'Manage'}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
|
||||||
import './Button.scss'
|
import './Button.scss'
|
||||||
|
|
||||||
interface ButtonProps {
|
interface ButtonProps {
|
||||||
|
|||||||