-
-
Notifications
You must be signed in to change notification settings - Fork 803
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
Auto Tag Confirmation #4016
Open
Flashy78
wants to merge
6
commits into
stashapp:develop
Choose a base branch
from
Flashy78:autotag-confirm
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Auto Tag Confirmation #4016
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
12cd25b
Autotag and Identify text and confirmation
Flashy78 6d9cff8
Fixed sorting
Flashy78 c88db2a
Linting
Flashy78 488e30a
Split out error messages and added icon
Flashy78 a3cd67c
Adding current item to auto tag dialog
Flashy78 8df480e
Adding organized tooltip
Flashy78 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { | ||
IconDefinition, | ||
faMinus, | ||
faPencilAlt, | ||
faPlus, | ||
|
@@ -15,12 +16,29 @@ interface IDirectorySelectionDialogProps { | |
animation?: boolean; | ||
initialPaths?: string[]; | ||
allowEmpty?: boolean; | ||
allowPathSelection?: boolean; | ||
message?: string | React.ReactNode; | ||
header?: string; | ||
icon?: IconDefinition; | ||
acceptButtonText?: string; | ||
acceptButtonVariant?: "danger" | "primary" | "secondary"; | ||
onClose: (paths?: string[]) => void; | ||
} | ||
|
||
export const DirectorySelectionDialog: React.FC< | ||
IDirectorySelectionDialogProps | ||
> = ({ animation, allowEmpty = false, initialPaths = [], onClose }) => { | ||
> = ({ | ||
animation, | ||
allowEmpty = false, | ||
initialPaths = [], | ||
allowPathSelection = true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This entire concept is a bit broken from a design perspective. The component is a |
||
message, | ||
header, | ||
icon = faPencilAlt, | ||
acceptButtonText, | ||
acceptButtonVariant = "primary", | ||
onClose, | ||
}) => { | ||
const intl = useIntl(); | ||
const { configuration } = React.useContext(ConfigurationContext); | ||
|
||
|
@@ -43,14 +61,15 @@ export const DirectorySelectionDialog: React.FC< | |
<ModalComponent | ||
show | ||
modalProps={{ animation }} | ||
disabled={!allowEmpty && paths.length === 0} | ||
icon={faPencilAlt} | ||
header={intl.formatMessage({ id: "actions.select_folders" })} | ||
disabled={!allowEmpty && allowPathSelection && paths.length === 0} | ||
icon={icon} | ||
header={header ?? intl.formatMessage({ id: "actions.select_folders" })} | ||
accept={{ | ||
onClick: () => { | ||
onClose(paths); | ||
}, | ||
text: intl.formatMessage({ id: "actions.confirm" }), | ||
text: acceptButtonText ?? intl.formatMessage({ id: "actions.confirm" }), | ||
variant: acceptButtonVariant, | ||
}} | ||
cancel={{ | ||
onClick: () => onClose(), | ||
|
@@ -78,19 +97,22 @@ export const DirectorySelectionDialog: React.FC< | |
</Row> | ||
))} | ||
|
||
<FolderSelect | ||
currentDirectory={currentDirectory} | ||
setCurrentDirectory={(v) => setCurrentDirectory(v)} | ||
defaultDirectories={libraryPaths} | ||
appendButton={ | ||
<Button | ||
variant="secondary" | ||
onClick={() => addPath(currentDirectory)} | ||
> | ||
<Icon icon={faPlus} /> | ||
</Button> | ||
} | ||
/> | ||
{allowPathSelection ? ( | ||
<FolderSelect | ||
currentDirectory={currentDirectory} | ||
setCurrentDirectory={(v) => setCurrentDirectory(v)} | ||
defaultDirectories={libraryPaths} | ||
appendButton={ | ||
<Button | ||
variant="secondary" | ||
onClick={() => addPath(currentDirectory)} | ||
> | ||
<Icon icon={faPlus} /> | ||
</Button> | ||
} | ||
/> | ||
) : undefined} | ||
{message} | ||
</div> | ||
</ModalComponent> | ||
); | ||
|
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why couldn't this have been put into the existing
CleanDialog
instead of removing theCleanDialog
altogether?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First I duplicated the
CleanDialog
code over intoLibraryTasks.tsx
as anAutoTagDialog
.That was almost identical code, and now a third instance of the
DirectorySelectionDialog
code. So I pulledCleanDialog
andAutoTagDialog
out into a new component file.This new file was almost identical to
DirectorySelectionDialog
, except for the extra styling options, message and option to hide the directory selection.I thought about adding the styling options to
DirectorySelectionDialog
and replacing the directory code in my new file with that component, but I would have to deconstructDirectorySelectionDialog
because it already has a<ModalComponent>
that I couldn't wrap in my higher level<ModelComponent>
.I figured since I was already going to add all the styling options to it, adding message and the option to totally hide it was less complicated and less error prone than trying to refactor
DirectorySelectionDialog
and pull out the directory selection code into a sub component that could be imported into anOptionalDirectorySelectionDialog
component.I could do that if you think it would be a better approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do this instead for now. We can address the duplicate code later if needed.