FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
AboutDialog.tsx
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2// Copyright (c) 2026-present FERS Contributors (see AUTHORS.md).
3
4import GitHubIcon from '@mui/icons-material/GitHub';
5import {
6 Box,
7 Button,
8 Chip,
9 Dialog,
10 DialogActions,
11 DialogContent,
12 DialogTitle,
13 Divider,
14 Typography,
15} from '@mui/material';
16import { getVersion } from '@tauri-apps/api/app';
17import { openUrl } from '@tauri-apps/plugin-opener';
18import { useEffect, useState } from 'react';
19
20interface AboutDialogProps {
21 open: boolean;
22 onClose: () => void;
23 onLicensesClick: () => void;
24}
25
26const GITHUB_URL = 'https://github.com/stpaine/FERS';
27
28export default function AboutDialog({
29 open,
30 onClose,
31 onLicensesClick,
32}: AboutDialogProps) {
33 const [version, setVersion] = useState('...');
34
35 useEffect(() => {
36 if (!open) return;
37 getVersion()
38 .then(setVersion)
39 .catch(() => setVersion('unknown'));
40 }, [open]);
41
42 const handleGitHub = () => {
43 openUrl(GITHUB_URL).catch(console.error);
44 };
45
46 return (
47 <Dialog open={open} onClose={onClose} maxWidth="xs" fullWidth>
48 <DialogTitle>About FERS</DialogTitle>
49 <DialogContent>
50 <Box
51 sx={{
52 display: 'flex',
53 flexDirection: 'column',
54 alignItems: 'center',
55 gap: 1,
56 pt: 1,
57 pb: 2,
58 textAlign: 'center',
59 }}
60 >
61 <Typography variant="h5" fontWeight="bold">
62 FERS
63 </Typography>
64 <Typography variant="subtitle2" color="text.secondary">
65 Flexible Extensible Radar Simulator
66 </Typography>
67 <Typography variant="body2">Version {version}</Typography>
68 <Chip
69 label="GPL-2.0-only"
70 size="small"
71 variant="outlined"
72 sx={{ mt: 0.5 }}
73 />
74 <Divider flexItem sx={{ my: 1 }} />
75 <Typography variant="body2" color="text.secondary">
76 Copyright © 2006–2008 Marc Brooker and Michael Inggs.
77 </Typography>
78 <Typography variant="body2" color="text.secondary">
79 Copyright © 2008–present FERS Contributors.
80 </Typography>
81 <Button
82 startIcon={<GitHubIcon />}
83 onClick={handleGitHub}
84 size="small"
85 sx={{ mt: 1 }}
86 >
87 View on GitHub
88 </Button>
89 </Box>
90 </DialogContent>
91 <DialogActions sx={{ justifyContent: 'space-between' }}>
92 <Button onClick={onLicensesClick} size="small">
93 Third-Party Licenses
94 </Button>
95 <Button onClick={onClose}>Close</Button>
96 </DialogActions>
97 </Dialog>
98 );
99}