Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

1.8 KB
Raw Blame
/*
 * Copyright 2025 Daytona Platforms Inc.
 * Modified by BoxLite AI, 2025-2026
 * SPDX-License-Identifier: AGPL-3.0
 */

import { Button } from '@/components/ui/button'
import { Separator } from '@/components/ui/separator'
import { cn, pluralize } from '@/lib/utils'
import { TrashIcon, XIcon } from '@/components/ui/icon'
import { motion } from 'motion/react'

export function SelectionToast({
  className,
  selectedCount,
  onClearSelection,
  onActionClick,
  actionLabel,
}: {
  className?: string
  selectedCount: number
  /** Runs the action directly. It used to open the command palette, which is
   *  where the bulk action then had to be found. */
  onActionClick: () => void
  actionLabel: string
  onClearSelection: () => void
}) {
  return (
    <motion.div
      initial={{ scale: 0.9, opacity: 0, y: 20, x: '-50%' }}
      animate={{ scale: 1, opacity: 1, y: 0, x: '-50%' }}
      exit={{ scale: 0.9, opacity: 0, y: 20, x: '-50%' }}
      className={cn('bg-popover  gap-3 max-w-[90vw]', className)}
    >
      <div className="bg-background text-foreground border border-border rounded-lg shadow-lg pl-3 pr-1 py-1 flex items-center justify-between gap-4">
        <div className="flex items-center gap-1">
          <div className="text-body tabular-nums whitespace-nowrap">
            {pluralize(selectedCount, 'item', 'items')} selected
          </div>
          <Button variant="ghost" size="icon-sm" onClick={onClearSelection}>
            <XIcon className="size-3.5" />
          </Button>
        </div>
        <Separator orientation="vertical" className="h-5" />

        <Button variant="ghost" size="sm" className="h-8" onClick={onActionClick}>
          <TrashIcon className="size-3.5" />
          <span className="text-body">{actionLabel}</span>
        </Button>
      </div>
    </motion.div>
  )
}