Compare commits

...

159 Commits

Author SHA1 Message Date
bee-worker b3137fbef1 chore(master): release 0.35.1 (#732)
* chore(master): release 0.35.1
* docs: update changelog.md for v0.53.1 bug fixes

---------

Co-authored-by: Ferenc Sárai <sarai.ferenc@gmail.com>
2026-04-10 11:25:29 +02:00
Ferenc Sárai e6f882d7e1 fix: for upcoming v0.53.1 (#731)
* fix: swap error caused by invalid id and batchcount
* fix: enhance creation messages for admin drive and user drives (#238)
* fix: enhance creation messages for admin drive and user drives
* fix: update creation message to indicate longer processing time
* fix: identity and wallet creation (#240)
* fix: asset preview types
* fix: fm search unicode text
* fix: feed identity and stamp usage
* fix: ui display changes (#239)
* fix: ui layout changes

* fix: stamp buy and dilute (#242)

fix: vite polyfill warning for stream
refactor: stamp depth and amount validation

* fix: spdv-917 (#243)

* fix: spdv-917

* refactor: spdv-917

* fix: add syncing message for Bee node and update page state handling spdv-955 (#244)

* fix: spdv-1037 (#245)

* fix: spdv-1038 (#246)

* fix: spdv-1038

* refactor: spdv-1038

* fix: validate stamp before every upgrade click (#247)

* fix: validate stamp before every upgrade click
---------

Co-authored-by: Roland Seres <roland.seres90@gmail.com>

* fix: use tochecksum() and toplurbigint() for ethers v6 compatibility (#248)

---------

Co-authored-by: Balint Ujvari <balint.ujvari@solarpunk.buzz>
Co-authored-by: Bálint Ujvári <58116288+bosi95@users.noreply.github.com>
Co-authored-by: rolandlor <33499567+rolandlor@users.noreply.github.com>
Co-authored-by: Roland Seres <roland.seres90@gmail.com>
2026-04-10 10:59:20 +02:00
bee-worker eda0529dfd chore(master): release 0.35.0 (#728)
* chore(master): release 0.35.0
* fix: update changelog with new features and bug fixes for version 0.35.0

---------

Co-authored-by: Ferenc Sárai <sarai.ferenc@gmail.com>
2026-04-02 15:30:25 +02:00
Ferenc Sárai cb5adfe031 feat: sync and update with all changes from solar-punk-ltd fork (#730)
* fix: swap error caused by invalid id and batchcount
* fix: enhance creation messages for admin drive and user drives
* fix: identity and wallet creation
* fix: asset preview types
* fix: fm search unicode text
* fix: feed identity and stamp usage
* fix: ui display changes
* fix: stamp buy and dilute
* fix: vite polyfill warning for stream
* fix: standard mode postage stamp purchase reserves incorrect size and duration
* fix: add syncing message for Bee node and update page state handling
* refactor: stamp depth and amount validation

---------

Co-authored-by: Balint Ujvari <balint.ujvari@solarpunk.buzz>
Co-authored-by: Bálint Ujvári <58116288+bosi95@users.noreply.github.com>
Co-authored-by: rolandlor <33499567+rolandlor@users.noreply.github.com>
2026-04-02 14:53:20 +02:00
Ferenc Sárai 4848b5be97 fix: remove cross-env from prepublishOnly script 2026-03-20 18:13:06 +01:00
Ferenc Sárai becb87377e fix: add workflow_dispatch trigger to npm publish workflow 2026-03-20 17:58:55 +01:00
bee-worker f149f86155 chore(master): release 0.34.0 (#727)
* chore(master): release 0.34.0

* fix: correct version number in package.json and update changelog

* fix: remove packageManager field from package.json

---------

Co-authored-by: Ferenc Sárai <sarai.ferenc@gmail.com>
2026-03-20 17:51:07 +01:00
Ferenc Sárai 37ab8fedaa fix: add --no-git-checks to pnpm publish command 2026-03-20 17:08:38 +01:00
bee-worker 688a95a454 chore(master): release 0.34.0 (#723) 2026-03-20 16:57:31 +01:00
Balint Ujvari d0922eb9a4 chore: set max commit header length 2026-03-20 16:02:17 +01:00
rolandlor a7e42053ae fix: spdv-1007 cost values correcting (#234)
* fix: spdv-1007

* refactor: spdv-1007

* refactor: spdv-1007
2026-03-20 16:02:17 +01:00
Bálint Ujvári e0280ead14 chore: update fm-lib version (#233) 2026-03-20 16:02:17 +01:00
Bálint Ujvári 855a017033 fix: filemanager state handling (#232)
* fix: filemanager state handling
* refactor: fm provider and fm page
* fix: detect bee warmup and wait more for syncing
* refactor: optimize bee provider to avoid rerenders
---------

Co-authored-by: Roland Seres <roland.seres90@gmail.com>
2026-03-20 16:02:17 +01:00
rolandlor 55e7879849 fix: spdv-934 (#231) 2026-03-20 16:02:17 +01:00
rolandlor e1fdd52676 fix: spdv-963 - Expired admin drive upgrading handling (#230)
* fix: spdv-963

* refactor: spdv-963
2026-03-20 16:02:17 +01:00
Ferenc Sárai db52e4471a fix: use uploadFile for single files to support long filenames and reafactor for linter (#228) 2026-03-20 16:02:17 +01:00
Bálint Ujvári a56a5c3ed8 fix: reflect file rename immediately (#227) 2026-03-20 16:02:17 +01:00
Bálint Ujvári 3031d54272 fix: buy stamp values display (#226)
fix: withdraw and deposit buttons style
fix: upload history text align
fix: buy stamp values display
2026-03-20 16:02:17 +01:00
Ferenc Sárai ae63615c7c fix: update documentation message for file access clarification (#221)
* fix: update documentation message for file access clarification
* fix(ui): upload message only for upload
2026-03-20 16:02:17 +01:00
rolandlor fa8a26e80d feat: spdv-995 (#225) 2026-03-20 16:02:17 +01:00
rolandlor 3c4d618cc8 fix: spdv-973 2026-03-20 16:02:17 +01:00
Bálint Ujvári e8e01c054a fix: download and upload files (#223)
* fix: download for unknown mime types
* fix: async process two files from the queue
* refactor: upload functions
2026-03-20 16:02:17 +01:00
Balint Ujvari 76bf2211ca fix: dockerfile build and use compose 2026-03-20 16:02:17 +01:00
rolandlor 220618f19b fix: spdv-914 - Modals are partially cut off in File Manager on Windows (Chrome) (#219)
* fix: spdv-914

* refactor: spdv-914-fix

* refactor: spdv-914-fix
2026-03-20 16:02:17 +01:00
Bálint Ujvári 8992c189fd fix: upload q and drive size error (#220)
* refactor: usetransfers hook functions
* refactor: bulk actions code style and readability
* fix: use upload q inflight size for subsequent uploads
* refactor: runUploadQueue execution
2026-03-20 16:02:17 +01:00
Ferenc Sárai bc2c0addbb fix: correct misleading update warning message for desktop version (#218) 2026-03-20 16:02:17 +01:00
Ferenc Sárai b58f01cc2b fix: add error handling and ui notifications for download failures (#217)
* fix: add error handling and ui notifications for download failures
* fix: refactor error handling for download failures
2026-03-20 16:02:17 +01:00
Bálint Ujvári 7e05a56073 fix: cannot forget expired drives (#214)
* fix: forget expired drives
2026-03-20 16:02:17 +01:00
rolandlor ad8c8f18eb fix: spdv-986 [commit: 519c411d] - Admin drive stucks in "in progress" state and the already existing admin drives are not listed on the initial modal (#215)
* fix: spdv-986

* refactor: spdv-986
2026-03-20 16:02:17 +01:00
Bálint Ujvári 308ec3dcc0 fix: use upload and download abort signals (#212)
* fix: use upload and download abort signals

* fix: progress trackers

chore: update fm-lib and bee-js

* chore: bump-up fm-lib version
2026-03-20 16:02:17 +01:00
rolandlor e00918b192 fix: spdv-971 (#211)
* fix: spdv-971

* fix: spdv-971
2026-03-20 16:02:17 +01:00
Ferenc Sárai 3ff645cab1 feat: add image opening functionality to DownloadActionBar (#725)
* feat: add image opening functionality to DownloadActionBar and Share components

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-05 16:51:09 +01:00
Ferenc Sárai fff94d9071 fix(rpc): ensure 0x prefix for recipient in sendBzzTransaction and add tests (#722)
* fix(rpc): ensure 0x prefixed recipient in sendBzzTransaction and add tests

* fix(tests): move rpc spec to tests/unit after rebase to master
2026-03-05 10:28:29 +01:00
Ferenc Sárai 7382da8595 fix(sidebar): use swarm-desktop GitHub link when running in desktop mode (#724) 2026-03-05 10:27:40 +01:00
Bálint Ujvári 519c411db0 feat: sync and update with all changes from fork (#720)
* feat: sync and update with all changes from fork
* refactor: extract clipboard copy logic into custom hook
* fix: correct spelling of DEFAULT_REFRESH_FREQUENCY_MS in Stamps and WalletBalance providers
* refactor(ui-tests): replace fixed sleeps with condition-based waits
* fix: handle null values for size and granteeCount in infoGroups
* fix(lint): add newline at end of file in useClipboardCopy hook
* fix(ui-tests): page.goto URL
* refactor: update import paths for useClipboardCopy

---------

Co-authored-by: Ferenc Sárai <sarai.ferenc@gmail.com>
2026-03-02 11:34:39 +01:00
bee-worker b0f00a624a chore(master): release 0.33.5 (#719)
* chore(master): release 0.33.5
* fix: update changelog

---------

Co-authored-by: Ferenc Sárai <sarai.ferenc@gmail.com>
2026-02-17 17:37:07 +01:00
Ferenc Sárai 9e1036ac29 fix: link_randomuuid_cache (#718)
* fix: [SPDV-828] use react router link instead of href
* fix: auto import issue
* fix: replace randomuuid with getRandomValues=
* fix: reset FM states if state is invalid
* fix: use no-cache for stamp fetch
* fix: clear cache and reload message
* fix: shallReset flag
* fix: identify browser platform and set help url accordingly
* fix: edge browser detection
* fix: use fallback chrome and verify for safari

---------

Co-authored-by: Nandor Komlodi <nandor.komlodi@gmail.com>
Co-authored-by: Balint Ujvari <balint.ujvari@solarpunk.buzz>
2026-02-17 17:19:10 +01:00
bee-worker beacd5b98e chore(master): release 0.33.4 (#716) 2026-01-26 13:19:08 +01:00
Bálint Ujvári 0d5138f5bc Fix: file-manager and swarm-desktop bugs (#714)
- drive capacity display with stamp polling
- download/upload progress handling
- overlay and tooltip issues
- FileMaganger readme
- ultra-light mode handling
- account feed view page
- download media files
- remove not found syncing link
- fix ultra light node wallet page
- tooltip issues
---------
Co-authored-by: Andrei Mitrea <andrei.mitrea.hq@gmail.com>
Co-authored-by: nidishk <nidishkrishnan45@gmail.com>
Co-authored-by: Ferenc Sárai <sarai.ferenc@gmail.com>
Co-authored-by: Nándor Komlódi <nandor.komlodi@gmail.com>
Co-authored-by: rolandlor <33499567+rolandlor@users.noreply.github.com>
2026-01-26 12:57:14 +01:00
Not Darko ecadafd21d [ci] Update npm publish workflow for new node version 2026-01-05 19:03:59 +01:00
bee-worker 369bd275c4 chore(master): release 0.33.3 (#711) 2025-11-17 13:34:32 +01:00
Ferenc Sárai 6d28653bb0 fix: add formbricks environment variables to workflow files (#709) 2025-11-17 13:25:32 +01:00
bee-worker aacb109e3f chore(master): release 0.33.2 (#708) 2025-11-14 15:34:50 +01:00
Ferenc Sárai 82e7c78a81 fix: clarify installation instructions in README (#707) 2025-11-14 15:27:12 +01:00
Bálint Ujvári c8fbf504e7 chore: set formbricks env in pull_request workflow (#103) (#706) 2025-11-14 14:26:14 +01:00
bee-worker 1e52adddf6 chore(master): release 0.33.1 (#705) 2025-11-13 19:09:37 +01:00
Cafe137 096522aa8a fix: put back external wallet balance context (#704)
* fix: put back external wallet balance context

* fix: include top up index page

* fix: include gift code index page

* fix: add BalanceProvider
2025-11-13 19:00:35 +01:00
bee-worker 5fdcdfb444 chore(master): release 0.33.0 (#698) 2025-11-12 11:47:45 +01:00
Bálint Ujvári 5bfe2a0331 Feat: FileManager (#98) (#703)
* feat: add file manager module

- Complete file manager implementation with UI/UX
- Add drive management functionality
- Add file upload/download with progress tracking
- Add stamp integration and handling
- Add bulk operations and context menus

Co-authored-by: Roland Seres <roland.seres90@gmail.com>
Co-authored-by: nidishk <nidishkrishnan45@gmail.com>
2025-11-12 11:26:00 +01:00
Cafe137 1249c0df71 feat: bee-js revamp (#690)
* chore: initial commit

* refactor: remove unnecessary wrappers

* style: add missing newline

* chore: bump bee-js

* chore: ignore any cast in fdp

* fix: remove cid import

* fix: make TextEncoder and TextDecoder available in jest

* refactor: dedupe stamp ttl second conversion

* refactor: use convenience methods from bee-js

* feat: update to bee-js for restored ens support

* fix: bump bee-js to get download fix

* fix: resolve feed before downloading reference

* fix: fix token displays

* fix: fix token input modal error message

* refactor: remove wallet balance provider

* chore: remove dead code

* refactor: upcoming bee js 0.15.0 (#692)

* chore: initial commit

* fix: do not break page when duration seconds is 0

* ci: remove cache

* chore: upgrade bee-js

* feat: bee-js and bee v2.6 compatibility

* chore: switch upcoming/bee-js to ethersphere/bee-js
2025-07-16 17:10:14 +02:00
bee-worker 082a8f52ef chore(master): release 0.32.0 (#689) 2025-03-12 12:34:55 +01:00
Levente Kiss bcd3d50b42 feat: vod display (#686)
* feat: preview for html5 supported videos

* fix: handle out of limit tags

* feat: support preview on the donwload screen

* refactor: rework meta and preview handling to be more general

* fix: missing meta

* fix: do not allow maybe or probably types

* fix: make the media check more strict

---------

Co-authored-by: Levente Kiss <levente.kiss@solarpunk.bzz>
2025-02-12 11:35:46 +01:00
bee-worker f695ac3a1c chore(master): release 0.31.0 (#688) 2025-01-13 14:57:16 +01:00
Ferenc Sárai a6125b3d0b feat: remove experimental FDP menu item (#687)
Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
2025-01-13 14:43:10 +01:00
bee-worker e01d9fe3d7 chore(master): release 0.30.0 (#675) 2024-11-25 12:35:42 +01:00
Cafe137 6294bb0a7b fix: allow changing api url (#676)
* fix: allow changing api url

* chore: bump ci

* fix: add missing hook dependency
2024-11-25 11:17:27 +01:00
Cafe137 fbb2ed8a57 feat: update map data (#684) 2024-11-25 10:47:30 +01:00
Cafe137 aef6c07371 chore: update bee-js (#683) 2024-11-25 09:51:14 +01:00
Cafe137 ed75198528 ci: remove update supported bee action (#682) 2024-11-25 09:27:24 +01:00
Cafe137 d0c94b7316 feat: add experimental fdp (#681)
* feat: add experimental fdp

* ci: update swarm-actions to v1

* fix: fix eslint violations

* refactor: decaf
2024-11-21 12:43:30 +01:00
Cafe137 63f338075b fix: explicitly define type 0 transaction (#674) 2024-10-03 15:27:17 +02:00
bee-worker 4cb0bcd3b9 chore(master): release 0.29.0 (#668) 2024-07-30 23:24:02 +02:00
Cafe137 01b1b39c42 feat: clarify labels and syncing (#670) 2024-07-17 19:30:21 +02:00
Cafe137 8558860f0a feat: polish app (#669) 2024-07-17 15:49:22 +02:00
tamas6 b4ebfc7c3f fix: clarify withdraw and deposit message (#654)
* fix: clear withdraw/deposit message

* fix: withdraw/deposit message shorten
2024-07-17 14:07:45 +02:00
bee-worker a47de8fcb5 chore(master): release 0.28.0 (#667) 2024-06-18 14:46:52 +02:00
Cafe137 e9ebe33d51 feat: upgrade bee-js to 7.0.3 (#666) 2024-06-18 14:46:04 +02:00
bee-worker 4c06ff5d8e chore(master): release 0.27.0 (#665) 2024-06-11 21:26:45 +02:00
rampall 999399fb08 feat: add redeem shortcut to sidebar 2024-06-11 21:22:11 +02:00
bee-worker a00ca77b3e chore(master): release 0.26.2 (#663) 2024-06-05 06:56:12 +02:00
Cafe137 cae90c1a82 fix: merge version and health check (#662) 2024-06-05 06:55:40 +02:00
bee-worker 7f169bbabd chore(master): release 0.26.1 (#660) 2024-06-04 01:29:02 +02:00
Cafe137 a5d4ecf045 fix: add bee version (#659) 2024-06-04 01:25:28 +02:00
bee-worker 1e67de0242 chore(master): release 0.26.0 (#652) 2024-06-04 00:19:43 +02:00
Cafe137 8cbd812a2c feat: merge api (#658) 2024-06-04 00:07:01 +02:00
rolandlor b3f521ca20 fix: correct the bee version detection (#645)
* feat: Github repository link to ethersphere/bee-dashboard

* fix: correct the Bee version detection
2024-01-10 10:57:55 +01:00
Levente Kiss 79bb315401 feat: wait for upload sync (#649)
* feat: add basic progress bar (#605)

* feat: add syncing to share page (#605)

* refactor: use the documentation text comp (#605)

* refactor: move sync logic to new comp (#605)

* refactor: optimize sync check (#605)

* chore: linting (#605)

---------

Co-authored-by: Levente Kiss <levente.kiss@solarpunk.bzz>
2024-01-08 22:56:31 +01:00
Levente Kiss 5871223203 feat: display effective capacity (#643)
* feat: add stamp effective volume display (#636)

* refactor: make it cleaner (#636)

---------

Co-authored-by: Levente Kiss <levente.kiss@solarpunk.bzz>
2024-01-08 22:54:32 +01:00
Ferenc Sárai cc91f1d64c feat: show syncing info (#647)
Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
2024-01-08 22:53:01 +01:00
Vojtech Simetka e287845f7c chore: update code owners (#651) 2024-01-08 22:51:54 +01:00
bee-worker 16ffffb0c4 chore(master): release 0.25.0 (#637) 2023-12-04 22:32:19 +01:00
Cafe137 080d9f2c2a refactor: clean up postage stamp screens (#642)
* refactor: clean up postage stamp screens

* fix: add immutable flag
2023-12-04 22:28:44 +01:00
rolandlor 4f9abc614e feat: update postage stamp creation screen (#641)
* style: UI changes for postage stamp

* feat: New postage stamp standard page

---------

Co-authored-by: Seres Roland <seresroland@Seres-MBP.home>
2023-12-04 22:01:51 +01:00
Cafe137 20a051b658 fix: put stamp input error handling in state (#640) 2023-11-20 14:59:00 +01:00
Ferenc Sárai 0c2ac0c454 feat: improve topup and dilute ux
Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
2023-11-20 14:00:42 +01:00
Ferenc Sárai 8802d20555 style: add padding to files download (#387) (#639)
Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
2023-11-20 13:59:40 +01:00
zol1981 7fa1cb0ccf fix: add missing stamp labels and fix inputs (#634)
* fix issue #630, #606

* fix: Stamp Labels #630, Entering * into amount #606

* #606 Entering * into amount

* fix: inputs eliminating warnings

---------

Co-authored-by: Zoltán Mihály <zolmac@Zoltans-MacBook-Pro.local>
2023-11-08 14:15:34 +01:00
Ferenc Sárai bab08e1df2 style: add padding to account chequebook (#635)
Co-authored-by: Ferenc Sárai <ferenc.sarai@solarpunk.buzz>
2023-11-07 12:33:28 +01:00
bee-worker d91c334cf8 chore(master): release 0.24.1 (#629) 2023-10-18 15:48:48 +02:00
rampall bce93ce3cd fix: update swap-endpoint to blockchain-rpc-endpoint (#628) 2023-10-18 15:42:06 +02:00
bee-worker 8367f2b76a chore(master): release 0.24.0 (#621) 2023-08-12 00:47:34 +02:00
Cafe137 055a3002b3 feat: add stamp dilute and topup (#619)
* feat: add stamp dilute and topup

* fix: remove any

* chore: bump bee-js

* chore: remove obsolete workaround
2023-08-12 00:41:10 +02:00
bee-worker c9c4e7d7d1 chore(master): release 0.23.0 (#609) 2023-02-23 01:25:09 +01:00
bee-worker d97bc27c14 docs: update supported bee (#612) 2023-02-21 10:30:59 +01:00
Cafe137 e215c61ea1 feat: upgrade bee-js to 5.2.0 (#611) 2023-02-21 10:16:16 +01:00
bee-worker 8298d0bc66 docs: update supported bee (#610) 2023-02-19 23:29:11 +01:00
Cafe137 fac72b1299 feat: add staking for full nodes (#590)
* feat: add staking

* feat: enable staking in full mode, add loading state

* chore: revert constants
2023-02-19 22:58:55 +01:00
bee-worker e780b971d9 chore(master): release 0.22.0 (#604) 2023-01-19 12:17:25 +01:00
Cafe137 90f9f91ddb feat: add node connecting status (#603) 2023-01-19 12:05:24 +01:00
bee-worker 01838dccd1 chore(master): release 0.21.1 (#600) 2022-12-21 14:49:34 +01:00
Cafe137 42b7f080b0 fix: do not require chequebook funding (#599)
* fix: do not require chequebook funding

* chore: revert import sorting
2022-12-21 14:36:24 +01:00
bee-worker a88e78e748 chore(master): release 0.21.0 (#579) 2022-12-02 12:39:02 +01:00
Cafe137 665ae063fa fix: handle auth and server error during swap (#593)
* fix: change execution order for light node upgrade

* refactor: grab new configuration from post config request

* fix: only print successful light node upgrade when it really happens

* fix: log full desktop side swap error (#596)

* refactor: try to make the auth error in swap nicer

* refactor: make error instruction consistent

* fix: avoid overwriting daiToSwap when it is set manually
2022-12-01 12:36:15 +01:00
Cafe137 dc04e26db4 fix: change version mismatch to a warning (#594) 2022-11-30 12:36:34 +01:00
Cafe137 b798fa0e68 fix: always set rpc to newly provided value in desktop (#591)
* fix: always set rpc to newly provided value in desktop

* fix: always set new rpc and restart node

* fix: disable version check in desktop mode

* fix: only set rpc in desktop when in light mode

* refactor: simplify code
2022-11-24 14:06:00 +01:00
Cafe137 4e564dd5c0 feat: add prerequisite checks before swap (#588)
* feat: add prerequisite checks before swap

* fix: add missing authentication on desktop config call

* refactor(wip): introduce swap error

* refactor: use wrapWithSwapError

* fix: log originalError instead of error

* fix: show snackbar when error is unexpected
2022-11-23 14:20:55 +01:00
Adam Uhlíř 1c53364fcd chore: add Bee Factory support (#592) 2022-11-22 15:55:04 +01:00
Cafe137 848e61a7a0 feat: add starting state to sidebar indicator (#587) 2022-11-22 10:33:38 +01:00
bee-worker c3a940c8d7 docs: update supported bee (#586) 2022-11-15 15:23:30 +01:00
Cafe137 02469046b0 fix: add loading state to info page (#584)
* fix: add loading state to info page

* refactor: use bee-js for readiness check
2022-11-14 14:22:49 +01:00
Cafe137 1ce4a47495 fix: fix conditional rendering for blockchain network (#583) 2022-11-14 11:16:14 +01:00
Cafe137 9a8520eb6f fix: hide swap in standalone mode (#582) 2022-11-14 11:15:40 +01:00
Cafe137 ec8fdf0315 fix: always consider user input when performing swap (#572)
* fix: always consider user input when performing swap

* refactor: extract decimal places constants

* refactor: extract minimumOptimalValue

* fix: handle bzz precision and tweak message
2022-11-09 14:21:34 +01:00
Cafe137 a4b8e7ca25 fix: change status page depending on desktop mode (#573)
* fix: change status page depending on desktop mode

* refactor: check desktop reachability periodically
2022-11-07 14:02:22 +01:00
Cafe137 693609810d fix: refresh after chequebook withdraw deposit (#576)
* fix: refresh after chequebook withdraw deposit

* refactor: remove extra catch
2022-11-07 14:02:11 +01:00
Adam Uhlíř 73f845a73a docs: desktop development (#539) 2022-10-05 09:27:28 +02:00
Adam Uhlíř b6419297f4 ci: make preview check step optional (#548) 2022-10-05 09:26:57 +02:00
bee-worker 9d2d271c20 chore(master): release 0.20.2 (#552) 2022-09-15 17:05:48 +02:00
Adam Uhlíř c0456a3bf6 fix: stamp purchasing (#551) 2022-09-15 17:02:11 +02:00
bee-worker 463622c297 chore(master): release 0.20.1 (#549) 2022-09-15 05:46:11 -07:00
Adam Uhlíř e2dd077118 fix: rpc endpoint setting ultra-light mode logic (#547) 2022-09-15 14:42:53 +02:00
Adam Uhlíř 5295bd5b01 fix: revert bee env. variable names and add default rpc var (#545) 2022-09-15 14:29:19 +02:00
dependabot[bot] 0592995564 build(deps-dev): bump typescript from 4.8.2 to 4.8.3 (#532)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-14 12:44:55 +02:00
bee-worker da0ae9cd94 chore(master): release 0.20.0 (#534) 2022-09-14 11:54:48 +02:00
Adam Uhlíř 528a810690 fix: show update notifications only on non-auto-updating Swarm Desktops (#543) 2022-09-14 11:48:24 +02:00
Adam Uhlíř 0c74dae4e8 feat: error reporting callback (#530) 2022-09-09 13:07:40 +02:00
dependabot[bot] d42d440f85 build(deps-dev): bump typescript from 4.7.3 to 4.8.2 (#528)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-09 12:03:34 +02:00
Adam Uhlíř 0c262a4811 refactor: remove env. variables from the component (#529) 2022-09-08 08:51:55 +02:00
bee-worker 0603018f09 chore(master): release 0.19.3 (#527) 2022-08-24 22:23:17 +02:00
Cafe137 677b6de0f8 fix: pass isBeeDesktop from provider to hook (#525) 2022-08-24 22:02:34 +02:00
Adam Uhlíř 27f965ef63 ci: cleanup sentry removal (#523) 2022-08-24 21:25:17 +02:00
bee-worker e72347d87a chore(master): release 0.19.2 (#521) 2022-08-11 10:53:52 +02:00
Adam Uhlíř 0260df61de fix: remove sentry (#520) 2022-08-08 18:19:38 +02:00
bee-worker e986d7ca22 chore(master): release 0.19.1 (#517) 2022-08-03 16:00:40 +02:00
Vojtech Simetka df925b013b fix: compile types when building the library (#516) 2022-08-03 15:44:10 +02:00
bee-worker d7867ff475 chore(master): release 0.19.0 (#487)
* chore(master): release 0.19.0

* chore: fix typos

Co-authored-by: Vojtech Simetka <vojtech@simetka.cz>
2022-08-03 14:20:20 +02:00
Vojtech Simetka b9c008f019 feat: add loading state to wallet balance (#508)
* feat: add loading state to wallet balance

* refactor: extract the wallet balance into a provider
2022-08-03 14:09:24 +02:00
Vojtech Simetka a7bd94af82 build: bundle assets inline for the component library (#513)
* build: bundle assets inline for the component library

* chore(deps): allow react version 17.x.x and 18.x.x
2022-08-03 07:28:57 +02:00
Vojtech Simetka 1be5cbda6d fix: new bee version notification is only shown if user bee version is detected (#512)
* fix: new bee version notification is only shown if user bee version is detected

* chore: add missing useEffect dependency
2022-08-02 12:44:33 +02:00
Vojtech Simetka 4c48657fca feat: pass isBeeDesktop as Bee Dashboard component property (#510)
* feat: pass isBeeDesktop as Bee Dashboard component property

* chore: remove console log
2022-08-02 09:53:50 +02:00
Vojtech Simetka 72488fd5a3 chore: update to use bee-js 5.0.0 and support bee 1.7.0 (#503)
* chore: update to use bee-js 5.0.0 and support bee 1.7.0

* fix: store reference to feed manifest correctly

* fix: set waitForUsable to false (#507)

Co-authored-by: Cafe137 <77121044+Cafe137@users.noreply.github.com>
2022-08-01 16:21:52 +02:00
Vojtech Simetka 896f6e48d9 fix: if the node has error, disable pages that can never load (#502) 2022-07-29 10:42:14 +02:00
Vojtech Simetka f53e9664da feat: reintroduce new bee version notification (#500) 2022-07-29 10:41:34 +02:00
Vojtech Simetka ff5b832017 docs: update screenshots in README (#504) 2022-07-29 10:41:12 +02:00
Vojtech Simetka 9f0ab1323b chore: typo in useNewBeeDesktopVersion hook (#501) 2022-07-28 15:47:06 +02:00
Adam Uhlíř c9384ff23e chore: update swarm-desktop development with the desktop env (#498) 2022-07-27 20:16:10 +02:00
Vojtech Simetka f8390d7eac fix: disable swarm invitation outside of Swarm Desktop (#497) 2022-07-27 08:45:11 +02:00
Vojtech Simetka 408b565935 feat: make blockchain JSON RPC configurable from settings (#494)
* feat: make blockchain JSON RPC configurable from settings

* chore: expose the settings directly

* feat: restart bee node when blockchain RPC changes, add notification and error logging
2022-07-27 08:45:03 +02:00
Cafe137 f82444f212 fix: handle unicode filename and website uploads (#491)
* fix: print meaningful error message for invalid filenames

* fix: handle unicode dirnames and filenames

* chore: revert custom error message
2022-07-26 13:13:25 +02:00
Vojtech Simetka fd11f0166d feat: add wallet endpoint and display blockchain name (#492) 2022-07-26 10:18:27 +02:00
Cafe137 186d0352cf fix: correct website upload path (#483)
* test(wip): add ui tests

* fix: correct website upload path

* fix: use includes

* test: rewrite ui tests

* build: remove concurrently

* ci: run puppeteer in headless

* test: add regression tests

* test: add website regression 03 test

* test: add react test website

* chore: revert newlines

Co-authored-by: Cafe137 <aron@aronsoos.com>
2022-07-25 11:24:32 +02:00
Vojtech Simetka f01477ea70 feat: check whether the app runs within bee-desktop is now an environment variable (#490)
* feat: check whether the app runs within bee-desktop is now an environment variable

* chore: remove console.log
2022-07-25 10:28:17 +02:00
Vojtech Simetka 6bfe97be5d feat: log errorss to consolve when showing error notification (#489) 2022-07-25 07:26:01 +02:00
Vojtech Simetka feeca008ac feat: don't display duplicate notifications with snackbar (#488) 2022-07-25 07:25:52 +02:00
Vojtech Simetka cba21bb2e0 feat: set default rpc endpoint (#485)
* feat: add default RPC endpoint

* feat: removed setting RPC endpoint altogherher and altered the routes accordingly
2022-07-22 10:55:19 +02:00
Adam Uhlíř 318592653c ci: fix sentry release version (#481) 2022-07-11 11:56:32 +02:00
bee-worker 786d624e18 chore(master): release 0.18.2 (#478) 2022-07-06 11:34:35 +02:00
Adam Uhlíř 33fff93cac fix: enable desktop update notifications on all platforms (#476) 2022-07-06 11:27:48 +02:00
Adam Uhlíř 498294e227 fix: don't link to latest release (#477) 2022-07-06 11:27:41 +02:00
360 changed files with 87549 additions and 47538 deletions
+7 -37
View File
@@ -1,50 +1,20 @@
'use strict'
module.exports = function (api) {
const targets = '>1% and not ie 11 and not dead'
module.exports = api => {
api.cache(true)
api.cacheDirectory = true
return {
presets: [
['@babel/preset-env', { targets: { node: 'current' }, modules: 'commonjs' }],
'@babel/preset-typescript',
[
'@babel/preset-env',
{
targets,
modules: false,
}
],
['@babel/preset-react', {runtime: 'automatic' }]
['@babel/preset-react', { runtime: 'automatic' }],
],
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',
{
helpers: false,
regenerator: true
}
]
]
regenerator: true,
},
],
],
}
}
+10 -11
View File
@@ -1,19 +1,18 @@
{
"ignores": [
"@testing-library/react",
"@types/*",
"@commitlint/config-conventional",
"@commitlint/*",
"@babel/*",
"babel*",
"@eslint/*",
"@eslint/*",
"eslint*",
"file-loader",
"ts-node",
"webpack-cli",
"assert",
"buffer",
"crypto*",
"stream*",
"env-paths",
"open"
"husky",
"jest-environment-jsdom",
"open",
"rimraf",
"sass",
"ts-node",
"@vitejs/plugin-react"
]
}
+47
View File
@@ -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
+6 -7
View File
@@ -1,7 +1,6 @@
PORT=3001
REACT_APP_BEE_HOST=http://localhost:1633
REACT_APP_BEE_DEBUG_HOST=http://localhost:1635
REACT_APP_BEE_DOCS_HOST=https://docs.ethswarm.org/docs/
REACT_APP_BEE_DISCORD_HOST=https://discord.gg/eKr9XPv7
REACT_APP_BLOCKCHAIN_EXPLORER_URL=https://blockscout.com/xdai/mainnet
REACT_APP_BEE_GITHUB_REPO_URL=https://api.github.com/repos/ethersphere/bee
PORT=3002
VITE_BEE_DESKTOP_URL=http://localhost:3054
VITE_FORMBRICKS_ENV_ID=
VITE_FORMBRICKS_APP_URL=
VITE_DEFAULT_RPC_URL=
VITE_BEE_DESKTOP_ENABLED=
-6
View File
@@ -1,6 +0,0 @@
REACT_APP_BEE_HOST=http://localhost:1633
REACT_APP_BEE_DEBUG_HOST=http://localhost:1635
REACT_APP_BEE_DOCS_HOST=https://docs.ethswarm.org/docs/
REACT_APP_BEE_DISCORD_HOST=https://discord.gg/eKr9XPv7
REACT_APP_BLOCKCHAIN_EXPLORER_URL=https://blockscout.com/xdai/mainnet
REACT_APP_BEE_GITHUB_REPO_URL=https://api.github.com/repos/ethersphere/bee
-100
View File
@@ -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 -2
View File
@@ -2,12 +2,12 @@
version: 2
updates:
# Enable version updates for npm
# Enable version updates for pnpm
- package-ecosystem: 'npm'
# Look for `package.json` and `lock` files in the `root` directory
directory: '/'
# Check the npm registry for updates every day (weekdays)
schedule:
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
+28 -36
View File
@@ -14,77 +14,69 @@ jobs:
strategy:
matrix:
node-version: [18.x]
node-version: [24.x]
env:
REACT_APP_BEE_HOST: https://api.test-node.staging.ethswarm.org/
REACT_APP_BEE_DEBUG_HOST: https://debug.test-node.staging.ethswarm.org/
REACT_APP_DEV_MODE: 1
REACT_APP_SENTRY_KEY: ${{ secrets.SENTRY_KEY }}
REACT_APP_SENTRY_ENVIRONMENT: 'preview'
VITE_BEE_HOST: https://api.test-node.staging.ethswarm.org/
VITE_FORMBRICKS_ENV_ID: ${{ secrets.VITE_FORMBRICKS_ENV_ID }}
VITE_FORMBRICKS_APP_URL: ${{ secrets.VITE_FORMBRICKS_APP_URL }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
version: 10
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
## Try getting the node modules from cache, if failed npm ci
- uses: actions/cache@v2
id: cache-npm
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.OS }}-node-${{ matrix.node-version }}-${{ env.cache-name }}-
${{ runner.OS }}-node-${{ matrix.node-version }}-
${{ runner.os }}-pnpm-
- name: Install npm deps
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Commit linting
uses: wagoid/commitlint-github-action@v2
uses: wagoid/commitlint-github-action@v6
with:
configFile: ./commitlint.config.cjs
- name: Code linting
run: npm run lint:check
run: pnpm run lint
env:
CI: true
- name: Dependency check
run: npm run depcheck
run: pnpm run depcheck
- name: Types check
run: npm run check:types
- name: Types build
run: npm run compile:types
- name: Update supported Bee action
uses: ethersphere/update-supported-bee-action@v1
if: github.ref == 'refs/heads/master'
with:
token: ${{ secrets.GHA_PAT_BASIC }}
run: pnpm run check:types
- name: Build
run: npm run build
run: pnpm run build
- name: Build Component
run: npm run build:component
run: pnpm run build:component
- name: Create preview
uses: ethersphere/swarm-actions/pr-preview@v0
uses: ethersphere/swarm-actions/pr-preview@v1
continue-on-error: true
with:
bee-url: https://unlimited.gateway.ethswarm.org
token: ${{ secrets.GHA_PAT_BASIC }}
error-document: index.html
headers: "${{ secrets.GATEWAY_AUTHORIZATION_HEADER }}"
headers: '${{ secrets.GATEWAY_AUTHORIZATION_HEADER }}'
- name: Upload to testnet
uses: ethersphere/swarm-actions/upload-dir@v0
uses: ethersphere/swarm-actions/upload-dir@v1
continue-on-error: true
with:
index-document: index.html
+28 -19
View File
@@ -1,30 +1,39 @@
# After new release is published on github, publish it to npmjs
name: Publish on npmjs
name: Publish on npm
on:
workflow_dispatch:
release:
types: [published]
permissions:
id-token: write
contents: read
jobs:
publish:
runs-on: ubuntu-latest
env:
VITE_FORMBRICKS_ENV_ID: ${{ secrets.VITE_FORMBRICKS_ENV_ID }}
VITE_FORMBRICKS_APP_URL: ${{ secrets.VITE_FORMBRICKS_APP_URL }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
node-version: 18
version: 10
- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run compile:types
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
- name: Setup pnpm cache
uses: actions/cache@v3
with:
sourcemaps: ./build/static/js
version: ${{ github.ref }}
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- run: pnpm install --frozen-lockfile
- run: pnpm publish --provenance --access public --no-git-checks
+20 -8
View File
@@ -9,17 +9,29 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
env:
VITE_FORMBRICKS_ENV_ID: ${{ secrets.VITE_FORMBRICKS_ENV_ID }}
VITE_FORMBRICKS_APP_URL: ${{ secrets.VITE_FORMBRICKS_APP_URL }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
node-version: 18
version: 10
- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
env:
REACT_APP_SENTRY_KEY: ${{ secrets.SENTRY_KEY }}
REACT_APP_SENTRY_ENVIRONMENT: 'pages'
- 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: pnpm install --frozen-lockfile
- run: pnpm run build
- run: echo "dashboard.ethswarm.org" > ./build/CNAME
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
+18 -17
View File
@@ -12,34 +12,35 @@ jobs:
tests:
runs-on: ubuntu-latest
env:
VITE_FORMBRICKS_ENV_ID: ${{ secrets.VITE_FORMBRICKS_ENV_ID }}
VITE_FORMBRICKS_APP_URL: ${{ secrets.VITE_FORMBRICKS_APP_URL }}
strategy:
matrix:
node-version: [18.x]
node-version: [24.x]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
version: 10
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
## Try getting the node modules from cache, if failed npm ci
- uses: actions/cache@v2
id: cache-npm
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.OS }}-node-${{ matrix.node-version }}-${{ env.cache-name }}-
${{ runner.OS }}-node-${{ matrix.node-version }}-
${{ runner.os }}-pnpm-
- name: Install npm deps
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests
run: npm run test
run: pnpm run test
+11
View File
@@ -11,6 +11,7 @@
# production
/build
/lib
.env
# misc
.DS_Store
@@ -22,3 +23,13 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/**.log
settings.json
*.tsbuildinfo
**.tgz
api-key.txt
tmp/
+1
View File
@@ -0,0 +1 @@
pnpm exec commitlint --edit "$1"
+1
View File
@@ -0,0 +1 @@
pnpm run lint && pnpm run check:types && pnpm run depcheck
+1
View File
@@ -0,0 +1 @@
v24.0.0
+11
View File
@@ -0,0 +1,11 @@
node_modules
yarn.lock
package-lock.json
dist/
pnpm-lock.yaml
**/test-data/
**.html
**.svg
build/
lib/
**/assets/*
+360
View File
@@ -1,5 +1,365 @@
# Changelog
## [0.35.1](https://github.com/ethersphere/bee-dashboard/compare/v0.35.0...v0.35.1) (2026-04-10)
### Bug Fixes
- [`cb6854e`](https://github.com/ethersphere/bee-dashboard/commit/cb6854eb68ffe3064a39a171bc1e23f628ee93bb) fix: swap error caused by invalid id and batchcount
- [`bb93d5c`](https://github.com/ethersphere/bee-dashboard/commit/bb93d5c26fa5414c6423b87a3992e0f2e410e515) fix: enhance creation messages for admin drive and user drives [(#238)](https://github.com/ethersphere/bee-dashboard/issues/238)
- [`c08bf8a`](https://github.com/ethersphere/bee-dashboard/commit/d65da143d2200db653fe7a80a7891dacf4c2937e) fix: identity and wallet creation [(#240)](https://github.com/ethersphere/bee-dashboard/pull/240)
- [`d65da14`](https://github.com/ethersphere/bee-dashboard/commit/d65da143d2200db653fe7a80a7891dacf4c2937e) fix: ui display changes [(#239)](https://github.com/ethersphere/bee-dashboard/issues/239)
- [`c890f7c`](https://github.com/ethersphere/bee-dashboard/commit/c890f7c1e8e4d21f8d252b3e1a9c783982459adf) fix: stamp buy and dilute [(#242)](https://github.com/ethersphere/bee-dashboard/issues/242)
- [`b33b663`](https://github.com/ethersphere/bee-dashboard/commit/b33b6630c2b5830b0fdbfbcf14cadc3fa1225190) fix: standard mode postage stamp purchase [(#243)](https://github.com/ethersphere/bee-dashboard/issues/243)
- [`f943f7a`](https://github.com/ethersphere/bee-dashboard/commit/f943f7ad666de15ef780cb5adf736b533902eef7) fix: add syncing message for bee node and update page state [(#244)](https://github.com/ethersphere/bee-dashboard/pull/244)
- [`056188a`](https://github.com/ethersphere/bee-dashboard/commit/056188abedf3a8ac828b8eb10a71a3b823cd5e6e) fix: duplicated ttl (time to live) information [(#245)](https://github.com/ethersphere/bee-dashboard/issues/245)
- [`8b36556`](https://github.com/ethersphere/bee-dashboard/commit/8b36556502d316ac5bd7dba49ce34b594857d449) fix: misleading "bee node is syncing" message for ultra-light nodes in file manager [(#246)](https://github.com/ethersphere/bee-dashboard/pull/246)
- [`9732170`](https://github.com/ethersphere/bee-dashboard/commit/97321706c33fb02abe7e067e6d865a046051d68b) fix: validate stamp before every upgrade click [(#247)](https://github.com/ethersphere/bee-dashboard/issues/247)
- [`f52ed4a`](https://github.com/ethersphere/bee-dashboard/commit/f52ed4abb2bb5274b33430c1e8efadae6b3fa795) fix: use tochecksum() and toplurbigint for ethers v6 compatibility [(#248)](https://github.com/ethersphere/bee-dashboard/pull/248)
## [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)
### Bug Fixes
* file-manager and swarm-desktop bugs ([#714](https://github.com/ethersphere/bee-dashboard/issues/714)) ([0d5138f](https://github.com/ethersphere/bee-dashboard/commit/0d5138f5bc816cece0324793166ec84ef2147679))
## [0.33.3](https://github.com/ethersphere/bee-dashboard/compare/v0.33.2...v0.33.3) (2025-11-17)
### Bug Fixes
* add formbricks environment variables to workflow files ([#709](https://github.com/ethersphere/bee-dashboard/issues/709)) ([6d28653](https://github.com/ethersphere/bee-dashboard/commit/6d28653bb0b731a16d8adabbb9a8c9074387f769))
## [0.33.2](https://github.com/ethersphere/bee-dashboard/compare/v0.33.1...v0.33.2) (2025-11-14)
### Bug Fixes
* clarify installation instructions in README ([#707](https://github.com/ethersphere/bee-dashboard/issues/707)) ([82e7c78](https://github.com/ethersphere/bee-dashboard/commit/82e7c78a818b46031b040f92e9a9491003c9bd92))
## [0.33.1](https://github.com/ethersphere/bee-dashboard/compare/v0.33.0...v0.33.1) (2025-11-13)
### Bug Fixes
* put back external wallet balance context ([#704](https://github.com/ethersphere/bee-dashboard/issues/704)) ([096522a](https://github.com/ethersphere/bee-dashboard/commit/096522aa8a2f11afb0061a6fedbae241967408ef))
## [0.33.0](https://github.com/ethersphere/bee-dashboard/compare/v0.32.0...v0.33.0) (2025-11-12)
### Features
* bee-js revamp ([#690](https://github.com/ethersphere/bee-dashboard/issues/690)) ([1249c0d](https://github.com/ethersphere/bee-dashboard/commit/1249c0df71baec331cb3f2661e0a08648d924406))
* FileManager ([#98](https://github.com/ethersphere/bee-dashboard/issues/98)) ([#703](https://github.com/ethersphere/bee-dashboard/issues/703)) ([5bfe2a0](https://github.com/ethersphere/bee-dashboard/commit/5bfe2a033118dde43b4cd221830741a427882922))
## [0.32.0](https://github.com/ethersphere/bee-dashboard/compare/v0.31.0...v0.32.0) (2025-02-12)
### Features
* vod display ([#686](https://github.com/ethersphere/bee-dashboard/issues/686)) ([bcd3d50](https://github.com/ethersphere/bee-dashboard/commit/bcd3d50b4209a4f66a259b8a3f6ea5ffd908471f))
## [0.31.0](https://github.com/ethersphere/bee-dashboard/compare/v0.30.0...v0.31.0) (2025-01-13)
### Features
* remove experimental FDP menu item ([#687](https://github.com/ethersphere/bee-dashboard/issues/687)) ([a6125b3](https://github.com/ethersphere/bee-dashboard/commit/a6125b3d0b0b680a9fa61a8edcd75b2ae6c153e0))
## [0.30.0](https://github.com/ethersphere/bee-dashboard/compare/v0.29.0...v0.30.0) (2024-11-25)
### Features
* add experimental fdp ([#681](https://github.com/ethersphere/bee-dashboard/issues/681)) ([d0c94b7](https://github.com/ethersphere/bee-dashboard/commit/d0c94b7316ea2b139bddc5481132ea7de7cb840d))
* update map data ([#684](https://github.com/ethersphere/bee-dashboard/issues/684)) ([fbb2ed8](https://github.com/ethersphere/bee-dashboard/commit/fbb2ed8a576f3519883e71382b7f4e8505fbe139))
### Bug Fixes
* allow changing api url ([#676](https://github.com/ethersphere/bee-dashboard/issues/676)) ([6294bb0](https://github.com/ethersphere/bee-dashboard/commit/6294bb0a7be6b9b82354c42da8c84e767fad899e))
* explicitly define type 0 transaction ([#674](https://github.com/ethersphere/bee-dashboard/issues/674)) ([63f3380](https://github.com/ethersphere/bee-dashboard/commit/63f338075b919cb70d79665c3d86537f2ac1d2e9))
## [0.29.0](https://github.com/ethersphere/bee-dashboard/compare/v0.28.0...v0.29.0) (2024-07-17)
### Features
* clarify labels and syncing ([#670](https://github.com/ethersphere/bee-dashboard/issues/670)) ([01b1b39](https://github.com/ethersphere/bee-dashboard/commit/01b1b39c42cc5b68a0132c3696c3c42a27ea2ee4))
* polish app ([#669](https://github.com/ethersphere/bee-dashboard/issues/669)) ([8558860](https://github.com/ethersphere/bee-dashboard/commit/8558860f0a3baa82c31c091a44c78bb8e97de70d))
### Bug Fixes
* clarify withdraw and deposit message ([#654](https://github.com/ethersphere/bee-dashboard/issues/654)) ([b4ebfc7](https://github.com/ethersphere/bee-dashboard/commit/b4ebfc7c3fd449807db47fa25763df464cc45618))
## [0.28.0](https://github.com/ethersphere/bee-dashboard/compare/v0.27.0...v0.28.0) (2024-06-18)
### Features
* upgrade bee-js to 7.0.3 ([#666](https://github.com/ethersphere/bee-dashboard/issues/666)) ([e9ebe33](https://github.com/ethersphere/bee-dashboard/commit/e9ebe33d51aa525921eacfad683577605e591531))
## [0.27.0](https://github.com/ethersphere/bee-dashboard/compare/v0.26.2...v0.27.0) (2024-06-11)
### Features
* add redeem shortcut to sidebar ([999399f](https://github.com/ethersphere/bee-dashboard/commit/999399fb08c1a47a671ba0ad50409624654a1082))
## [0.26.2](https://github.com/ethersphere/bee-dashboard/compare/v0.26.1...v0.26.2) (2024-06-05)
### Bug Fixes
* merge version and health check ([#662](https://github.com/ethersphere/bee-dashboard/issues/662)) ([cae90c1](https://github.com/ethersphere/bee-dashboard/commit/cae90c1a82e16ee8c7908c43e2fd17f7130eb89d))
## [0.26.1](https://github.com/ethersphere/bee-dashboard/compare/v0.26.0...v0.26.1) (2024-06-03)
### Bug Fixes
* add bee version ([#659](https://github.com/ethersphere/bee-dashboard/issues/659)) ([a5d4ecf](https://github.com/ethersphere/bee-dashboard/commit/a5d4ecf045f691b9059fcca925d0f30675d12db0))
## [0.26.0](https://github.com/ethersphere/bee-dashboard/compare/v0.25.0...v0.26.0) (2024-06-03)
### Features
* display effective capacity ([#643](https://github.com/ethersphere/bee-dashboard/issues/643)) ([5871223](https://github.com/ethersphere/bee-dashboard/commit/58712232031e084195adf92c40cd41a98eaf16cf))
* merge api ([#658](https://github.com/ethersphere/bee-dashboard/issues/658)) ([8cbd812](https://github.com/ethersphere/bee-dashboard/commit/8cbd812a2c04706f8f46de5355209b96783723b9))
* show syncing info ([#647](https://github.com/ethersphere/bee-dashboard/issues/647)) ([cc91f1d](https://github.com/ethersphere/bee-dashboard/commit/cc91f1d64cd48a845fa9fa45ec4b58335eab3893))
* wait for upload sync ([#649](https://github.com/ethersphere/bee-dashboard/issues/649)) ([79bb315](https://github.com/ethersphere/bee-dashboard/commit/79bb31540196b74f3bc0220b8c844fbd5aaaf488))
### Bug Fixes
* correct the bee version detection ([#645](https://github.com/ethersphere/bee-dashboard/issues/645)) ([b3f521c](https://github.com/ethersphere/bee-dashboard/commit/b3f521ca2055b91d7adddf96563cca6bf92e3d59))
## [0.25.0](https://github.com/ethersphere/bee-dashboard/compare/v0.24.1...v0.25.0) (2023-12-04)
### Features
* improve topup and dilute ux ([0c2ac0c](https://github.com/ethersphere/bee-dashboard/commit/0c2ac0c454ad02200a2762958c5bc5abbdfe8005))
* update postage stamp creation screen ([#641](https://github.com/ethersphere/bee-dashboard/issues/641)) ([4f9abc6](https://github.com/ethersphere/bee-dashboard/commit/4f9abc614eedd5ce3a279a4686cc832c4d1e62c7))
### Bug Fixes
* add missing stamp labels and fix inputs ([#634](https://github.com/ethersphere/bee-dashboard/issues/634)) ([7fa1cb0](https://github.com/ethersphere/bee-dashboard/commit/7fa1cb0ccf9f2a32263e84aa76732ebd2fc7fb22))
* put stamp input error handling in state ([#640](https://github.com/ethersphere/bee-dashboard/issues/640)) ([20a051b](https://github.com/ethersphere/bee-dashboard/commit/20a051b6589c22397a7305d722a56df0604ff7a4))
## [0.24.1](https://github.com/ethersphere/bee-dashboard/compare/v0.24.0...v0.24.1) (2023-10-18)
### Bug Fixes
* update `swap-endpoint` to `blockchain-rpc-endpoint` ([#628](https://github.com/ethersphere/bee-dashboard/issues/628)) ([bce93ce](https://github.com/ethersphere/bee-dashboard/commit/bce93ce3cdc1ef4b1f50fcf274591ba00726be16))
## [0.24.0](https://github.com/ethersphere/bee-dashboard/compare/v0.23.0...v0.24.0) (2023-08-11)
### Features
* add stamp dilute and topup ([#619](https://github.com/ethersphere/bee-dashboard/issues/619)) ([055a300](https://github.com/ethersphere/bee-dashboard/commit/055a3002b303df45c7010ef4d365e14b979e9084))
## [0.23.0](https://github.com/ethersphere/bee-dashboard/compare/v0.22.0...v0.23.0) (2023-02-21)
### Features
* add staking for full nodes ([#590](https://github.com/ethersphere/bee-dashboard/issues/590)) ([fac72b1](https://github.com/ethersphere/bee-dashboard/commit/fac72b1299353c104231aa038c1bab9df78c1355))
* upgrade bee-js to 5.2.0 ([#611](https://github.com/ethersphere/bee-dashboard/issues/611)) ([e215c61](https://github.com/ethersphere/bee-dashboard/commit/e215c61ea1619fc388fe8b1904d160b04a1a5c0d))
## [0.22.0](https://github.com/ethersphere/bee-dashboard/compare/v0.21.1...v0.22.0) (2023-01-19)
### Features
* add node connecting status ([#603](https://github.com/ethersphere/bee-dashboard/issues/603)) ([90f9f91](https://github.com/ethersphere/bee-dashboard/commit/90f9f91ddbefb47b40c7e567125972b800d81972))
## [0.21.1](https://github.com/ethersphere/bee-dashboard/compare/v0.21.0...v0.21.1) (2022-12-21)
### Bug Fixes
* do not require chequebook funding ([#599](https://github.com/ethersphere/bee-dashboard/issues/599)) ([42b7f08](https://github.com/ethersphere/bee-dashboard/commit/42b7f080b00a94f068d2fad4779d02ddcf58e27d))
## [0.21.0](https://github.com/ethersphere/bee-dashboard/compare/v0.20.2...v0.21.0) (2022-12-01)
### Features
* add prerequisite checks before swap ([#588](https://github.com/ethersphere/bee-dashboard/issues/588)) ([4e564dd](https://github.com/ethersphere/bee-dashboard/commit/4e564dd5c08b938c95f07818bc60957a7df4f5bb))
* add starting state to sidebar indicator ([#587](https://github.com/ethersphere/bee-dashboard/issues/587)) ([848e61a](https://github.com/ethersphere/bee-dashboard/commit/848e61a7a0fc9b31cae4f603473b37d467f9e914))
### Bug Fixes
* add loading state to info page ([#584](https://github.com/ethersphere/bee-dashboard/issues/584)) ([0246904](https://github.com/ethersphere/bee-dashboard/commit/02469046b05512d6617d8b21ca93b41d6a8a6827))
* always consider user input when performing swap ([#572](https://github.com/ethersphere/bee-dashboard/issues/572)) ([ec8fdf0](https://github.com/ethersphere/bee-dashboard/commit/ec8fdf0315ed7ee75c7612780c602cba49a2321d))
* always set rpc to newly provided value in desktop ([#591](https://github.com/ethersphere/bee-dashboard/issues/591)) ([b798fa0](https://github.com/ethersphere/bee-dashboard/commit/b798fa0e68b367fe324ef64507b1405b642da6e0))
* change status page depending on desktop mode ([#573](https://github.com/ethersphere/bee-dashboard/issues/573)) ([a4b8e7c](https://github.com/ethersphere/bee-dashboard/commit/a4b8e7ca2596028e7c8192c92202c0361610e307))
* change version mismatch to a warning ([#594](https://github.com/ethersphere/bee-dashboard/issues/594)) ([dc04e26](https://github.com/ethersphere/bee-dashboard/commit/dc04e26db4fe6beb9e76fad79c732794b0b7f77d))
* fix conditional rendering for blockchain network ([#583](https://github.com/ethersphere/bee-dashboard/issues/583)) ([1ce4a47](https://github.com/ethersphere/bee-dashboard/commit/1ce4a474954a5ba4debee53b40bb66a46fb19ffc))
* handle auth and server error during swap ([#593](https://github.com/ethersphere/bee-dashboard/issues/593)) ([665ae06](https://github.com/ethersphere/bee-dashboard/commit/665ae063fa49bc94762ea10a9098b57e95327d9c))
* hide swap in standalone mode ([#582](https://github.com/ethersphere/bee-dashboard/issues/582)) ([9a8520e](https://github.com/ethersphere/bee-dashboard/commit/9a8520eb6fe9f40a77c4230ab79d3731ebdd4b42))
* refresh after chequebook withdraw deposit ([#576](https://github.com/ethersphere/bee-dashboard/issues/576)) ([6936098](https://github.com/ethersphere/bee-dashboard/commit/693609810d735d1e54691b13ea0e4db33e678a53))
## [0.20.2](https://github.com/ethersphere/bee-dashboard/compare/v0.20.1...v0.20.2) (2022-09-15)
### Bug Fixes
* stamp purchasing ([#551](https://github.com/ethersphere/bee-dashboard/issues/551)) ([c0456a3](https://github.com/ethersphere/bee-dashboard/commit/c0456a3bf6d541457b706670b1a757d2b1d70f10))
## [0.20.1](https://github.com/ethersphere/bee-dashboard/compare/v0.20.0...v0.20.1) (2022-09-15)
### Bug Fixes
* revert bee env. variable names and add default rpc var ([#545](https://github.com/ethersphere/bee-dashboard/issues/545)) ([5295bd5](https://github.com/ethersphere/bee-dashboard/commit/5295bd5b012962846aa15ff12ca4234f0c8b37f7))
* rpc endpoint setting ultra-light mode logic ([#547](https://github.com/ethersphere/bee-dashboard/issues/547)) ([e2dd077](https://github.com/ethersphere/bee-dashboard/commit/e2dd077118faf3b6071fc8327e37e317e0174975))
## [0.20.0](https://github.com/ethersphere/bee-dashboard/compare/v0.19.3...v0.20.0) (2022-09-14)
### Features
* error reporting callback ([#530](https://github.com/ethersphere/bee-dashboard/issues/530)) ([0c74dae](https://github.com/ethersphere/bee-dashboard/commit/0c74dae4e88916cf54c3c0500b37203b865e48a7))
### Bug Fixes
* show update notifications only on non-auto-updating Swarm Desktops ([#543](https://github.com/ethersphere/bee-dashboard/issues/543)) ([528a810](https://github.com/ethersphere/bee-dashboard/commit/528a8106907ef176bcdb68b3386c2f3f9ea98a47))
## [0.19.3](https://github.com/ethersphere/bee-dashboard/compare/v0.19.2...v0.19.3) (2022-08-24)
### Bug Fixes
* pass isBeeDesktop from provider to hook ([#525](https://github.com/ethersphere/bee-dashboard/issues/525)) ([677b6de](https://github.com/ethersphere/bee-dashboard/commit/677b6de0f82b02e1487420e3c08fbd19a949f97b))
## [0.19.2](https://github.com/ethersphere/bee-dashboard/compare/v0.19.1...v0.19.2) (2022-08-08)
### Bug Fixes
* remove sentry ([#520](https://github.com/ethersphere/bee-dashboard/issues/520)) ([0260df6](https://github.com/ethersphere/bee-dashboard/commit/0260df61de0619202a819b79820cfbef6e3757ae))
## [0.19.1](https://github.com/ethersphere/bee-dashboard/compare/v0.19.0...v0.19.1) (2022-08-03)
### Bug Fixes
* compile types when building the library ([#516](https://github.com/ethersphere/bee-dashboard/issues/516)) ([df925b0](https://github.com/ethersphere/bee-dashboard/commit/df925b013bb02a16d308a86050ec8e0e0e361ff7))
## [0.19.0](https://github.com/ethersphere/bee-dashboard/compare/v0.18.2...v0.19.0) (2022-08-03)
### Features
* add loading state to wallet balance ([#508](https://github.com/ethersphere/bee-dashboard/issues/508)) ([b9c008f](https://github.com/ethersphere/bee-dashboard/commit/b9c008f019f5bfe005d11f0208e90ca21b274e97))
* add wallet endpoint and display blockchain name ([#492](https://github.com/ethersphere/bee-dashboard/issues/492)) ([fd11f01](https://github.com/ethersphere/bee-dashboard/commit/fd11f0166d77a89a2b350f16f9254af91441089d))
* check whether the app runs within bee-desktop is now an environment variable ([#490](https://github.com/ethersphere/bee-dashboard/issues/490)) ([f01477e](https://github.com/ethersphere/bee-dashboard/commit/f01477ea70e6c343461cce6c1bcee3d738c076de))
* don't display duplicate notifications with snackbar ([#488](https://github.com/ethersphere/bee-dashboard/issues/488)) ([feeca00](https://github.com/ethersphere/bee-dashboard/commit/feeca008acd523f16e7efdde2fa92ec98fde8bc9))
* log errors to console when showing error notification ([#489](https://github.com/ethersphere/bee-dashboard/issues/489)) ([6bfe97b](https://github.com/ethersphere/bee-dashboard/commit/6bfe97be5d69adeb13dafad2016d1c76a9d2e67c))
* make blockchain JSON RPC configurable from settings ([#494](https://github.com/ethersphere/bee-dashboard/issues/494)) ([408b565](https://github.com/ethersphere/bee-dashboard/commit/408b565935a59759af6d3e252ceae6981fb60eb6))
* pass isBeeDesktop as Bee Dashboard component property ([#510](https://github.com/ethersphere/bee-dashboard/issues/510)) ([4c48657](https://github.com/ethersphere/bee-dashboard/commit/4c48657fca0c22d5d4aaf220ffb278ac67001e1f))
* reintroduce new bee version notification ([#500](https://github.com/ethersphere/bee-dashboard/issues/500)) ([f53e966](https://github.com/ethersphere/bee-dashboard/commit/f53e9664da8f4d1b6803de09f45a92493957d79d))
* set default rpc endpoint ([#485](https://github.com/ethersphere/bee-dashboard/issues/485)) ([cba21bb](https://github.com/ethersphere/bee-dashboard/commit/cba21bb2e0e70e0ada01402d44e9ee61a55173cf))
### Bug Fixes
* correct website upload path ([#483](https://github.com/ethersphere/bee-dashboard/issues/483)) ([186d035](https://github.com/ethersphere/bee-dashboard/commit/186d0352cfda0408cf7add535d9247a85ce3796d))
* disable swarm invitation outside of Swarm Desktop ([#497](https://github.com/ethersphere/bee-dashboard/issues/497)) ([f8390d7](https://github.com/ethersphere/bee-dashboard/commit/f8390d7eacc082a7b0a4551a3bc1572e3ce3463e))
* handle unicode filename and website uploads ([#491](https://github.com/ethersphere/bee-dashboard/issues/491)) ([f82444f](https://github.com/ethersphere/bee-dashboard/commit/f82444f2124cad8bccead01a33cbc9f51d126acf))
* if the node has error, disable pages that can never load ([#502](https://github.com/ethersphere/bee-dashboard/issues/502)) ([896f6e4](https://github.com/ethersphere/bee-dashboard/commit/896f6e48d988bbc0fe82a63a44bc82b035f30073))
* new bee version notification is only shown if user bee version is detected ([#512](https://github.com/ethersphere/bee-dashboard/issues/512)) ([1be5cbd](https://github.com/ethersphere/bee-dashboard/commit/1be5cbda6de073f1e569ab92f178d815548a461b))
## [0.18.2](https://github.com/ethersphere/bee-dashboard/compare/v0.18.1...v0.18.2) (2022-07-06)
### Bug Fixes
* don't link to latest release ([#477](https://github.com/ethersphere/bee-dashboard/issues/477)) ([498294e](https://github.com/ethersphere/bee-dashboard/commit/498294e227baa52c59adecf9c4cfd205061ddf75))
* enable desktop update notifications on all platforms ([#476](https://github.com/ethersphere/bee-dashboard/issues/476)) ([33fff93](https://github.com/ethersphere/bee-dashboard/commit/33fff93cac31ec54b02f9c7d0c90c13c8d3763c7))
## [0.18.1](https://github.com/ethersphere/bee-dashboard/compare/v0.18.0...v0.18.1) (2022-07-05)
+1 -1
View File
@@ -1 +1 @@
* @Cafe137 @vojtechsimetka
* @Cafe137
+7 -5
View File
@@ -1,11 +1,13 @@
FROM node:15.14-alpine AS build
FROM node:24-alpine AS build
WORKDIR /src
RUN corepack enable && corepack prepare pnpm@10 --activate
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --ignore-scripts
COPY . .
RUN npm ci
RUN npm run build
RUN pnpm run prepare
FROM node:15.14-alpine AS final
RUN npm i -g serve
FROM node:24-alpine AS final
RUN npm install -g serve
WORKDIR /app
COPY --from=build /src/build .
EXPOSE 8080
+61 -23
View File
@@ -4,7 +4,7 @@
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fethersphere%2Fbee-dashboard.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fethersphere%2Fbee-dashboard?ref=badge_shield)
![](https://img.shields.io/badge/npm-%3E%3D6.9.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/pnpm-%3E%3D10.0.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/Node.js-%3E%3D14.0.0-orange.svg?style=flat-square)
> An app which helps users to setup their Bee node and do actions like cash out cheques, upload and download files or
@@ -13,16 +13,14 @@
**Warning: This project is in alpha state. There might (and most probably will) be changes in the future to its API and
working. Also, no guarantees can be made about its stability, efficiency, and security at this stage.**
This project is intended to be used with **Bee version <!-- SUPPORTED_BEE_START -->1.6.0-6ceadd35<!-- SUPPORTED_BEE_END -->**.
Using it with older or newer Bee versions is not recommended and may not work. 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).
![Status page](/ui_samples/info.png)
![Status page](/docs/ui_samples/info.png)
| Node Setup | Upload Files | Download Content | Accounting | Postage Stamps |
| ------------------------------------ | -------------------------------------- | ------------------------------------------ | ----------------------------------------- | ---------------------------------------- |
| ![Setup](/ui_samples/node_setup.png) | ![Upload](/ui_samples/file_upload.png) | ![Download](/ui_samples/file_download.png) | ![Accounting](/ui_samples/accounting.png) | ![Peers](/ui_samples/postage_stamps.png) |
| Node Setup | Upload Files | Download Content | Accounting | Settings | File Manager |
| ----------------------------------------- | ------------------------------------------- | ----------------------------------------------- | ---------------------------------------------- | ------------------------------------------ | -------------------------------------------------- |
| ![Setup](/docs/ui_samples/node_setup.png) | ![Upload](/docs/ui_samples/file_upload.png) | ![Download](/docs/ui_samples/file_download.png) | ![Accounting](/docs/ui_samples/accounting.png) | ![Settings](/docs/ui_samples/settings.png) | ![File Manager](/docs/ui_samples/file_manager.png) |
## Table of Contents
@@ -32,22 +30,25 @@ Using it with older or newer Bee versions is not recommended and may not work. S
- [Docker](#docker)
- [Contribute](#contribute)
- [Development](#development)
- [File Manager](#file-manager)
- [Maintainers](#maintainers)
- [License](#license)
## 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
npm install -g @ethersphere/bee-dashboard
pnpm add -g @ethersphere/bee-dashboard
```
For the latest stable version, always use the official npm registry.
## Usage
:warning: To successfully connect to the Bee node, you will need to enable the Debug API and CORS. You can do so by
setting `cors-allowed-origins: ['*']` and `debug-api-enable: true` in the Bee config file and then restart the Bee node.
To see where the config file is, consult the
:warning: To successfully connect to the Bee node, you will need to enable CORS. You can do so by setting
`cors-allowed-origins: ['*']` in the Bee config file and then restart the Bee node. To see where the config file is,
consult the
[official Bee documentation](https://docs.ethswarm.org/docs/working-with-bee/configuration#configuring-bee-installed-using-a-package-manager)
### Terminal
@@ -78,6 +79,12 @@ docker build . -t 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)
### Development
@@ -87,25 +94,58 @@ git clone git@github.com:ethersphere/bee-dashboard.git
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/)
> Setting the `REACT_APP_DEV_MODE=1` environment variable, or opening Bee Dashboard with the query string `?devMode=1` loosens some checks. This makes it possible to develop Bee Dashboard without having connected peers and chequebook properly set up, effectively supporting the dev mode of Bee itself.
#### Environmental variables
#### Bee Desktop development
The CRA supports to specify "environmental variables" during build time which are then hardcoded into the served static
files. We support following variables:
If you want to develop Bee Dashboard in the Bee Desktop mode, then spin up `bee-desktop` to the point where you see Bee Dashboard (eq. install Bee etc.) and:
- `VITE_BEE_DESKTOP_ENABLED` (`boolean`) that toggles if the Dashboard is in Desktop mode or not.
- `VITE_BEE_DESKTOP_URL` (`string`) defines custom URL where the Desktop API is expected. By default, it is same origin
under which the Dashboard is served.
- `VITE_BEE_HOST` (`string`) defines custom Bee API URL to be used as default one. By default, the
`http://localhost:1633` is used.
- `VITE_DEFAULT_RPC_URL` (`string`) defines the default RPC provider URL. Be aware, that his only configures the default
value. The user can override this in Settings, which is then persisted in local store and has priority over the value
set in this env. variable. By default `https://xdai.fairdatasociety.org` is used.
- `VITE_FORMBRICKS_ENV_ID` and `VITE_FORMBRICKS_APP_URL` (`string`) configures the [Formbricks](https://formbricks.com/)
integration for user feedback collection. If these variables are not set, the feedback form is not available in the
app.
#### Swarm Desktop development
If you want to develop Bee Dashboard in the Swarm Desktop mode, then spin up `swarm-desktop` to the point where Desktop
is initialized (eq. the splash screen disappear) and:
```sh
echo "REACT_APP_BEE_DESKTOP_URL=http://localhost:3000" > .env.development.local
npm start
npm run desktop # This will inject the API key to the Dashboard
echo "VITE_BEE_DESKTOP_URL=http://localhost:3054
VITE_BEE_DESKTOP_ENABLED=true" > .env.development.local
pnpm start
pnpm run desktop # This will inject the API key to the Dashboard
```
## File Manager
The File Manager module provides intuitive decentralized file storage and management.
For comprehensive documentation, see the [File Manager Documentation](./docs/FILE_MANAGER.md).
### Features
- Create and manage multiple drives with configurable capacity and lifetime
- Upload, download, and organize files with version control
- Manage postage stamps required for file uploads
- Configure erasure coding levels for data redundancy
## Contribute
There are some ways you can make this module better:
@@ -117,7 +157,6 @@ There are some ways you can make this module better:
## Maintainers
- [vojtechsimetka](https://github.com/vojtechsimetka)
- [Cafe137](https://github.com/Cafe137)
See what "Maintainer" means [here](https://github.com/ethersphere/repo-maintainer).
@@ -126,5 +165,4 @@ See what "Maintainer" means [here](https://github.com/ethersphere/repo-maintaine
[BSD-3-Clause](./LICENSE)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fethersphere%2Fbee-dashboard.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fethersphere%2Fbee-dashboard?ref=badge_large)
+7
View File
@@ -0,0 +1,7 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-max-line-length': [1, 'always', 120],
'header-max-length': [2, 'always', 160],
},
}
-6
View File
@@ -1,6 +0,0 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-max-line-length': [0, 'always', Infinity], // disable commit body length restriction
},
}
+7 -3
View File
@@ -1,14 +1,18 @@
#!/usr/bin/env node
import envPaths from 'env-paths'
import open from 'open'
import open from 'open'
import { readFile } from 'node:fs/promises'
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 apiKey = await readFile(join(paths.data, 'api-key.txt'), {encoding: 'utf-8'})
const url = `http://localhost:3001/?v=${apiKey}#/`
const apiKey = await readFile(join(paths.data, 'api-key.txt'), { encoding: 'utf-8' })
const url = `http://localhost:${desktopPort}/?v=${apiKey}#/`
// eslint-disable-next-line no-undef
console.log('Opening: ' + url)
await open(url)
+7
View File
@@ -0,0 +1,7 @@
services:
bee-dashboard:
build: .
image: ethersphere/bee-dashboard:latest
ports:
- '127.0.0.1:8080:8080'
restart: unless-stopped
+605
View File
@@ -0,0 +1,605 @@
# File Manager Module Documentation
## Introduction
The File Manager module is a decentralized file storage interface built on top of Ethereum Swarm. It provides a complete file management system that leverages Swarm's postage stamp mechanism for incentivized storage and retrieval.
### Table of Contents
- [Introduction](#introduction)
- [Key Concepts](#key-concepts)
- [Architecture Overview](#architecture-overview)
- [Module Structure](#module-structure)
- [Getting Started](#getting-started)
- [State Management](#state-management)
- [Core Features](#core-features)
- [Operation Flows](#operation-flows)
- [Component Architecture](#component-architecture)
- [Design Patterns](#design-patterns)
- [Troubleshooting](#troubleshooting)
- [Testing Approach](#testing-approach)
- [Performance Considerations](#performance-considerations)
- [Known Limitations](#known-limitations)
- [Future Enhancements](#future-enhancements)
### What is File Manager?
File Manager allows users to:
- Create and manage multiple isolated storage containers (drives)
- Upload, download, and organize files with folder support
- Configure security levels (redundancy levels) using erasure coding
- Purchase and manage postage stamp batches to pay for storage
- Track file versions and restore previous states
- Handle file conflicts and perform bulk operations
### Core Philosophy
File Manager is built around several key principles:
1. **Decentralization**: All file metadata and content are stored on Swarm, not centralized servers
2. **User Control**: Users own their private keys and control their data
3. **Stamp-Based Storage**: All operations require valid postage stamps (blockchain-backed storage payment)
4. **Complexity Management**: Components follow strict complexity limits (max 20) with extraction patterns
5. **State Consistency**: Real-time synchronization between UI and Swarm storage
---
## Key Concepts
### Drives
**Drives** are isolated storage containers that hold files and folders. Each drive:
- Has a unique ID derived from its creation topic on Swarm
- Is associated with a specific postage batch
- Has configurable initial capacity and desired lifetime (inherited from batch)
- Can be either an **admin drive** (manages system state) or **user drive** (stores user files)
- Maintains its own file list and metadata
**Admin Drive** is a special drive that:
- Is created once per File Manager instance
- Stores the list of all user drives
- Must be initialized before any other operations
- Uses a stamp labeled `ADMIN_STAMP_LABEL`
- Cannot be deleted (only reset)
**User Drives** are regular drives that:
- Store user files and folders
- Can be created, upgraded, or destroyed
- Appear in the sidebar for navigation
- Move to "Expired Drives" when their postage batch expires
### Postage Stamps
**Postage Stamps** (or batches) are blockchain-based payment mechanisms for Swarm storage:
- Purchased with BZZ tokens (Swarm's native token)
- Have a **batchID** (unique identifier)
- Define **initial capacity** (storage space) and **desired lifetime** (time-to-live)
- Must be **usable** (not expired, not diluted beyond capacity)
- Can have optional labels for identification
**Postage Batch Validation** is critical:
- Before creating drives
- Before uploading files
- During admin drive initialization
- Invalid or unusable batches cause operations to fail
### File Info
**FileInfo** objects represent files in File Manager:
- Stored as metadata on Swarm (not in local storage)
- Contains: name, size, mime type, timestamps, drive association
- Has a **topic** (unique identifier derived from path and parent)
- Can be **trashed** (soft delete) or **forgotten** (hard delete)
- Supports versioning via **history** (Swarm feed entries)
### Erasure Coding
**Erasure coding** provides data redundancy:
- **OFF**: No redundancy (1x storage)
- **MEDIUM**: Moderate redundancy (~2x storage)
- **STRONG**: High redundancy (~3x storage)
- **INSANE**: Very high redundancy (~4x storage)
- **PARANOID**: Maximum redundancy (~5x storage)
Higher levels cost more but protect against data loss if Swarm nodes go offline.
---
## Architecture Overview
### High-Level Flow
The File Manager follows a layered architecture:
1. **User Action** - User interacts with UI components
2. **Component Layer** - FileBrowser, DriveItem, Modals handle UI logic
3. **Context Layer** - FileManagerProvider, ViewProvider, SearchProvider manage state
4. **Library Layer** - FileManagerBase from @solarpunkltd/file-manager-lib handles business logic
5. **API Layer** - Bee API from @ethersphere/bee-js communicates with Swarm
6. **Network Layer** - Swarm network stores data
### State Management
File Manager uses **React Context** for state management with three separate contexts:
1. **FileManagerProvider** - Core FM state: drives, files, admin drive, current drive. Manages FM instance lifecycle and event listeners.
2. **ViewProvider** - UI view preferences (grid/list) and current item being viewed (drive name or search results).
3. **SearchProvider** - Search query and scope (all drives, selected drive), filter options (include active, include trashed).
This separation ensures that updates in one context don't unnecessarily trigger re-renders in components that only depend on other contexts.
### Component Hierarchy
The component structure follows a strict hierarchy:
- **FileManagerPage** - Orchestrates initialization flow
- **Providers** - Wrap entire tree (FileManager → View → Search)
- **Header** - Top navigation
- **AdminStatusBar** - Admin stamp status display
- **Sidebar** - Drive list with create/destroy actions
- **FileBrowser** - Main file browser with operations
- **Modals** - Various modals for different operations
---
## Module Structure
### Directory Organization
The File Manager module is organized into logical sections:
**Components Directory** - All React UI components, each in its own folder with associated styles and tests. Major components include FileBrowser (main interface), Sidebar (drive navigation), various modals for operations, and reusable elements like buttons and dropdowns.
**Hooks Directory** - Custom React hooks for specific functionality. Key hooks include useTransfers (upload/download management), useFileFiltering (search and filtering), useBulkActions (bulk operations), and useSorting (column sorting).
**Utils Directory** - Pure utility functions. Includes Bee API wrappers for stamp validation and drive operations, common helpers for formatting, download logic, and UI utilities.
**Constants Directory** - Configuration constants for erasure code levels, postage batch desired lifetimes, tooltips, and transfer statuses.
---
## Getting Started
### Prerequisites
1. **Bee Node**: Running Bee node (dev mode or mainnet). Can be local or remote connection via Settings.
2. **Wallet Balance**: BZZ tokens to purchase postage batches, and xDAI for gas fees on blockchain transactions.
3. **CORS Configuration**: Bee node must allow CORS from the dashboard origin.
### Initial Setup Flow
**First Launch - Private Key Generation**
When a user first visits File Manager, they must provide or generate a private key. This key is stored in browser local storage and is critical - loss of the key means permanent data loss with no recovery option.
**One-Time Admin Drive Creation**
After the private key is set, the system checks for an admin drive. If none exists, the InitialModal appears automatically. The user selects initial capacity and desired lifetime, then purchases a postage batch with BZZ tokens. The system creates the admin drive which stores all user drive metadata.
**Creating User Drives**
Once the admin drive exists, users can create user drives from the sidebar. They enter a drive name (max 40 characters), select initial capacity, desired lifetime, and security level (erasure coding). The system displays the BZZ cost and creates the drive upon confirmation.
**Uploading Files**
Users select a drive from the sidebar, then drag-and-drop files or click "Upload File(s)". They choose an active postage batch, and the system monitors progress with ETA calculations. Files are uploaded with automatic conflict resolution if names already exist.
---
## State Management
### FileManager Provider
The FileManager Provider is the core state management solution. It manages:
**Core State**: The FileManagerBase instance, all files across drives, user drives with valid postage batches, expired drives, admin drive, currently selected drive, and currently selected postage batch.
**Error States**: Initialization errors, error modal visibility, and reset requirements when admin postage batch is invalid.
**Synchronization**: Real-time updates through event listeners that respond to drive and file changes from the FileManagerBase library.
### Initialization Sequence
The provider handles a complex initialization:
1. **Private Key Check** - Retrieves key from local storage. If missing, initialization halts until user provides one.
2. **Bee Instance Creation** - Creates Bee client with the private key as signer, then creates FileManagerBase instance.
3. **Event Listener Registration** - Registers handlers for all file manager events (drive created, file uploaded, file trashed, etc.).
4. **Admin Postage Batch Validation** - If admin postage batch exists, validates it's still usable. Invalid batches trigger reset flow.
5. **State Synchronization** - Categorizes drives into admin, user, and expired based on postage batch validity. Populates file list.
### Drive Categorization
The system continuously categorizes drives based on postage batch validity:
**Admin Drive** - Must have valid postage batch. If invalid, entire FM enters reset state.
**User Drives** - Drives with valid, usable postage batches appear in main drive list for normal operations.
**Expired Drives** - Drives whose postage batches expired but data still exists on Swarm. Appear in collapsed section, cannot be modified but can be viewed.
### State Synchronization Methods
**Sync Files** - Updates the files array when files are uploaded, trashed, restored, or forgotten. Can update entire list or individual files incrementally.
**Sync Drives** - Updates drive arrays (user, expired, admin) when drives are created, upgraded, or destroyed. Fetches current postage batch validity and recategorizes.
**Resync** - Full state refresh that re-initializes FM instance and restores previous selections if still valid. Used after major operations or manual refresh.
**Refresh Postage Batch** - Updates a specific postage batch's information without full resync. Used after uploads to update capacity.
### Event Flow
When a user performs an operation like uploading a file:
1. Component calls FM method
2. FileManagerBase library executes operation
3. Library emits event when complete
4. Provider's event listener catches it
5. Provider updates React state
6. UI automatically re-renders with new data
This event-driven architecture keeps UI and Swarm state perfectly synchronized.
---
## Core Features
### Upload Management
The upload system handles complex scenarios:
**Conflict Detection** - Before upload, checks if file name already exists in target drive. Offers three resolution options: Cancel (skip file), Keep Both (rename with suffix like "file (1).txt"), or Replace (overwrite with new version).
**Queue Processing** - Uploads are queued and processed with maximum 10 concurrent uploads. This prevents overwhelming the network while maintaining good throughput.
**Progress Tracking** - Each upload shows percentage complete, data transferred, elapsed time, and ETA. ETA uses smoothing algorithm to prevent wild fluctuations from network speed variations.
**Postage Batch Validation** - Before each upload, validates the selected postage batch is still usable. Verifies sufficient capacity remains for the file size considering erasure coding overhead.
**Cancellation** - Users can cancel in-progress uploads. The system uses abort controllers to cleanly terminate HTTP requests and update transfer status.
### Download Management
Downloads execute in the background using browser's native download API:
**Progress Tracking** - Similar to uploads, shows percentage, speed, and ETA for each download.
**Bulk Downloads** - Users can select multiple files and download all at once. Each download tracks independently.
**Background Execution** - Downloads continue even if user navigates away from File Manager (within same browser tab).
### File Filtering
The filtering system supports multiple criteria:
**Search Query** - Case-insensitive substring matching on file names.
**Drive Scope** - Filter to selected drive only, or search across all drives.
**Trash Status** - Include active files only, trashed files only, or both.
**State Preservation** - When entering search mode, current filter settings are saved. Clearing search restores previous settings automatically.
### Sorting
Users can sort file lists by multiple columns:
**Sort Keys** - Name (alphabetical), Size (bytes), Timestamp (upload date), Drive (name, when searching all drives).
**Sort Direction** - Ascending or descending. Clicking same column header toggles direction.
**Sort Reset** - Clear sorting returns to natural order (order from Swarm).
### Bulk Operations
Select multiple files and perform batch actions:
**Bulk Trash** - Move multiple files to trash (soft delete). Can be restored later.
**Bulk Restore** - Restore multiple trashed files to active status.
**Bulk Forget** - Permanently delete files (irreversible). Requires confirmation.
**Bulk Download** - Download multiple files simultaneously with individual progress tracking.
### Version History
Files support full version history:
**Version Tracking** - Each file upload creates new version, previous versions retained.
**View History** - Modal shows all versions with timestamps and sizes.
**Restore Version** - Roll back to any previous version, which becomes the new current version.
**Storage Impact** - Each version consumes postage batch capacity, old versions can be forgotten but space continues to be occupied.
### Drag and Drop
Full drag-and-drop support for file uploads:
**Visual Feedback** - Overlay appears when dragging files over browser area.
**Drag Counter** - Tracks nested drag events to prevent flickering on complex layouts.
**Drop Handling** - Processes dropped files through same upload pipeline as manual selection.
---
## Operation Flows
### Initial Setup
**User Opens /file-manager**
- System checks for private key in local storage
- If no key: Shows PrivateKeyModal for user to enter or generate key
- If has key: Initializes FileManager
**FileManager Initialization**
- Creates Bee instance with user's private key
- Creates FileManagerBase instance
- Registers event listeners for all FM events
- Reads admin state from Swarm
**Admin Drive Validation**
- If admin postage batch exists and valid: Loads drives and files, shows FileBrowser
- If admin postage batch exists but invalid: Sets reset flag, shows InitialModal in reset mode
- If no admin postage batch (first time): Shows InitialModal for first-time setup
**Creating Admin Drive**
- User selects desired lifetime and security level (erasure coding)
- System calculates cost in BZZ tokens
- User confirms and purchases postage batch (blockchain transaction)
- System creates admin drive with purchased postage batch
- Success: Shows Sidebar and FileBrowser
### Creating User Drive
**User Initiates Creation**
- Clicks "Create New Drive" button in Sidebar
- CreateDriveModal appears
**Drive Configuration**
- User enters drive name (validated: max 40 chars)
- Selects initial capacity from dropdown
- Selects desired lifetime from dropdown
- Chooses security level (erasure coding: OFF, MEDIUM, STRONG, INSANE, PARANOID)
**Cost Calculation**
- System fetches current BZZ cost based on capacity, desired lifetime, and redundancy level
- Displays total cost to user
- Validates user has sufficient BZZ balance
- If insufficient: Shows error, disables Create button
- If sufficient: Enables Create button
**Drive Creation**
- User clicks Create
- System shows creation progress indicator
- Purchases new postage batch (blockchain transaction, waits for confirmation)
- Creates drive metadata on Swarm
- FM emits DRIVE_CREATED event
- Provider categorizes drive (has usable postage batch)
- Drive appears in Sidebar
- Success: User can now select and use the drive
### Uploading Files
**File Selection**
- User drags files onto browser OR clicks "Upload file(s)" button
- System receives file list
**Conflict Resolution (per file)**
- Checks if file.name already exists in current drive
- If no conflict: Proceeds with original name
- If conflict: Shows UploadConflictModal with options:
- Cancel: Skip this file
- Keep Both: Rename to unique name (e.g., "file (1).txt")
- Replace: Overwrite existing file, creating new version
**Queue Processing**
- All files added to upload queue with resolved names
- Queue processes maximum 10 files concurrently
- For each file in batch:
- Validates postage batch still exists and is usable
- Verifies sufficient drive space remains
- Creates transfer tracking item (shows in UI)
- Executes upload with progress callbacks to Swarm
- Updates progress (percentage, ETA, elapsed time)
- On completion: Marks transfer Done, refreshes postage batch capacity
- On error: Marks transfer Error, shows error message
- Next batch starts when previous completes
**Event Synchronization**
- FM library emits FILE_UPLOADED event
- Provider's sync method adds/updates file in state
- UI automatically updates to show new file
### Destroying Drive
**User Initiates Destruction**
- Clicks menu button on Drive Item in Sidebar
- Selects "Destroy Drive" from context menu
- DestroyDriveModal appears with confirmation prompt
**Confirmation**
- User reads warning about permanent deletion
- User clicks "Destroy" button
**Destruction Process**
- Modal closes
- Progress overlay appears (spinner with "Destroying drive..." text)
- Overlay is clickable to expand to full progress modal
- System executes drive destruction:
- Deletes drive metadata from Swarm
- FM emits DRIVE_DESTROYED event
- Provider removes drive from drives array
- Provider removes all files belonging to destroyed drive
- Progress overlay disappears
- Drive no longer appears in Sidebar
- If drive was selected: View switches to another drive or empty state
### Downloading Files
**User Initiates Download**
- User right-clicks file
- Selects "Download" from menu
**Download Tracking**
- System creates download transfer item in UI
- Transfer item shows: file name, size, progress percentage
- Download panel appears at bottom of screen
**Download Execution**
- System retrieves file from Swarm using file's topic
- Uses browser's native download API to save file
- Progress callbacks update UI in real-time:
- Bytes downloaded / total bytes (from Swarm chunks)
- Download speed
- Estimated time remaining (ETA with smoothing)
- Elapsed time
**Background Processing**
- Downloads execute in background
- User can continue browsing File Manager
- Multiple downloads can run simultaneously
- Each download tracks independently
**Completion**
- On success: Browser saves file to user's downloads folder
- Transfer item marked as "Done"
- User can dismiss completed downloads
- On error: Shows error message, allows retry
**Cancellation**
- User clicks cancel button on transfer item
- System aborts HTTP request using AbortController
- Transfer item marked as "Cancelled"
- Partial download discarded
### Search Operation
**Entering Search**
- User types in search box
- SearchContext captures query
- System saves current scope and filter settings
- Sets inSearch flag to true
**Filtering Execution**
- useFileFiltering hook processes files array:
- Filters by trash status (active/trashed based on checkboxes)
- Filters by drive scope (selected drive vs all drives)
- Filters by search query (case-insensitive substring match on name)
- Returns filtered array
**Sorting Application**
- useSorting hook processes filtered array
- Applies current sort key and direction
- Returns sorted array
**Display**
- FileBrowserContent renders sorted list
- If searching all drives: Shows drive name column
- If no results: Shows "No files found" message
**Exiting Search**
- User clears search box (empty query)
- System restores saved scope and filter settings
- Sets inSearch flag to false
- View returns to previous state
---
## Component Architecture
### Hierarchical Structure
File Manager follows strict component hierarchy to manage complexity:
**Page Level** - FileManagerPage orchestrates the entire module, handling initialization states and conditional rendering.
**Provider Level** - Three nested contexts (FileManager → View → Search) wrap the component tree, each managing separate concerns.
**Layout Level** - Header, AdminStatusBar, Sidebar, and FileBrowser form the main layout structure.
**Feature Level** - Major features like FileBrowser contain sub-components for specific areas (TopBar, Header, Content, Modals, Overlays).
**Primitive Level** - Reusable elements like buttons, dropdowns, tooltips, progress bars used throughout.
### Component Responsibilities
Each component has a single, clear responsibility:
**FileManagerPage** - Orchestrates initialization flow and conditional rendering based on FM state.
**Sidebar** - Displays drive list, handles navigation, shows drive creation button.
**DriveItem** - Renders individual drive with capacity info, context menu, progress indicators.
**FileBrowser** - Main file browser interface, coordinates all file operations.
**FileBrowserModals** - Renders all modals (extracted for complexity management).
**FileBrowserOverlays** - Renders progress overlays (extracted for complexity management).
---
## Known Limitations
### Admin Drive Expiration
**Status**: Not fully handled (TODO in code).
**Current Behavior**: When admin drive postage batch expires, entire FM enters invalid state. User must reset and create new admin drive. Previous user drives remain accessible if their postage batches are valid.
**Desired Behavior**: System detects admin postage batch expiration before it happens, shows warning with "Extend Batch" button, seamlessly extends admin postage batch without requiring reset.
### Drive Name Length
**Limitation**: Drive names limited to 40 characters maximum.
**Reason**: Swarm feed entry size constraints limit metadata size.
**Workaround**: Use shorter, descriptive names. Consider abbreviations or codes for long project names.
### Postage Batch Selection in CreateDriveModal
**Status**: TODO comment in code.
**Current Behavior**: CreateDriveModal always purchases new postage batch for each drive.
**Desired Behavior**: Dropdown to select from existing usable postage batches (like InitialModal has), allowing users to reuse batches with remaining capacity.
**Impact**: Users must purchase separate postage batch for each drive, even if existing batches have sufficient capacity for multiple drives.
### Postage Batch Capacity Calculation
**Issue**: Capacity calculation depends on erasure coding level.
**Problem**: Frontend calculates approximate capacity based on redundancy multiplier. Actual capacity depends on how Bee node distributes chunks across Swarm network.
**Current**: Approximate calculation usually close enough for practical use.
**Ideal**: Bee node provides exact remaining capacity calculation accounting for actual chunk distribution and erasure coding overhead.
### Ultra-Light Nodes
**Limitation**: Ultra-light Bee nodes cannot create drives or purchase postage batches.
**Requirement**: Users must upgrade to light node to use File Manager.
**Error Message**: Displayed in InitialModal and CreateDriveModal when ultra-light node detected.
**Documentation**: https://docs.ethswarm.org/docs/desktop/configuration/#upgrading-from-an-ultra-light-to-a-light-node
---
*This documentation provides a comprehensive functional overview of the File Manager module. For implementation details, refer to the source code in `src/modules/filemanager/` and `src/providers/FileManager.tsx`.*
Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

+21
View File
@@ -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,
}
+260
View File
@@ -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',
},
},
},
])
+18
View File
@@ -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>
+15
View File
@@ -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'],
}
-35465
View File
File diff suppressed because it is too large Load Diff
+138 -129
View File
@@ -1,7 +1,140 @@
{
"name": "@ethersphere/bee-dashboard",
"version": "0.18.1",
"version": "0.35.1",
"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": [
"bee",
"swarm",
@@ -11,131 +144,6 @@
"typescript",
"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"
},
"dependencies": {
"@ethersphere/bee-js": "^4.1.1",
"@ethersphere/manifest-js": "1.2.1",
"@ethersphere/swarm-cid": "^0.1.0",
"@material-ui/core": "4.12.3",
"@material-ui/icons": "4.11.2",
"@material-ui/lab": "4.0.0-alpha.57",
"@sentry/react": "^7.1.1",
"@sentry/tracing": "^7.1.1",
"assert": "^2.0.0",
"axios": "0.24.0",
"bignumber.js": "9.0.1",
"buffer": "^6.0.3",
"crypto": "npm:crypto-browserify",
"crypto-browserify": "^3.12.0",
"dotted-map": "^2.2.3",
"ethers": "^5.6.4",
"file-saver": "^2.0.5",
"formik": "2.2.9",
"formik-material-ui": "3.0.1",
"jszip": "^3.7.1",
"material-ui-dropzone": "3.5.0",
"notistack": "1.0.10",
"opener": "1.5.2",
"qrcode.react": "1.0.1",
"react": ">= 17.0.2",
"react-copy-to-clipboard": "5.0.4",
"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",
"semver": "7.3.5",
"serve-handler": "6.1.3",
"stream": "npm:stream-browserify",
"stream-browserify": "^3.0.0"
},
"devDependencies": {
"@babel/core": "7.16.0",
"@babel/plugin-proposal-class-properties": "7.16.0",
"@babel/plugin-transform-runtime": "7.16.4",
"@babel/preset-env": "7.16.4",
"@babel/preset-react": "7.16.7",
"@babel/preset-typescript": "7.16.0",
"@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",
"@types/semver": "7.3.9",
"@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",
"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",
"react-scripts": "^5.0.1",
"ts-node": "^10.8.1",
"typescript": "4.7.3",
"web-vitals": "2.1.2",
"webpack": "^5.73.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": "webpack --mode=production",
"compile:types": "tsc --project tsconfig.lib.json --emitDeclarationOnly --declaration",
"test": "react-scripts test",
"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"
},
"files": [
"lib",
"build",
@@ -154,8 +162,9 @@
]
},
"engines": {
"node": ">=12.0.0",
"npm": ">=6.9.0",
"bee": ">=0.6.0"
"node": ">=24.0.0",
"npm": ">=11.0.0",
"pnpm": ">=10.0.0",
"bee": "2.7.0"
}
}
+12137
View File
File diff suppressed because it is too large Load Diff
-42
View File
@@ -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>
+11 -8
View File
@@ -1,12 +1,15 @@
{
"trailingSlash": false,
"headers": [
"rewrites": [{ "source": "**", "destination": "/index.html" }],
"trailingSlash": false,
"headers": [
{
"source": "*",
"headers": [
{
"source" : "*",
"headers" : [{
"key" : "Cache-Control",
"value" : "max-age=3600"
}]
"key": "Cache-Control",
"value": "max-age=3600"
}
]
]
}
]
}
+2
View File
@@ -1,4 +1,6 @@
#!/usr/bin/env node
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-require-imports */
const path = require('path')
const handler = require('serve-handler')
-15
View File
@@ -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
}
+17 -2
View File
@@ -15,8 +15,19 @@
}
.App {
font-family: 'iAWriterQuattroV', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-family:
'iAWriterQuattroV',
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
'Roboto',
'Oxygen',
'Ubuntu',
'Cantarell',
'Fira Sans',
'Droid Sans',
'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@@ -26,3 +37,7 @@ button {
font-family: 'iAWriterMonoV' !important;
color: #dd7700;
}
.MuiContainer-maxWidthLg > .fm {
padding: 0px !important;
}
+49 -46
View File
@@ -1,60 +1,75 @@
import CssBaseline from '@material-ui/core/CssBaseline'
import { ThemeProvider } from '@material-ui/core/styles'
import CssBaseline from '@mui/material/CssBaseline'
import { ThemeProvider } from '@mui/material/styles'
import { SnackbarProvider } from 'notistack'
import React, { ReactElement } from 'react'
import { ReactElement } from 'react'
import { HashRouter as Router } from 'react-router-dom'
import * as Sentry from '@sentry/react'
import './App.css'
import Dashboard from './layout/Dashboard'
import { Provider as BeeProvider } from './providers/Bee'
import { Provider as FeedsProvider } from './providers/Feeds'
import { Provider as FileProvider } from './providers/File'
import { Provider as FileManagerProvider } from './providers/FileManager'
import { Provider as PlatformProvider } from './providers/Platform'
import { Provider as SettingsProvider } from './providers/Settings'
import { Provider as StampsProvider } from './providers/Stamps'
import { Provider as TopUpProvider } from './providers/TopUp'
import { Provider as BalanceProvider } from './providers/WalletBalance'
import BaseRouter from './routes'
import { theme } from './theme'
import { config } from './config'
import ItsBroken from './layout/ItsBroken'
import { initSentry } from './utils/sentry'
import './App.css'
interface Props {
beeApiUrl?: string
beeDebugApiUrl?: string
defaultRpcUrl?: string
lockedApiSettings?: boolean
isDesktop?: boolean
desktopUrl?: string
errorReporting?: (err: Error) => void
}
if (config.SENTRY_KEY) {
// eslint-disable-next-line no-console
initSentry().catch(e => console.error(e))
}
const App = ({ beeApiUrl, beeDebugApiUrl, lockedApiSettings }: Props): ReactElement => {
const App = ({
beeApiUrl,
defaultRpcUrl,
lockedApiSettings,
isDesktop,
desktopUrl,
errorReporting,
}: Props): ReactElement => {
const mainApp = (
<div className="App">
<ThemeProvider theme={theme}>
<SettingsProvider beeApiUrl={beeApiUrl} beeDebugApiUrl={beeDebugApiUrl} lockedApiSettings={lockedApiSettings}>
<SettingsProvider
beeApiUrl={beeApiUrl}
defaultRpcUrl={defaultRpcUrl}
lockedApiSettings={lockedApiSettings}
isDesktop={isDesktop}
desktopUrl={desktopUrl}
>
<TopUpProvider>
<BeeProvider>
<StampsProvider>
<FileProvider>
<FeedsProvider>
<PlatformProvider>
<SnackbarProvider anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}>
<Router>
<>
<CssBaseline />
<Dashboard>
<BaseRouter />
</Dashboard>
</>
</Router>
</SnackbarProvider>
</PlatformProvider>
</FeedsProvider>
</FileProvider>
</StampsProvider>
<BalanceProvider>
<StampsProvider>
<FileProvider>
<FileManagerProvider>
<FeedsProvider>
<PlatformProvider>
<SnackbarProvider preventDuplicate anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}>
<Router>
<>
<CssBaseline />
<Dashboard errorReporting={errorReporting}>
<BaseRouter />
</Dashboard>
</>
</Router>
</SnackbarProvider>
</PlatformProvider>
</FeedsProvider>
</FileManagerProvider>
</FileProvider>
</StampsProvider>
</BalanceProvider>
</BeeProvider>
</TopUpProvider>
</SettingsProvider>
@@ -62,18 +77,6 @@ const App = ({ beeApiUrl, beeDebugApiUrl, lockedApiSettings }: Props): ReactElem
</div>
)
// Displays Report Dialog when some component crashes
if (config.SENTRY_KEY) {
return (
<Sentry.ErrorBoundary
showDialog
fallback={({ error, componentStack, resetError }) => <ItsBroken message={error.message} />}
>
{mainApp}
</Sentry.ErrorBoundary>
)
}
return mainApp
}
+51739 -7115
View File
File diff suppressed because it is too large Load Diff
+11 -13
View File
@@ -1,7 +1,7 @@
import Collapse from '@material-ui/core/Collapse'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { Alert, AlertTitle } from '@material-ui/lab'
import { Alert, AlertTitle } from '@mui/material'
import Collapse from '@mui/material/Collapse'
import { ReactElement } from 'react'
import { makeStyles } from 'tss-react/mui'
const LIMIT = 100000000 // 100 megabytes
@@ -9,18 +9,16 @@ interface Props {
files: File[]
}
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
width: '100%',
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
},
}),
)
const useStyles = makeStyles()(theme => ({
root: {
width: '100%',
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
},
}))
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)
+56 -37
View File
@@ -1,7 +1,13 @@
import { createStyles, makeStyles, Theme, Typography } from '@material-ui/core'
import { Typography } from '@mui/material'
import { ReactElement } from 'react'
import Check from 'remixicon-react/CheckLineIcon'
import AlertCircle from 'remixicon-react/ErrorWarningFillIcon'
import Connecting from 'remixicon-react/LinksLineIcon'
import RefreshLine from 'remixicon-react/RefreshLineIcon'
import { makeStyles } from 'tss-react/mui'
import { CheckState } from '../providers/Bee'
import { SwarmButton, SwarmButtonProps } from './SwarmButton'
interface Props {
@@ -9,59 +15,72 @@ interface Props {
title: string
subtitle: string
buttonProps: SwarmButtonProps
status: 'ok' | 'error'
status: CheckState
}
const useStyles = (backgroundColor: string) =>
makeStyles((theme: Theme) =>
createStyles({
root: {
flexGrow: 1,
flexBasis: '100px',
},
wrapper: {
backgroundColor,
padding: '16px',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
textAlign: 'center',
},
iconWrapper: {
display: 'flex',
alignItems: 'flex-start',
marginBottom: '18px',
},
button: {
width: '100%',
marginTop: '2px',
backgroundColor,
'&:hover': {
makeStyles()(theme => ({
root: {
flexGrow: 1,
flexBasis: '100px',
},
wrapper: {
backgroundColor,
padding: '16px',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
textAlign: 'center',
height: '130px',
},
iconWrapper: {
display: 'flex',
alignItems: 'flex-start',
marginBottom: '18px',
},
button: {
width: '100%',
marginTop: '2px',
backgroundColor,
'&:hover': {
backgroundColor: theme.palette.primary.main,
color: 'white',
boxShadow: 'none',
// https://github.com/mui-org/material-ui/issues/22543
'@media (hover: none)': {
backgroundColor: theme.palette.primary.main,
color: 'white',
boxShadow: 'none',
// https://github.com/mui-org/material-ui/issues/22543
'@media (hover: none)': {
backgroundColor: theme.palette.primary.main,
color: 'white',
boxShadow: 'none',
},
},
},
}),
)
},
}))
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 classes = useStyles(backgroundColor)()
const { classes } = useStyles(backgroundColor)()
let statusIcon = null
if (status === CheckState.OK) {
statusIcon = <Check size="13" color="#09ca6c" />
} else if (CheckState.STARTING) {
statusIcon = <RefreshLine size="13" color="#d99400d5" />
} else if (CheckState.CONNECTING) {
statusIcon = <Connecting size="13" color="#0074D9" />
} else if (CheckState.WARNING) {
statusIcon = <Connecting size="13" color="#cbd900" />
} else {
statusIcon = <AlertCircle size="13" color="#f44336" />
}
return (
<div className={classes.root}>
<div className={classes.wrapper}>
<div className={classes.iconWrapper}>
{icon}
{status === 'ok' ? <Check size="13" color="#09ca6c" /> : <AlertCircle size="13" color="#f44336" />}
{statusIcon}
</div>
<Typography variant="h2" style={{ marginBottom: '8px' }}>
{title}
+16 -20
View File
@@ -1,15 +1,15 @@
import { CircularProgress, Container } from '@material-ui/core'
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 { CircularProgress, Container } from '@mui/material'
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 { useSnackbar } from 'notistack'
import { ReactElement, useContext, useState } from 'react'
import Zap from 'remixicon-react/FlashlightLineIcon'
import { Context as SettingsContext } from '../providers/Settings'
import EthereumAddress from './EthereumAddress'
interface Props {
peerId: string
@@ -19,8 +19,8 @@ interface Props {
export default function CheckoutModal({ peerId, uncashedAmount }: Props): ReactElement {
const [open, setOpen] = useState<boolean>(false)
const [loadingCashout, setLoadingCashout] = useState<boolean>(false)
const { beeApi } = useContext(SettingsContext)
const { enqueueSnackbar } = useSnackbar()
const { beeDebugApi } = useContext(SettingsContext)
const handleClickOpen = () => {
setOpen(true)
@@ -31,23 +31,19 @@ export default function CheckoutModal({ peerId, uncashedAmount }: Props): ReactE
}
const handleCashout = () => {
if (!beeDebugApi) return
if (peerId) {
if (peerId && beeApi) {
setLoadingCashout(true)
beeDebugApi
beeApi
.cashoutLastCheque(peerId)
.then(res => {
setOpen(false)
enqueueSnackbar(
<span>
Successfully cashed out cheque. Transaction
<EthereumAddress hideBlockie transaction address={res} />
</span>,
{ variant: 'success' },
)
enqueueSnackbar(<span>Successfully cashed out cheque. Transaction {res.toHex()}</span>, {
variant: 'success',
})
})
.catch((e: Error) => {
// eslint-disable-next-line no-console
console.error(e)
enqueueSnackbar(<span>Error: {e.message}</span>, { variant: 'error' })
})
.finally(() => {
+30
View File
@@ -0,0 +1,30 @@
import { ChainState } from '@ethersphere/bee-js'
import { useContext, useEffect, useState } from 'react'
import { Context } from '../providers/Settings'
import ExpandableListItem from './ExpandableListItem'
const CHAIN_STATE_INTERVAL_MS = 3_000
export function ChainSync() {
const { beeApi } = useContext(Context)
const [chainState, setChainState] = useState<ChainState | null>(null)
useEffect(() => {
const interval = setInterval(() => {
if (!beeApi) {
return
}
// eslint-disable-next-line no-console
beeApi.getChainState().then(setChainState).catch(console.error)
}, CHAIN_STATE_INTERVAL_MS)
return () => clearInterval(interval)
})
return (
<ExpandableListItem label="Chain state" value={chainState ? `${chainState.block} / ${chainState.chainTip}` : '-'} />
)
}
+13 -8
View File
@@ -1,8 +1,7 @@
import type { ReactElement } from 'react'
import IconButton from '@material-ui/core/IconButton'
import { CopyToClipboard } from 'react-copy-to-clipboard'
import Clipboard from 'remixicon-react/ClipboardLineIcon'
import IconButton from '@mui/material/IconButton'
import { useSnackbar } from 'notistack'
import type { ReactElement } from 'react'
import Clipboard from 'remixicon-react/ClipboardLineIcon'
interface Props {
value: string
@@ -10,14 +9,20 @@ interface Props {
export default function ClipboardCopy({ value }: Props): ReactElement {
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 (
<div style={{ marginRight: '3px', marginLeft: '3px' }}>
<IconButton color="primary" size="small" onClick={handleCopy}>
<CopyToClipboard text={value}>
<Clipboard style={{ height: '20px' }} />
</CopyToClipboard>
<Clipboard style={{ height: '20px' }} />
</IconButton>
</div>
)
+9 -11
View File
@@ -1,22 +1,20 @@
import { createStyles, makeStyles, Theme } from '@material-ui/core'
import { Close } from '@material-ui/icons'
import { Close } from '@mui/icons-material'
import { ReactElement } from 'react'
import { makeStyles } from 'tss-react/mui'
interface Props {
onClose: () => void
}
const useStyles = makeStyles((theme: Theme) =>
createStyles({
wrapper: {
padding: theme.spacing(1),
cursor: 'pointer',
},
}),
)
const useStyles = makeStyles()(theme => ({
wrapper: {
padding: theme.spacing(1),
cursor: 'pointer',
},
}))
export function CloseButton({ onClose }: Props): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
return (
<div className={classes.wrapper} onClick={onClose}>
+12 -14
View File
@@ -1,23 +1,21 @@
import { createStyles, makeStyles, Theme } from '@material-ui/core'
import { ReactElement } from 'react'
import { makeStyles } from 'tss-react/mui'
interface Props {
children: string
prettify?: boolean
}
const useStyles = makeStyles((theme: Theme) =>
createStyles({
wrapper: {
overflow: 'scroll',
background: '#ffffff',
},
pre: {
maxHeight: '6em',
padding: theme.spacing(2),
},
}),
)
const useStyles = makeStyles()(theme => ({
wrapper: {
overflow: 'scroll',
background: '#ffffff',
},
pre: {
maxHeight: '6em',
padding: theme.spacing(2),
},
}))
function prettifyString(string: string): string {
try {
@@ -28,7 +26,7 @@ function prettifyString(string: string): string {
}
export function Code({ children, prettify }: Props): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
return (
<div className={classes.wrapper}>
+4 -2
View File
@@ -1,8 +1,10 @@
import { ReactElement, useContext } from 'react'
import TabsContainer from './TabsContainer'
import CodeBlock from './CodeBlock'
import { Context } from '../providers/Platform'
import CodeBlock from './CodeBlock'
import TabsContainer from './TabsContainer'
interface Props {
linux: string
mac: string
+9 -10
View File
@@ -1,21 +1,20 @@
import { createStyles, makeStyles, Typography } from '@material-ui/core'
import { Typography } from '@mui/material'
import { ReactElement } from 'react'
import { makeStyles } from 'tss-react/mui'
interface Props {
children: (string | ReactElement)[] | (string | ReactElement)
}
const useStyles = makeStyles(() =>
createStyles({
text: {
color: '#606060',
fontSize: '0.9rem',
},
}),
)
const useStyles = makeStyles()(() => ({
text: {
color: '#606060',
fontSize: '0.9rem',
},
}))
export function DocumentationText({ children }: Props): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
return <Typography className={classes.text}>{children}</Typography>
}
+12 -4
View File
@@ -1,8 +1,8 @@
import { Component, ErrorInfo, ReactElement } from 'react'
import ItsBroken from '../layout/ItsBroken'
interface Props {
children: ReactElement
errorReporting?: (err: Error) => void
}
interface State {
@@ -10,8 +10,11 @@ interface State {
}
export default class ErrorBoundary extends Component<Props, State> {
private errorReporting?: (err: Error) => void
constructor(props: Props) {
super(props)
this.errorReporting = props.errorReporting
this.state = { error: null }
}
@@ -21,13 +24,18 @@ export default class ErrorBoundary extends Component<Props, State> {
}
componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
// You can also log the error to an error reporting service
console.error({ error, errorInfo }) // eslint-disable-line
if (this.errorReporting) {
this.errorReporting(error)
}
// eslint-disable-next-line no-console
console.error({ error, errorInfo })
}
render(): ReactElement {
if (this.state.error) {
return <ItsBroken message={this.state.error.message} />
// You can render any custom fallback UI
return <h1>Something went wrong. Error: {this.state.error.message}</h1>
}
return this.props.children
-54
View File
@@ -1,54 +0,0 @@
import { Typography } from '@material-ui/core/'
import { ReactElement } from 'react'
import Identicon from 'react-identicons'
import { config } from '../config'
import ClipboardCopy from './ClipboardCopy'
import QRCodeModal from './QRCodeModal'
interface Props {
address: string | undefined
hideBlockie?: boolean
transaction?: boolean
truncate?: boolean
}
export default function EthereumAddress(props: Props): ReactElement {
return (
<Typography component="div" variant="subtitle1">
{props.address ? (
<div style={{ display: 'flex' }}>
{props.hideBlockie ? null : (
<div style={{ paddingTop: '5px', marginRight: '10px' }}>
<Identicon size={20} string={props.address} />
</div>
)}
<div>
<a
style={
props.truncate
? {
marginRight: '7px',
maxWidth: '200px',
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
display: 'block',
}
: { marginRight: '7px' }
}
href={`${config.BLOCKCHAIN_EXPLORER_URL}/${props.transaction ? 'tx' : 'address'}/${props.address}`}
target="_blank"
rel="noreferrer"
>
{props.address}
</a>
</div>
<QRCodeModal value={props.address} label={'Ethereum Address'} />
<ClipboardCopy value={props.address} />
</div>
) : (
'-'
)}
</Typography>
)
}
+32 -31
View File
@@ -1,35 +1,36 @@
import { Collapse, ListItem } from '@material-ui/core'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { ExpandLess, ExpandMore } from '@material-ui/icons'
import { ExpandLess, ExpandMore } from '@mui/icons-material'
import { Collapse, ListItemButton } from '@mui/material'
import { ReactElement, ReactNode, useState } from 'react'
import { makeStyles } from 'tss-react/mui'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
width: '100%',
padding: 0,
margin: 0,
marginTop: theme.spacing(4),
'&:first-child': {
marginTop: 0,
},
const useStyles = makeStyles()(theme => ({
root: {
width: '100%',
padding: 0,
margin: 0,
marginTop: theme.spacing(4),
'&:first-of-type': {
marginTop: 0,
},
rootLevel1: { marginTop: theme.spacing(1) },
rootLevel2: { marginTop: theme.spacing(0.5) },
header: {
backgroundColor: theme.palette.background.paper,
},
rootLevel1: { marginTop: theme.spacing(1) },
rootLevel2: { marginTop: theme.spacing(0.5) },
header: {
backgroundColor: theme.palette.background.paper,
},
contentLevel0: {
marginTop: theme.spacing(1),
},
contentLevel12: {
marginTop: theme.spacing(0.25),
'& > li:last-of-type': {
marginBottom: theme.spacing(2),
},
contentLevel0: {
marginTop: theme.spacing(1),
},
contentLevel12: {
marginTop: theme.spacing(0.25),
},
infoText: {
color: '#c9c9c9',
},
}),
)
},
infoText: {
color: '#c9c9c9',
},
}))
interface Props {
children: ReactNode
@@ -38,7 +39,7 @@ interface Props {
}
export default function ExpandableElement({ children, expandable, defaultOpen }: Props): ReactElement | null {
const classes = useStyles()
const { classes } = useStyles()
const [open, setOpen] = useState<boolean>(Boolean(defaultOpen))
const handleClick = () => {
@@ -47,10 +48,10 @@ export default function ExpandableElement({ children, expandable, defaultOpen }:
return (
<div className={`${classes.root} ${classes.rootLevel2}`}>
<ListItem button onClick={handleClick} className={classes.header}>
<ListItemButton onClick={handleClick} className={classes.header}>
{children}
{open ? <ExpandLess /> : <ExpandMore />}
</ListItem>
</ListItemButton>
<Collapse in={open} timeout="auto" unmountOnExit>
<div className={classes.contentLevel12}>{expandable}</div>
</Collapse>
+34 -34
View File
@@ -1,35 +1,35 @@
import { ExpandLess, ExpandMore } from '@mui/icons-material'
import { Collapse, ListItemButton, ListItemText, Typography } from '@mui/material'
import { ReactElement, ReactNode, useState } from 'react'
import { makeStyles, Theme, createStyles } from '@material-ui/core/styles'
import { Collapse, ListItem, ListItemText, Typography } from '@material-ui/core'
import { ExpandLess, ExpandMore } from '@material-ui/icons'
import { makeStyles } from 'tss-react/mui'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
width: '100%',
padding: 0,
margin: 0,
marginTop: theme.spacing(4),
'&:first-child': {
marginTop: 0,
},
import { Flex } from './Flex'
const useStyles = makeStyles()(theme => ({
root: {
width: '100%',
padding: 0,
margin: 0,
marginTop: theme.spacing(4),
'&:first-of-type': {
marginTop: 0,
},
rootLevel1: { marginTop: theme.spacing(1) },
rootLevel2: { marginTop: theme.spacing(0.5) },
header: {
backgroundColor: theme.palette.background.paper,
},
contentLevel0: {
marginTop: theme.spacing(1),
},
contentLevel12: {
marginTop: theme.spacing(0.25),
},
infoText: {
color: '#c9c9c9',
},
}),
)
},
rootLevel1: { marginTop: theme.spacing(1) },
rootLevel2: { marginTop: theme.spacing(0.5) },
header: {
backgroundColor: theme.palette.background.paper,
},
contentLevel0: {
marginTop: theme.spacing(1),
},
contentLevel12: {
marginTop: theme.spacing(0.25),
},
infoText: {
color: '#c9c9c9',
},
}))
interface Props {
children?: ReactNode
@@ -40,7 +40,7 @@ interface Props {
}
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 handleClick = () => {
@@ -63,17 +63,17 @@ export default function ExpandableList({ children, label, level, defaultOpen, in
return (
<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>} />
<div style={{ display: 'flex' }}>
<Flex>
{!open && (
<Typography variant="body2" className={classes.infoText}>
{info}
</Typography>
)}
{open ? <ExpandLess /> : <ExpandMore />}
</div>
</ListItem>
</Flex>
</ListItemButton>
<Collapse in={open} timeout="auto" unmountOnExit>
<div className={contentLevelClass}>{children}</div>
</Collapse>
+41 -37
View File
@@ -1,27 +1,25 @@
import { Box, IconButton, Tooltip, Typography } from '@mui/material'
import ListItemButton from '@mui/material/ListItemButton'
import { ReactElement, ReactNode } from 'react'
import { makeStyles, Theme, createStyles } from '@material-ui/core/styles'
import { Typography, Grid, IconButton, Tooltip } from '@material-ui/core'
import Info from 'remixicon-react/InformationLineIcon'
import ListItem from '@material-ui/core/ListItem'
import { makeStyles } from 'tss-react/mui'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
header: {
backgroundColor: theme.palette.background.paper,
marginBottom: theme.spacing(0.25),
wordBreak: 'break-word',
const useStyles = makeStyles()(theme => ({
header: {
backgroundColor: theme.palette.background.paper,
marginBottom: theme.spacing(0.25),
wordBreak: 'break-word',
},
copyValue: {
cursor: 'pointer',
padding: theme.spacing(1),
borderRadius: 0,
'&:hover': {
backgroundColor: '#fcf2e8',
color: theme.palette.primary.main,
},
copyValue: {
cursor: 'pointer',
padding: theme.spacing(1),
borderRadius: 0,
'&:hover': {
backgroundColor: '#fcf2e8',
color: theme.palette.primary.main,
},
},
}),
)
},
}))
interface Props {
label?: ReactNode
@@ -30,25 +28,31 @@ interface Props {
}
export default function ExpandableListItem({ label, value, tooltip }: Props): ReactElement | null {
const classes = useStyles()
const { classes } = useStyles()
return (
<ListItem className={classes.header}>
<Grid container direction="row" justifyContent="space-between" alignItems="center">
{label && <Typography variant="body1">{label}</Typography>}
{value && (
<Typography variant="body2">
{value}
{tooltip && (
<Tooltip title={tooltip} placement="top" arrow>
<IconButton size="small" className={classes.copyValue}>
<Info strokeWidth={1} />
</IconButton>
</Tooltip>
)}
</Typography>
<ListItemButton className={classes.header}>
<Box display="flex" flexDirection="row" alignItems="center" width="100%">
{label && (
<Box flex={2}>
<Typography variant="body1">{label}</Typography>
</Box>
)}
</Grid>
</ListItem>
{value && (
<Box flex={1} textAlign="right">
<Typography variant="body2" component="div">
{value}
{tooltip && (
<Tooltip title={tooltip} placement="top" arrow>
<IconButton size="small" className={classes.copyValue}>
<Info strokeWidth={1} />
</IconButton>
</Tooltip>
)}
</Typography>
</Box>
)}
</Box>
</ListItemButton>
)
}
+14 -16
View File
@@ -1,27 +1,25 @@
import { Grid } from '@material-ui/core'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { Grid } from '@mui/material'
import { ReactElement, ReactNode } from 'react'
import { makeStyles } from 'tss-react/mui'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
wrapper: {
display: 'flex',
flexDirection: 'row',
flexWrap: 'wrap',
},
action: {
marginBottom: theme.spacing(1),
marginRight: theme.spacing(1),
},
}),
)
const useStyles = makeStyles()(theme => ({
wrapper: {
display: 'flex',
flexDirection: 'row',
flexWrap: 'wrap',
},
action: {
marginBottom: theme.spacing(1),
marginRight: theme.spacing(1),
},
}))
interface Props {
children: ReactNode | ReactNode[]
}
export default function ExpandableListItemActions({ children }: Props): ReactElement | null {
const classes = useStyles()
const { classes } = useStyles()
if (Array.isArray(children)) {
return (
+134 -110
View File
@@ -1,53 +1,58 @@
import { Grid, IconButton, InputBase, ListItem, Typography } from '@material-ui/core'
import Collapse from '@material-ui/core/Collapse'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { ChangeEvent, ReactElement, useState } from 'react'
import { Box, IconButton, InputBase, ListItemButton, Typography } from '@mui/material'
import Collapse from '@mui/material/Collapse'
import React, { ChangeEvent, ReactElement, useState } from 'react'
import type { RemixiconReactIconProps } from 'remixicon-react'
import Check from 'remixicon-react/CheckLineIcon'
import X from 'remixicon-react/CloseLineIcon'
import Edit from 'remixicon-react/PencilLineIcon'
import Minus from 'remixicon-react/SubtractLineIcon'
import X from 'remixicon-react/CloseLineIcon'
import { makeStyles } from 'tss-react/mui'
import ExpandableListItemActions from './ExpandableListItemActions'
import ExpandableListItemNote from './ExpandableListItemNote'
import { SwarmButton } from './SwarmButton'
import type { RemixiconReactIconProps } from 'remixicon-react'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
header: {
const useStyles = makeStyles()(theme => ({
header: {
backgroundColor: theme.palette.background.paper,
marginBottom: theme.spacing(0.25),
borderLeft: `${theme.spacing(0.25)} solid rgba(0,0,0,0)`,
wordBreak: 'break-word',
'&:hover': {
backgroundColor: theme.palette.background.paper,
marginBottom: theme.spacing(0.25),
borderLeft: `${theme.spacing(0.25)}px solid rgba(0,0,0,0)`,
wordBreak: 'break-word',
},
headerOpen: {
borderLeft: `${theme.spacing(0.25)}px solid ${theme.palette.primary.main}`,
'&:focus-within': {
backgroundColor: theme.palette.background.paper,
},
copyValue: {
cursor: 'pointer',
padding: theme.spacing(1),
borderRadius: 0,
'&:hover': {
backgroundColor: '#fcf2e8',
color: theme.palette.primary.main,
},
},
headerOpen: {
borderLeft: `${theme.spacing(0.25)} solid ${theme.palette.primary.main}`,
},
copyValue: {
cursor: 'pointer',
padding: theme.spacing(1),
borderRadius: 0,
'&:hover': {
backgroundColor: '#fcf2e8',
color: theme.palette.primary.main,
},
content: {
marginTop: theme.spacing(1),
marginBottom: theme.spacing(1),
},
keyMargin: {
marginRight: theme.spacing(1),
},
unselectableLabel: {
cursor: 'default',
userSelect: 'none',
// Many browsers don't support yet the general user-select css property
WebkitUserSelect: 'none',
MozUserSelect: 'none',
msUserSelect: 'none',
},
}),
)
},
content: {
marginTop: theme.spacing(1),
marginBottom: theme.spacing(1),
},
keyMargin: {
marginRight: theme.spacing(1),
},
unselectableLabel: {
cursor: 'default',
userSelect: 'none',
// Many browsers don't support yet the general user-select css property
WebkitUserSelect: 'none',
MozUserSelect: 'none',
msUserSelect: 'none',
},
}))
interface Props {
label: string
@@ -65,100 +70,119 @@ interface Props {
locked?: boolean
}
export default function ExpandableListItemKey({
export default function ExpandableListItemInput({
label,
value,
onConfirm,
onChange,
value = '',
placeholder,
helperText,
expandedOnly,
confirmLabel,
confirmLabelDisabled,
confirmIcon,
expandedOnly,
helperText,
placeholder,
loading,
onChange,
onConfirm,
mapperFn,
locked,
}: Props): ReactElement | null {
const classes = useStyles()
const { classes } = useStyles()
const [open, setOpen] = useState(Boolean(expandedOnly))
const [inputValue, setInputValue] = useState<string>(value || '')
const toggleOpen = () => setOpen(!open)
const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {
const handleChange = (e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
let newValue = e.target.value
if (mapperFn) {
e.target.value = mapperFn(e.target.value)
newValue = mapperFn(newValue)
}
setInputValue(newValue)
setInputValue(e.target.value)
if (onChange) onChange(e.target.value)
if (onChange) onChange(newValue)
}
return (
<>
<ListItem className={`${classes.header} ${open ? classes.headerOpen : ''}`}>
<Grid container direction="column" justifyContent="space-between" alignItems="stretch">
<Grid container direction="row" justifyContent="space-between" alignItems="center">
<ListItemButton className={`${classes.header} ${open ? classes.headerOpen : ''}`}>
<Box display="flex" flexDirection="column" width="100%">
<Box display="flex" flexDirection="row" alignItems="center" width="100%">
{label && (
<Typography variant="body1" className={classes.unselectableLabel}>
{label}
</Typography>
<Box flex={1} minWidth={0}>
<Typography variant="body1" className={classes.unselectableLabel} component="span">
{label}
</Typography>
</Box>
)}
<Typography variant="body2">
<div>
{!open && value}
{!expandedOnly && !locked && (
<IconButton size="small" className={classes.copyValue}>
{open ? (
<Minus onClick={toggleOpen} strokeWidth={1} />
) : (
<Edit onClick={toggleOpen} strokeWidth={1} />
)}
</IconButton>
)}
</div>
</Typography>
</Grid>
<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>
)}
{!expandedOnly && !locked && (
<IconButton size="small" className={classes.copyValue} onClick={toggleOpen}>
{open ? <Minus strokeWidth={1} /> : <Edit strokeWidth={1} />}
</IconButton>
)}
</Box>
</Box>
<Collapse in={open} timeout="auto" unmountOnExit>
<InputBase
value={inputValue}
placeholder={placeholder}
onChange={handleChange}
fullWidth
className={classes.content}
autoFocus
hidden={locked}
/>
<Box display="flex" alignItems="center" width="100%" minWidth={0}>
<InputBase
value={inputValue}
placeholder={placeholder}
onChange={handleChange}
fullWidth
className={classes.content}
autoFocus
hidden={locked}
inputProps={{
style: {
width: '100%',
minWidth: 220,
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
},
maxLength: 512,
}}
/>
</Box>
{helperText && <ExpandableListItemNote>{helperText}</ExpandableListItemNote>}
</Collapse>
</Grid>
</ListItem>
</Box>
</ListItemButton>
<Collapse in={open} timeout="auto" unmountOnExit>
{helperText && <ExpandableListItemNote>{helperText}</ExpandableListItemNote>}
<ExpandableListItemActions>
<SwarmButton
disabled={
loading ||
inputValue === value ||
Boolean(confirmLabelDisabled) || // Disable if external validation is provided
(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
}
loading={loading}
iconType={confirmIcon ?? Check}
onClick={() => {
if (onConfirm) onConfirm(inputValue)
}}
>
{confirmLabel || 'Save'}
</SwarmButton>
<SwarmButton
disabled={loading || inputValue === value || inputValue === ''}
iconType={X}
onClick={() => setInputValue(value || '')}
cancel
>
Cancel
</SwarmButton>
</ExpandableListItemActions>
<Box mt={2}>
<ExpandableListItemActions>
<SwarmButton
disabled={
loading ||
inputValue === value ||
Boolean(confirmLabelDisabled) ||
(inputValue === '' && value === undefined)
}
loading={loading}
iconType={confirmIcon ?? Check}
onClick={() => {
onConfirm?.(inputValue.trim())
}}
>
{confirmLabel || 'Save'}
</SwarmButton>
<SwarmButton
disabled={loading || inputValue === value || inputValue === ''}
iconType={X}
onClick={() => setInputValue(value || '')}
cancel
>
Cancel
</SwarmButton>
</ExpandableListItemActions>
</Box>
</Collapse>
</>
)
+65 -65
View File
@@ -1,40 +1,44 @@
import { Grid, IconButton, ListItem, Tooltip, Typography } from '@material-ui/core'
import Collapse from '@material-ui/core/Collapse'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { Collapse, Grid, IconButton, ListItemButton, Tooltip, Typography } from '@mui/material'
import { ReactElement, useState } from 'react'
import { CopyToClipboard } from 'react-copy-to-clipboard'
import Eye from 'remixicon-react/EyeLineIcon'
import Minus from 'remixicon-react/SubtractLineIcon'
import { makeStyles } from 'tss-react/mui'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
header: {
import { useClipboardCopy } from '../hooks/useClipboardCopy'
const useStyles = makeStyles()(theme => ({
header: {
backgroundColor: theme.palette.background.paper,
marginBottom: theme.spacing(0.25),
borderLeft: `${theme.spacing(0.25)} solid rgba(0,0,0,0)`,
wordBreak: 'break-word',
'&:hover': {
backgroundColor: theme.palette.background.paper,
marginBottom: theme.spacing(0.25),
borderLeft: `${theme.spacing(0.25)}px solid rgba(0,0,0,0)`,
wordBreak: 'break-word',
},
headerOpen: {
borderLeft: `${theme.spacing(0.25)}px solid ${theme.palette.primary.main}`,
'&:focus-within': {
backgroundColor: theme.palette.background.paper,
},
copyValue: {
cursor: 'pointer',
padding: theme.spacing(1),
borderRadius: 0,
'&:hover': {
backgroundColor: '#fcf2e8',
color: theme.palette.primary.main,
},
},
headerOpen: {
borderLeft: `${theme.spacing(0.25)} solid ${theme.palette.primary.main}`,
},
copyValue: {
cursor: 'pointer',
padding: theme.spacing(1),
borderRadius: 0,
'&:hover': {
backgroundColor: '#fcf2e8',
color: theme.palette.primary.main,
},
content: {
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
},
keyMargin: {
marginRight: theme.spacing(1),
},
}),
)
},
content: {
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
},
keyMargin: {
marginRight: theme.spacing(1),
},
}))
interface Props {
label: string
@@ -57,13 +61,11 @@ const split = (s: string): string[] => {
}
export default function ExpandableListItemKey({ label, value, expanded }: Props): ReactElement | null {
const classes = useStyles()
const [open, setOpen] = useState(expanded || false)
const [copied, setCopied] = useState(false)
const toggleOpen = () => setOpen(!open)
const { classes } = useStyles()
const tooltipClickHandler = () => setCopied(true)
const tooltipCloseHandler = () => setCopied(false)
const [open, setOpen] = useState(expanded || false)
const { copied, handleCopy, tooltipCloseHandler } = useClipboardCopy(value)
const toggleOpen = () => setOpen(!open)
const splitValues = split(value)
const hasPrefix = isPrefixedHexString(value)
@@ -72,46 +74,44 @@ export default function ExpandableListItemKey({ label, value, expanded }: Props)
}`
return (
<ListItem className={`${classes.header} ${open ? classes.headerOpen : ''}`}>
<Grid container direction="column" justifyContent="space-between" alignItems="stretch">
<ListItemButton className={`${classes.header} ${open ? classes.headerOpen : ''}`}>
<Grid container direction="column" justifyContent="space-between" alignItems="stretch" style={{ width: '100%' }}>
<Grid container direction="row" justifyContent="space-between" alignItems="center">
{label && <Typography variant="body1">{label}</Typography>}
<Typography variant="body2">
<div>
{!open && (
<span className={classes.copyValue}>
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
<CopyToClipboard text={value}>
<span onClick={tooltipClickHandler}>{value ? spanText : ''}</span>
</CopyToClipboard>
</Tooltip>
</span>
)}
<IconButton size="small" className={classes.copyValue}>
{open ? <Minus onClick={toggleOpen} strokeWidth={1} /> : <Eye onClick={toggleOpen} strokeWidth={1} />}
</IconButton>
</div>
{label && (
<Typography variant="body1" component="span">
{label}
</Typography>
)}
<Typography variant="body2" component="span">
{!open && (
<span className={classes.copyValue}>
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
<span onClick={handleCopy}>{value ? spanText : ''}</span>
</Tooltip>
</span>
)}
<IconButton size="small" className={classes.copyValue} onClick={toggleOpen}>
{open ? <Minus strokeWidth={1} /> : <Eye strokeWidth={1} />}
</IconButton>
</Typography>
</Grid>
<Collapse in={open} timeout="auto" unmountOnExit>
<div className={classes.content}>
<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*/}
<span onClick={tooltipClickHandler}>
<span className={classes.copyValue}>
{splitValues.map((s, i) => (
<Typography variant="body2" key={i} className={classes.keyMargin} component="span">
{s}
</Typography>
))}
</span>
{/* This has to be wrapped in two spans otherwise either the tooltip or the highlighting does not work*/}
<span onClick={handleCopy}>
<span className={classes.copyValue}>
{splitValues.map((s, i) => (
<Typography variant="body2" key={i} className={classes.keyMargin} component="span">
{s}
</Typography>
))}
</span>
</CopyToClipboard>
</span>
</Tooltip>
</div>
</Collapse>
</Grid>
</ListItem>
</ListItemButton>
)
}
+72 -69
View File
@@ -1,54 +1,64 @@
import { Grid, IconButton, ListItem, Tooltip, Typography } from '@material-ui/core'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { ArrowForward, OpenInNewSharp } from '@material-ui/icons'
import { ReactElement, useState } from 'react'
import CopyToClipboard from 'react-copy-to-clipboard'
import { ArrowForward, OpenInNewSharp } from '@mui/icons-material'
import { Box, IconButton, ListItemButton, Tooltip, Typography } from '@mui/material'
import { ReactElement } from 'react'
import { useNavigate } from 'react-router'
import { makeStyles } from 'tss-react/mui'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
header: {
import { useClipboardCopy } from '../hooks/useClipboardCopy'
const useStyles = makeStyles()(theme => ({
header: {
backgroundColor: theme.palette.background.paper,
marginBottom: theme.spacing(0.25),
borderLeft: `${theme.spacing(0.25)} solid rgba(0,0,0,0)`,
wordBreak: 'break-word',
'&:hover': {
backgroundColor: theme.palette.background.paper,
marginBottom: theme.spacing(0.25),
borderLeft: `${theme.spacing(0.25)}px solid rgba(0,0,0,0)`,
wordBreak: 'break-word',
},
headerOpen: {
borderLeft: `${theme.spacing(0.25)}px solid ${theme.palette.primary.main}`,
'&:focus-within': {
backgroundColor: theme.palette.background.paper,
},
openLinkIcon: {
cursor: 'pointer',
padding: theme.spacing(1),
borderRadius: 0,
'&:hover': {
backgroundColor: '#fcf2e8',
color: theme.palette.primary.main,
},
},
headerOpen: {
borderLeft: `${theme.spacing(0.25)} solid ${theme.palette.primary.main}`,
},
openLinkIcon: {
cursor: 'pointer',
padding: theme.spacing(1),
borderRadius: 0,
'&:hover': {
backgroundColor: '#fcf2e8',
color: theme.palette.primary.main,
},
content: {
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
},
content: {
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
},
keyMargin: {
marginRight: theme.spacing(1),
},
copyValue: {
cursor: 'pointer',
padding: theme.spacing(1),
borderRadius: 0,
'&:hover': {
backgroundColor: '#fcf2e8',
color: theme.palette.primary.main,
},
keyMargin: {
marginRight: theme.spacing(1),
},
copyValue: {
cursor: 'pointer',
padding: theme.spacing(1),
borderRadius: 0,
'&:hover': {
backgroundColor: '#fcf2e8',
color: theme.palette.primary.main,
},
},
}),
)
},
}))
export enum NavigationType {
NEW_WINDOW = 'NEW_WINDOW',
HISTORY_PUSH = 'HISTORY_PUSH',
}
interface Props {
label: string
value: string
link?: string
navigationType?: 'NEW_WINDOW' | 'HISTORY_PUSH'
navigationType?: NavigationType
allowClipboard?: boolean
}
@@ -56,20 +66,17 @@ export default function ExpandableListItemLink({
label,
value,
link,
navigationType = 'NEW_WINDOW',
navigationType = NavigationType.NEW_WINDOW,
allowClipboard = true,
}: Props): ReactElement | null {
const classes = useStyles()
const [copied, setCopied] = useState(false)
const { classes } = useStyles()
const navigate = useNavigate()
const tooltipClickHandler = () => setCopied(true)
const tooltipCloseHandler = () => setCopied(false)
const { copied, handleCopy, tooltipCloseHandler } = useClipboardCopy(value)
const displayValue = value.length > 22 ? value.slice(0, 19) + '...' : value
function onNavigation() {
if (navigationType === 'NEW_WINDOW') {
if (navigationType === NavigationType.NEW_WINDOW) {
window.open(link || value)
} else {
navigate(link || value)
@@ -77,30 +84,26 @@ export default function ExpandableListItemLink({
}
return (
<ListItem className={classes.header}>
<Grid container direction="column" justifyContent="space-between" alignItems="stretch">
<Grid container direction="row" justifyContent="space-between" alignItems="center">
{label && <Typography variant="body1">{label}</Typography>}
<ListItemButton className={classes.header} sx={{ width: '100%' }}>
<Box display="flex" flexDirection="row" justifyContent="space-between" alignItems="center" width="100%">
{label && <Typography variant="body1">{label}</Typography>}
<Box display="flex" alignItems="center">
<Typography variant="body2">
<div>
{allowClipboard && (
<span className={classes.copyValue}>
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
<CopyToClipboard text={value}>
<span onClick={tooltipClickHandler}>{displayValue}</span>
</CopyToClipboard>
</Tooltip>
</span>
)}
{!allowClipboard && <span onClick={onNavigation}>{displayValue}</span>}
<IconButton size="small" className={classes.openLinkIcon}>
{navigationType === 'NEW_WINDOW' && <OpenInNewSharp onClick={onNavigation} strokeWidth={1} />}
{navigationType === 'HISTORY_PUSH' && <ArrowForward onClick={onNavigation} strokeWidth={1} />}
</IconButton>
</div>
{allowClipboard && (
<span className={classes.copyValue}>
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
<span onClick={handleCopy}>{displayValue}</span>
</Tooltip>
</span>
)}
{!allowClipboard && <span onClick={onNavigation}>{displayValue}</span>}
</Typography>
</Grid>
</Grid>
</ListItem>
<IconButton size="small" className={classes.openLinkIcon} onClick={onNavigation}>
{navigationType === NavigationType.NEW_WINDOW && <OpenInNewSharp strokeWidth={1} />}
{navigationType === NavigationType.HISTORY_PUSH && <ArrowForward strokeWidth={1} />}
</IconButton>
</Box>
</Box>
</ListItemButton>
)
}
+15 -17
View File
@@ -1,32 +1,30 @@
import { Typography } from '@mui/material'
import ListItemButton from '@mui/material/ListItemButton'
import { ReactElement, ReactNode } from 'react'
import { makeStyles, Theme, createStyles } from '@material-ui/core/styles'
import { Typography } from '@material-ui/core'
import ListItem from '@material-ui/core/ListItem'
import { makeStyles } from 'tss-react/mui'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
header: {
backgroundColor: '#F7F7F7',
marginBottom: theme.spacing(0.25),
},
typography: {
color: '#242424',
},
}),
)
const useStyles = makeStyles()(theme => ({
header: {
backgroundColor: '#F7F7F7',
marginBottom: theme.spacing(0.25),
},
typography: {
color: '#242424',
},
}))
interface Props {
children?: ReactNode | ReactNode[]
}
export default function ExpandableListItemNote({ children }: Props): ReactElement | null {
const classes = useStyles()
const { classes } = useStyles()
return (
<ListItem className={classes.header}>
<ListItemButton className={classes.header}>
<Typography variant="body1" className={classes.typography}>
{children}
</Typography>
</ListItem>
</ListItemButton>
)
}
-95
View File
@@ -1,95 +0,0 @@
import { ReactElement, useEffect, useState } from 'react'
import * as Sentry from '@sentry/react'
import { Link } from '@material-ui/core'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import MessageSquare from 'remixicon-react/Message2LineIcon'
import config from '../config'
import SideBarItem from './SideBarItem'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
link: {
color: '#9f9f9f',
textDecoration: 'none',
'&:hover': {
textDecoration: 'none',
// https://github.com/mui-org/material-ui/issues/22543
'@media (hover: none)': {
textDecoration: 'none',
},
},
},
icon: {
height: theme.spacing(4),
},
}),
)
/**
* Parses Sentry DNS so it could be transformed into API call
* Sentry DNS like https://1asfasdf2312asdf3@o132123.ingest.sentry.io/13123123
*/
const SENTRY_PARSING_REGEX = /^https:\/\/(?<key>\w+)@(?<sub>\w+)\.ingest\.sentry\.io\/(?<path>\d+)$/gm
async function isSentryReachable(): Promise<boolean> {
const key = config.SENTRY_KEY
if (!key) {
return false
}
const match = SENTRY_PARSING_REGEX.exec(key)
if (!match) {
return false
}
const url = `https://${match.groups?.sub}.ingest.sentry.io/api/${match.groups?.path}/envelope/?sentry_key=${match.groups?.key}`
try {
await fetch(url, { method: 'POST' })
// Since we got some reply (even though most probably with some error) that means Sentry is reachable ==> lets provide the Feedback form
return true
} catch (e) {
// If an error was thrown than the request was blocked by the browser so Sentry is not accessible to us
return false
}
}
function showFeedbackForm(): void {
const eventId = Sentry.captureMessage('User feedback')
Sentry.showReportDialog({
eventId,
title: 'Provide us feedback!',
subtitle: 'Share with us what you like and/or dislike.',
subtitle2: 'We will be very happy.',
labelComments: 'What is your impression about this app?',
labelSubmit: 'Send Feedback',
})
}
export default function Feedback(): ReactElement {
const [sentryEnabled, setSentryEnabled] = useState(false)
const classes = useStyles()
// Run this only on component mount to verify once that Sentry is reachable
useEffect(() => {
isSentryReachable().then(result => {
setSentryEnabled(result)
})
}, [])
if (sentryEnabled) {
return (
<Link onClick={showFeedbackForm} className={classes.link}>
<SideBarItem iconStart={<MessageSquare className={classes.icon} />} label={<span>Send feedback</span>} />
</Link>
)
}
return <></>
}
+31
View File
@@ -0,0 +1,31 @@
import { ReactElement } from 'react'
import { makeStyles } from 'tss-react/mui'
const useStyles = makeStyles()(() => ({
audio: {
width: '100%',
maxWidth: '250px',
},
}))
interface AudioProps {
src: string | undefined
maxHeight?: string
maxWidth?: string
}
export function FitAudio(props: AudioProps): ReactElement {
const { classes } = useStyles()
const inlineStyles: Record<string, string> = {}
if (props.maxHeight) {
inlineStyles.maxHeight = props.maxHeight
}
if (props.maxWidth) {
inlineStyles.maxWidth = props.maxWidth
}
return <audio className={classes.audio} src={props.src} style={inlineStyles} controls />
}
+16 -13
View File
@@ -1,15 +1,13 @@
import { createStyles, makeStyles } from '@material-ui/core'
import { ReactElement } from 'react'
import { makeStyles } from 'tss-react/mui'
const useStyles = makeStyles(() =>
createStyles({
image: {
width: '100%',
height: '100%',
objectFit: 'cover',
},
}),
)
const useStyles = makeStyles()(() => ({
image: {
width: '100%',
height: '100%',
objectFit: 'cover',
},
}))
interface Props {
alt: string
@@ -19,12 +17,17 @@ interface Props {
}
export function FitImage(props: Props): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
const inlineStyles: Record<string, string> = {}
props.maxHeight && (inlineStyles.maxHeight = props.maxHeight)
props.maxWidth && (inlineStyles.maxWidth = props.maxWidth)
if (props.maxHeight) {
inlineStyles.maxHeight = props.maxHeight
}
if (props.maxWidth) {
inlineStyles.maxWidth = props.maxWidth
}
return <img className={classes.image} alt={props.alt} src={props.src} style={inlineStyles} />
}
+32
View File
@@ -0,0 +1,32 @@
import { ReactElement } from 'react'
import { makeStyles } from 'tss-react/mui'
const useStyles = makeStyles()(() => ({
video: {
width: '100%',
height: '100%',
objectFit: 'cover',
},
}))
interface VideoProps {
src: string | undefined
maxHeight?: string
maxWidth?: string
}
export function FitVideo(props: VideoProps): ReactElement {
const { classes } = useStyles()
const inlineStyles: Record<string, string> = {}
if (props.maxHeight) {
inlineStyles.maxHeight = props.maxHeight
}
if (props.maxWidth) {
inlineStyles.maxWidth = props.maxWidth
}
return <video className={classes.video} src={props.src} style={inlineStyles} controls />
}
+9
View File
@@ -0,0 +1,9 @@
import { ReactNode } from 'react'
interface Props {
children: ReactNode
}
export function Flex({ children }: Props) {
return <div style={{ display: 'flex' }}>{children}</div>
}
+5 -3
View File
@@ -1,8 +1,10 @@
import { ReactElement, useEffect, useState } from 'react'
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 ExpandableListItemLink from './ExpandableListItemLink'
import ExpandableListItemLink, { NavigationType } from './ExpandableListItemLink'
interface Props {
title: string
@@ -28,7 +30,7 @@ export function History({ title, localStorageKey }: Props): ReactElement | null
value={x.name}
link={'/files/hash/' + x.hash}
key={i}
navigationType="HISTORY_PUSH"
navigationType={NavigationType.HISTORY_PUSH}
allowClipboard={false}
/>
))}
+12 -13
View File
@@ -1,25 +1,24 @@
import { Box, createStyles, Grid, makeStyles, Typography } from '@material-ui/core'
import { ArrowBack } from '@material-ui/icons'
import { ArrowBack } from '@mui/icons-material'
import { Box, Grid, Typography } from '@mui/material'
import { ReactElement } from 'react'
import { useNavigate } from 'react-router-dom'
import { makeStyles } from 'tss-react/mui'
interface Props {
children: string
}
const useStyles = makeStyles(() =>
createStyles({
pressable: {
cursor: 'pointer',
},
icon: {
color: '#242424',
},
}),
)
const useStyles = makeStyles()(() => ({
pressable: {
cursor: 'pointer',
},
icon: {
color: '#242424',
},
}))
export function HistoryHeader({ children }: Props): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
const navigate = useNavigate()
function goBack() {
+1 -1
View File
@@ -1,4 +1,4 @@
import { CircularProgress, Grid } from '@material-ui/core'
import { CircularProgress, Grid } from '@mui/material'
import { ReactElement } from 'react'
export function Loading(): ReactElement {
+34 -22
View File
@@ -1,9 +1,10 @@
import { ReactElement, CSSProperties, useContext, useState, useEffect } from 'react'
import type { Peer } from '@ethersphere/bee-js'
import DottedMap, { DottedMapWithoutCountriesLib } from 'dotted-map/without-countries'
import { CSSProperties, ReactElement, useContext, useEffect, useState } from 'react'
import mapData from '../assets/data/map-data.json'
import nodesDb from '../assets/data/nodes-db.json'
import { Context } from '../providers/Bee'
import mapData from '../assets/data/map-data.json'
interface Props {
style?: CSSProperties
@@ -18,17 +19,10 @@ interface MapRecord {
type MapDB = Record<string, MapRecord>
const fullMapDb = nodesDb as unknown as MapDB
const deduplicatedRecords = deduplicate(fullMapDb)
function deduplicate(db: MapDB): MapRecord[] {
const noDuplicates: Record<string, MapRecord> = {}
Object.entries(fullMapDb).forEach(([key, record]) => {
noDuplicates[`${record.lat} ${record.lng}`] = record
})
return Object.values(noDuplicates)
}
const deduplicatedRecords = Object.values(
Object.fromEntries(Object.values(fullMapDb).map(r => [`${r.lat} ${r.lng}`, r])),
)
function findIntersection(db: MapDB, peers: Peer[]): 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 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 {
const { peers } = useContext(Context)
const [map, setMap] = useState<string>(mapPrecomputed.getSVG(mapSvgOptions))
useEffect(() => {
// Display error map
if (error) setMap(mapNoPins.getSVG({ ...mapSvgOptions, color: '#eaeaea' }))
let newSvg: string
// 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 mapNew = Object.create(mapPrecomputed)
addPins(mapNew, points, PeerColors.Green)
newSvg = mapNew.getSVG(mapSvgOptions)
} else {
return
}
const points = findIntersection(fullMapDb, peers)
const mapNew = Object.create(mapPrecomputed)
addPins(mapNew, points, '#09CA6C')
setMap(mapNew.getSVG(mapSvgOptions))
if (newSvg !== map) {
setMap(newSvg)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [peers, error])
return (
+22
View File
@@ -0,0 +1,22 @@
import Box from '@mui/material/Box'
import LinearProgress, { LinearProgressProps } from '@mui/material/LinearProgress'
import Typography from '@mui/material/Typography'
import React, { ReactElement } from 'react'
interface Props {
linearProgressProps?: LinearProgressProps
value: number
}
export function LinearProgressWithLabel(props: Props): ReactElement {
return (
<Box display="flex" alignItems="center">
<Box width="100%" mr={1}>
<LinearProgress variant="determinate" {...props} />
</Box>
<Box minWidth={35}>
<Typography variant="body2" color="textSecondary">{`${Math.round(props.value)}%`}</Typography>
</Box>
</Box>
)
}
+26 -27
View File
@@ -1,39 +1,38 @@
import { createStyles, Grid, makeStyles, Typography } from '@material-ui/core'
import { Grid, Typography } from '@mui/material'
import { ReactElement } from 'react'
import { makeStyles } from 'tss-react/mui'
interface Props {
steps: string[]
index: number
}
const useStyles = makeStyles(() =>
createStyles({
wrapper: {
height: '52px',
display: 'flex',
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
todo: {
background: '#f7f7f7',
color: '#c9c9c9',
},
inProgress: {
background: '#ffffff',
color: '#242424',
height: '52px',
},
done: {
background: '#f7f7f7',
color: '#606060',
height: '52px',
},
}),
)
const useStyles = makeStyles()(() => ({
wrapper: {
height: '52px',
display: 'flex',
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
todo: {
background: '#f7f7f7',
color: '#c9c9c9',
},
inProgress: {
background: '#ffffff',
color: '#242424',
height: '52px',
},
done: {
background: '#f7f7f7',
color: '#606060',
height: '52px',
},
}))
export function ProgressIndicator({ steps, index }: Props): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
function pickClass(i: number): string {
if (i === index) {
+4 -12
View File
@@ -1,7 +1,7 @@
import { FilterCenterFocusSharp } from '@mui/icons-material'
import { Dialog, DialogTitle, IconButton } from '@mui/material'
import { ReactElement, useState } from 'react'
import QRCode from 'qrcode.react'
import { IconButton, Dialog, DialogTitle } from '@material-ui/core'
import { FilterCenterFocusSharp } from '@material-ui/icons'
import QRCode from 'react-qr-code'
interface Props {
value: string
@@ -27,15 +27,7 @@ export default function QRCodeModal(props: Props): ReactElement {
<Dialog onClose={handleClose} aria-labelledby="simple-dialog-title" open={open}>
<div style={{ padding: '30px', textAlign: 'center' }}>
<DialogTitle id="simple-dialog-title">{props.label}</DialogTitle>
<QRCode
value={props.value}
size={150}
bgColor={'#ffffff'}
fgColor={'#000000'}
level={'L'}
includeMargin={false}
renderAs={'svg'}
/>
<QRCode value={props.value} size={150} bgColor={'#ffffff'} fgColor={'#000000'} level={'L'} />
</div>
</Dialog>
</div>
+156 -60
View File
@@ -1,76 +1,127 @@
import { Divider, Drawer, Grid, Link as MUILink, List } from '@material-ui/core'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { ReactElement, useContext } from 'react'
import { BeeModes } from '@ethersphere/bee-js'
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 FilesIcon from 'remixicon-react/ArrowUpDownLineIcon'
import DocsIcon from 'remixicon-react/BookOpenLineIcon'
import ExternalLinkIcon from 'remixicon-react/ExternalLinkLineIcon'
import FileManagerIcon from 'remixicon-react/FolderOpenLineIcon'
import GithubIcon from 'remixicon-react/GithubFillIcon'
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 AccountIcon from 'remixicon-react/Wallet3LineIcon'
import { Context as BeeContext } from '../providers/Bee'
import { Context as TopUpContext } from '../providers/TopUp'
import { makeStyles } from 'tss-react/mui'
import DashboardLogo from '../assets/dashboard-logo.svg'
import DesktopLogo from '../assets/desktop-logo.svg'
import { config } from '../config'
import { useIsBeeDesktop } from '../hooks/apiHooks'
import { BEE_DOCS_HOST, GITHUB_BEE_DASHBOARD_URL, GITHUB_BEE_DESKTOP_URL } from '../constants'
import { Context as BeeContext } from '../providers/Bee'
import { Context as SettingsContext } from '../providers/Settings'
import { ROUTES } from '../routes'
import Feedback from './Feedback'
import SideBarItem from './SideBarItem'
import SideBarStatus from './SideBarStatus'
import { BeeModes } from '@ethersphere/bee-js'
const drawerWidth = 300
const drawerWidthCollapsed = 72
const drawerHeaderHeight = 56
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
flexWrap: 'nowrap',
minHeight: '100vh',
paddingTop: theme.spacing(8),
paddingBottom: theme.spacing(8),
},
drawer: {
width: drawerWidth,
flexShrink: 0,
},
drawerPaper: {
width: drawerWidth,
backgroundColor: '#212121',
zIndex: 988,
},
logo: {
marginLeft: theme.spacing(8),
marginRight: theme.spacing(8),
},
icon: {
height: theme.spacing(4),
},
divider: {
const useStyles = makeStyles()(theme => ({
root: {
flexWrap: 'nowrap',
minHeight: `calc(100vh - ${drawerHeaderHeight}px)`,
paddingBottom: theme.spacing(8),
},
drawer: {
width: drawerWidth,
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: {
width: drawerWidth,
backgroundColor: '#212121',
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: {
flex: 1,
display: 'flex',
alignItems: 'center',
overflow: 'hidden',
},
logoImg: {
maxWidth: '100%',
display: 'block',
},
toggleButton: {
color: '#9f9f9f',
'&:hover': {
color: '#f9f9f9',
backgroundColor: '#2c2c2c',
marginLeft: theme.spacing(4),
marginRight: theme.spacing(4),
},
link: {
color: '#9f9f9f',
},
toggleButtonCollapsed: {
marginLeft: 'auto',
},
icon: {
height: theme.spacing(4),
},
divider: {
backgroundColor: '#2c2c2c',
marginLeft: theme.spacing(4),
marginRight: theme.spacing(4),
},
link: {
color: '#9f9f9f',
textDecoration: 'none',
'&:hover': {
textDecoration: 'none',
'&:hover': {
textDecoration: 'none',
// https://github.com/mui-org/material-ui/issues/22543
'@media (hover: none)': {
textDecoration: 'none',
},
// https://github.com/mui-org/material-ui/issues/22543
'@media (hover: none)': {
textDecoration: 'none',
},
},
}),
)
},
}))
export default function SideBar(): ReactElement {
const classes = useStyles()
const { isBeeDesktop } = useIsBeeDesktop()
const { providerUrl } = useContext(TopUpContext)
const { classes } = useStyles()
const { isDesktop } = useContext(SettingsContext)
const { nodeInfo } = useContext(BeeContext)
const [isCollapsed, setIsCollapsed] = useState(false)
const navBarItems = [
{
@@ -84,9 +135,15 @@ export default function SideBar(): ReactElement {
icon: FilesIcon,
pathMatcherSubstring: '/files/',
},
{
label: 'File Manager',
path: ROUTES.FILEMANAGER,
icon: FileManagerIcon,
pathMatcherSubstring: '/filemanager',
},
{
label: 'Account',
path: providerUrl === null ? ROUTES.WALLET : ROUTES.ACCOUNT_WALLET,
path: ROUTES.ACCOUNT_WALLET,
icon: AccountIcon,
pathMatcherSubstring: '/account/',
},
@@ -98,13 +155,28 @@ export default function SideBar(): ReactElement {
]
return (
<Drawer className={classes.drawer} variant="permanent" anchor="left" classes={{ paper: classes.drawerPaper }}>
<Grid container direction="column" justifyContent="space-between" className={classes.root}>
<Grid className={classes.logo}>
<Link to={ROUTES.INFO}>
<img alt="swarm" src={isBeeDesktop ? DesktopLogo : DashboardLogo} />
<Drawer
className={`${classes.drawer} ${isCollapsed ? classes.drawerCollapsed : ''}`}
variant="permanent"
anchor="left"
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>
</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>
<List>
{navBarItems.map(p => (
@@ -115,27 +187,51 @@ export default function SideBar(): ReactElement {
path={p.path}
pathMatcherSubstring={p.pathMatcherSubstring}
label={p.label}
isCollapsed={isCollapsed}
/>
</Link>
))}
</List>
<Divider className={classes.divider} />
<List>
<MUILink href={config.BEE_DOCS_HOST} target="_blank" className={classes.link}>
<MUILink href={BEE_DOCS_HOST} target="_blank" className={classes.link}>
<SideBarItem
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>}
isCollapsed={isCollapsed}
/>
</MUILink>
</List>
<Divider className={classes.divider} />
<List>
<MUILink
href={isDesktop ? GITHUB_BEE_DESKTOP_URL : GITHUB_BEE_DASHBOARD_URL}
target="_blank"
className={classes.link}
>
<SideBarItem
iconStart={<GithubIcon className={classes.icon} />}
iconEnd={!isCollapsed ? <ExternalLinkIcon className={classes.icon} color="#595959" /> : undefined}
label={<span>GitHub</span>}
isCollapsed={isCollapsed}
/>
</MUILink>
</List>
<Divider className={classes.divider} />
{!isCollapsed && (
<Box mt={4}>
<Link to={ROUTES.TOP_UP_GIFT_CODE}>
<Typography align="center">Redeem gift code</Typography>
</Link>
</Box>
)}
</Grid>
<Grid>
<List>
<Link to={ROUTES.STATUS} className={classes.link}>
<SideBarStatus path={ROUTES.STATUS} />
<SideBarStatus path={ROUTES.STATUS} isCollapsed={isCollapsed} />
</Link>
<Feedback />
</List>
</Grid>
</Grid>
+46 -23
View File
@@ -1,9 +1,9 @@
import { ListItem, ListItemIcon, ListItemText } from '@material-ui/core'
import { createStyles, makeStyles, Theme, withStyles } from '@material-ui/core/styles'
import { ListItemButton, ListItemIcon, ListItemText, Tooltip } from '@mui/material'
import type { ReactElement, ReactNode } from 'react'
import { matchPath, useLocation } from 'react-router-dom'
import { makeStyles } from 'tss-react/mui'
const StyledListItem = withStyles((theme: Theme) => ({
const useItemStyles = makeStyles()(theme => ({
root: {
paddingLeft: theme.spacing(4),
paddingRight: theme.spacing(4),
@@ -13,8 +13,6 @@ const StyledListItem = withStyles((theme: Theme) => ({
backgroundColor: '#2c2c2c',
color: '#f9f9f9',
},
},
button: {
'&:hover': {
backgroundColor: '#2c2c2c',
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) =>
createStyles({
icon: {
color: 'inherit',
},
activeIcon: {
color: theme.palette.primary.main,
},
}),
)
const useStyles = makeStyles()(theme => ({
icon: {
color: 'inherit',
minWidth: 0,
},
activeIcon: {
color: theme.palette.primary.main,
minWidth: 0,
},
label: {
marginLeft: theme.spacing(2),
},
}))
interface Props {
iconStart?: ReactNode
@@ -45,20 +51,37 @@ interface Props {
path?: string
label: ReactNode
pathMatcherSubstring?: string
isCollapsed?: boolean
}
export default function SideBarItem({ iconStart, iconEnd, path, label, pathMatcherSubstring }: Props): ReactElement {
const classes = useStyles()
export default function SideBarItem({
iconStart,
iconEnd,
path,
label,
pathMatcherSubstring,
isCollapsed,
}: Props): ReactElement {
const { classes } = useStyles()
const { classes: itemClasses } = useItemStyles()
const location = useLocation()
const isSelected = pathMatcherSubstring
? location.pathname.startsWith(pathMatcherSubstring)
: Boolean(path && matchPath(location.pathname, path))
return (
<StyledListItem button selected={isSelected} disableRipple>
<ListItemIcon className={isSelected ? classes.activeIcon : classes.icon}>{iconStart}</ListItemIcon>
<ListItemText primary={label} />
<ListItemIcon className={isSelected ? classes.activeIcon : classes.icon}>{iconEnd}</ListItemIcon>
</StyledListItem>
<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>
{!isCollapsed && <ListItemText primary={label} className={classes.label} />}
{!isCollapsed && iconEnd && (
<ListItemIcon className={isSelected ? classes.activeIcon : classes.icon}>{iconEnd}</ListItemIcon>
)}
</ListItemButton>
</Tooltip>
)
}
+83 -53
View File
@@ -1,77 +1,107 @@
import { ListItemButton, ListItemIcon, ListItemText, Tooltip, Typography } from '@mui/material'
import { ReactElement, useContext } from 'react'
import { useLocation, matchPath } from 'react-router-dom'
import { matchPath, useLocation } from 'react-router-dom'
import ArrowRight from 'remixicon-react/ArrowRightLineIcon'
import { makeStyles } from 'tss-react/mui'
import { createStyles, Theme, makeStyles } from '@material-ui/core/styles'
import { ListItemText, ListItemIcon, ListItem, Typography } from '@material-ui/core'
import { Context } from '../providers/Bee'
import StatusIcon from './StatusIcon'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
icon: {
color: 'inherit',
},
iconSmall: {
height: theme.spacing(2),
},
const useStyles = makeStyles()(theme => ({
icon: {
color: 'inherit',
},
iconSmall: {
height: theme.spacing(2),
},
root: {
height: theme.spacing(4),
paddingLeft: theme.spacing(1),
paddingRight: theme.spacing(4),
color: '#f9f9f9',
borderLeft: '0px solid rgba(0,0,0,0)',
'&.Mui-selected, &.Mui-selected:hover': {
borderLeft: `0px solid ${theme.palette.primary.main}`,
backgroundColor: '#2c2c2c',
},
root: {
height: theme.spacing(4),
paddingLeft: theme.spacing(0),
paddingRight: theme.spacing(0),
color: '#f9f9f9',
borderLeft: '0px solid rgba(0,0,0,0)',
'&.Mui-selected, &.Mui-selected:hover': {
borderLeft: `0px solid ${theme.palette.primary.main}`,
backgroundColor: '#2c2c2c',
},
rootError: {
backgroundColor: 'rgba(255, 58, 82, 0.25)',
},
button: {
'&:hover': {
},
rootError: {
backgroundColor: 'rgba(255, 58, 82, 0.25)',
},
button: {
'&:hover': {
backgroundColor: '#2c2c2c',
color: 'white',
// https://github.com/mui-org/material-ui/issues/22543
'@media (hover: none)': {
backgroundColor: '#2c2c2c',
color: 'white',
// https://github.com/mui-org/material-ui/issues/22543
'@media (hover: none)': {
backgroundColor: '#2c2c2c',
color: 'white',
},
},
},
smallerText: {
fontSize: '0.9rem',
},
}),
)
},
smallerText: {
fontSize: '0.9rem',
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 {
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 classes = useStyles()
const { classes } = useStyles()
const location = useLocation()
const isSelected = Boolean(path && matchPath(location.pathname, path))
return (
<ListItem
button
classes={{ root: `${classes.root} ${status.all ? '' : classes.rootError}`, button: classes.button }}
selected={isSelected}
disableRipple
>
<ListItemIcon style={{ marginLeft: '30px' }}>
<StatusIcon checkState={status.all} isLoading={isLoading} />
</ListItemIcon>
<ListItemText primary={<Typography className={classes.smallerText}>{`Node ${status.all}`}</Typography>} />
<ListItemIcon className={classes.icon}>
{status.all ? null : <ArrowRight className={classes.iconSmall} />}
</ListItemIcon>
</ListItem>
<Tooltip title={isCollapsed ? `Node ${status.all}` : ''} placement="right">
<ListItemButton
classes={{
root: `${classes.root} ${status.all ? '' : classes.rootError} ${isCollapsed ? classes.rootCollapsed : ''}`,
}}
selected={isSelected}
disableRipple
>
<ListItemIcon className={isCollapsed ? classes.statusIconCollapsed : classes.statusIcon}>
<StatusIcon checkState={status.all} isLoading={isLoading} />
</ListItemIcon>
{!isCollapsed && (
<>
<ListItemText
primary={
<Typography
className={`${classes.smallerText} ${classes.statusText}`}
>{`Node ${status.all}`}</Typography>
}
/>
<ListItemIcon className={classes.icon}>
{status.all ? null : <ArrowRight className={classes.iconSmall} />}
</ListItemIcon>
</>
)}
</ListItemButton>
</Tooltip>
)
}
+166
View File
@@ -0,0 +1,166 @@
import { Bee, PostageBatch } from '@ethersphere/bee-js'
import { Box } from '@mui/material'
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 DialogTitle from '@mui/material/DialogTitle'
import Input from '@mui/material/Input'
import { useSnackbar } from 'notistack'
import React, { ReactElement, ReactNode, useState } from 'react'
import { makeStyles } from 'tss-react/mui'
import { CheckState } from '../providers/Bee'
const useStyles = makeStyles()(theme => ({
buttonSelected: {
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',
}
interface Props {
type: StampExtensionType
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 label = `${type} ${stamp.batchID.toHex().substring(0, 8)}`
const handleClickOpen = (e: React.MouseEvent<HTMLButtonElement>) => {
setOpen(true)
e.stopPropagation()
}
const handleClose = () => {
setOpen(false)
}
const handleAction = async () => {
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 {
await bee.topUpBatch(stamp.batchID, amount)
enqueueSnackbar(`Successfully topped up stamp, your changes will appear soon`, { variant: 'success' })
} catch (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
}
try {
await bee.diluteBatch(stamp.batchID, newDepth)
enqueueSnackbar(`Successfully diluted stamp, your changes will appear soon`, { variant: 'success' })
} catch (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>) => {
setAmount(event.target.value)
}
return (
<Box mb={2}>
<Button className={classes.buttonSelected} variant="contained" onClick={handleClickOpen} startIcon={icon}>
{type}
</Button>
<Dialog open={open} onClose={handleClose} aria-labelledby="form-dialog-title">
<DialogTitle id="form-dialog-title">{label}</DialogTitle>
<DialogContent>
<Input
autoFocus
margin="dense"
id="name"
type="text"
placeholder={type === StampExtensionType.Topup ? 'Amount to add' : 'New depth to dilute'}
fullWidth
value={amount}
onChange={handleChange}
/>
</DialogContent>
<DialogActions>
<Button onClick={handleClose} color="primary">
Cancel
</Button>
<Button
disabled={amount === ''}
onClick={async () => {
await handleAction()
handleClose()
}}
color="primary"
>
{type}
</Button>
</DialogActions>
</Dialog>
</Box>
)
}
+8 -1
View File
@@ -1,5 +1,6 @@
import { CircularProgress } from '@mui/material'
import type { ReactElement } from 'react'
import { CircularProgress } from '@material-ui/core'
import { CheckState } from '../providers/Bee'
interface Props {
@@ -25,6 +26,12 @@ export default function StatusIcon({ checkState, size, className, isLoading }: P
case CheckState.ERROR:
backgroundColor = '#ff3a52'
break
case CheckState.STARTING:
backgroundColor = 'orange'
break
case CheckState.CONNECTING:
backgroundColor = '#0074D9'
break
default:
// Default is error
backgroundColor = '#ff3a52'
+12 -14
View File
@@ -1,31 +1,29 @@
import { createStyles, makeStyles } from '@material-ui/core'
import { ReactElement } from 'react'
import { makeStyles } from 'tss-react/mui'
interface Props {
children: ReactElement | ReactElement[]
}
const useStyles = makeStyles(() =>
createStyles({
wrapper: {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
width: '175px',
height: '175px',
background: `repeating-linear-gradient(
const useStyles = makeStyles()(() => ({
wrapper: {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
width: '175px',
height: '175px',
background: `repeating-linear-gradient(
45deg,
#efefef,
#efefef 4px,
#ffffff 4px,
#ffffff 8px
)`,
},
}),
)
},
}))
export function StripedWrapper({ children }: Props): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
return <div className={classes.wrapper}>{children}</div>
}
+27 -28
View File
@@ -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 type { RemixiconReactIconProps } from 'remixicon-react'
import { makeStyles } from 'tss-react/mui'
export interface SwarmButtonProps extends ButtonProps {
iconType: React.ComponentType<RemixiconReactIconProps>
@@ -9,34 +10,32 @@ export interface SwarmButtonProps extends ButtonProps {
variant?: 'text' | 'contained' | 'outlined'
}
const useStyles = makeStyles(() =>
createStyles({
button: {
height: '42px',
position: 'relative',
whiteSpace: 'nowrap',
color: '#242424',
'&:hover, &:focus': {
'& svg': {
fill: '#fff',
transition: '0.1s',
},
const useStyles = makeStyles()(() => ({
button: {
height: '42px',
position: 'relative',
whiteSpace: 'nowrap',
color: '#242424',
'&:hover, &:focus': {
'& svg': {
fill: '#fff',
transition: '0.1s',
},
},
cancelButton: {
background: '#f7f7f7',
color: '#606060',
},
spinnerWrapper: {
position: 'absolute',
left: '50%',
top: '50%',
width: '40px',
height: '40px',
transform: 'translate(-50%, -50%)',
},
}),
)
},
cancelButton: {
background: '#f7f7f7',
color: '#606060',
},
spinnerWrapper: {
position: 'absolute',
left: '50%',
top: '50%',
width: '40px',
height: '40px',
transform: 'translate(-50%, -50%)',
},
}))
export function SwarmButton({
children,
@@ -50,7 +49,7 @@ export function SwarmButton({
style,
...other
}: SwarmButtonProps): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
function getIconColor() {
if (loading || disabled) {
+1 -1
View File
@@ -1,4 +1,4 @@
import { Box, Dialog, Grid } from '@material-ui/core'
import { Box, Dialog, Grid } from '@mui/material'
import { ReactElement } from 'react'
interface Props {
+1 -1
View File
@@ -1,4 +1,4 @@
import { Box, Divider } from '@material-ui/core'
import { Box, Divider } from '@mui/material'
import { ReactElement } from 'react'
interface Props {
+29 -28
View File
@@ -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 { Select } from 'formik-material-ui'
import { Select } from 'formik-mui'
import { ReactElement, ReactNode } from 'react'
import { makeStyles } from 'tss-react/mui'
export type SelectEvent = React.ChangeEvent<{
name?: string | undefined
value: unknown
}>
export type SelectEvent = SelectChangeEvent<string>
function renderValue(value: unknown): ReactNode {
if (typeof value === 'string') {
@@ -28,40 +26,40 @@ interface Props {
options: { value: string; label: string }[]
onChange?: (event: SelectEvent) => void
formik?: boolean
defaultValue?: string
value?: string
placeholder?: string
disabled?: boolean
}
const useStyles = makeStyles((theme: Theme) =>
createStyles({
select: {
borderRadius: 0,
background: theme.palette.background.paper,
'& fieldset': {
border: 0,
},
'& .MuiSelect-select': {
'&:focus': {
background: theme.palette.background.paper,
},
const useStyles = makeStyles()(theme => ({
select: {
borderRadius: 0,
background: theme.palette.background.paper,
'& fieldset': {
border: 0,
},
'& .MuiSelect-select': {
'&:focus': {
background: theme.palette.background.paper,
},
},
option: {
height: '52px',
},
}),
)
},
option: {
height: '52px',
},
}))
export function SwarmSelect({
defaultValue,
value,
formik,
name,
options,
onChange,
label,
placeholder,
disabled = false,
}: Props): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
if (formik) {
return (
@@ -69,13 +67,15 @@ export function SwarmSelect({
{label && <FormHelperText>{label}</FormHelperText>}
<Field
required
disabled={disabled}
component={Select}
name={name}
fullWidth
variant="outlined"
defaultValue={defaultValue}
value={value}
className={classes.select}
displayEmpty
onChange={onChange}
renderValue={(value: unknown) => (value ? renderValue(value) : placeholder)}
MenuProps={{ MenuListProps: { disablePadding: true }, PaperProps: { square: true } }}
>
@@ -94,11 +94,12 @@ export function SwarmSelect({
{label && <FormHelperText>{label}</FormHelperText>}
<MuiSelect
required
disabled={disabled}
name={name}
fullWidth
variant="outlined"
className={classes.select}
defaultValue={defaultValue}
value={value}
onChange={onChange}
displayEmpty
renderValue={(value: unknown) => (value ? renderValue(value) : placeholder)}
+22 -23
View File
@@ -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 { TextField } from 'formik-material-ui'
import { TextField } from 'formik-mui'
import { ChangeEvent, ReactElement } from 'react'
import { makeStyles } from 'tss-react/mui'
interface Props {
name: string
@@ -14,25 +15,23 @@ interface Props {
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void
}
const useStyles = makeStyles((theme: Theme) =>
createStyles({
field: {
background: theme.palette.background.paper,
'& fieldset': {
border: 0,
},
'& .Mui-focused': {
background: theme.palette.background.paper,
},
'& .MuiInputBase-root': {
background: theme.palette.background.paper,
},
'& .MuiFilledInput-root': {
borderRadius: 0,
},
const useStyles = makeStyles()(theme => ({
field: {
background: theme.palette.background.paper,
'& fieldset': {
border: 0,
},
}),
)
'& .Mui-focused': {
background: theme.palette.background.paper,
},
'& .MuiInputBase-root': {
background: theme.palette.background.paper,
},
'& .MuiFilledInput-root': {
borderRadius: 0,
},
},
}))
export function SwarmTextInput({
name,
@@ -44,7 +43,7 @@ export function SwarmTextInput({
defaultValue,
placeholder,
}: Props): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
if (formik) {
return (
@@ -58,7 +57,7 @@ export function SwarmTextInput({
variant="filled"
className={classes.field}
defaultValue={defaultValue || ''}
InputProps={{ disableUnderline: true }}
slotProps={{ input: { disableUnderline: true } }}
placeholder={placeholder}
/>
)
@@ -74,7 +73,7 @@ export function SwarmTextInput({
className={classes.field}
defaultValue={defaultValue || ''}
onChange={onChange}
InputProps={{ disableUnderline: true }}
slotProps={{ input: { disableUnderline: true } }}
placeholder={placeholder}
/>
)
+12 -14
View File
@@ -1,6 +1,6 @@
import { Tab, Tabs } from '@mui/material'
import React, { ReactElement, ReactNode } from 'react'
import { makeStyles, Theme, createStyles } from '@material-ui/core/styles'
import { Tab, Tabs } from '@material-ui/core'
import { makeStyles } from 'tss-react/mui'
interface TabPanelProps {
children?: ReactNode
@@ -18,16 +18,14 @@ function TabPanel(props: TabPanelProps) {
)
}
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
flexGrow: 1,
},
content: {
marginTop: theme.spacing(2),
},
}),
)
const useStyles = makeStyles()(theme => ({
root: {
flexGrow: 1,
},
content: {
marginTop: theme.spacing(2),
},
}))
interface TabsValues {
component: ReactNode
@@ -41,10 +39,10 @@ interface Props {
}
export default function SimpleTabs({ values, index, indexChanged }: Props): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
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)
else setValue(newValue)
}
+10 -10
View File
@@ -1,5 +1,7 @@
import { createStyles, Grid, makeStyles, Typography } from '@material-ui/core'
import { Grid, Typography } from '@mui/material'
import { ReactElement } from 'react'
import { makeStyles } from 'tss-react/mui'
import { CloseButton } from './CloseButton'
interface Props {
@@ -7,17 +9,15 @@ interface Props {
onClose: () => void
}
const useStyles = makeStyles(() =>
createStyles({
text: {
color: '#606060',
fontWeight: 'bold',
},
}),
)
const useStyles = makeStyles()(() => ({
text: {
color: '#606060',
fontWeight: 'bold',
},
}))
export function TitleWithClose({ children, onClose }: Props): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
return (
<Grid container justifyContent="space-between" alignItems="center">
+2
View File
@@ -1,6 +1,8 @@
import type { Topology } from '@ethersphere/bee-js'
import type { ReactElement } from 'react'
import { pickThreshold, ThresholdValues } from '../utils/threshold'
import ExpandableListItem from './ExpandableListItem'
interface Props {
+25 -26
View File
@@ -1,53 +1,52 @@
import { Button, Grid, Link as MuiLink, Typography } from '@material-ui/core/'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { Button, Grid, Link as MuiLink, Typography } from '@mui/material'
import type { ReactElement } from 'react'
import Activity from 'remixicon-react/PulseLineIcon'
import { Link } from 'react-router-dom'
import { config } from '../config'
import Activity from 'remixicon-react/PulseLineIcon'
import { makeStyles } from 'tss-react/mui'
import { BEE_DISCORD_HOST, BEE_DOCS_HOST } from '../constants'
import { ROUTES } from '../routes'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
height: '100%',
const useStyles = makeStyles()(theme => ({
root: {
height: '100%',
},
content: {
maxWidth: 500,
marginBottom: theme.spacing(4),
'&:last-child': {
marginBottom: 0,
},
content: {
maxWidth: 500,
marginBottom: theme.spacing(4),
'&:last-child': {
marginBottom: 0,
},
},
icon: {
height: '1rem',
},
}),
)
},
icon: {
height: '1rem',
},
}))
export default function TroubleshootConnectionCard(): ReactElement {
const classes = useStyles()
const { classes } = useStyles()
return (
<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">
Uh oh, it looks like your node is not connected.
</Typography>
</Grid>
<Grid item className={classes.content}>
<Grid className={classes.content}>
<Typography align="center">
Please check your node status to fix the problem. You can also check out the{' '}
<MuiLink href={config.BEE_DOCS_HOST} target="_blank" rel="noreferrer">
<MuiLink href={BEE_DOCS_HOST} target="_blank" rel="noreferrer">
Swarm Bee Docs
</MuiLink>{' '}
or ask for support on the{' '}
<MuiLink href={config.BEE_DISCORD_HOST} target="_blank" rel="noreferrer">
<MuiLink href={BEE_DISCORD_HOST} target="_blank" rel="noreferrer">
Ethereum Swarm Discord
</MuiLink>
.
</Typography>
</Grid>
<Grid item className={classes.content}>
<Grid className={classes.content}>
<Typography align="center">
<Button
component={Link}
+1 -1
View File
@@ -1,4 +1,4 @@
import { CircularProgress, Grid } from '@material-ui/core'
import { CircularProgress, Grid } from '@mui/material'
import { ReactElement } from 'react'
export function Waiting(): ReactElement {
+54 -20
View File
@@ -1,24 +1,54 @@
import { ReactElement, ReactNode, useState } from 'react'
import Button from '@material-ui/core/Button'
import Input from '@material-ui/core/Input'
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 { Token } from '../models/Token'
import type { BigNumber } from 'bignumber.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 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 {
successMessage: string
errorMessage: string
dialogMessage: string
label: string
max?: BigNumber
min?: BigNumber
action: (amount: bigint) => Promise<string>
max?: BZZ
min?: BZZ
action: (amount: BZZ) => Promise<TransactionId>
icon?: ReactNode
}
@@ -32,9 +62,11 @@ export default function WithdrawDepositModal({
action,
icon,
}: Props): ReactElement {
const { classes } = useStyles()
const [open, setOpen] = useState(false)
const [amount, setAmount] = useState('')
const [amountToken, setAmountToken] = useState<Token | null>(null)
const [amountToken, setAmountToken] = useState<BZZ | null>(null)
const [amountError, setAmountError] = useState<Error | null>(null)
const { enqueueSnackbar } = useSnackbar()
@@ -51,10 +83,12 @@ export default function WithdrawDepositModal({
if (amountToken === null) return
try {
const transactionHash = await action(amountToken.toBigInt as bigint)
const transactionHash = await action(amountToken)
setOpen(false)
enqueueSnackbar(`${successMessage} Transaction ${transactionHash}`, { variant: 'success' })
} catch (e) {
// eslint-disable-next-line no-console
console.error(e)
enqueueSnackbar(`${errorMessage} Error: ${(e as Error).message}`, { variant: 'error' })
}
}
@@ -64,12 +98,12 @@ export default function WithdrawDepositModal({
setAmount(value)
setAmountError(null)
try {
const t = Token.fromDecimal(value)
const t = BZZ.fromDecimalString(value)
setAmountToken(t)
if (min && t.toDecimal.isLessThan(min)) setAmountError(new Error(`Needs to be more than ${min}`))
if (min && t.lt(min)) setAmountError(new Error(`Needs to be more than ${min.toSignificantDigits(4)}`))
if (max && t.toDecimal.isGreaterThan(max)) setAmountError(new Error(`Needs to be less than ${max}`))
if (max && t.gt(max)) setAmountError(new Error(`Needs to be less than ${max.toSignificantDigits(4)}`))
} catch (e) {
setAmountError(e as Error)
}
@@ -77,7 +111,7 @@ export default function WithdrawDepositModal({
return (
<div>
<Button variant="contained" onClick={handleClickOpen} startIcon={icon}>
<Button variant="contained" onClick={handleClickOpen} startIcon={icon} className={classes.buttonSelected}>
{label}
</Button>
<Dialog open={open} onClose={handleClose} aria-labelledby="form-dialog-title">
-29
View File
@@ -1,29 +0,0 @@
class Config {
public readonly BEE_API_HOST: string
public readonly BEE_DEBUG_API_HOST: string
public readonly BLOCKCHAIN_EXPLORER_URL: string
public readonly BEE_DOCS_HOST: string
public readonly BEE_DISCORD_HOST: string
public readonly GITHUB_REPO_URL: string
public readonly BEE_DESKTOP_URL: string
public readonly SENTRY_KEY: string | undefined
public readonly SENTRY_ENVIRONMENT: string | undefined
constructor() {
this.BEE_API_HOST = sessionStorage.getItem('api_host') ?? process.env.REACT_APP_BEE_HOST ?? 'http://localhost:1633'
this.SENTRY_KEY = process.env.REACT_APP_SENTRY_KEY
this.SENTRY_ENVIRONMENT = process.env.REACT_APP_SENTRY_ENVIRONMENT
this.BEE_DEBUG_API_HOST =
sessionStorage.getItem('debug_api_host') ?? process.env.REACT_APP_BEE_DEBUG_HOST ?? 'http://localhost:1635'
this.BLOCKCHAIN_EXPLORER_URL =
process.env.REACT_APP_BLOCKCHAIN_EXPLORER_URL ?? 'https://blockscout.com/xdai/mainnet'
this.BEE_DOCS_HOST = process.env.REACT_APP_BEE_DOCS_HOST ?? 'https://docs.ethswarm.org/docs/'
this.BEE_DISCORD_HOST = process.env.REACT_APP_BEE_DISCORD_HOST ?? 'https://discord.gg/eKr9XPv7'
this.GITHUB_REPO_URL = process.env.REACT_APP_BEE_GITHUB_REPO_URL ?? 'https://api.github.com/repos/ethersphere/bee'
this.BEE_DESKTOP_URL = process.env.REACT_APP_BEE_DESKTOP_URL ?? window.location.origin
}
}
export const config = new Config()
export default config
+15 -3
View File
@@ -1,4 +1,16 @@
export const META_FILE_NAME = '.swarmgatewaymeta.json'
export const PREVIEW_FILE_NAME = '.swarmgatewaypreview.jpeg'
export const META_FILE_NAME = 'metadata'
export const PREVIEW_DIMENSIONS = { maxWidth: 250, maxHeight: 175 }
export const BZZ_LINK_DOMAIN = process.env.REACT_APP_BZZ_LINK_DOMAIN || 'bzz.link'
export const BZZ_LINK_DOMAIN = 'bzz.link'
export const BLOCKCHAIN_EXPLORER_URL = 'https://blockscout.com/xdai/mainnet'
export const BEE_DOCS_HOST = 'https://docs.ethswarm.org/docs/'
export const BEE_DISCORD_HOST = 'https://discord.gg/eKr9XPv7'
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_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_API =
'https://api.github.com/repos/ethersphere/bee-desktop/releases/latest'
export const DEFAULT_BEE_API_HOST = 'http://localhost:1633'
export const DEFAULT_RPC_URL = 'https://xdai.fairdatasociety.org'
export const MIN_STAMP_DEPTH = 17
export const MAX_STAMP_DEPTH = 255
+15 -8
View File
@@ -1,25 +1,32 @@
import { BZZ } from '@ethersphere/bee-js'
import { ReactElement, useContext } from 'react'
import Download from 'remixicon-react/DownloadLineIcon'
import { Context as SettingsContext } from '../providers/Settings'
import WithdrawDepositModal from '../components/WithdrawDepositModal'
import { BigNumber } from 'bignumber.js'
import { Context as BeeContext } from '../providers/Bee'
import { Context as SettingsContext } from '../providers/Settings'
export default function DepositModal(): ReactElement {
const { beeDebugApi } = useContext(SettingsContext)
const { beeApi } = useContext(SettingsContext)
const { refresh } = useContext(BeeContext)
return (
<WithdrawDepositModal
successMessage="Successful deposit."
errorMessage="Error with depositing"
dialogMessage="Specify the amount of xBZZ you would like to deposit to your node."
dialogMessage="Amount of xBZZ to deposit to the checkbook, from your node."
label="Deposit"
icon={<Download size="1rem" />}
min={new BigNumber(0)}
action={(amount: bigint) => {
if (!beeDebugApi) throw new Error('Bee Debug URL is not valid')
min={BZZ.fromPLUR('1')}
action={async (amount: BZZ) => {
if (!beeApi) {
throw new Error('Bee URL is not valid')
}
return beeDebugApi.depositTokens(amount.toString())
const transactionHash = await beeApi.depositBZZToChequebook(amount)
refresh()
return transactionHash
}}
/>
)
+44
View File
@@ -0,0 +1,44 @@
import { BZZ } from '@ethersphere/bee-js'
import { ReactElement, useContext } from 'react'
import Download from 'remixicon-react/DownloadLineIcon'
import WithdrawDepositModal from '../components/WithdrawDepositModal'
import { Context as BeeContext } from '../providers/Bee'
import { Context as SettingsContext } from '../providers/Settings'
interface Props {
onStarted: () => void
onFinished: () => void
}
export default function StakeModal({ onStarted, onFinished }: Props): ReactElement {
const { beeApi } = useContext(SettingsContext)
const { refresh } = useContext(BeeContext)
return (
<WithdrawDepositModal
successMessage="Successfully deposited stake."
errorMessage="Error with depositing"
dialogMessage="Specify the amount of xBZZ you would like to stake. Your first stake must be at least 10 xBZZ. This will lock your tokens."
label="Stake"
icon={<Download size="1rem" />}
min={BZZ.fromPLUR('1')}
action={async (amount: BZZ) => {
if (!beeApi) {
throw new Error('Bee URL is not valid')
}
onStarted()
try {
const transactionHash = await beeApi.depositStake(amount)
return transactionHash
} finally {
refresh()
onFinished()
}
}}
/>
)
}
+15 -7
View File
@@ -1,24 +1,32 @@
import { BigNumber } from 'bignumber.js'
import { BZZ } from '@ethersphere/bee-js'
import { ReactElement, useContext } from 'react'
import Upload from 'remixicon-react/UploadLineIcon'
import WithdrawDepositModal from '../components/WithdrawDepositModal'
import { Context as BeeContext } from '../providers/Bee'
import { Context as SettingsContext } from '../providers/Settings'
export default function WithdrawModal(): ReactElement {
const { beeDebugApi } = useContext(SettingsContext)
const { beeApi } = useContext(SettingsContext)
const { refresh } = useContext(BeeContext)
return (
<WithdrawDepositModal
successMessage="Successful withdrawal."
errorMessage="Error with withdrawing."
dialogMessage="Specify the amount of xBZZ you would like to withdraw from your node."
dialogMessage="Amount of xBZZ to withdraw from the checkbook to your node."
label="Withdraw"
icon={<Upload size="1rem" />}
min={new BigNumber(0)}
action={(amount: bigint) => {
if (!beeDebugApi) throw new Error('Bee Debug URL is not valid')
min={BZZ.fromPLUR('1')}
action={async (amount: BZZ) => {
if (!beeApi) {
throw new Error('Bee URL is not valid')
}
return beeDebugApi.withdrawTokens(amount.toString())
const transactionHash = await beeApi.withdrawBZZFromChequebook(amount)
refresh()
return transactionHash
}}
/>
)
+28 -29
View File
@@ -1,22 +1,21 @@
import { LastCashoutActionResponse, BeeDebug } from '@ethersphere/bee-js'
import { AllSettlements, Bee, BZZ, LastCashoutActionResponse, PeerBalance, Settlements } from '@ethersphere/bee-js'
import { useEffect, useState } from 'react'
import { Token } from '../models/Token'
import { makeRetriablePromise, unwrapPromiseSettlements } from '../utils'
import { Balance, Settlements, Settlement } from '../types'
interface UseAccountingHook {
isLoadingUncashed: boolean
totalUncashed: Token
totalUncashed: BZZ
accounting: Accounting[] | null
}
export interface Accounting {
peer: string
uncashedAmount: Token
balance: Token
received: Token
sent: Token
total: Token
uncashedAmount: BZZ
balance: BZZ
received: BZZ
sent: BZZ
total: BZZ
}
/**
@@ -29,8 +28,8 @@ export interface Accounting {
* @returns
*/
function mergeAccounting(
balances: Balance[] | null,
settlements?: Settlement[],
balances: PeerBalance[] | null,
settlements?: Settlements[],
uncashedAmounts?: LastCashoutActionResponse[],
): Accounting[] | null {
// Settlements or balances are still loading or there is an error -> return null
@@ -44,9 +43,9 @@ function mergeAccounting(
(accounting[peer] = {
peer,
balance,
sent: new Token('0'),
received: new Token('0'),
uncashedAmount: new Token('0'),
sent: BZZ.fromPLUR('0'),
received: BZZ.fromPLUR('0'),
uncashedAmount: BZZ.fromPLUR('0'),
total: balance,
}),
)
@@ -57,7 +56,7 @@ function mergeAccounting(
...accounting[peer],
sent,
received,
total: new Token(accounting[peer].balance.toBigNumber.plus(received.toBigNumber).minus(sent.toBigNumber)),
total: accounting[peer].balance.plus(received).minus(sent),
}),
)
@@ -65,49 +64,49 @@ function mergeAccounting(
if (!uncashedAmounts) return Object.values(accounting).sort((a, b) => (a.peer < b.peer ? -1 : 1))
uncashedAmounts?.forEach(({ peer, uncashedAmount }) => {
accounting[peer].uncashedAmount = new Token(uncashedAmount)
accounting[peer].uncashedAmount = uncashedAmount
})
// Return sorted by the uncashed amount first and then by the peer id
return Object.values(accounting).sort((a, b) => {
const diff = b.uncashedAmount.toBigNumber.minus(a.uncashedAmount.toBigNumber).toNumber()
const diff = Number(b.uncashedAmount.minus(a.uncashedAmount))
if (diff !== 0) return diff
if (diff !== 0) {
return diff
}
return a.peer < b.peer ? -1 : 1
})
}
export const useAccounting = (
beeDebugApi: BeeDebug | null,
settlements: Settlements | null,
balances: Balance[] | null,
beeApi: Bee | null,
settlements: AllSettlements | null,
balances: PeerBalance[] | null,
): UseAccountingHook => {
const [isLoadingUncashed, setIsloadingUncashed] = useState<boolean>(false)
const [uncashedAmounts, setUncashedAmounts] = useState<LastCashoutActionResponse[] | undefined>(undefined)
useEffect(() => {
// We don't have any settlements loaded yet or we are already loading/have loaded the uncashed amounts
if (isLoadingUncashed || !beeDebugApi || !settlements || uncashedAmounts) return
if (isLoadingUncashed || !beeApi || !settlements || uncashedAmounts) return
setIsloadingUncashed(true)
const promises = settlements.settlements
.filter(({ received }) => received.toBigNumber.gt('0'))
.map(({ peer }) => makeRetriablePromise(() => beeDebugApi.getLastCashoutAction(peer)))
.filter(({ received }) => received.gt(BZZ.fromPLUR('0')))
.map(({ peer }) => makeRetriablePromise(() => beeApi.getLastCashoutAction(peer)))
Promise.allSettled(promises).then(settlements => {
const results = unwrapPromiseSettlements(settlements)
setUncashedAmounts(results.fulfilled)
setIsloadingUncashed(false)
})
}, [settlements, isLoadingUncashed, uncashedAmounts, beeDebugApi])
}, [settlements, isLoadingUncashed, uncashedAmounts, beeApi])
const accounting = mergeAccounting(balances, settlements?.settlements, uncashedAmounts)
let totalUncashed: Token = new Token('0')
accounting?.forEach(
({ uncashedAmount }) => (totalUncashed = new Token(totalUncashed.toBigNumber.plus(uncashedAmount.toBigNumber))),
)
let totalUncashed = BZZ.fromPLUR('0')
accounting?.forEach(({ uncashedAmount }) => (totalUncashed = totalUncashed.plus(uncashedAmount)))
return {
isLoadingUncashed,

Some files were not shown because too many files have changed in this diff Show More