mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 12:25:05 +03:00
remove from sidebar
This commit is contained in:
1 parent
512035b507
commit
3ee2cd0717
2 files changed
+17
-50
No files matched your search
@@ -1,12 +1,12 @@
|
||||
import { History } from 'lucide-react'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
import { useParams } from 'common'
|
||||
import { useRecentRoutes } from 'hooks/misc/useRecentRoutes'
|
||||
import { useRegisterCommands, useSetCommandMenuOpen } from 'ui-patterns/CommandMenu'
|
||||
import { COMMAND_MENU_SECTIONS } from './CommandMenu.utils'
|
||||
import { orderCommandSectionsByPriority } from './ordering'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useParams } from 'common'
|
||||
|
||||
export function useRecentRoutesCommands() {
|
||||
const router = useRouter()
|
||||
@@ -15,22 +15,20 @@ export function useRecentRoutesCommands() {
|
||||
const { recentRoutes } = useRecentRoutes()
|
||||
|
||||
const commands = useMemo(() => {
|
||||
return recentRoutes.map((route) => {
|
||||
// Format: "Parent > Child" (e.g., "Authentication > Users")
|
||||
const displayName = route.parentLabel
|
||||
? `${route.parentLabel} > ${route.childName}`
|
||||
: route.childName
|
||||
|
||||
return {
|
||||
id: `recent-${route.key}`,
|
||||
name: displayName,
|
||||
action: () => {
|
||||
router.push(route.link)
|
||||
setIsOpen(false)
|
||||
},
|
||||
icon: () => <History size={18} />,
|
||||
}
|
||||
})
|
||||
return recentRoutes.map((route) => ({
|
||||
id: `recent-${route.key}`,
|
||||
name: route.childName,
|
||||
// Include parent label in value for search
|
||||
value: route.parentLabel ? `${route.childName} ${route.parentLabel}` : route.childName,
|
||||
action: () => {
|
||||
router.push(route.link)
|
||||
setIsOpen(false)
|
||||
},
|
||||
icon: () => <History size={18} />,
|
||||
badge: route.parentLabel
|
||||
? () => <span className="text-xs text-foreground-muted">{route.parentLabel}</span>
|
||||
: undefined,
|
||||
}))
|
||||
}, [recentRoutes, router, setIsOpen])
|
||||
|
||||
useRegisterCommands(COMMAND_MENU_SECTIONS.RECENTS, commands, {
|
||||
|
||||
@@ -228,11 +228,7 @@ const ProjectLinks = () => {
|
||||
const { securityLints, errorLints } = useLints()
|
||||
const showReports = useIsFeatureEnabled('reports:all')
|
||||
const { mutate: sendEvent } = useSendEventMutation()
|
||||
const { recentRoutes, trackRoute } = useRecentRoutes()
|
||||
const [sidebarBehaviour] = useLocalStorageQuery(
|
||||
LOCAL_STORAGE_KEYS.SIDEBAR_BEHAVIOR,
|
||||
DEFAULT_SIDEBAR_BEHAVIOR
|
||||
)
|
||||
const { trackRoute } = useRecentRoutes()
|
||||
|
||||
const isNewAPIDocsEnabled = useIsAPIDocsSidePanelEnabled()
|
||||
const { isEnabled: isUnifiedLogsEnabled } = useUnifiedLogsPreview()
|
||||
@@ -397,33 +393,6 @@ const ProjectLinks = () => {
|
||||
/>
|
||||
))}
|
||||
</SidebarGroup>
|
||||
{recentRoutes.length > 0 && (
|
||||
<>
|
||||
<Separator className="w-[calc(100%-1rem)] mx-auto" />
|
||||
<SidebarGroup className="gap-0.5">
|
||||
<span className="text-xs text-foreground-lighter w-full px-2 py-1 uppercase font-mono">Recents</span>
|
||||
{recentRoutes.map((route) => (
|
||||
<SidebarMenuItem key={`recent-${route.key}`}>
|
||||
<SidebarMenuButton
|
||||
asChild
|
||||
tooltip={sidebarBehaviour === 'closed' ? route.childName : ''}
|
||||
className={cn('text-sm', sidebarBehaviour === 'open' ? '' : '')}
|
||||
size="sm"
|
||||
>
|
||||
<Link href={route.link}>
|
||||
<div className="flex flex-col items-start leading-tight">
|
||||
<span>{route.childName}</span>
|
||||
{route.parentLabel && (
|
||||
<span className="text-[10px] text-foreground-muted">{route.parentLabel}</span>
|
||||
)}
|
||||
</div>
|
||||
</Link>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
))}
|
||||
</SidebarGroup>
|
||||
</>
|
||||
)}
|
||||
<Separator className="w-[calc(100%-1rem)] mx-auto" />
|
||||
<SidebarGroup className="gap-0.5">
|
||||
{productRoutes.map((route, i) => (
|
||||
|
||||
Reference in new issue
Block a user