mirror of
https://github.com/ChiChou/entdb.git
synced 2026-09-23 13:10:42 +02:00
Persist diff state in URL and simplify binary detail header
- Store compareWith version in URL as diff param for shareable links - Remove redundant Entitlements title - Show full path as muted subtitle
This commit is contained in:
+16
-11
@@ -44,10 +44,22 @@ export default function BinaryDetail() {
|
|||||||
const [xml, setXML] = useState<string>("");
|
const [xml, setXML] = useState<string>("");
|
||||||
const [xmlKeys, setXMLKeys] = useState<Set<string>>(new Set());
|
const [xmlKeys, setXMLKeys] = useState<Set<string>>(new Set());
|
||||||
const [history, setHistory] = useState<PathHistory[]>([]);
|
const [history, setHistory] = useState<PathHistory[]>([]);
|
||||||
const [compareWith, setCompareWith] = useState<string | null>(null);
|
|
||||||
const [compareXml, setCompareXml] = useState<string>("");
|
const [compareXml, setCompareXml] = useState<string>("");
|
||||||
const [compareLoading, setCompareLoading] = useState(false);
|
const [compareLoading, setCompareLoading] = useState(false);
|
||||||
|
|
||||||
|
// Read compareWith from URL
|
||||||
|
const compareWith = params.get("diff");
|
||||||
|
|
||||||
|
const setCompareWith = (value: string | null) => {
|
||||||
|
const newParams = new URLSearchParams(params.toString());
|
||||||
|
if (value) {
|
||||||
|
newParams.set("diff", value);
|
||||||
|
} else {
|
||||||
|
newParams.delete("diff");
|
||||||
|
}
|
||||||
|
router.replace(`/os/bin?${newParams.toString()}`, { scroll: false });
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setMounted(true);
|
setMounted(true);
|
||||||
}, []);
|
}, []);
|
||||||
@@ -220,16 +232,9 @@ export default function BinaryDetail() {
|
|||||||
|
|
||||||
{/* Main content */}
|
{/* Main content */}
|
||||||
<main className="flex-1 min-w-0 space-y-4">
|
<main className="flex-1 min-w-0 space-y-4">
|
||||||
<div className="flex items-start justify-between gap-4">
|
<p className="truncate text-muted-foreground" title={path || ""}>
|
||||||
<div className="min-w-0">
|
<code className="text-sm">{path}</code>
|
||||||
<h2 className="text-lg font-semibold">Entitlements</h2>
|
</p>
|
||||||
<p className="truncate" title={path || ""}>
|
|
||||||
<code className="text-blue-600 dark:text-blue-400 text-sm">
|
|
||||||
{path}
|
|
||||||
</code>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{loading && (
|
{loading && (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user