mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +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;
|
||||
showAllCounts?: boolean;
|
||||
}> = ({ tabKey, studio, abbreviateCounter, showAllCounts = false }) => {
|
||||
const [showAllDetails, setShowAllDetails] = useState<boolean>(showAllCounts);
|
||||
const [showAllDetails, setShowAllDetails] = useState<boolean>(
|
||||
showAllCounts && studio.child_studios.length > 0
|
||||
);
|
||||
|
||||
const sceneCount =
|
||||
(showAllDetails ? studio.scene_count_all : studio.scene_count) ?? 0;
|
||||
@@ -125,8 +127,12 @@ const StudioTabs: React.FC<{
|
||||
baseURL: `/studios/${studio.id}`,
|
||||
});
|
||||
|
||||
const contentSwitch = useMemo(
|
||||
() => (
|
||||
const contentSwitch = useMemo(() => {
|
||||
if (!studio.child_studios.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="item-list-header">
|
||||
<Form.Check
|
||||
id="showSubContent"
|
||||
@@ -136,9 +142,8 @@ const StudioTabs: React.FC<{
|
||||
label={<FormattedMessage id="include_sub_studio_content" />}
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
[showAllDetails]
|
||||
);
|
||||
);
|
||||
}, [showAllDetails, studio.child_studios.length]);
|
||||
|
||||
return (
|
||||
<Tabs
|
||||
|
||||
Reference in New Issue
Block a user