Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/docs-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
with:
sparse-checkout: |
apps/docs
packages

- uses: pnpm/action-setup@v4
name: Install pnpm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import MessageBird from './MessageBirdConfig.mdx'
import Twilio from './TwilioConfig.mdx'
import Vonage from './VonageConfig.mdx'
import TextLocal from './TextLocalConfig.mdx'
import { safeHistoryReplaceState } from '~/lib/historyUtils'

const reducer = (_, action: (typeof PhoneLoginsItems)[number] | undefined) => {
const url = new URL(document.location.href)
Expand All @@ -16,7 +17,7 @@ const reducer = (_, action: (typeof PhoneLoginsItems)[number] | undefined) => {
} else {
url.searchParams.delete('showSmsProvider')
}
window.history.replaceState(null, '', url)
safeHistoryReplaceState(url.toString())
return action
}

Expand Down
13 changes: 11 additions & 2 deletions apps/docs/components/Navigation/Navigation.commands.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ArrowRight } from 'lucide-react'

import { isFeatureEnabled } from 'common'
import type { ICommand } from 'ui-patterns/CommandMenu'
import { useRegisterCommands } from 'ui-patterns/CommandMenu'

Expand Down Expand Up @@ -89,34 +90,39 @@ const navCommands = [
value: 'Reference, API, SDK: Go to Dart reference (Flutter)',
route: '/reference/dart/introduction',
icon: () => <ArrowRight />,
enabled: isFeatureEnabled('sdk:dart'),
},
{
id: 'nav-ref-python',
name: 'Go to Python reference',
value: 'Reference, API, SDK: Go to Python reference',
route: '/reference/python/introduction',
icon: () => <ArrowRight />,
enabled: isFeatureEnabled('sdk:python'),
},
{
id: 'nav-ref-csharp',
name: 'Go to C# reference',
value: 'Reference, API, SDK: Go to C# reference',
route: '/reference/csharp/introduction',
icon: () => <ArrowRight />,
enabled: isFeatureEnabled('sdk:csharp'),
},
{
id: 'nav-ref-swift',
name: 'Go to Swift reference',
value: 'Reference, API, SDK: Go to Swift reference',
route: '/reference/swift/introduction',
icon: () => <ArrowRight />,
enabled: isFeatureEnabled('sdk:swift'),
},
{
id: 'nav-ref-kotlin',
name: 'Go to Kotlin reference',
value: 'Reference, API, SDK: Go to Kotlin reference',
route: '/reference/kotlin/introduction',
icon: () => <ArrowRight />,
enabled: isFeatureEnabled('sdk:kotlin'),
},
{
id: 'nav-ref-cli',
Expand All @@ -143,11 +149,14 @@ const navCommands = [
name: 'Go to Integrations',
route: 'https://supabase.com/partners/integrations',
icon: () => <ArrowRight />,
enabled: isFeatureEnabled('integrations:partners'),
},
] satisfies ICommand[]
] satisfies Array<ICommand & { enabled?: boolean }>

const filteredNavCommands = navCommands.filter((command) => command.enabled !== false)

const useDocsNavCommands = () => {
useRegisterCommands('Go to', navCommands)
useRegisterCommands('Go to', filteredNavCommands)
}

