-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tags): enable tags to be set in the stasharr settings (#52)
Allows users to set which tags will be associated with studios, scenes, and performers when they are added to Whisparr using Stasharr. fix #49
- Loading branch information
Showing
21 changed files
with
121 additions
and
103 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
4 changes: 2 additions & 2 deletions
4
src/components/DomainInput.tsx → src/components/settings/DomainInput.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
2 changes: 1 addition & 1 deletion
2
src/components/NavbarLink.tsx → src/components/settings/NavbarLink.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
4 changes: 2 additions & 2 deletions
4
src/components/ProtocolSwitch.tsx → src/components/settings/ProtocolSwitch.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
6 changes: 3 additions & 3 deletions
6
src/components/QualityProfile.tsx → src/components/settings/QualityProfile.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
6 changes: 3 additions & 3 deletions
6
src/components/RootFolderPath.tsx → src/components/settings/RootFolderPath.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
4 changes: 2 additions & 2 deletions
4
src/components/SearchOnAdd.tsx → src/components/settings/SearchOnAdd.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
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
4 changes: 2 additions & 2 deletions
4
src/components/StashInstance.tsx → src/components/settings/StashInstance.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
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,60 @@ | ||
import { Form } from 'solid-bootstrap'; | ||
import { useSettings } from '../../contexts/useSettings'; | ||
import { Stasharr } from '../../enums/Stasharr'; | ||
import { createMemo, createResource, For } from 'solid-js'; | ||
import { Config } from '../../models/Config'; | ||
import WhisparrService from '../../service/WhisparrService'; | ||
import { parseInt } from 'lodash'; | ||
|
||
const Tags = () => { | ||
const { store, setStore } = useSettings(); | ||
|
||
const reactiveStore = createMemo( | ||
() => new Config(store.protocol, store.domain, store.whisparrApiKey), | ||
); | ||
|
||
const [tags] = createResource(reactiveStore, async (s) => { | ||
if (!s.domain || !s.whisparrApiKey) return []; | ||
return WhisparrService.tags(s) || []; | ||
}); | ||
|
||
const handleTagsChange = ( | ||
// eslint-disable-next-line no-undef | ||
selectedOptions: HTMLCollectionOf<HTMLOptionElement>, | ||
) => { | ||
if (selectedOptions.length === 0) setStore('tags', []); | ||
let tags: number[] = []; | ||
for (let i = 0; i < selectedOptions.length; i++) { | ||
const option = selectedOptions.item(i); | ||
if (option) tags.push(parseInt(option.value, 10)); | ||
} | ||
setStore('tags', tags); | ||
}; | ||
return ( | ||
<div class="input-group mb-3"> | ||
<label class="input-group-text">Tags</label> | ||
<Form.Select | ||
aria-label="Tags select" | ||
multiple={true} | ||
onChange={(e) => handleTagsChange(e.target.selectedOptions)} | ||
// value={store.tags.map((tag) => tag + '')} | ||
id={Stasharr.ID.Modal.Tags} | ||
data-bs-toggle="tooltip" | ||
data-bs-title="Enter tags to be associated with the scenes, studios, and performers added via Stasharr." | ||
> | ||
<For each={tags()}> | ||
{(tag) => ( | ||
<option | ||
value={tag.id} | ||
selected={store.tags.filter((t) => t === tag.id).length > 0} | ||
> | ||
{tag.label} | ||
</option> | ||
)} | ||
</For> | ||
</Form.Select> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Tags; |
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
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
Oops, something went wrong.