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