Skip to content

UI optimization#81

Open
ngvtuan wants to merge 15 commits into
mainfrom
feat/ui-optimization
Open

UI optimization#81
ngvtuan wants to merge 15 commits into
mainfrom
feat/ui-optimization

Conversation

@ngvtuan

@ngvtuan ngvtuan commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

No description provided.

…/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
@ghost

ghost commented Dec 10, 2025

Copy link
Copy Markdown

Rooviewer Clock   See task on Roo Cloud

I've reviewed the changes. The typo in fileZise has been fixed. The logic bug in getSummary regarding totalSupernode has also been resolved.

  • Fix typo fileZise to fileSize in apps/web/src/hooks/useCascade.ts
  • Fix logic bug in getSummary where totalSupernode is set to 0 on success in apps/web/src/hooks/useCascade.ts
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@ngvtuan ngvtuan requested a review from a-ok123 December 10, 2025 06:16
Comment thread apps/web/src/hooks/useCascade.ts Outdated
Comment thread apps/web/src/hooks/useCascade.ts Outdated
Comment thread apps/web/src/hooks/useCascade.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useCascade to 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/';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants