mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 12:55:06 +03:00
- move navigation components to `apps/studio/components/layouts/Navigation` - add [FloatingMobileToolbar](https://github.com/supabase/supabase/pull/43444/changes#diff-3dffe47fd51ca851d612d8728e03b2dc344ec213d4f3a46a824d3fa32a7cc851) as quick access to tools such as search, assistant, inline editor, etc - behind feature flag and feature preview (true by default as it's a bit annoying to have to enable it all the time as previews are stored in local-storage) - fix sidebar panels closing on viewport resizing (regression from previous pr) https://github.com/user-attachments/assets/d6881e3b-5128-4306-bb82-3ca39c755dba <img width="986" height="697" alt="Screenshot 2026-03-12 at 12 40 11" src="https://github.com/user-attachments/assets/da8511e2-7d01-4237-b814-596031c747c5" />
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import { LOCAL_STORAGE_KEYS } from 'common'
|
|
import { useOrganizationsQuery } from 'data/organizations/organizations-query'
|
|
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
|
|
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
|
|
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
|
|
import { IS_PLATFORM } from 'lib/constants'
|
|
import Link from 'next/link'
|
|
import { useRouter } from 'next/router'
|
|
import { cn } from 'ui'
|
|
|
|
export const HomeIcon = ({ className }: { className?: string }) => {
|
|
const { data: selectedOrganization } = useSelectedOrganizationQuery()
|
|
const { data: organizations } = useOrganizationsQuery()
|
|
|
|
const largeLogo = useIsFeatureEnabled('branding:large_logo')
|
|
|
|
const router = useRouter()
|
|
const [lastVisitedOrganization] = useLocalStorageQuery(
|
|
LOCAL_STORAGE_KEYS.LAST_VISITED_ORGANIZATION,
|
|
''
|
|
)
|
|
|
|
const getDefaultOrgRedirect = () => {
|
|
if (lastVisitedOrganization) return `/org/${lastVisitedOrganization}`
|
|
if (selectedOrganization?.slug) return `/org/${selectedOrganization.slug}`
|
|
if (organizations && organizations.length > 0) return `/org/${organizations[0].slug}`
|
|
return '/organizations'
|
|
}
|
|
|
|
const href = IS_PLATFORM ? getDefaultOrgRedirect() : '/project/default'
|
|
|
|
return (
|
|
<Link href={href} className={cn('items-center justify-center flex-shrink-0 flex', className)}>
|
|
<img
|
|
alt="Supabase"
|
|
src={`${router.basePath}/img/supabase-logo.svg`}
|
|
className={largeLogo ? 'h-[20px]' : 'h-[18px]'}
|
|
/>
|
|
</Link>
|
|
)
|
|
}
|