fix: remove expand/collapse from MyEntityStrip, always show all items

The collapse behavior made strips appear empty on some pages (Plugins).
All MY strips now always show every item without truncation or toggle.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
2026-08-23 17:42:31 +05:30
parent 42645faaa4
commit 183ab56283

View File

@@ -1,6 +1,6 @@
import { useState, useRef, useEffect, type ReactNode } from 'react'
import { type ReactNode } from 'react'
import { Link } from 'react-router-dom'
import { ChevronRight, ChevronDown, ChevronUp, Clock } from 'lucide-react'
import { ChevronRight, Clock } from 'lucide-react'
import { formatRelativeTime } from '@/lib/utils'
import { MyPanel, type MyPanelTheme } from './MyPanel'
@@ -42,25 +42,9 @@ const STATUS_COLORS: Record<string, string> = {
archived: 'var(--ag-text-ghost)',
}
// One collapsed row = 68px card + 10px gap buffer
const ROW_H = 78
export function MyEntityStrip({
title, icon, items, emptyText, theme = 'agos', badge, headerAction,
}: MyEntityStripProps) {
const [expanded, setExpanded] = useState(false)
const gridRef = useRef<HTMLDivElement>(null)
const [fullH, setFullH] = useState<number | null>(null)
useEffect(() => {
const el = gridRef.current
if (!el) return
const ro = new ResizeObserver(() => setFullH(el.scrollHeight))
ro.observe(el)
setFullH(el.scrollHeight)
return () => ro.disconnect()
}, [items.length])
if (items.length === 0 && !emptyText) return null
return (
@@ -83,15 +67,7 @@ export function MyEntityStrip({
<div className="ne-MyStrip__empty">{emptyText ?? 'Nothing here yet'}</div>
) : (
<>
<div
ref={gridRef}
className="ne-MyStrip__grid"
style={{
maxHeight: expanded ? (fullH ?? 9999) : ROW_H,
overflow: 'hidden',
transition: 'max-height 0.32s cubic-bezier(0.4,0,0.2,1)',
}}
>
<div className="ne-MyStrip__grid">
{items.map((item, idx) => {
const dotColor = item.statusColor
?? (item.status ? STATUS_COLORS[item.status] ?? undefined : undefined)
@@ -158,13 +134,6 @@ export function MyEntityStrip({
)
})}
</div>
{fullH !== null && fullH > ROW_H && (
<button className="ne-MyStrip__toggle" onClick={() => setExpanded(v => !v)}>
{expanded
? <><ChevronUp size={10} /> Show less</>
: <><ChevronDown size={10} /> Show all {items.length}</>}
</button>
)}
</>
)}
</MyPanel>