-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Modify title and favicon when item in progress (issue #2392) #6204
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
Merged
psychedelicious
merged 16 commits into
invoke-ai:main
from
jungleBadger:modify-title-and-favicon-when-in-progress
Apr 14, 2024
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
01fcd1a
Add alert variation for Invoke favicon
jungleBadger 96d4d62
Add ID to the HTML link element
jungleBadger b24e911
Implement `updatePageTitle` and `updatePageFavicon` methods
jungleBadger 7582479
Update HTML page title and favicon upon queue item event
jungleBadger 7758ec3
Replace `let` with `const`
jungleBadger a85b88a
Apply eslint/prettier fixes
jungleBadger e2d85e7
Increase favicon alert detail size
jungleBadger 6464063
Modify the processing to consider the active queue length instead of …
jungleBadger 2ce0f65
Add JSDoc strings
jungleBadger bf6e578
Apply eslint/prettier fixes
jungleBadger 6b134d0
Apply brand red color and a black border
jungleBadger 19be1fe
Remove unnecessary code
jungleBadger 2a83080
Add a hook as a singleton to update favicon and title upon queueSize …
jungleBadger fbb514d
Import hook in the main App script
jungleBadger 770e763
Remove unnecessary whitespace
jungleBadger 6791794
Merge branch 'main' into modify-title-and-favicon-when-in-progress
psychedelicious File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
5 changes: 5 additions & 0 deletions
5
invokeai/frontend/web/public/assets/images/invoke-alert-favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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,25 @@ | ||
import { useEffect } from 'react'; | ||
import { useGetQueueStatusQuery } from 'services/api/endpoints/queue'; | ||
|
||
const baseTitle = document.title; | ||
const invokeLogoSVG = 'assets/images/invoke-favicon.svg'; | ||
const invokeAlertLogoSVG = 'assets/images/invoke-alert-favicon.svg'; | ||
|
||
/** | ||
* This hook synchronizes the queue status with the page's title and favicon. | ||
* It should be considered a singleton and only used once in the component tree. | ||
*/ | ||
export const useSyncQueueStatus = () => { | ||
const { queueSize } = useGetQueueStatusQuery(undefined, { | ||
selectFromResult: (res) => ({ | ||
queueSize: res.data ? res.data.queue.pending + res.data.queue.in_progress : 0, | ||
}), | ||
}); | ||
useEffect(() => { | ||
document.title = queueSize > 0 ? `(${queueSize}) ${baseTitle}` : baseTitle; | ||
const faviconEl = document.getElementById('invoke-favicon'); | ||
if (faviconEl instanceof HTMLLinkElement) { | ||
faviconEl.href = queueSize > 0 ? invokeAlertLogoSVG : invokeLogoSVG; | ||
} | ||
}, [queueSize]); | ||
}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.