chore: cleanup upgrade modal code
This commit is contained in:
@@ -62,9 +62,7 @@ export const NavBar: React.FC<NavBarProps> = ({
|
|||||||
|
|
||||||
const currentVersion = packageJson.version;
|
const currentVersion = packageJson.version;
|
||||||
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
const [latestVersion, setLatestVersion] = useState<string | null>(null);
|
const [latestVersion, setLatestVersion] = useState<string | null>(null);
|
||||||
const [tab, setTab] = useState(0);
|
|
||||||
const [isUpdateAvailable, setIsUpdateAvailable] = useState(false);
|
const [isUpdateAvailable, setIsUpdateAvailable] = useState(false);
|
||||||
|
|
||||||
const fetchLatestVersion = async (): Promise<string | null> => {
|
const fetchLatestVersion = async (): Promise<string | null> => {
|
||||||
@@ -79,20 +77,6 @@ export const NavBar: React.FC<NavBarProps> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUpdateOpen = () => {
|
|
||||||
setOpen(true);
|
|
||||||
fetchLatestVersion();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleUpdateClose = () => {
|
|
||||||
setOpen(false);
|
|
||||||
setTab(0); // Reset tab to the first tab
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleUpdateTabChange = (event: React.SyntheticEvent, newValue: number) => {
|
|
||||||
setTab(newValue);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleMenuOpen = (event: React.MouseEvent<HTMLElement>) => {
|
const handleMenuOpen = (event: React.MouseEvent<HTMLElement>) => {
|
||||||
setAnchorEl(event.currentTarget);
|
setAnchorEl(event.currentTarget);
|
||||||
};
|
};
|
||||||
@@ -197,7 +181,6 @@ export const NavBar: React.FC<NavBarProps> = ({
|
|||||||
<Button
|
<Button
|
||||||
color="primary"
|
color="primary"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={handleUpdateOpen}
|
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: '#ff00c3',
|
backgroundColor: '#ff00c3',
|
||||||
color: 'white',
|
color: 'white',
|
||||||
@@ -249,101 +232,6 @@ export const NavBar: React.FC<NavBarProps> = ({
|
|||||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-end' }}>
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-end' }}>
|
||||||
{!isRecording ? (
|
{!isRecording ? (
|
||||||
<>
|
<>
|
||||||
<Modal open={open} onClose={handleUpdateClose}>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
position: "absolute",
|
|
||||||
top: "50%",
|
|
||||||
left: "50%",
|
|
||||||
transform: "translate(-50%, -50%)",
|
|
||||||
width: 700,
|
|
||||||
bgcolor: "background.paper",
|
|
||||||
boxShadow: 24,
|
|
||||||
p: 4,
|
|
||||||
borderRadius: 2,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{latestVersion === null ? (
|
|
||||||
<Typography>Checking for updates...</Typography>
|
|
||||||
) : currentVersion === latestVersion ? (
|
|
||||||
<Typography variant="h6" textAlign="center">
|
|
||||||
{t('navbar.upgrade.modal.up_to_date')}
|
|
||||||
</Typography>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Typography variant="body1" textAlign="left" sx={{ marginLeft: '30px' }}>
|
|
||||||
{t('navbar.upgrade.modal.new_version_available', { version: latestVersion })}
|
|
||||||
<br />
|
|
||||||
{t('navbar.upgrade.modal.view_updates')}
|
|
||||||
<a href="https://github.com/getmaxun/maxun/releases/" target="_blank" style={{ textDecoration: 'none' }}>{' '}here.</a>
|
|
||||||
</Typography>
|
|
||||||
<Tabs
|
|
||||||
value={tab}
|
|
||||||
onChange={handleUpdateTabChange}
|
|
||||||
sx={{ marginTop: 2, marginBottom: 2, marginLeft: '30px' }}
|
|
||||||
>
|
|
||||||
<Tab label={t('navbar.upgrade.modal.tabs.manual_setup')} />
|
|
||||||
<Tab label={t('navbar.upgrade.modal.tabs.docker_setup')} />
|
|
||||||
</Tabs>
|
|
||||||
{tab === 0 && (
|
|
||||||
<Box sx={{ marginLeft: '30px', background: '#cfd0d1', padding: 1, borderRadius: 3 }}>
|
|
||||||
<code style={{ color: 'black' }}>
|
|
||||||
<p>Run the commands below</p>
|
|
||||||
# cd to project directory (eg: maxun)
|
|
||||||
<br />
|
|
||||||
cd maxun
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
# pull latest changes
|
|
||||||
<br />
|
|
||||||
git pull origin master
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
# install dependencies
|
|
||||||
<br />
|
|
||||||
npm install
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
# start maxun
|
|
||||||
<br />
|
|
||||||
npm run start
|
|
||||||
</code>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
{tab === 1 && (
|
|
||||||
<Box sx={{ marginLeft: '30px', background: '#cfd0d1', padding: 1, borderRadius: 3 }}>
|
|
||||||
<code style={{ color: 'black' }}>
|
|
||||||
<p>Run the commands below</p>
|
|
||||||
# cd to project directory (eg: maxun)
|
|
||||||
<br />
|
|
||||||
cd maxun
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
# stop the working containers
|
|
||||||
<br />
|
|
||||||
docker-compose down
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
# Remove existing backend and frontend images
|
|
||||||
<br />
|
|
||||||
docker rmi getmaxun/maxun-frontend:latest getmaxun/maxun-backend:latest
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
# pull latest docker images
|
|
||||||
<br />
|
|
||||||
docker-compose pull backend frontend
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
# start maxun
|
|
||||||
<br />
|
|
||||||
docker-compose up -d
|
|
||||||
</code>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
</Modal>
|
|
||||||
{/* <iframe
|
{/* <iframe
|
||||||
src="https://ghbtns.com/github-btn.html?user=getmaxun&repo=maxun&type=star&count=true&size=large"
|
src="https://ghbtns.com/github-btn.html?user=getmaxun&repo=maxun&type=star&count=true&size=large"
|
||||||
// frameBorder="0"
|
// frameBorder="0"
|
||||||
|
|||||||
Reference in New Issue
Block a user