mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
The service worker update notice was a dismissible toast that was easy to miss, leaving users on a stale build. Render a persistent status bar above the app shell with an explicit Reload action, and switch the shell to a flex column so pages size against the shell height (h-full) rather than the viewport (h-dvh), keeping the layout correct while the banner is visible.
81 lines
3.1 KiB
TypeScript
81 lines
3.1 KiB
TypeScript
import { useState } from "react";
|
|
import { useNavigate } from "react-router-dom";
|
|
import { RepoList } from "@/components/repo/RepoList";
|
|
import { AddRepoDialog } from "@/components/repo/AddRepoDialog";
|
|
import { FileBrowserSheet } from "@/components/file-browser/FileBrowserSheet";
|
|
import { Header } from "@/components/ui/header";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Plus, FolderOpen, CalendarClock } from "lucide-react";
|
|
import { PendingActionsGroup } from "@/components/notifications/PendingActionsGroup";
|
|
import { useDialogParam } from "@/hooks/useDialogParam";
|
|
import { useMobile } from "@/hooks/useMobile";
|
|
import { useToolPanel } from "@/hooks/useToolPanel";
|
|
import { ToolSidePanel } from "@/components/navigation/ToolSidePanel";
|
|
|
|
export function Repos() {
|
|
const navigate = useNavigate();
|
|
const [addRepoOpen, setAddRepoOpen] = useState(false);
|
|
const [fileBrowserOpen, setFileBrowserOpen] = useDialogParam('files');
|
|
const docked = !useMobile();
|
|
const toolPanel = useToolPanel(docked);
|
|
|
|
const handleCloseFileBrowser = () => {
|
|
setFileBrowserOpen(false);
|
|
};
|
|
|
|
return (
|
|
<div className="flex h-full max-h-full min-w-0">
|
|
<div className="flex-1 min-w-0 h-full max-h-full overflow-hidden bg-gradient-to-br from-background via-background to-background flex flex-col">
|
|
<Header>
|
|
<div className="flex items-center gap-3">
|
|
<Header.Title logo>OpenCode</Header.Title>
|
|
</div>
|
|
<Header.Actions>
|
|
<div className="flex items-center gap-1">
|
|
<PendingActionsGroup />
|
|
</div>
|
|
<Button
|
|
variant="ghost"
|
|
size="icon"
|
|
onClick={() => setFileBrowserOpen(true)}
|
|
aria-label="Open files"
|
|
className="hidden sm:flex text-muted-foreground hover:text-foreground hover:bg-accent transition-all duration-200 h-8 w-8"
|
|
>
|
|
<FolderOpen className="w-4 h-4" />
|
|
</Button>
|
|
<Button
|
|
variant="outline"
|
|
onClick={() => navigate('/schedules')}
|
|
size="sm"
|
|
className="hidden sm:flex text-foreground border-border hover:bg-accent transition-all duration-200 hover:scale-105"
|
|
>
|
|
<CalendarClock className="w-4 h-4 mr-2" />
|
|
All Schedules
|
|
</Button>
|
|
<Button onClick={() => setAddRepoOpen(true)} size="sm">
|
|
<Plus className="w-4 h-4 mr-1" />
|
|
Repo
|
|
</Button>
|
|
<span>
|
|
<Header.Settings />
|
|
</span>
|
|
</Header.Actions>
|
|
</Header>
|
|
<div className="container mx-auto flex-1 pt-2 px-2 min-h-0 overflow-auto pb-[calc(env(safe-area-inset-bottom)+60px)] sm:pb-0">
|
|
|
|
<RepoList />
|
|
</div>
|
|
<AddRepoDialog open={addRepoOpen} onOpenChange={setAddRepoOpen} />
|
|
<FileBrowserSheet
|
|
isOpen={!docked && fileBrowserOpen}
|
|
onClose={handleCloseFileBrowser}
|
|
basePath=""
|
|
repoName="Workspace Root"
|
|
allowNavigateAboveBase={true}
|
|
/>
|
|
</div>
|
|
{docked && <ToolSidePanel panel={toolPanel} filesBasePath="" allowNavigateAboveBase />}
|
|
</div>
|
|
);
|
|
}
|