mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
## Problem supabase-swift v3 is in alpha (`3.0.0-alpha.2`). The docs have no reference for it. v3 renames many public APIs, so the v2 reference does not help people who try the alpha. ## Solution Add a v3 reference at `/reference/swift/v3`. v2 stays the default at `/reference/swift`. - **Prerelease flag.** A version in `REFERENCES` can now set `prerelease: 'alpha'` (or another stage). Swift versions are `['v2', 'v3', 'v1']`. `versions[0]` is still the latest stable version, so the existing URL and "latest" logic does not change. Other SDKs can use the same flag. - **Alpha notice.** A prerelease page shows "This version is in alpha" with a link to the stable version. It does not show the "Version out of date" warning. - **Version menu.** Prerelease versions show in a separate "Prereleases" group with a stage badge. - **Spec.** `spec/supabase_swift_v3.yml` ports the v2 spec to the v3 API. The examples were checked against the v3 source at the `v3.0.0-alpha.2` tag. It adds the new v3 APIs: MFA recovery codes, `AuthAdminClient`, admin custom providers, `functions.stream`, and the Realtime streams API. - **Pages.** New introduction, installing (Xcode 26, Swift 6.2), and upgrade guide pages under `docs/ref/swift/v3/`. - **Navigation.** Nav entries for v3. v3 is excluded from the "TypeScript support" section. Not in this PR: - Search indexing for v3. Search still covers v2 only. - In the v2 spec, 7 filter ids use camelCase (for example `containedBy` and `textSearch`). They match no section, so they do not render in the v2 docs today. The v3 spec uses the matching kebab-case ids. The v2 fix can be a separate PR. ## Review instructions 1. Open `/docs/reference/swift/v3` on the preview. See the alpha notice and the v3 sections. 2. Open the version menu. See "Stable releases" (v2.0 with a "Latest" badge, v1.0) and "Prereleases" (v3.0 with an "Alpha" badge). 3. Open `/docs/reference/swift`. See that it still shows v2 with no notice. 4. Read the upgrade guide at `/docs/reference/swift/v3/upgrade-guide`. Typecheck, Prettier, and ESLint pass locally. I did not run the docs unit tests. The Swift examples were not compiled. <img width="318" height="236" alt="Screenshot 2026-11-25 at 10 36 01" src="https://github.com/user-attachments/assets/0f0caf18-7a4a-4835-8f6a-b76df9c66fa9" /> <img width="685" height="417" alt="Screenshot 2026-11-25 at 10 36 10" src="https://github.com/user-attachments/assets/1c55bc44-1fc1-4390-8d8c-48bc55822bd3" /> ## Checklist Check all before review: - [ ] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
108 lines
3.2 KiB
TypeScript
108 lines
3.2 KiB
TypeScript
'use client'
|
|
|
|
import { getPrereleaseStage, REFERENCES } from '~/content/navigation.references'
|
|
import { ChevronDown } from 'lucide-react'
|
|
import { useRouter } from 'next/navigation'
|
|
import {
|
|
Badge,
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuLabel,
|
|
DropdownMenuSeparator,
|
|
DropdownMenuTrigger,
|
|
} from 'ui'
|
|
|
|
const RevVersionDropdown = ({
|
|
library,
|
|
currentVersion,
|
|
}: {
|
|
library: string
|
|
currentVersion: string
|
|
}) => {
|
|
const { push } = useRouter()
|
|
|
|
const libraryMeta = REFERENCES?.[library] ?? undefined
|
|
const versions = libraryMeta?.versions ?? []
|
|
|
|
if (!versions || versions.length <= 1) {
|
|
return null
|
|
}
|
|
|
|
const prereleaseVersions = versions.flatMap((version) => {
|
|
const stage = getPrereleaseStage(library, version)
|
|
return stage ? [{ version, stage }] : []
|
|
})
|
|
const stableVersions = versions.filter((version) => !getPrereleaseStage(library, version))
|
|
|
|
const onSelectVersion = (version: string) => {
|
|
if (version === versions[0]) {
|
|
push(`/reference/${library}`)
|
|
} else {
|
|
push(`/reference/${library}/${version}`)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger>
|
|
<div
|
|
className="
|
|
group
|
|
justify-between
|
|
bg-control
|
|
border
|
|
hover:border-control
|
|
hover:bg-overlay-hover
|
|
border-control px-2 h-[32px] rounded-sm
|
|
layout-v2:h-6 layout-v2:px-1.5 layout-v2:rounded-md
|
|
font-mono
|
|
flex items-center gap-1 text-foreground-muted text-xs group-hover:text-foreground transition
|
|
"
|
|
>
|
|
<span className="text-foreground text-sm layout-v2:text-xs group-hover:text-foreground transition">
|
|
{currentVersion}.0
|
|
</span>
|
|
<ChevronDown size={14} strokeWidth={2} />
|
|
</div>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="start" side="bottom" className="w-48">
|
|
<DropdownMenuLabel className="text-xs">Stable releases</DropdownMenuLabel>
|
|
{stableVersions.map((version) => (
|
|
<DropdownMenuItem
|
|
key={version}
|
|
onClick={() => onSelectVersion(version)}
|
|
className="justify-between flex"
|
|
>
|
|
<span className={`${currentVersion === version ? 'font-bold' : ''}`}>
|
|
Version {version}.0
|
|
</span>
|
|
{version === versions[0] && <Badge>Latest</Badge>}
|
|
</DropdownMenuItem>
|
|
))}
|
|
{prereleaseVersions.length > 0 && (
|
|
<>
|
|
<DropdownMenuSeparator />
|
|
<DropdownMenuLabel className="text-xs">Prereleases</DropdownMenuLabel>
|
|
{prereleaseVersions.map(({ version, stage }) => (
|
|
<DropdownMenuItem
|
|
key={version}
|
|
onClick={() => onSelectVersion(version)}
|
|
className="justify-between flex"
|
|
>
|
|
<span className={`${currentVersion === version ? 'font-bold' : ''}`}>
|
|
Version {version}.0
|
|
</span>
|
|
<Badge variant="warning" className="capitalize">
|
|
{stage}
|
|
</Badge>
|
|
</DropdownMenuItem>
|
|
))}
|
|
</>
|
|
)}
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
)
|
|
}
|
|
export default RevVersionDropdown
|