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

Place popover to right on edit pages #3939

Merged
merged 1 commit into from
Jul 25, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ export const GalleryEditPanel: React.FC<IProps> = ({
)
}
ids={formik.values.tag_ids}
hoverPlacement="right"
/>
</Col>
</Form.Group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ export const ImageEditPanel: React.FC<IProps> = ({
)
}
ids={formik.values.tag_ids}
hoverPlacement="right"
/>
</Col>
</Form.Group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@ export const SceneEditPanel: React.FC<IProps> = ({
)
}
ids={formik.values.tag_ids}
hoverPlacement="right"
/>
</Col>
</Form.Group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const SceneMarkerForm: React.FC<ISceneMarkerForm> = ({
}
ids={fieldProps.field.value ? [fieldProps.field.value] : []}
noSelectionString="Select/create tag..."
hoverPlacement="right"
/>
);

Expand All @@ -108,6 +109,7 @@ export const SceneMarkerForm: React.FC<ISceneMarkerForm> = ({
}
ids={fieldProps.field.value}
noSelectionString="Select/create tags..."
hoverPlacement="right"
/>
);

Expand Down
9 changes: 5 additions & 4 deletions ui/v2.5/src/components/Shared/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { galleryTitle } from "src/core/galleries";
import { TagPopover } from "../Tags/TagPopover";
import { defaultMaxOptionsShown, IUIConfig } from "src/core/config";
import { useDebouncedSetState } from "src/hooks/debounce";
import { Placement } from "react-bootstrap/esm/Overlay";

export type SelectObject = {
id: string;
Expand Down Expand Up @@ -832,9 +833,9 @@ export const MovieSelect: React.FC<IFilterProps> = (props) => {
);
};

export const TagSelect: React.FC<IFilterProps & { excludeIds?: string[] }> = (
props
) => {
export const TagSelect: React.FC<
IFilterProps & { excludeIds?: string[]; hoverPlacement?: Placement }
> = (props) => {
const [tagAliases, setTagAliases] = useState<Record<string, string[]>>({});
const [allAliases, setAllAliases] = useState<string[]>([]);
const { data, loading } = useAllTagsForFilter();
Expand Down Expand Up @@ -890,7 +891,7 @@ export const TagSelect: React.FC<IFilterProps & { excludeIds?: string[] }> = (
: optionProps.data.value;

return (
<TagPopover id={id}>
<TagPopover id={id} placement={props.hoverPlacement}>
<reactSelectComponents.Option {...thisOptionProps} />
</TagPopover>
);
Expand Down
4 changes: 3 additions & 1 deletion ui/v2.5/src/components/Shared/TagLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { galleryTitle } from "src/core/galleries";
import * as GQL from "src/core/generated-graphql";
import { TagPopover } from "../Tags/TagPopover";
import { markerTitle } from "src/core/markers";
import { Placement } from "react-bootstrap/esm/Overlay";

interface IFile {
path: string;
Expand All @@ -40,6 +41,7 @@ interface IProps {
scene?: Partial<Pick<SceneDataFragment, "id" | "title" | "files">>;
gallery?: Partial<IGallery>;
className?: string;
hoverPlacement?: Placement;
}

export const TagLink: React.FC<IProps> = (props: IProps) => {
Expand Down Expand Up @@ -84,7 +86,7 @@ export const TagLink: React.FC<IProps> = (props: IProps) => {
}
return (
<Badge className={cx("tag-item", props.className)} variant="secondary">
<TagPopover id={id}>
<TagPopover id={id} placement={props.hoverPlacement}>
<Link to={link}>{title}</Link>
</TagPopover>
</Badge>
Expand Down
2 changes: 2 additions & 0 deletions ui/v2.5/src/components/Tags/TagDetails/TagEditPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ export const TagEditPanel: React.FC<ITagEditPanel> = ({
...formik.values.child_ids,
]}
creatable={false}
hoverPlacement="right"
/>
</Col>
</Form.Group>
Expand Down Expand Up @@ -269,6 +270,7 @@ export const TagEditPanel: React.FC<ITagEditPanel> = ({
...formik.values.parent_ids,
]}
creatable={false}
hoverPlacement="right"
/>
</Col>
</Form.Group>
Expand Down
10 changes: 8 additions & 2 deletions ui/v2.5/src/components/Tags/TagPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import { useFindTag } from "../../core/StashService";
import { TagCard } from "./TagCard";
import { ConfigurationContext } from "../../hooks/Config";
import { IUIConfig } from "src/core/config";
import { Placement } from "react-bootstrap/esm/Overlay";

interface ITagPopoverProps {
id?: string;
placement?: Placement;
}

export const TagPopoverCard: React.FC<ITagPopoverCardProps> = ({ id }) => {
Expand All @@ -33,7 +35,11 @@ export const TagPopoverCard: React.FC<ITagPopoverCardProps> = ({ id }) => {
);
};

export const TagPopover: React.FC<ITagPopoverProps> = ({ id, children }) => {
export const TagPopover: React.FC<ITagPopoverProps> = ({
id,
children,
placement = "top",
}) => {
const { configuration: config } = React.useContext(ConfigurationContext);

const showTagCardOnHover =
Expand All @@ -45,7 +51,7 @@ export const TagPopover: React.FC<ITagPopoverProps> = ({ id, children }) => {

return (
<HoverPopover
placement={"top"}
placement={placement}
enterDelay={500}
leaveDelay={100}
content={<TagPopoverCard id={id} />}
Expand Down
Loading