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

Use a default stash-box name if none provided #1889

Merged
merged 3 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
stringToGender,
} from "src/utils/gender";
import { ConfigurationContext } from "src/hooks/Config";
import { stashboxDisplayName } from "src/utils/stashbox";
import { PerformerScrapeDialog } from "./PerformerScrapeDialog";
import PerformerScrapeModal from "./PerformerScrapeModal";
import PerformerStashBoxModal, { IStashBox } from "./PerformerStashBoxModal";
Expand Down Expand Up @@ -580,7 +581,7 @@ export const PerformerEditPanel: React.FC<IPerformerDetails> = ({
className="minimal"
onClick={() => onScraperSelected({ ...s, index })}
>
{s.name ?? "Stash-Box"}
{stashboxDisplayName(s.name, index)}
</Dropdown.Item>
))}
{queryableScrapers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useIntl } from "react-intl";

import * as GQL from "src/core/generated-graphql";
import { Modal, LoadingIndicator } from "src/components/Shared";
import { stashboxDisplayName } from "src/utils/stashbox";

const CLASSNAME = "PerformerScrapeModal";
const CLASSNAME_LIST = `${CLASSNAME}-list`;
Expand Down Expand Up @@ -52,7 +53,10 @@ const PerformerStashBoxModal: React.FC<IProps> = ({
<Modal
show
onHide={onHide}
header={`Scrape performer from ${instance.name ?? "Stash-Box"}`}
header={`Scrape performer from ${stashboxDisplayName(
instance.name,
instance.index
)}`}
accept={{
text: intl.formatMessage({ id: "actions.cancel" }),
onClick: onHide,
Expand Down
5 changes: 3 additions & 2 deletions ui/v2.5/src/components/Scenes/SceneDetails/SceneEditPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { MovieSelect } from "src/components/Shared/Select";
import { useFormik } from "formik";
import { Prompt } from "react-router";
import { ConfigurationContext } from "src/hooks/Config";
import { stashboxDisplayName } from "src/utils/stashbox";
import { SceneMovieTable } from "./SceneMovieTable";
import { RatingStars } from "./RatingStars";
import { SceneScrapeDialog } from "./SceneScrapeDialog";
Expand Down Expand Up @@ -396,7 +397,7 @@ export const SceneEditPanel: React.FC<IProps> = ({
key={s.endpoint}
onClick={() => onScrapeQueryClicked({ stash_box_index: index })}
>
{s.name ?? "Stash-Box"}
{stashboxDisplayName(s.name, index)}
</Dropdown.Item>
))}
{queryableScrapers.map((s) => (
Expand Down Expand Up @@ -463,7 +464,7 @@ export const SceneEditPanel: React.FC<IProps> = ({
key={s.endpoint}
onClick={() => onScrapeClicked({ stash_box_index: index })}
>
{s.name ?? "Stash-Box"}
{stashboxDisplayName(s.name, index)}
</Dropdown.Item>
))}
{fragmentScrapers.map((s) => (
Expand Down
2 changes: 1 addition & 1 deletion ui/v2.5/src/components/Tagger/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const TaggerContext: React.FC = ({ children }) => {
sourceInput: {
stash_box_index: i,
},
displayName: `stash-box: ${s.name}`,
displayName: `stash-box: ${s.name || `#${i + 1}`}`,
supportSceneFragment: true,
supportSceneQuery: true,
}));
Expand Down
3 changes: 3 additions & 0 deletions ui/v2.5/src/utils/stashbox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function stashboxDisplayName(name: string, index: number) {
return name || `Stash-Box #${index + 1}`;
}