import { useEffect, useRef, useState } from 'react'; import type { ReactNode } from 'react'; import { Check, ChevronDown, Copy, Download } from 'lucide-react'; import { config } from 'virtual:seemore/config'; import type { ActionId } from '../../shared/types.js'; import { copyPageAsMarkdown } from '../export/copyMarkdown.js'; import { exportPageAsHtml } from '../export/exportPage.js'; import { useRouteUrl } from '../router.js'; interface Action { label: string; icon: ReactNode; run: (url: string) => Promise; /** Shown in place of the label for a moment afterwards, for an action with no visible result. */ done?: string; } /** * The actions the button can hold, keyed by the id a config's `pageActions` array names. * A new action is a new id in `ACTION_IDS`, one entry here, and the menu picks it up — * no component changes. */ const ACTIONS: Record = { 'copy-markdown': { label: 'Copy as Markdown', icon: