Skip to content
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

[WIP] Adding In Tagger Buttons #5158

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
65 changes: 65 additions & 0 deletions ui/v2.5/src/components/Tagger/scenes/SceneTagger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,69 @@ export const Tagger: React.FC<ITaggerProps> = ({ scenes, queue }) => {
}
}

function maybeRenderSearchAllButton() {
const searchButtons = document.querySelectorAll('.input-group-append .btn.btn-primary');

if (searchButtons.length > 0) {
return (
<Button onClick={handleSearchAllClick}>
<FormattedMessage id="component_tagger.verb_search_all" />
</Button>
);
}
return null;
}

function handleSearchAllClick() {
const searchButtons = document.querySelectorAll('.input-group-append .btn.btn-primary');

searchButtons.forEach((button, index) => {
setTimeout(() => {
console.log(`Clicking button ${index + 1}:`, button);

if (button instanceof HTMLElement) {
button.click();
}
}, index * 700); // 700ms delay between clicks... its a lot but if it goes too quick then the UI breaks and skips scenes.
});
}

function maybeRenderCreateAllButton() {
const CreateButtons = document.querySelectorAll('.row.no-gutters.align-items-center.mt-2 .btn-group .btn.btn-secondary');

if (CreateButtons.length > 0) {
return (
<Button onClick={handleCreateAllClick}>
<FormattedMessage id="component_tagger.verb_create_all" />
</Button>
);
}
return null;
}

function handleCreateAllClick() {
const createButtons = document.querySelectorAll('.row.no-gutters.align-items-center.mt-2 .btn-group .btn.btn-secondary');

createButtons.forEach((button, index) => {
setTimeout(() => {
console.log(`Clicking create button ${index + 1}:`, button);

if (button instanceof HTMLElement) {
button.click();

setTimeout(() => {
const saveButton = document.querySelector('.ModalFooter.modal-footer .ml-2.btn.btn-primary');
if (saveButton instanceof HTMLElement) {
saveButton.click();
} else {
console.warn(`Save button not found for create button ${index + 1}`);
}
}, 500);
}
}, index * 800);
});
}

function maybeRenderSubmitFingerprintsButton() {
if (pendingFingerprints.length) {
return (
Expand Down Expand Up @@ -253,6 +316,8 @@ export const Tagger: React.FC<ITaggerProps> = ({ scenes, queue }) => {
<div className="d-flex justify-content-between align-items-center flex-wrap">
<div className="w-auto">{renderSourceSelector()}</div>
<div className="d-flex">
{maybeRenderCreateAllButton()}
{maybeRenderSearchAllButton()}
{maybeRenderShowHideUnmatchedButton()}
{maybeRenderSubmitFingerprintsButton()}
{renderFragmentScrapeButton()}
Expand Down
4 changes: 4 additions & 0 deletions ui/v2.5/src/components/Tagger/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
}
}

.d-flex .btn.btn-primary{
margin-right: 3px;
}

.sprite-button {
bottom: 5px;
filter: drop-shadow(1px 1px 1px #222);
Expand Down
2 changes: 2 additions & 0 deletions ui/v2.5/src/locales/en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@
"verb_match_fp": "Match Fingerprints",
"verb_matched": "Matched",
"verb_scrape_all": "Scrape All",
"verb_search_all": "Search All",
"verb_create_all": "Create All",
"verb_submit_fp": "Submit {fpCount, plural, one{# Fingerprint} other{# Fingerprints}}",
"verb_toggle_config": "{toggle} {configuration}",
"verb_toggle_unmatched": "{toggle} unmatched scenes"
Expand Down
Loading