mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 21:44:55 +03:00
simplify used hooks
This commit is contained in:
parent
e45991cb7c
commit
fc9990bb72
@ -14,7 +14,6 @@ const isMac = window.electron.platform === "darwin";
|
||||
export function AutoUpdateSubHeader() {
|
||||
const [showUpdateSubheader, setShowUpdateSubheader] = useState(false);
|
||||
const [newVersion, setNewVersion] = useState("");
|
||||
const [newVersionText, setNewVersionText] = useState("");
|
||||
|
||||
const { t } = useTranslation("header");
|
||||
|
||||
@ -22,18 +21,6 @@ export function AutoUpdateSubHeader() {
|
||||
window.electron.restartAndInstallUpdate();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (isMac) {
|
||||
setNewVersionText(
|
||||
t("version_available_download", { version: newVersion })
|
||||
);
|
||||
} else {
|
||||
setNewVersionText(
|
||||
t("version_available_install", { version: newVersion })
|
||||
);
|
||||
}
|
||||
}, [t, newVersion]);
|
||||
|
||||
useEffect(() => {
|
||||
const unsubscribe = window.electron.onAutoUpdaterEvent(
|
||||
(event: AppUpdaterEvents) => {
|
||||
@ -65,7 +52,9 @@ export function AutoUpdateSubHeader() {
|
||||
{isMac ? (
|
||||
<Link to={releasesPageUrl} className={styles.newVersionLink}>
|
||||
<SyncIcon size={12} />
|
||||
<small>{newVersionText}</small>
|
||||
<small>
|
||||
{t("version_available_download", { version: newVersion })}
|
||||
</small>
|
||||
</Link>
|
||||
) : (
|
||||
<button
|
||||
@ -74,7 +63,9 @@ export function AutoUpdateSubHeader() {
|
||||
onClick={handleClickNewUpdate}
|
||||
>
|
||||
<SyncIcon size={12} />
|
||||
<small>{newVersionText}</small>
|
||||
<small>
|
||||
{t("version_available_install", { version: newVersion })}
|
||||
</small>
|
||||
</button>
|
||||
)}
|
||||
</header>
|
||||
|
Loading…
Reference in New Issue
Block a user