fix(ui): Set page title

This commit is contained in:
Richard Palethorpe
2025-04-02 08:23:12 +01:00
parent 9f77bb99f1
commit 6d9f1a95cc
10 changed files with 88 additions and 36 deletions

View File

@@ -1,14 +1,25 @@
import { useState, useEffect } from 'react';
import { useParams, Link } from 'react-router-dom';
import { useParams, Link, useNavigate } from 'react-router-dom';
function AgentStatus() {
const { name } = useParams();
const navigate = useNavigate();
const [statusData, setStatusData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [eventSource, setEventSource] = useState(null);
const [liveUpdates, setLiveUpdates] = useState([]);
// Update document title
useEffect(() => {
if (name) {
document.title = `Agent Status: ${name} - LocalAgent`;
}
return () => {
document.title = 'LocalAgent'; // Reset title when component unmounts
};
}, [name]);
// Fetch initial status data
useEffect(() => {
const fetchStatusData = async () => {