Skip to content

Commit 35f16ab

Browse files
authored
Add Kusama information banner, and fix certain ui issues (#41)
* Add Kusama information banner * Mobile support
1 parent a68957d commit 35f16ab

File tree

8 files changed

+799
-43
lines changed

8 files changed

+799
-43
lines changed

frontend/src/App.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import XcmMessageMetrics from './components/XcmMessageMetrics';
55
import BalanceVerification from './components/BalanceVerification';
66
import AlertsCard from './components/AlertsCard';
77
import BackendUrlInput from './components/BackendUrlInput';
8+
import KusamaMigrationBanner from './components/KusamaMigrationBanner';
9+
import KusamaMigrationStats from './components/KusamaMigrationStats';
810
import { useEventSource, useBackendUrl } from './hooks/useEventSource';
911
import type { EventType } from './hooks/useEventSource';
1012
import './App.css';
@@ -13,6 +15,7 @@ import polkadotLogo from './assets/Polkadot_Token_Pink.png';
1315
function App() {
1416
const [rcBlockNumber, setRcBlockNumber] = useState<number | null>(null);
1517
const [ahBlockNumber, setAhBlockNumber] = useState<number | null>(null);
18+
const [showStatsPage, setShowStatsPage] = useState<boolean>(false);
1619

1720
const { backendUrl, setBackendUrl, isConnected } = useBackendUrl();
1821

@@ -30,8 +33,27 @@ function App() {
3033
setBackendUrl(url);
3134
}, [setBackendUrl]);
3235

36+
const handleNavigateToStats = useCallback(() => {
37+
setShowStatsPage(true);
38+
}, []);
39+
40+
const handleNavigateBack = useCallback(() => {
41+
setShowStatsPage(false);
42+
}, []);
43+
44+
// Render stats page
45+
if (showStatsPage) {
46+
return (
47+
<div className="app">
48+
<KusamaMigrationStats onBack={handleNavigateBack} />
49+
</div>
50+
);
51+
}
52+
53+
// Render main dashboard
3354
return (
3455
<div className="app">
56+
<KusamaMigrationBanner onNavigate={handleNavigateToStats} />
3557
<header>
3658
<div className="logo">
3759
<img src={polkadotLogo} alt="Polkadot Logo" />

frontend/src/components/BalanceVerification.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ const BalanceVerification: React.FC = () => {
4949
}
5050
}, []));
5151

52+
// Subscribe to pallet migration summary for initial state
53+
useEventSource(['palletMigrationSummary'], useCallback((eventType: EventType, data: any) => {
54+
if (eventType === 'palletMigrationSummary' && data.pallets) {
55+
const accountsPallet = data.pallets.find((p: any) => p.palletName === 'Accounts');
56+
if (accountsPallet) {
57+
setAccountMigration({
58+
totalAccounts: accountsPallet.totalItemsProcessed || 0,
59+
timestamp: accountsPallet.lastUpdated,
60+
});
61+
}
62+
}
63+
}, []));
64+
5265
// Format balance for display (assumes balance is in planck, convert to KSM)
5366
const formatBalance = (balance: string | null): string => {
5467
if (!balance) return '-';
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
.kusama-migration-banner {
2+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
3+
border: 1px solid rgba(230, 0, 122, 0.3);
4+
border-radius: 0;
5+
border-left: none;
6+
border-right: none;
7+
border-top: none;
8+
padding: 20px 24px;
9+
margin: 0;
10+
box-shadow: 0 4px 12px rgba(230, 0, 122, 0.15);
11+
transition: all 0.3s ease;
12+
}
13+
14+
.kusama-migration-banner:hover {
15+
border-color: rgba(230, 0, 122, 0.5);
16+
box-shadow: 0 6px 16px rgba(230, 0, 122, 0.25);
17+
transform: translateY(-2px);
18+
}
19+
20+
.banner-content {
21+
display: flex;
22+
align-items: center;
23+
gap: 20px;
24+
}
25+
26+
.banner-icon {
27+
font-size: 32px;
28+
flex-shrink: 0;
29+
}
30+
31+
.banner-text {
32+
flex: 1;
33+
}
34+
35+
.banner-title {
36+
margin: 0;
37+
font-size: 18px;
38+
font-weight: 600;
39+
color: #ffffff;
40+
margin-bottom: 4px;
41+
}
42+
43+
.banner-subtitle {
44+
margin: 0;
45+
font-size: 14px;
46+
color: rgba(255, 255, 255, 0.7);
47+
}
48+
49+
.banner-button {
50+
display: flex;
51+
align-items: center;
52+
gap: 8px;
53+
padding: 10px 20px;
54+
background: rgba(230, 0, 122, 0.1);
55+
border: 1px solid rgba(230, 0, 122, 0.3);
56+
border-radius: 8px;
57+
color: #e6007a;
58+
font-size: 14px;
59+
font-weight: 600;
60+
cursor: pointer;
61+
transition: all 0.2s ease;
62+
flex-shrink: 0;
63+
}
64+
65+
.banner-button:hover {
66+
background: rgba(230, 0, 122, 0.2);
67+
border-color: rgba(230, 0, 122, 0.5);
68+
transform: translateX(4px);
69+
}
70+
71+
.banner-button svg {
72+
transition: transform 0.2s ease;
73+
}
74+
75+
.banner-button:hover svg {
76+
transform: translateX(4px);
77+
}
78+
79+
/* Mobile responsive */
80+
@media (max-width: 768px) {
81+
.banner-content {
82+
flex-direction: column;
83+
text-align: center;
84+
gap: 16px;
85+
}
86+
87+
.banner-button {
88+
width: 100%;
89+
justify-content: center;
90+
}
91+
92+
.banner-title {
93+
font-size: 16px;
94+
}
95+
96+
.banner-subtitle {
97+
font-size: 13px;
98+
}
99+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from 'react';
2+
import './KusamaMigrationBanner.css';
3+
4+
interface KusamaMigrationBannerProps {
5+
onNavigate: () => void;
6+
}
7+
8+
const KusamaMigrationBanner: React.FC<KusamaMigrationBannerProps> = ({ onNavigate }) => {
9+
return (
10+
<div className="kusama-migration-banner">
11+
<div className="banner-content">
12+
<div className="banner-icon"></div>
13+
<div className="banner-text">
14+
<h3 className="banner-title">Kusama Asset Hub Migration Complete!</h3>
15+
<p className="banner-subtitle">View detailed statistics and metrics from the successful migration</p>
16+
</div>
17+
<button className="banner-button" onClick={onNavigate}>
18+
View Stats
19+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
20+
<path d="M9 18L15 12L9 6" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
21+
</svg>
22+
</button>
23+
</div>
24+
</div>
25+
);
26+
};
27+
28+
export default KusamaMigrationBanner;

0 commit comments

Comments
 (0)