11"use client" ;
22
33import { IconCheckmarkLine , IconChevronDownLine } from "@karrotmarket/react-monochrome-icon" ;
4- import { useEffect , useState } from "react" ;
4+ import { useState } from "react" ;
55import { Popover , PopoverContent , PopoverTrigger } from "fumadocs-ui/components/ui/popover" ;
66import { buttonVariants } from "fumadocs-ui/components/ui/button" ;
77import { cva } from "class-variance-authority" ;
@@ -12,19 +12,17 @@ const VERSIONS = [
1212 { label : "v1.0" , url : "https://1-0.seed-design.pages.dev/react" } ,
1313] as const satisfies ReadonlyArray < { label : string ; url : string } > ;
1414
15+ // NOTE: update CURRENT_VERSION when releasing a new version & keep in release branch
16+ const CURRENT_VERSION : ( typeof VERSIONS ) [ number ] [ "label" ] = "v1.2 (latest)" ;
17+
1518const itemVariants = cva (
1619 "text-sm p-2 rounded-lg inline-flex items-center gap-2 hover:text-fd-accent-foreground hover:bg-fd-accent [&_svg]:size-4" ,
1720) ;
1821
1922export function ReactVersionSwitcher ( ) {
2023 const [ open , setOpen ] = useState ( false ) ;
21- const [ hostname , setHostname ] = useState ( "" ) ;
22-
23- useEffect ( ( ) => {
24- setHostname ( window . location . hostname ) ;
25- } , [ ] ) ;
2624
27- const current = VERSIONS . find ( ( v ) => new URL ( v . url ) . hostname === hostname ) ?? VERSIONS [ 0 ] ;
25+ const current = VERSIONS . find ( ( v ) => v . label === CURRENT_VERSION ) ?? VERSIONS [ 0 ] ;
2826
2927 return (
3028 < Popover open = { open } onOpenChange = { setOpen } >
0 commit comments