feat(All) 修改整体页面格式,增加地图中间模型与下方表格间的联动显示
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useState, useCallback } from 'react'
|
||||
import { ThemeProvider } from './contexts/ThemeContext'
|
||||
import ThemeSwitcher from './components/ThemeSwitcher'
|
||||
import FloatingHeader from './components/FloatingHeader'
|
||||
import IpInput from './components/IpInput'
|
||||
import LatencyMap from './components/LatencyMap'
|
||||
import ResultsPanel from './components/ResultsPanel'
|
||||
@@ -11,10 +11,12 @@ import './styles/index.css'
|
||||
function AppContent() {
|
||||
const [results, setResults] = useState<Map<string, LatencyResult>>(new Map())
|
||||
const [testing, setTesting] = useState(false)
|
||||
const [selectedNodeId, setSelectedNodeId] = useState<string | null>(null)
|
||||
|
||||
const handleTest = useCallback(async (target: string) => {
|
||||
setTesting(true)
|
||||
setResults(new Map())
|
||||
setSelectedNodeId(null)
|
||||
|
||||
await testAllNodes(target, (result) => {
|
||||
setResults((prev) => new Map(prev).set(result.nodeId, result))
|
||||
@@ -23,27 +25,33 @@ function AppContent() {
|
||||
setTesting(false)
|
||||
}, [])
|
||||
|
||||
const handleNodeSelect = useCallback((nodeId: string | null) => {
|
||||
setSelectedNodeId(nodeId)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className="app">
|
||||
<header className="app-header">
|
||||
<h1 className="app-title">
|
||||
<span className="title-icon">🌐</span>
|
||||
Latency Test
|
||||
</h1>
|
||||
<ThemeSwitcher />
|
||||
</header>
|
||||
<FloatingHeader />
|
||||
|
||||
<main className="app-main">
|
||||
<main className="app-main" style={{ paddingTop: '5rem' }}>
|
||||
<p className="app-description">
|
||||
Test network latency from global locations to any IP address or domain
|
||||
</p>
|
||||
<IpInput onTest={handleTest} testing={testing} />
|
||||
<LatencyMap results={results} />
|
||||
<ResultsPanel results={results} />
|
||||
<LatencyMap
|
||||
results={results}
|
||||
selectedNodeId={selectedNodeId}
|
||||
onNodeSelect={handleNodeSelect}
|
||||
/>
|
||||
<ResultsPanel
|
||||
results={results}
|
||||
selectedNodeId={selectedNodeId}
|
||||
onNodeSelect={handleNodeSelect}
|
||||
/>
|
||||
</main>
|
||||
|
||||
<footer className="app-footer">
|
||||
<p>Latency thresholds: <span className="excellent">●</span> <50ms <span className="good">●</span> 50-150ms <span className="poor">●</span> >150ms</p>
|
||||
<p>© 2024 Latency Test. Powered by GlobalPing.</p>
|
||||
</footer>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user