mirror of
https://github.com/skidoodle/hostinfo
synced 2026-04-28 01:27:36 +02:00
da23868817
Introduce modular host info UI components: Header, InfoRow, CopyButton, and Browser/Local/Public views. Refactor ServerInfo to compose these components. Add network error handling: background listens for webRequest onErrorOccurred and forwards errors to Tab.handleError. Implement Tab.handleError to store friendly error info and Tab.processSystemPage to handle browser/system pages.
28 lines
733 B
TypeScript
28 lines
733 B
TypeScript
import type { HostInfo } from '@/utils/types';
|
|
import Error from './Error';
|
|
import { BrowserResourceView } from './Browser';
|
|
import { LocalNetworkView } from './Local';
|
|
import { PublicNetworkView } from './Public';
|
|
|
|
export default function ServerInfo({ data }: { data: HostInfo }) {
|
|
const { network, isBrowserResource } = data;
|
|
|
|
// Browser Resource View
|
|
if (isBrowserResource) {
|
|
return <BrowserResourceView data={data} />;
|
|
}
|
|
|
|
// Fallback if network data is missing
|
|
if (!network) {
|
|
return <Error error="Host information unavailable." />;
|
|
}
|
|
|
|
// Local Network View
|
|
if (network.isLocal) {
|
|
return <LocalNetworkView data={data} />;
|
|
}
|
|
|
|
// Public Internet View
|
|
return <PublicNetworkView data={data} />;
|
|
}
|