- New mission-map-markers collection (permission-gated, removed with its mission via a Missions beforeDelete hook) plus an opt-in classification.planningMapEnabled flag on missions. - The mission page gains a planning section: place and edit Arma markers (icons, ellipses, rectangles, polylines) with debounced saves, an SQF copy export, and an Arma grid readout. Everyone who can read the mission sees the plan once enabled; editing requires missions:update or mission ownership. - Base layers come from GET /api/map-features?layers=base, which skips the structure, node and shipment queries; marker icons render tinted by color exactly like in-game. - Includes the hand-written migration, the missionMap service lib, server actions emitting mission:map-marker-* events, and integration plus e2e coverage.
73 lines
1.9 KiB
TypeScript
73 lines
1.9 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import { type VariantProps } from "class-variance-authority"
|
|
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
import { toggleVariants } from "@/components/ui/toggle"
|
|
|
|
const ToggleGroupContext = React.createContext<
|
|
VariantProps<typeof toggleVariants>
|
|
>({
|
|
size: "default",
|
|
variant: "default",
|
|
})
|
|
|
|
function ToggleGroup({
|
|
className,
|
|
variant,
|
|
size,
|
|
children,
|
|
...props
|
|
}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
|
|
VariantProps<typeof toggleVariants>) {
|
|
return (
|
|
<ToggleGroupPrimitive.Root
|
|
data-slot="toggle-group"
|
|
data-variant={variant}
|
|
data-size={size}
|
|
className={cn(
|
|
"group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
<ToggleGroupContext.Provider value={{ variant, size }}>
|
|
{children}
|
|
</ToggleGroupContext.Provider>
|
|
</ToggleGroupPrimitive.Root>
|
|
)
|
|
}
|
|
|
|
function ToggleGroupItem({
|
|
className,
|
|
children,
|
|
variant,
|
|
size,
|
|
...props
|
|
}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &
|
|
VariantProps<typeof toggleVariants>) {
|
|
const context = React.useContext(ToggleGroupContext)
|
|
|
|
return (
|
|
<ToggleGroupPrimitive.Item
|
|
data-slot="toggle-group-item"
|
|
data-variant={context.variant || variant}
|
|
data-size={context.size || size}
|
|
className={cn(
|
|
toggleVariants({
|
|
variant: context.variant || variant,
|
|
size: context.size || size,
|
|
}),
|
|
"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</ToggleGroupPrimitive.Item>
|
|
)
|
|
}
|
|
|
|
export { ToggleGroup, ToggleGroupItem }
|