mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
refactor(activity): remove the compact activity list from the mobile More drawer
This commit is contained in:
1 parent
11a2661cc6
commit
87a8a21a8d
5 files changed
+20
-331
No files matched your search
@@ -367,47 +367,19 @@ describe('MoreDrawer', () => {
|
||||
expect(screen.queryByRole('button', { name: 'Assistant' })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('shows the Activity section above the menu when there are items', () => {
|
||||
it('shows no Activity section even when there are activity items', () => {
|
||||
mockAuth()
|
||||
mockServerHealth()
|
||||
setActivityGroups({ recent: [createActiveWorkItem()] })
|
||||
renderMoreDrawer({ initialEntry: '/repos/1/sessions/session-1', routePath: '/repos/:id/sessions/:sessionId' })
|
||||
|
||||
const heading = screen.getByRole('heading', { name: 'Activity' })
|
||||
const firstMenuRow = screen.getByText('Files')
|
||||
expect(screen.getByText('Session s1')).toBeInTheDocument()
|
||||
expect(heading.compareDocumentPosition(firstMenuRow) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()
|
||||
})
|
||||
|
||||
it('hides the Activity section when there are no items', () => {
|
||||
mockAuth()
|
||||
mockServerHealth()
|
||||
setActivityGroups({})
|
||||
renderMoreDrawer({ initialEntry: '/repos/1/sessions/session-1', routePath: '/repos/:id/sessions/:sessionId' })
|
||||
|
||||
expect(screen.queryByRole('heading', { name: 'Activity' })).not.toBeInTheDocument()
|
||||
expect(screen.queryByText('Session s1')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('navigates to the activity item without a close that would replace the new route', () => {
|
||||
const navigateMock = vi.fn()
|
||||
vi.mocked(useNavigate).mockReturnValue(navigateMock)
|
||||
mockAuth()
|
||||
mockServerHealth()
|
||||
setActivityGroups({ recent: [createActiveWorkItem()] })
|
||||
const handleClose = vi.fn()
|
||||
renderMoreDrawer({ initialEntry: '/repos/1/sessions/session-1', routePath: '/repos/:id/sessions/:sessionId', onClose: handleClose })
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: /Session s1/ }))
|
||||
|
||||
expect(navigateMock).toHaveBeenCalledWith('/repos/1/sessions/s1')
|
||||
expect(handleClose).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('offers only the remote-capable project items on a linked-server route', () => {
|
||||
mockAuth()
|
||||
mockServerHealth()
|
||||
setActivityGroups({ recent: [createActiveWorkItem()] })
|
||||
renderMoreDrawer({
|
||||
initialEntry: '/servers/srv_kitchen/sessions/ses_remote',
|
||||
routePath: '/servers/:serverId/sessions/:sessionId',
|
||||
@@ -419,7 +391,6 @@ describe('MoreDrawer', () => {
|
||||
expect(screen.getByText('Settings')).toBeInTheDocument()
|
||||
expect(screen.getByText('Logout')).toBeInTheDocument()
|
||||
expect(screen.getByText('Terminal')).toBeInTheDocument()
|
||||
expect(screen.getByRole('heading', { name: 'Activity' })).toBeInTheDocument()
|
||||
expect(screen.getByText('Sessions')).toBeInTheDocument()
|
||||
expect(screen.queryByText('Files')).not.toBeInTheDocument()
|
||||
expect(screen.getByText('Source Control')).toBeInTheDocument()
|
||||
|
||||
@@ -8,7 +8,6 @@ import { useQuery } from '@tanstack/react-query'
|
||||
import { getRepo } from '@/api/repos'
|
||||
import { useRefreshOnOpen } from '@/hooks/useRefreshOnOpen'
|
||||
import { SideDrawer, SideDrawerContent } from '@/components/ui/side-drawer'
|
||||
import { CompactActivityList } from '@/components/activity/CompactActivityList'
|
||||
import { ScheduleReportsList } from '@/components/notifications/ScheduleReportsBell'
|
||||
import { useMarkAllScheduleRunsViewed, useUnreadScheduleRuns } from '@/hooks/useSchedules'
|
||||
import { buildMoreItems, buildNavModel, isManagerOnlyNavItem, isSessionDetailPath, type MoreDrawerItem } from './moreDrawerItems'
|
||||
@@ -206,9 +205,6 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) {
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{isOpen && (
|
||||
<CompactActivityList onNavigate={(path) => navigate(path)} />
|
||||
)}
|
||||
<MenuSection>
|
||||
{(isSessionDetail || isRemoteSessionDetail) && (
|
||||
<MenuRow icon={List} label="Sessions" onClick={() => openMobileSheet('sessions')} trailing />
|
||||
|
||||
Reference in new issue
Block a user