mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Show option for sub-content only if there are child objects (#5223)
This commit is contained in:
@@ -79,7 +79,9 @@ const StudioTabs: React.FC<{
|
|||||||
abbreviateCounter: boolean;
|
abbreviateCounter: boolean;
|
||||||
showAllCounts?: boolean;
|
showAllCounts?: boolean;
|
||||||
}> = ({ tabKey, studio, abbreviateCounter, showAllCounts = false }) => {
|
}> = ({ tabKey, studio, abbreviateCounter, showAllCounts = false }) => {
|
||||||
const [showAllDetails, setShowAllDetails] = useState<boolean>(showAllCounts);
|
const [showAllDetails, setShowAllDetails] = useState<boolean>(
|
||||||
|
showAllCounts && studio.child_studios.length > 0
|
||||||
|
);
|
||||||
|
|
||||||
const sceneCount =
|
const sceneCount =
|
||||||
(showAllDetails ? studio.scene_count_all : studio.scene_count) ?? 0;
|
(showAllDetails ? studio.scene_count_all : studio.scene_count) ?? 0;
|
||||||
@@ -125,8 +127,12 @@ const StudioTabs: React.FC<{
|
|||||||
baseURL: `/studios/${studio.id}`,
|
baseURL: `/studios/${studio.id}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const contentSwitch = useMemo(
|
const contentSwitch = useMemo(() => {
|
||||||
() => (
|
if (!studio.child_studios.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
<div className="item-list-header">
|
<div className="item-list-header">
|
||||||
<Form.Check
|
<Form.Check
|
||||||
id="showSubContent"
|
id="showSubContent"
|
||||||
@@ -136,9 +142,8 @@ const StudioTabs: React.FC<{
|
|||||||
label={<FormattedMessage id="include_sub_studio_content" />}
|
label={<FormattedMessage id="include_sub_studio_content" />}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
),
|
|
||||||
[showAllDetails]
|
|
||||||
);
|
);
|
||||||
|
}, [showAllDetails, studio.child_studios.length]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs
|
<Tabs
|
||||||
|
|||||||
@@ -82,7 +82,9 @@ const TagTabs: React.FC<{
|
|||||||
abbreviateCounter: boolean;
|
abbreviateCounter: boolean;
|
||||||
showAllCounts?: boolean;
|
showAllCounts?: boolean;
|
||||||
}> = ({ tabKey, tag, abbreviateCounter, showAllCounts = false }) => {
|
}> = ({ tabKey, tag, abbreviateCounter, showAllCounts = false }) => {
|
||||||
const [showAllDetails, setShowAllDetails] = useState<boolean>(showAllCounts);
|
const [showAllDetails, setShowAllDetails] = useState<boolean>(
|
||||||
|
showAllCounts && tag.children.length > 0
|
||||||
|
);
|
||||||
|
|
||||||
const sceneCount =
|
const sceneCount =
|
||||||
(showAllDetails ? tag.scene_count_all : tag.scene_count) ?? 0;
|
(showAllDetails ? tag.scene_count_all : tag.scene_count) ?? 0;
|
||||||
@@ -135,8 +137,12 @@ const TagTabs: React.FC<{
|
|||||||
baseURL: `/tags/${tag.id}`,
|
baseURL: `/tags/${tag.id}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const contentSwitch = useMemo(
|
const contentSwitch = useMemo(() => {
|
||||||
() => (
|
if (tag.children.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
<div className="item-list-header">
|
<div className="item-list-header">
|
||||||
<Form.Check
|
<Form.Check
|
||||||
id="showSubContent"
|
id="showSubContent"
|
||||||
@@ -146,9 +152,8 @@ const TagTabs: React.FC<{
|
|||||||
label={<FormattedMessage id="include_sub_tag_content" />}
|
label={<FormattedMessage id="include_sub_tag_content" />}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
),
|
|
||||||
[showAllDetails]
|
|
||||||
);
|
);
|
||||||
|
}, [showAllDetails, tag.children.length]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs
|
<Tabs
|
||||||
|
|||||||
Reference in New Issue
Block a user