🔥 Remove update indicator from settings

Co-authored-by: Bjorn L. <walkxnl@gmail.com>
This commit is contained in:
ajnart
2022-05-18 22:08:09 +02:00
parent 7e5602c881
commit 879581224a

View File

@@ -2,19 +2,15 @@ import {
ActionIcon, ActionIcon,
Group, Group,
Modal, Modal,
Switch,
Title, Title,
Text, Text,
Tooltip, Tooltip,
SegmentedControl, SegmentedControl,
Indicator,
Alert,
TextInput, TextInput,
} from '@mantine/core'; } from '@mantine/core';
import { useColorScheme } from '@mantine/hooks'; import { useColorScheme } from '@mantine/hooks';
import { useEffect, useState } from 'react'; import { useState } from 'react';
import { AlertCircle, Settings as SettingsIcon } from 'tabler-icons-react'; import { Settings as SettingsIcon } from 'tabler-icons-react';
import { CURRENT_VERSION, REPO_URL } from '../../../data/constants';
import { useConfig } from '../../tools/state'; import { useConfig } from '../../tools/state';
import { ColorSchemeSwitch } from '../ColorSchemeToggle/ColorSchemeSwitch'; import { ColorSchemeSwitch } from '../ColorSchemeToggle/ColorSchemeSwitch';
import ConfigChanger from '../Config/ConfigChanger'; import ConfigChanger from '../Config/ConfigChanger';
@@ -40,14 +36,6 @@ function SettingsMenu(props: any) {
return ( return (
<Group direction="column" grow> <Group direction="column" grow>
<Alert
icon={<AlertCircle size={16} />}
title="Update available"
radius="lg"
hidden={current === latest}
>
Version {latest} is available. Current: {current}
</Alert>
<Group grow direction="column" spacing={0}> <Group grow direction="column" spacing={0}>
<Text>Search engine</Text> <Text>Search engine</Text>
<SegmentedControl <SegmentedControl
@@ -109,20 +97,7 @@ function SettingsMenu(props: any) {
} }
export function SettingsMenuButton(props: any) { export function SettingsMenuButton(props: any) {
const [update, setUpdate] = useState(false);
const [opened, setOpened] = useState(false); const [opened, setOpened] = useState(false);
const [latestVersion, setLatestVersion] = useState(CURRENT_VERSION);
useEffect(() => {
// Fetch Data here when component first mounted
fetch(`https://api.github.com/repos/${REPO_URL}/releases/latest`).then((res) => {
res.json().then((data) => {
setLatestVersion(data.tag_name);
if (data.tag_name !== CURRENT_VERSION) {
setUpdate(true);
}
});
});
}, []);
return ( return (
<> <>
<Modal <Modal
@@ -132,7 +107,7 @@ export function SettingsMenuButton(props: any) {
opened={props.opened || opened} opened={props.opened || opened}
onClose={() => setOpened(false)} onClose={() => setOpened(false)}
> >
<SettingsMenu current={CURRENT_VERSION} latest={latestVersion} /> <SettingsMenu />
</Modal> </Modal>
<ActionIcon <ActionIcon
variant="default" variant="default"
@@ -143,14 +118,7 @@ export function SettingsMenuButton(props: any) {
onClick={() => setOpened(true)} onClick={() => setOpened(true)}
> >
<Tooltip label="Settings"> <Tooltip label="Settings">
<Indicator <SettingsIcon />
size={12}
disabled={CURRENT_VERSION === latestVersion}
offset={-3}
position="top-end"
>
<SettingsIcon />
</Indicator>
</Tooltip> </Tooltip>
</ActionIcon> </ActionIcon>
</> </>