-
Notifications
You must be signed in to change notification settings - Fork 902
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Innei <[email protected]>
- Loading branch information
Showing
7 changed files
with
58 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
apps/renderer/src/modules/update-notice/UpdateNotice.mobile.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { m } from "framer-motion" | ||
import { useCallback } from "react" | ||
import { useTranslation } from "react-i18next" | ||
|
||
import { getUpdaterStatus, setUpdaterStatus, useUpdaterStatus } from "~/atoms/updater" | ||
import { softBouncePreset } from "~/components/ui/constants/spring" | ||
|
||
export const UpdateNotice = () => { | ||
const updaterStatus = useUpdaterStatus() | ||
const { t } = useTranslation() | ||
|
||
const handleClick = useCallback(() => { | ||
const status = getUpdaterStatus() | ||
if (!status) return | ||
|
||
switch (status.type) { | ||
case "pwa": { | ||
window.location.reload() | ||
break | ||
} | ||
} | ||
setUpdaterStatus(null) | ||
}, []) | ||
|
||
if (!updaterStatus) return null | ||
|
||
return ( | ||
<m.div | ||
className={ | ||
"border-theme-border group absolute inset-x-3 cursor-pointer overflow-hidden rounded-lg border bg-theme-modal-background py-3 text-center text-sm shadow backdrop-blur bottom-safe-offset-3" | ||
} | ||
onClick={handleClick} | ||
initial={{ y: 50, opacity: 0 }} | ||
animate={{ y: 0, opacity: 1 }} | ||
transition={softBouncePreset} | ||
> | ||
<div className="font-medium">{t("notify.update_info", { app_name: APP_NAME })}</div> | ||
<div className="text-xs text-zinc-500">{t("notify.update_info_3")}</div> | ||
</m.div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters