Adding useAutoRefresh on agent page.

This commit is contained in:
charlesgauthereau
2025-12-26 11:55:43 +01:00
parent 7f7f8e642f
commit ee285df7b5
7 changed files with 189 additions and 83 deletions
@@ -0,0 +1,28 @@
"use client";
import {useTheme} from "next-themes";
import {useEffect, useState} from "react";
export function ThemeMetaUpdaterRoot() {
const {resolvedTheme} = useTheme();
const [mounted, setMounted] = useState(false);
useEffect(() => {
setMounted(true);
}, []);
useEffect(() => {
if (!mounted || !resolvedTheme) return;
const color = resolvedTheme === "dark" ? "#000000" : "#ffffff";
let tag = document.querySelector<HTMLMetaElement>('meta[name="theme-color"]');
if (!tag) {
tag = document.createElement("meta");
tag.name = "theme-color";
document.head.appendChild(tag);
}
tag.content = color;
}, [mounted, resolvedTheme]);
return null;
}