Skip to content
Myr

client-territory.tsx

This file

Path

apps/web/src/features/propose/client-territory.tsx

47 lines · 1.4 KiB · TypeScript

Last changed by

Merge build/comments-web-features into mainoscabrielbefore adoption74bfc72

History of this file

Take it

Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2

line 1why, one step back
1/**

Merge build/comments-web-features into mainoscabrielbefore adoption74bfc72

lines 2–3why, one step back
2 * `import.meta.env.SSR` is `true` in the Worker's build, so the dynamic import
3 * below is dead code there and the Worker bundles none of it.

Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2

lines 4–47why, one step back
4 */
5import { ClientOnly } from "@tanstack/react-router";6import { ChevronDown } from "lucide-react";7import { lazy, Suspense } from "react";89import type { TerritorySelectProps } from "./territory-select.tsx";1011const SelectLater = import.meta.env.SSR12 ? undefined13 : lazy(() => import("./territory-select.tsx"));1415const StandIn = ({ choices, labelledBy, value }: TerritorySelectProps) => (16 <>17 <button18 aria-labelledby={labelledBy}19 className="border-input tablet:text-ui tablet:h-9 flex h-11 w-full max-w-xs items-center justify-between gap-1.5 border bg-transparent py-2 pr-2 pl-2.5 text-base"20 data-slot="select-trigger"21 disabled22 type="button"23 >24 {choices.find((choice) => choice.value === value)?.label ?? value}25 <ChevronDown26 aria-hidden="true"27 className="text-muted-foreground size-4"28 strokeWidth={1.75}29 />30 </button>31 <input name="territory" type="hidden" value={value} />32 </>33);3435export const ClientTerritorySelect = (props: TerritorySelectProps) => {36 const fallback = <StandIn {...props} />;3738 return SelectLater === undefined ? (39 fallback40 ) : (41 <ClientOnly fallback={fallback}>42 <Suspense fallback={fallback}>43 <SelectLater {...props} />44 </Suspense>45 </ClientOnly>46 );47};