097fbf0016
## Summary - New "Locals" sidebar nav item with list + detail + browse pages - Remotes page filters out local repos (repo_type=local hidden) - LocalDetail: simplified view — just name, type, description + "Browse Files" button - Virtuals: member links resolve to /locals/ or /remotes/ based on repo_type - Objects page detects context for correct back-navigation ## Test plan - [ ] Visual check: locals page shows only local repos - [ ] Remotes page hides local repos - [ ] Virtual member links point to correct pages - [ ] Browse files works from local detail page Reviewed-on: #54 Co-authored-by: Ben Vincent <ben@unkin.net> Co-committed-by: Ben Vincent <ben@unkin.net>
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import { useEffect, useState } from 'react';
|
|
import { useParams, Link } from 'react-router-dom';
|
|
import { api } from '../api/client';
|
|
import type { Remote } from '../api/types';
|
|
import { Badge } from '../components/Badge';
|
|
import './RemoteDetail.css';
|
|
|
|
export function LocalDetail() {
|
|
const { name } = useParams<{ name: string }>();
|
|
const [remote, setRemote] = useState<Remote | null>(null);
|
|
const [error, setError] = useState<string | null>(null);
|
|
|
|
useEffect(() => {
|
|
if (!name) return;
|
|
api.getRemote(name)
|
|
.then(setRemote)
|
|
.catch(e => setError(e.message));
|
|
}, [name]);
|
|
|
|
if (error) return <div className="error-banner">{error}</div>;
|
|
if (!remote) return <div className="loading">Loading...</div>;
|
|
|
|
return (
|
|
<div>
|
|
<div className="detail-header">
|
|
<Link to="/locals" className="back-link">← Locals</Link>
|
|
<h1 className="page-title">{remote.name}</h1>
|
|
<div className="detail-badges">
|
|
<Badge variant="blue">{remote.package_type}</Badge>
|
|
<Badge variant="default">local</Badge>
|
|
{remote.managed_by && <Badge variant="green">managed by {remote.managed_by}</Badge>}
|
|
</div>
|
|
</div>
|
|
|
|
{remote.description && (
|
|
<p className="detail-description">{remote.description}</p>
|
|
)}
|
|
|
|
<div className="detail-actions">
|
|
<Link to={`/locals/${remote.name}/objects`} className="btn btn-primary">
|
|
Browse Files
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|