diff --git a/ui/src/pages/AppsTab/AppDeploymentPage/DeploymentTab/HistoryDisclosure.tsx b/ui/src/pages/AppsTab/AppDeploymentPage/DeploymentTab/HistoryDisclosure.tsx index bb74b60c..fdc2e4cb 100644 --- a/ui/src/pages/AppsTab/AppDeploymentPage/DeploymentTab/HistoryDisclosure.tsx +++ b/ui/src/pages/AppsTab/AppDeploymentPage/DeploymentTab/HistoryDisclosure.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import { DataTable } from '@cameleer/design-system'; import type { Column } from '@cameleer/design-system'; import type { Deployment, AppVersion } from '../../../../api/queries/admin/apps'; @@ -16,8 +16,15 @@ interface Props { export function HistoryDisclosure({ deployments, versions, appSlug, envSlug }: Props) { const [open, setOpen] = useState(false); const [expanded, setExpanded] = useState(null); + const logPanelRef = useRef(null); const versionMap = new Map(versions.map((v) => [v.id, v])); + useEffect(() => { + if (expanded && logPanelRef.current) { + logPanelRef.current.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); + } + }, [expanded]); + const rows = deployments .slice() .sort((a, b) => (b.createdAt ?? '').localeCompare(a.createdAt ?? '')); @@ -55,7 +62,11 @@ export function HistoryDisclosure({ deployments, versions, appSlug, envSlug }: P {expanded && (() => { const d = rows.find((r) => r.id === expanded); if (!d) return null; - return ; + return ( +
+ +
+ ); })()} )}