mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
fix(mobile): tighten repo header actions and hide empty reports inbox
Group the back button with the title so the repo name truncates instead of colliding with actions, unify the mobile header buttons to 40px ghost icons, collapse the reports inbox when nothing is unread, and let Header.Title truncate on every page.
This commit is contained in:
1 parent
e42ce1bd56
commit
fbdc14b408
6 files changed
+39
-16
No files matched your search
@@ -53,12 +53,25 @@ describe('ScheduleReportsBell', () => {
|
||||
expect(screen.getByTestId('schedule-reports-count')).toHaveClass('bg-destructive')
|
||||
})
|
||||
|
||||
it('shows the all-caught-up empty state when there are no unread runs', async () => {
|
||||
const user = userEvent.setup()
|
||||
it('renders nothing when there are no unread runs', () => {
|
||||
mocks.useUnreadScheduleRuns.mockReturnValue({ data: { runs: [], total: 0, failed: 0 } })
|
||||
renderBell()
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Reports, 0 unread' }))
|
||||
expect(screen.queryByRole('button', { name: /Reports/ })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('stays open with the all-caught-up state after the last unread run is cleared', async () => {
|
||||
const user = userEvent.setup()
|
||||
mocks.useUnreadScheduleRuns.mockReturnValue({ data: { runs: [], total: 1, failed: 0 } })
|
||||
const { rerender } = renderBell()
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Reports, 1 unread' }))
|
||||
mocks.useUnreadScheduleRuns.mockReturnValue({ data: { runs: [], total: 0, failed: 0 } })
|
||||
rerender(
|
||||
<MemoryRouter>
|
||||
<ScheduleReportsBell />
|
||||
</MemoryRouter>,
|
||||
)
|
||||
|
||||
expect(await screen.findByText('All caught up')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
@@ -130,6 +130,8 @@ export function ScheduleReportsBell() {
|
||||
markAllViewed.mutate()
|
||||
}
|
||||
|
||||
if (total === 0 && !open) return null
|
||||
|
||||
const trigger = (
|
||||
<Button
|
||||
variant="ghost"
|
||||
|
||||
@@ -170,9 +170,9 @@ export function ProjectActionsMenu({ repoId, directory }: ProjectActionsMenuProp
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
aria-label="Project actions"
|
||||
className="h-8 w-8 text-muted-foreground hover:text-foreground"
|
||||
className="h-10 w-10 text-muted-foreground hover:text-foreground sm:h-8 sm:w-8"
|
||||
>
|
||||
<Play className="h-4 w-4" />
|
||||
<Play className="h-5 w-5 sm:h-4 sm:w-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-56">
|
||||
|
||||
@@ -40,7 +40,7 @@ function HeaderTitle({ children, logo, className }: HeaderTitleProps) {
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
<div className={cn("flex items-center gap-2", className)}>
|
||||
<div className={cn("flex min-w-0 items-center gap-2", className)}>
|
||||
{logo && typeof children === "string" && children === "OpenCode" ? (
|
||||
<img
|
||||
src={theme === 'light' ? "/opencode-wordmark-light.svg" : "/opencode-wordmark-dark.svg"}
|
||||
|
||||
@@ -44,7 +44,7 @@ export function PendingActionBadge({
|
||||
size="icon"
|
||||
onClick={onClick}
|
||||
className={cn(
|
||||
'relative h-8 w-8 transition-all duration-200',
|
||||
'relative h-10 w-10 transition-all duration-200 sm:h-8 sm:w-8',
|
||||
styles.bg,
|
||||
styles.hover,
|
||||
styles.text,
|
||||
@@ -52,7 +52,7 @@ export function PendingActionBadge({
|
||||
)}
|
||||
title={`${count} pending ${label}${count > 1 ? 's' : ''}`}
|
||||
>
|
||||
<Icon className="w-4 h-4" />
|
||||
<Icon className="w-5 h-5 sm:w-4 sm:h-4" />
|
||||
<span
|
||||
className={cn(
|
||||
'absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full animate-pulse',
|
||||
|
||||
@@ -215,8 +215,8 @@ export function RepoDetail() {
|
||||
className="h-dvh max-h-dvh overflow-hidden bg-gradient-to-br from-background via-background to-background flex flex-col pb-[calc(env(safe-area-inset-bottom)+56px)] sm:pb-0"
|
||||
>
|
||||
<Header>
|
||||
<Header.BackButton to="/" />
|
||||
<div className="flex items-center gap-2 min-w-0">
|
||||
<div className="flex items-center gap-2 sm:gap-3 min-w-0 flex-1">
|
||||
<Header.BackButton to="/" />
|
||||
<Header.Title>{repoName}</Header.Title>
|
||||
{isWorktree ? (
|
||||
<Badge className="text-xs px-1.5 sm:px-2.5 py-0.5 bg-primary/20 text-primary border-primary/40" title="Worktree">
|
||||
@@ -225,20 +225,28 @@ export function RepoDetail() {
|
||||
</Badge>
|
||||
) : null}
|
||||
</div>
|
||||
<Header.Actions>
|
||||
<div className="flex items-center gap-1">
|
||||
<Header.Actions className="shrink-0 gap-1 sm:gap-2 pl-2">
|
||||
<div className="flex items-center gap-0.5 sm:gap-1">
|
||||
<ProjectActionsMenu repoId={repoId} directory={baseDirectory} />
|
||||
<PendingActionsGroup />
|
||||
<Button
|
||||
onClick={() => setMultiRunOpen(true)}
|
||||
aria-label="Multi-run"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="sm:hidden h-10 w-10 text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
<Columns3 className="w-5 h-5" />
|
||||
</Button>
|
||||
</div>
|
||||
<Button
|
||||
onClick={() => setMultiRunOpen(true)}
|
||||
aria-label="Multi-run"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-10 sm:h-9"
|
||||
className="hidden sm:inline-flex h-9"
|
||||
>
|
||||
<Columns3 className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">Multi-run</span>
|
||||
<Columns3 className="w-4 h-4 mr-2" />
|
||||
<span>Multi-run</span>
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => handleCreateSession()}
|
||||
|
||||
Reference in new issue
Block a user