Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
import { BookmarkIcon } from "lucide-react";
import { memo } from "react";
import { useI18n } from "~/i18n";
import { cn } from "~/lib/utils";
import { Button } from "../ui/button";
import { ComposerBanner } from "./ComposerBanner";
/**
* Bookmark tab that shows the stash count beside the composer's other attachments
* and opens the stash menu.
*
* On save the badge gives one quiet acknowledgement: it lifts to full
* opacity and the count ticks over. `pulseKey` changes per stash, remounting
* the count so the transition replays without a continuous animation.
*/
export const ComposerStashBadge = memo(function ComposerStashBadge(props: {
count: number;
menuOpen: boolean;
placement?: "inline" | "tab";
pulseKey: number;
pulsing: boolean;
onToggleMenu: () => void;
}) {
const { t } = useI18n();
if (props.count === 0) return null;
const inline = props.placement === "inline";
const count = (
<ComposerBanner.Count
key={props.pulseKey}
className={cn(
props.pulsing
? "animate-prompt-stash-count-enter text-primary motion-reduce:animate-none"
: "text-muted-foreground",
)}
>
{props.count}
</ComposerBanner.Count>
);
if (inline) {
return (
<Button
size="micro"
variant="ghost-muted"
data-prompt-stash-badge="true"
aria-label={t("Stashed prompts: {count}. Open stash.", { count: props.count })}
aria-expanded={props.menuOpen}
presentation={props.menuOpen || props.pulsing ? "stash-badge-active" : "stash-badge"}
className="shrink-0"
onPointerDown={(event) => event.preventDefault()}
onClick={props.onToggleMenu}
>
<BookmarkIcon className="size-3 shrink-0" aria-hidden="true" />
{count}
</Button>
);
}
return (
<ComposerBanner.Root width="content" data-composer-shoulder-tab className="ml-auto">
<ComposerBanner.Row
render={<button type="button" />}
data-prompt-stash-badge="true"
aria-label={t("Stashed prompts: {count}. Open stash.", { count: props.count })}
aria-expanded={props.menuOpen}
className={cn(
"transition-colors duration-200",
props.menuOpen && "pointer-events-none",
props.menuOpen || props.pulsing
? "text-foreground"
: "text-muted-foreground hover:text-foreground",
)}
onPointerDown={(event) => event.preventDefault()}
onClick={props.onToggleMenu}
>
<ComposerBanner.Icon>
<BookmarkIcon />
</ComposerBanner.Icon>
<ComposerBanner.Content>{t("Stash")}</ComposerBanner.Content>
<ComposerBanner.Actions>{count}</ComposerBanner.Actions>
</ComposerBanner.Row>
</ComposerBanner.Root>
);
});