export { useDocsNavCommands }
1 change: 1 addition & 0 deletions apps/docs/components/Navigation/Navigation.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ export type NavMenuConstant = Readonly<{
icon: string
url?: `/${string}`
items: ReadonlyArray<Partial<NavMenuSection>>
enabled?: boolean
}>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
billingAll: billingEnabled,
docsCompliance: complianceEnabled,
'docsSelf-hosting': selfHostingEnabled,
integrationsPartners: integrationsEnabled,
sdkCsharp: sdkCsharpEnabled,
sdkDart: sdkDartEnabled,
sdkKotlin: sdkKotlinEnabled,
Expand All @@ -19,6 +20,7 @@ const {
'billing:all',
'docs:compliance',
'docs:self-hosting',
'integrations:partners',
'sdk:csharp',
'sdk:dart',
'sdk:kotlin',
Expand Down Expand Up @@ -128,6 +130,7 @@ export const GLOBAL_MENU_ITEMS: GlobalMenuItems = [
hasLightIcon: true,
href: '/guides/integrations' as `/${string}`,
level: 'integrations',
enabled: integrationsEnabled,
},
],
],
Expand Down Expand Up @@ -2626,6 +2629,7 @@ export const integrations: NavMenuConstant = {
title: 'Integrations',
icon: 'integrations',
url: '/guides/integrations',
enabled: integrationsEnabled,
items: [
{
name: 'Overview',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ const ContentLink = React.memo(function ContentLink(props: any) {
const Content = (props) => {
const { menu, id } = props

if (menu.enabled === false) {
return null
}

return (
<ul className={['relative w-full flex flex-col gap-0 pb-5'].join(' ')}>
<Link href={menu.url ?? ''}>
Expand Down
7 changes: 1 addition & 6 deletions apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,7 @@ const TopNavBar: FC = () => {
<div className="hidden lg:flex items-center justify-end gap-3">
{!isUserLoading && (
<Button asChild>
<a
href="https://supabase.com/dashboard"
className="h-[30px]"
target="_blank"
rel="noreferrer noopener"
>
<a href="/dashboard" className="h-[30px]" target="_blank" rel="noreferrer noopener">
{isLoggedIn ? 'Dashboard' : 'Sign up'}
</a>
</Button>
Expand Down
3 changes: 2 additions & 1 deletion apps/docs/features/docs/Reference.ui.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import type { HTMLAttributes, PropsWithChildren } from 'react'
import { useContext, useEffect, useRef, useState } from 'react'
import { useInView } from 'react-intersection-observer'
import { safeHistoryReplaceState } from '~/lib/historyUtils'

import {
cn,
Expand Down Expand Up @@ -44,7 +45,7 @@ export function ReferenceSectionWrapper({
initialScrollHappened &&
window.scrollY > 0 /* Don't update on first navigation to introduction */
) {
window.history.replaceState(null, '', link)
safeHistoryReplaceState(link)
}
},
})
Expand Down
3 changes: 2 additions & 1 deletion apps/docs/layouts/ref/RefSubLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useNavigationMenuContext } from '~/components/Navigation/NavigationMenu
import { menuState } from '~/hooks/useMenuState'
import Image from 'next/legacy/image'
import { cn } from 'ui'
import { safeHistoryReplaceState } from '~/lib/historyUtils'

interface ISectionContainer {
id: string
Expand Down Expand Up @@ -97,7 +98,7 @@ const StickyHeader: FC<StickyHeader> = ({ icon, ...props }) => {
onChange: (inView, entry) => {
if (inView && window) highlightSelectedNavItem(entry.target.attributes['data-ref-id'].value)
if (inView && props.scrollSpyHeader) {
window.history.replaceState(null, '', entry.target.id)
safeHistoryReplaceState(entry.target.id)
// if (setActiveRefItem) setActiveRefItem(entry.target.attributes['data-ref-id'].value)
menuState.setMenuActiveRefId(entry.target.attributes['data-ref-id'].value)
// router.push(`/reference/javascript/${entry.target.attributes['data-ref-id'].value}`, null, {
Expand Down
3 changes: 2 additions & 1 deletion apps/docs/layouts/ref/RefSubLayoutNonFunc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { highlightSelectedNavItem } from 'ui/src/components/CustomHTMLElements/C
import { useRouter } from 'next/compat/router'
import { useNavigationMenuContext } from '~/components/Navigation/NavigationMenu/NavigationMenu.Context'
import { menuState } from '~/hooks/useMenuState'
import { safeHistoryReplaceState } from '~/lib/historyUtils'

interface ISectionContainer {
id: string
Expand Down Expand Up @@ -60,7 +61,7 @@ const StickyHeader: FC<StickyHeader> = (props) => {
onChange: (inView, entry) => {
if (inView && window) highlightSelectedNavItem(entry.target.attributes['data-ref-id'].value)
if (inView && props.scrollSpyHeader) {
window.history.replaceState(null, '', entry.target.id)
safeHistoryReplaceState(entry.target.id)
// if (setActiveRefItem) setActiveRefItem(entry.target.attributes['data-ref-id'].value)
menuState.setMenuActiveRefId(entry.target.attributes['data-ref-id'].value)
// router.push(`/reference/javascript/${entry.target.attributes['data-ref-id'].value}`, null, {
Expand Down
13 changes: 13 additions & 0 deletions apps/docs/lib/historyUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { debounce } from 'lodash-es'

export const safeHistoryReplaceState = debounce((url: string) => {
if (typeof window === 'undefined') return

if (url === window.location.href) return

try {
window.history.replaceState(null, '', url)
} catch (error) {
console.warn('Failed to call history.replaceState:', error)
}
}, 120)
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ const EXTERNAL_PROVIDER_APPLE = {
},
EXTERNAL_APPLE_CLIENT_ID: {
title: 'Client IDs',
description: `Comma separated list of allowed Apple app (Web, OAuth, iOS, macOS, watchOS, or tvOS) bundle IDs for native sign in, or service IDs for Sign in with Apple JS. [Learn more](https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js)`,
description: `Comma separated list of allowed Apple app (Web, OAuth, iOS, macOS, watchOS, or tvOS) bundle IDs for native sign in, or service IDs for Sign in with Apple JS. [Learn more](https://developer.apple.com/documentation/signinwithapplejs)`,
type: 'string',
},
EXTERNAL_APPLE_SECRET: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const QueryPerformanceGrid = ({ queryPerformanceQuery }: QueryPerformance
const fillWidth = Math.min(percentage, 100)

return (
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums">
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums font-mono">
<div
className={`absolute inset-0 bg-foreground transition-all duration-200 z-0`}
style={{
Expand Down Expand Up @@ -174,7 +174,7 @@ export const QueryPerformanceGrid = ({ queryPerformanceQuery }: QueryPerformance

if (col.id === 'total_time') {
return (
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums">
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums font-mono">
{isTime && typeof value === 'number' && !isNaN(value) && isFinite(value) ? (
<p
className={cn((value / 1000).toFixed(2) === '0.00' && 'text-foreground-lighter')}
Expand All @@ -194,7 +194,7 @@ export const QueryPerformanceGrid = ({ queryPerformanceQuery }: QueryPerformance

if (col.id === 'calls') {
return (
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums">
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums font-mono">
{typeof value === 'number' && !isNaN(value) && isFinite(value) ? (
<p className={cn(value === 0 && 'text-foreground-lighter')}>
{value.toLocaleString()}
Expand All @@ -208,7 +208,7 @@ export const QueryPerformanceGrid = ({ queryPerformanceQuery }: QueryPerformance

if (col.id === 'max_time' || col.id === 'mean_time' || col.id === 'min_time') {
return (
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums">
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums font-mono">
{typeof value === 'number' && !isNaN(value) && isFinite(value) ? (
<p className={cn(value.toFixed(0) === '0' && 'text-foreground-lighter')}>
{Math.round(value).toLocaleString()}ms
Expand All @@ -222,7 +222,7 @@ export const QueryPerformanceGrid = ({ queryPerformanceQuery }: QueryPerformance

if (col.id === 'rows_read') {
return (
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums">
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums font-mono">
{typeof value === 'number' && !isNaN(value) && isFinite(value) ? (
<p className={cn(value === 0 && 'text-foreground-lighter')}>
{value.toLocaleString()}
Expand All @@ -241,7 +241,7 @@ export const QueryPerformanceGrid = ({ queryPerformanceQuery }: QueryPerformance

if (col.id === 'cache_hit_rate') {
return (
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums">
<div className="w-full flex flex-col justify-center text-xs text-right tabular-nums font-mono">
{typeof value === 'string' ? (
<p
className={cn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
UpdateColumnPayload,
} from '../SidePanelEditor.types'
import type { RetrievedTableColumn, RetrieveTableResult } from 'data/tables/table-retrieve-query'
import { toast } from 'sonner'

const isSQLExpression = (input: string) => {
if (['CURRENT_DATE'].includes(input)) return true
Expand Down Expand Up @@ -170,9 +171,11 @@ export const validateFields = (field: ColumnField) => {
const errors = {} as Dictionary<any>
if (field.name.length === 0) {
errors['name'] = `Please assign a name for your column`
toast.error(errors['name'])
}
if (field.format.length === 0) {
errors['format'] = `Please select a type for your column`
toast.error(errors['format'])
}
return errors
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const ColumnType = ({
description,
showRecommendation = false,
onOptionSelect = noop,
error,
}: ColumnTypeProps) => {
const [open, setOpen] = useState(false)
const availableTypes = POSTGRES_DATA_TYPES.concat(
Expand Down Expand Up @@ -167,7 +168,7 @@ const ColumnType = ({
<Popover_Shadcn_ open={open} onOpenChange={setOpen}>
<PopoverTrigger_Shadcn_ asChild>
<Button
type="default"
type={error ? 'danger' : 'default'}
role="combobox"
size={'small'}
aria-expanded={open}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ export const TableEditor = ({
const onSaveChanges = (resolve: any) => {
if (tableFields) {
const errors: any = validateFields(tableFields)
if (errors.name) {
toast.error(errors.name)
}

if (errors.columns) {
toast.error(errors.columns)
}
Expand Down
3 changes: 2 additions & 1 deletion packages/common/enabled-features/enabled-features.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@

"feedback:docs": true,

"integrations:vercel": true,
"integrations:partners": true,
"integrations:show_stripe_wrapper": true,
"integrations:vercel": true,

"logs:templates": true,
"logs:collections": true,
Expand Down
11 changes: 8 additions & 3 deletions packages/common/enabled-features/enabled-features.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,18 @@
"description": "Enable feedback submission for docs site"
},

"integrations:vercel": {
"integrations:partners": {
"type": "boolean",
"description": "Enable the vercel integration section in the organization and project settings pages"
"description": "Show all third-party-managed integrations"
},
"integrations:show_stripe_wrapper": {
"type": "boolean",
"description": "Show the Stripe wrapper under project integrations"
},
"integrations:vercel": {
"type": "boolean",
"description": "Enable the vercel integration section in the organization and project settings pages"
},

"logs:templates": {
"type": "boolean",
Expand Down Expand Up @@ -291,8 +295,9 @@
"docs:compliance",
"docs:self-hosting",
"feedback:docs",
"integrations:vercel",
"integrations:partners",
"integrations:show_stripe_wrapper",
"integrations:vercel",
"profile:show_email",
"profile:show_information",
"profile:show_analytics_and_marketing",
Expand Down
Loading