Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

1.6 KB
Raw Blame
import * as React from 'react';
import { Info } from 'lucide-react';

import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { cn } from '@/lib/utils';

export const ModelHubInfoHint: React.FC<{
  label: string;
  content: React.ReactNode;
  className?: string;
  align?: 'start' | 'center' | 'end';
}> = ({ label, content, className, align = 'start' }) => {
  const [open, setOpen] = React.useState(false);
  // A mouse over the trigger has already opened the hint; its click must not toggle it shut again.
  const hovering = React.useRef(false);
  return (
    <Popover open={open} onOpenChange={(next) => setOpen(next || hovering.current)}>
      <PopoverTrigger asChild>
        <button
          type="button"
          aria-label={label}
          onPointerEnter={(event) => { if (event.pointerType === 'mouse') { hovering.current = true; setOpen(true); } }}
          onPointerLeave={(event) => { if (event.pointerType === 'mouse') { hovering.current = false; setOpen(false); } }}
          className={cn('inline-flex size-4 shrink-0 items-center justify-center rounded-full text-muted outline-none transition hover:text-foreground focus-visible:text-foreground', className)}
        >
          <Info className="size-3.5" />
        </button>
      </PopoverTrigger>
      <PopoverContent
        align={align}
        sideOffset={6}
        onOpenAutoFocus={(event) => event.preventDefault()}
        className="w-64 p-3 text-[12px] font-normal leading-relaxed text-muted"
      >
        {content}
      </PopoverContent>
    </Popover>
  );
};