diff --git a/packages/app/src/views/Details/ModernDetailContent.js b/packages/app/src/views/Details/ModernDetailContent.js
index 2b97e544..6140b729 100644
--- a/packages/app/src/views/Details/ModernDetailContent.js
+++ b/packages/app/src/views/Details/ModernDetailContent.js
@@ -58,6 +58,29 @@ const ModernDetailContent = (props) => {
const played = item.UserData?.Played;
const isFavorite = item.UserData?.IsFavorite;
+ const [canToggle, setCanToggle] = useState(false);
+ const [isExpanded, setIsExpanded] = useState(false);
+ const descriptionRef = useRef(null);
+
+ // Reset expanded state when navigating to a different item. Keyed on the id so an
+ // in-place update to the same item doesn't collapse the text.
+ useEffect(() => {
+ setIsExpanded(false);
+ setCanToggle(false);
+ }, [item?.Id]);
+
+ // Detect if description text overflows 4 lines
+ useEffect(() => {
+ const el = descriptionRef.current;
+ if (el && !isExpanded) {
+ setCanToggle(el.scrollHeight > el.clientHeight);
+ }
+ }, [item?.Overview, isExpanded]);
+
+ const handleToggleExpand = useCallback(() => {
+ setIsExpanded(prev => !prev);
+ }, []);
+
const scrollToRef = useRef(null);
const handleScrollTo = useCallback((fn) => {
scrollToRef.current = fn;
@@ -507,7 +530,18 @@ const ModernDetailContent = (props) => {
)}
{!isPerson &&
{item.Overview}
} + {item.Overview && ( ++ {item.Overview} +
+ {canToggle &&