Skip to content

Fix: [Software update notification overlapping] #9128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Utils/Notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ export const Success = ({ msg }) => {
notify(msg, "success");
};

/*Info message Handler*/
export const Info = ({ msg }) => {
notify(msg, "info");
};

/** Error message handler */
export const Error = ({ msg }) => {
notify(msg, "error");
Expand Down
36 changes: 20 additions & 16 deletions src/components/Users/UserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import request from "@/Utils/request/request";
import uploadFile from "@/Utils/request/uploadFile";
import useQuery from "@/Utils/request/useQuery";
import {
classNames,
dateQueryString,
formatDate,
formatDisplayName,
Expand Down Expand Up @@ -453,6 +452,9 @@ export default function UserProfile() {
isUpdateAvailable: true,
isChecking: false,
});
Notification.Info({
msg: "A new update is available. Click 'Update' to proceed.",
});
} else {
setUpdateStatus({
isUpdateAvailable: false,
Expand Down Expand Up @@ -1006,31 +1008,33 @@ export default function UserProfile() {
</p>
</div>
</div>
{updateStatus.isUpdateAvailable && (
{updateStatus.isUpdateAvailable && !updateStatus.isChecking && (
<UpdatableApp silentlyAutoUpdate={false}>
<ButtonV2 disabled={true}>
<ButtonV2 onClick={checkUpdates} disabled={false}>
<div className="flex items-center gap-4">
<CareIcon icon="l-exclamation" className="text-2xl" />
{t("update_available")}
</div>
</ButtonV2>
</UpdatableApp>
)}
{/* Show "Check for Update" Button if update is not available and check is not in progress */}
<div className="mt-5 md:col-span-2 md:mt-0">
{!updateStatus.isUpdateAvailable && (
<ButtonV2 disabled={updateStatus.isChecking} onClick={checkUpdates}>
{" "}
{!updateStatus.isUpdateAvailable && !updateStatus.isChecking && (
<ButtonV2 onClick={checkUpdates}>
<div className="flex items-center gap-4">
<CareIcon icon="l-sync" className="text-2xl" />
{t("check_for_update")}
</div>
</ButtonV2>
)}

{/* Show "Checking for Update" Button when the update check is in progress */}
{updateStatus.isChecking && (
<ButtonV2 disabled={true}>
<div className="flex items-center gap-4">
<CareIcon
icon="l-sync"
className={classNames(
"text-2xl",
updateStatus.isChecking && "animate-spin",
)}
/>
{updateStatus.isChecking
? t("checking_for_update")
: t("check_for_update")}
<CareIcon icon="l-sync" className="text-2xl animate-spin" />
{t("checking_for_update")}
</div>
</ButtonV2>
)}
Expand Down
Loading