UI optimization#81
Open
ngvtuan wants to merge 15 commits into
Open
Conversation
…/lumera-hub into feat/ui-optimization # Conflicts: # apps/web/src/hooks/useCascade.ts # packages/ui/src/screens/CascadeScreen.tsx
Add fee calculation modal when uploading file Add API to get data for my files Update plugin react-lumera-sdk to 0.0.9
Add fee calculation modal when uploading file Add API to get data for my files Update plugin react-lumera-sdk to 0.0.9 update UI
…col/lumera-hub into feat/ui-optimization # Conflicts: # packages/ui/src/screens/CascadeScreen.tsx
Add pagination and update the logic for retrieving the my files list Update loading for cascade page
Update the API for retrieving supernode information, file list, and Network Storage information.
fixed UI issues
fixed UI issues Update the download cascade function Add status, Last Modified, txID, and size for my files
…col/lumera-hub into feat/ui-optimization # Conflicts: # apps/web/data/supernodes.json
I've reviewed the changes. The typo in
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
ghost
reviewed
Dec 10, 2025
ghost
reviewed
Dec 10, 2025
ghost
reviewed
Dec 11, 2025
There was a problem hiding this comment.
Pull request overview
This PR updates the Cascade (storage) UI and its supporting data-fetching logic, adds a supernode location cache API route, and refreshes dependencies/documentation in the Lumera Hub monorepo.
Changes:
- Refactors Cascade screen to add upload fee confirmation, upload success modal, richer “My Files” table (status/price/fee), and pagination.
- Reworks
useCascadeto fetch supernodes/actions via SNScope/SNAPI endpoints, adds caching for supernode geolocation, and updates download/upload flows. - Updates SDK/dependencies and expands project README and environment configuration.
Reviewed changes
Copilot reviewed 26 out of 29 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates project intro, badges, banner, and official links. |
| pnpm-lock.yaml | Updates lockfile for dependency removals/upgrades. |
| packages/ui/src/screens/CascadeScreen.tsx | Major Cascade UI refactor (modals, table, pagination, map details). |
| apps/web/src/utils/helpers.ts | Tweaks file type simplification; adds IPv4 validator. |
| apps/web/src/utils/format.ts | Adds formatFileSize helper. |
| apps/web/src/utils/api.ts | Adds postExternal wrapper. |
| apps/web/src/types/index.ts | Extends message type with optional metadata and price. |
| apps/web/src/hooks/useWalletConnect.ts | Fixes indentation. |
| apps/web/src/hooks/useValidator.ts | Adjusts error message extraction. |
| apps/web/src/hooks/useUnbond.ts | Adjusts error message extraction. |
| apps/web/src/hooks/useStaking.ts | Adjusts error message extraction. |
| apps/web/src/hooks/useSend.ts | Adjusts error message extraction. |
| apps/web/src/hooks/useRedelegate.ts | Adjusts error message extraction. |
| apps/web/src/hooks/useProposals.ts | Adjusts error message extraction. |
| apps/web/src/hooks/useLatestBlocks.ts | Adjusts error message extraction. |
| apps/web/src/hooks/useGovernances.ts | Adjusts error message extraction and one interpolated error string. |
| apps/web/src/hooks/useGovernanceDetails.ts | Adjusts error message extraction. |
| apps/web/src/hooks/useDeposit.ts | Adjusts error message extraction. |
| apps/web/src/hooks/useDelegate.ts | Adjusts error message extraction. |
| apps/web/src/hooks/useCascade.ts | Major data-flow refactor for Cascade (SNScope/SNAPI, caching, fee modal, downloads). |
| apps/web/src/hooks/useBlockDetails.ts | Adjusts error message extraction. |
| apps/web/src/contants/network.ts | Adds SDK_PRESET and SNSCOPE_URL. |
| apps/web/src/components/Skeleton/index.tsx | Adds className support for Skeleton variants. |
| apps/web/src/app/globals.css | Adds warning color CSS variable. |
| apps/web/src/app/api/supernode/route.ts | Adds API route to read/write cached supernode locations. |
| apps/web/package.json | Removes node-iplocate, upgrades react-lumera-sdk. |
| apps/web/data/supernodes.json | Adds initial cached supernode location dataset. |
| apps/web/.env.example | Replaces IP API keys with SNScope/SDK preset env vars. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comment on lines
+197
to
+199
| const ITEM_PER_PAGE = 10; | ||
| const GAS_PRICE = '025ulume'; | ||
|
|
Comment on lines
+200
to
+209
| export const getTxHash = (file: IMyFile, txs: IRecentActivity[]) => { | ||
| const tx = txs.find((t) => t.height.toString() === file.height.toString() && t.tx.body.messages.some((m) => m.metadata?.indexOf(file.datahash) !== -1)); | ||
| const amount = tx?.tx?.auth_info?.fee?.amount; | ||
| return { | ||
| txhash: tx ? tx.txhash : '', | ||
| timestamp: tx?.timestamp, | ||
| price: tx?.tx.body.messages[0].price ? formatNumber(Number(extractValidNumber(tx?.tx.body.messages[0].price)) / RATE_VALUE, { decimalsLength: 2 }) + ' LUME' : '0', | ||
| fee: `${amount?.length ? (formatNumber(Number(amount[0].amount) / RATE_VALUE, { decimalsLength: 3 })) + ' LUME' : '0'}` | ||
| }; | ||
| } |
Comment on lines
+514
to
+517
| files.push({ | ||
| name: item.decoded.file_name || '', | ||
| size: fileInfo.file_size_kbs || 0, | ||
| txId: '', |
Comment on lines
+532
to
+535
| const getMyFiles = useCallback(async () => { | ||
| setMyFilesLoading(true); | ||
| setMyFilesLoadMore(true); | ||
| try { |
Comment on lines
764
to
771
|
|
||
| if (!stream) { | ||
| if (!streamResul.data) { | ||
| toast.error('Error when downloading the file. Please try again.', { | ||
| position: "bottom-center", | ||
| theme: "dark", | ||
| }); | ||
| return; | ||
| } |
Comment on lines
+369
to
+382
| <RadioGroup.Item value='private' id='radiogroup-private' size="$4"> | ||
| <RadioGroup.Indicator /> | ||
| </RadioGroup.Item> | ||
| <Label size="$4" id='radiogroup-private' className='leading-none'> | ||
| Private | ||
| </Label> | ||
| </div> | ||
| <div className='flex items-center gap-2'> | ||
| <RadioGroup.Item value='publish' id='radiogroup-publish' size="$4"> | ||
| <RadioGroup.Indicator /> | ||
| </RadioGroup.Item> | ||
| <Label size="$4" id='radiogroup-publish' className='leading-none'> | ||
| Publish | ||
| </Label> |
Comment on lines
+141
to
+151
| export async function POST() { | ||
| try { | ||
| updateSupernode(); | ||
| return NextResponse.json({ | ||
| status: true | ||
| }); | ||
| } catch (error) { | ||
| console.error('API Error:', error); | ||
| return NextResponse.json({ error: 'An unknown error occurred.' }, { status: 500 }); | ||
| } | ||
| } |
Comment on lines
+11
to
+36
| const filePath = path.join(process.cwd(), 'data', 'supernodes.json'); | ||
|
|
||
| async function readFile() { | ||
| try { | ||
| const data = await fs.readFile(filePath, 'utf8'); | ||
| return { | ||
| status: true, | ||
| supernodes: JSON.parse(data), | ||
| message: null, | ||
| }; | ||
| } catch (error) { | ||
| return { | ||
| status: false, | ||
| supernodes: [], | ||
| message: (error as Error)?.message || 'An unknown error occurred.' | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| async function writeFile(content: IMarker[]) { | ||
| try { | ||
| await fs.writeFile(filePath, JSON.stringify(content, null, 2), 'utf8'); | ||
| return { success: true, data: content }; | ||
| } catch { | ||
| return { success: false, error: 'Cannot write file' }; | ||
| } |
Comment on lines
+95
to
+99
| const address = item.ip_address; | ||
| const ip = address.split(':')[0]; | ||
| if (isValidIPv4(ip)) { | ||
| const supernode = supernodeData.find((s) => s.address === address); | ||
| if (!supernode) { |
Comment on lines
+13
to
+14
| export const SDK_PRESET = process.env.NEXT_PUBLIC_SDK_PRESET || 'mainnet'; | ||
| export const SNSCOPE_URL = process.env.NEXT_PUBLIC_SNSCOPE_URL || 'https://snscope.testnet.lumera.io/'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.