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

added support for hooking into detail page item dropdowns #4927

Open
wants to merge 2 commits 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
16 changes: 16 additions & 0 deletions ui/v2.5/src/components/Galleries/GalleryDetails/Gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import cx from "classnames";
import { useRatingKeybinds } from "src/hooks/keybinds";
import { ConfigurationContext } from "src/hooks/Config";
import { TruncatedText } from "src/components/Shared/TruncatedText";
import { PatchComponent } from "src/patch";

interface IProps {
gallery: GQL.GalleryDataFragment;
Expand All @@ -53,6 +54,20 @@ interface IGalleryParams {
tab?: string;
}

interface IGalleryDropdownItemProps {
galleryId: string;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _GalleryDropdownItem = (props: IGalleryDropdownItemProps) => {
return null;
};

export const GalleryDropdownItem = PatchComponent(
"GalleryDropdownItem",
_GalleryDropdownItem
);

export const GalleryPage: React.FC<IProps> = ({ gallery, add }) => {
const history = useHistory();
const Toast = useToast();
Expand Down Expand Up @@ -192,6 +207,7 @@ export const GalleryPage: React.FC<IProps> = ({ gallery, add }) => {
values={{ entityType: intl.formatMessage({ id: "gallery" }) }}
/>
</Dropdown.Item>
<GalleryDropdownItem galleryId={gallery.id} />
</Dropdown.Menu>
</Dropdown>
);
Expand Down
16 changes: 16 additions & 0 deletions ui/v2.5/src/components/Images/ImageDetails/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import TextUtils from "src/utils/text";
import { RatingSystem } from "src/components/Shared/Rating/RatingSystem";
import cx from "classnames";
import { TruncatedText } from "src/components/Shared/TruncatedText";
import { PatchComponent } from "src/patch";

interface IProps {
image: GQL.ImageDataFragment;
Expand All @@ -43,6 +44,20 @@ interface IImageParams {
id: string;
}

interface IImageDropdownItemProps {
imageId: string;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _ImageDropdownItem = (props: IImageDropdownItemProps) => {
return null;
};

export const ImageDropdownItem = PatchComponent(
"ImageDropdownItem",
_ImageDropdownItem
);

const ImagePage: React.FC<IProps> = ({ image }) => {
const history = useHistory();
const Toast = useToast();
Expand Down Expand Up @@ -196,6 +211,7 @@ const ImagePage: React.FC<IProps> = ({ image }) => {
values={{ entityType: intl.formatMessage({ id: "image" }) }}
/>
</Dropdown.Item>
<ImageDropdownItem imageId={image.id} />
</Dropdown.Menu>
</Dropdown>
);
Expand Down
16 changes: 16 additions & 0 deletions ui/v2.5/src/components/Scenes/SceneDetails/Scene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { useRatingKeybinds } from "src/hooks/keybinds";
import { lazyComponent } from "src/utils/lazyComponent";
import cx from "classnames";
import { TruncatedText } from "src/components/Shared/TruncatedText";
import { PatchComponent } from "src/patch";

const SubmitStashBoxDraft = lazyComponent(
() => import("src/components/Dialogs/SubmitDraft")
Expand Down Expand Up @@ -82,6 +83,20 @@ const SceneVideoFilterPanel = lazyComponent(
() => import("./SceneVideoFilterPanel")
);

interface ISceneDropdownItemProps {
sceneId: string;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _SceneDropdownItem = (props: ISceneDropdownItemProps) => {
return null;
};

export const SceneDropdownItem = PatchComponent(
"SceneDropdownItem",
_SceneDropdownItem
);

const VideoFrameRateResolution: React.FC<{
width?: number;
height?: number;
Expand Down Expand Up @@ -411,6 +426,7 @@ const ScenePage: React.FC<IProps> = ({
values={{ entityType: intl.formatMessage({ id: "scene" }) }}
/>
</Dropdown.Item>
<SceneDropdownItem sceneId={scene.id} />
</Dropdown.Menu>
</Dropdown>
);
Expand Down
3 changes: 3 additions & 0 deletions ui/v2.5/src/docs/en/Manual/UIPluginApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,12 @@ Returns `void`.
- `CountrySelect`
- `DateInput`
- `FolderSelect`
- `GalleryDropdownItem`
- `GalleryIDSelect`
- `GallerySelect`
- `GallerySelect.sort`
- `Icon`
- `ImageDropdownItem`
- `ModalSetting`
- `MovieIDSelect`
- `MovieSelect`
Expand All @@ -163,6 +165,7 @@ Returns `void`.
- `PerformerSelect.sort`
- `PluginRoutes`
- `SceneCard`
- `SceneDropdownItem`
- `SceneCard.Details`
- `SceneCard.Image`
- `SceneCard.Overlays`
Expand Down
Loading