mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
fix: centralize iOS safe area and refactor list components (#47)
* fix: add iOS safe-area-inset-top support for fullscreen overlays - Add pt-safe CSS utility class for safe-area-inset-top - Create FullscreenSheet component with built-in safe-area support - Add fullscreen prop to DialogContent for fullscreen dialogs - Update FileBrowserSheet to use FullscreenSheet - Update MobileFilePreviewModal to use FullscreenSheet - Add pt-safe to SettingsDialog mobile view Fixes status bar overlap on iOS devices with notch/Dynamic Island * fix: add pt-safe to main page headers - Header.tsx (main repos page) - SessionDetailHeader.tsx (session page) * docs: add TDD refactoring plan for iOS safe area * remove plan file from repo * refactor: centralize iOS safe area handling with PageHeader component - Add PageHeader component with pt-safe, sticky, z-10, border-b styling - Add TDD test infrastructure (vitest config, testing-library, jsdom) - Refactor Header, SessionDetailHeader, RepoDetailHeader, Workspace to use PageHeader - Fix missing pt-safe on RepoDetailHeader and Workspace pages - All header safe area styling now has single fix point * fix: add pt-safe to remaining fullscreen dialogs and sheets - GitChangesSheet, FilePreviewDialog: add fullscreen prop - ModelSelectDialog, RepoMcpDialog: add pt-safe class - EditSessionTitleDialog: add pt-safe on mobile * fix: use mobile-first positioning for large dialogs Dialogs need top-0 positioning on mobile for pt-safe to work. Centered dialogs don't benefit from safe area padding. * fix: add mobileFullscreen prop to DialogContent - Fullscreen on mobile with pt-safe, centered on desktop - Simplifies large dialog styling * fix: use inline styles for iOS safe area to fix CSS cascade issues - Convert pt-safe/pb-safe to @utility directives with iOS 11 fallback - Use inline styles on DialogContent for reliable safe-area padding - Position close button with calc(env(safe-area-inset-top) + 1rem) - Add 10 tests for DialogContent safe-area behavior * refactor: extract ListToolbar and Header components for reuse - Add ListToolbar component for search/select all/delete UI - Add Header compound component (Header.Root, Header.Title, etc.) - Update SessionList and RepoList to use ListToolbar - Mobile delete: deletes selected or all if none selected - Cancel delete now clears selection - Remove unused layout components --------- Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
This commit is contained in:
1 parent
72bb20a4fa
commit
cd9a552bf8
34 files changed
+1627
-986
No files matched your search
@@ -4,12 +4,17 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { getRepo } from "@/api/repos";
|
||||
import { SessionList } from "@/components/session/SessionList";
|
||||
import { FileBrowserSheet } from "@/components/file-browser/FileBrowserSheet";
|
||||
import { RepoDetailHeader } from "@/components/layout/RepoDetailHeader";
|
||||
import { Header } from "@/components/ui/header";
|
||||
import { SwitchConfigDialog } from "@/components/repo/SwitchConfigDialog";
|
||||
import { RepoMcpDialog } from "@/components/repo/RepoMcpDialog";
|
||||
import { useCreateSession } from "@/hooks/useOpenCode";
|
||||
import { OPENCODE_API_ENDPOINT, API_BASE_URL } from "@/config";
|
||||
import { useSwipeBack } from "@/hooks/useMobile";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { BranchSwitcher } from "@/components/repo/BranchSwitcher";
|
||||
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
||||
import { Plug, FolderOpen, Plus, GitBranch } from "lucide-react";
|
||||
|
||||
import { Loader2 } from "lucide-react";
|
||||
|
||||
@@ -107,24 +112,86 @@ export function RepoDetail() {
|
||||
const branchToDisplay = repo.currentBranch || repo.branch;
|
||||
const displayName = branchToDisplay ? `${repoName} (${branchToDisplay})` : repoName;
|
||||
const currentBranch = repo.currentBranch || repo.branch || "main";
|
||||
const isWorktree = repo.isWorktree || false;
|
||||
|
||||
return (
|
||||
<div
|
||||
<div
|
||||
ref={pageRef}
|
||||
className="h-dvh max-h-dvh overflow-hidden bg-gradient-to-br from-background via-background to-background flex flex-col"
|
||||
style={swipeStyles}
|
||||
>
|
||||
<RepoDetailHeader
|
||||
repoName={repoName}
|
||||
repoId={repoId}
|
||||
currentBranch={currentBranch}
|
||||
isWorktree={repo.isWorktree || false}
|
||||
repoUrl={repo.repoUrl}
|
||||
onMcpClick={() => setMcpDialogOpen(true)}
|
||||
onFilesClick={() => setFileBrowserOpen(true)}
|
||||
onNewSession={handleCreateSession}
|
||||
disabledNewSession={!opcodeUrl || createSessionMutation.isPending}
|
||||
/>
|
||||
<Header>
|
||||
<Header.BackButton to="/" />
|
||||
<div className="flex items-center gap-2 min-w-0">
|
||||
<Header.Title>{repoName}</Header.Title>
|
||||
{isWorktree ? (
|
||||
<Badge className="text-xs px-1.5 sm:px-2.5 py-0.5 bg-purple-600/20 text-purple-400 border-purple-600/40" title="Worktree">
|
||||
<GitBranch className="h-3 w-3 sm:mr-1" />
|
||||
<span className="hidden sm:inline">WT: {currentBranch}</span>
|
||||
</Badge>
|
||||
) : !isWorktree && currentBranch ? (
|
||||
<BranchSwitcher
|
||||
repoId={repoId}
|
||||
currentBranch={currentBranch}
|
||||
isWorktree={false}
|
||||
repoUrl={repo.repoUrl}
|
||||
className="hidden sm:flex w-[140px] max-w-[140px]"
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
<Header.Actions>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => setMcpDialogOpen(true)}
|
||||
size="sm"
|
||||
className="hidden sm:flex text-foreground border-border hover:bg-accent transition-all duration-200 hover:scale-105"
|
||||
>
|
||||
<Plug className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">MCP</span>
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => setFileBrowserOpen(true)}
|
||||
size="sm"
|
||||
className="hidden sm:flex text-foreground border-border hover:bg-accent transition-all duration-200 hover:scale-105"
|
||||
>
|
||||
<FolderOpen className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">Files</span>
|
||||
</Button>
|
||||
<Header.MobileDropdown>
|
||||
{!isWorktree && currentBranch && (
|
||||
<>
|
||||
<div className="px-2 py-1.5">
|
||||
<BranchSwitcher
|
||||
repoId={repoId}
|
||||
currentBranch={currentBranch}
|
||||
isWorktree={false}
|
||||
repoUrl={repo.repoUrl}
|
||||
iconOnly={false}
|
||||
className="w-full"
|
||||
/>
|
||||
</div>
|
||||
<div className="h-px bg-border my-1" />
|
||||
</>
|
||||
)}
|
||||
<DropdownMenuItem onClick={() => setMcpDialogOpen(true)}>
|
||||
<Plug className="w-4 h-4 mr-2" /> MCP
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setFileBrowserOpen(true)}>
|
||||
<FolderOpen className="w-4 h-4 mr-2" /> Files
|
||||
</DropdownMenuItem>
|
||||
</Header.MobileDropdown>
|
||||
<Button
|
||||
onClick={() => handleCreateSession()}
|
||||
disabled={!opcodeUrl || createSessionMutation.isPending}
|
||||
size="sm"
|
||||
className="bg-blue-600 hover:bg-blue-700 text-white transition-all duration-200 hover:scale-105"
|
||||
>
|
||||
<Plus className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">New Session</span>
|
||||
</Button>
|
||||
</Header.Actions>
|
||||
</Header>
|
||||
|
||||
<div className="flex-1 flex flex-col min-h-0">
|
||||
{opcodeUrl && repoDirectory && (
|
||||
|
||||
Reference in new issue
Block a user