Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge pull request #6805 from Huyvux12/fix/issue-6702-pinned-card-overlap

milind-soni43d0041ee56d
diff --cc src/components/AskCard.tsx
index 05a1ac99aa,f678f0a2a9..ecb2f4f50b
--- a/src/components/AskCard.tsx
+++ b/src/components/AskCard.tsx
@@@ -89,15 -65,12 +89,15 @@@ export function AskCard(
data-tour={tour}
data-ask-card="pending" data-look="ask-card"
onKeyDown={onKeyDown}
- className={cn("w-full max-w-[560px] rounded-[18px] px-4 pb-3.5 pt-3 text-start", stays ? `sticky top-[var(--glass-top,60px)] bottom-[72px] z-10 ${ELEVATED_FLOAT}` : ELEVATED_CARD)}
+ data-shell={kicker ? "kicker" : undefined}
+ className={cn("w-full max-w-[560px] rounded-[18px] text-start", kicker ? "overflow-hidden px-4 pb-4 pt-3.5" : "px-4 pb-3.5 pt-3",
- stays ? `sticky top-[60px] bottom-[72px] z-10 ${ELEVATED_FLOAT}` : ELEVATED_CARD)}
++ stays ? `sticky top-[var(--glass-top,60px)] bottom-[72px] z-10 ${ELEVATED_FLOAT}` : ELEVATED_CARD)}
>
{header && <div className="mb-1.5 pe-6">{header}</div>}
+ {kicker && <div className="mb-2"><AskKickerRow kicker={kicker} /></div>}
<div className="flex min-w-0 items-start gap-2">
{icon && <span aria-hidden="true" className="mt-[3px] flex shrink-0 text-ink-secondary">{icon}</span>}
- <div className="min-w-0 flex-1 break-words text-[15px] font-medium leading-[22px] text-ink">
+ <div className={cn("min-w-0 flex-1 break-words text-[15px]", kicker ? "font-semibold" : "font-medium", "leading-[22px] text-ink")}>
<bdi dir="auto">{title}</bdi>
</div>
{meta && <span className="mt-0.5 shrink-0 text-[12px] tabular-nums text-ink-tertiary">{meta}</span>}
diff --cc src/components/SignInRequestCard.test.ts
index bd4f00850f,32c76e0e4b..7ad8720cd6
--- a/src/components/SignInRequestCard.test.ts
+++ b/src/components/SignInRequestCard.test.ts
@@@ -29,11 -29,12 +29,12 @@@ vi.mock("@/lib/logins", () => (
}));
import { LoginForm } from "./LoginForm";
+ import { isPinnedSignIn, PinnedSignInSlot } from "./PinnedSignInSlot";
-import { SignInBanner, SignInRequestCard } from "./SignInRequestCard";
+import { SignInBanner, SignInRequestCard, SiteSignInCard } from "./SignInRequestCard";
import { VaultChoices } from "./VaultChoices";
- const card = (signIn: Record<string, unknown> = {}): Message => ({
- id: "card-1",
+ const card = (signIn: Record<string, unknown> = {}, id = "card-1"): Message => ({
+ id,
role: "bot",
kind: "signin",
at: 1,
diff --cc src/components/SignInRequestCard.tsx
index 0dc0d6d9e2,c6379c3649..4fa8888478
--- a/src/components/SignInRequestCard.tsx
+++ b/src/components/SignInRequestCard.tsx
@@@ -31,14 -37,9 +31,16 @@@ type CardProps =
color?: Bot["color"];
threadId: string;
message: Message;
+ /** False when the host already pins the card in a reserved slot outside the scrollport. */
+ stays?: boolean;
-}) {
+};
+
+/** A bot's handoff (its own instruction) or a site sign-in. */
+export function SignInRequestCard(props: CardProps) {
+ return isHandoff(props.message.signIn) ? <HandoffCard {...props} /> : <SiteSignInCard {...props} />;
+}
+
- export function SiteSignInCard({ botId, botName, color, threadId, message }: CardProps) {
++export function SiteSignInCard({ botId, botName, color, threadId, message, stays = true }: CardProps) {
const { state, dispatch } = useStore();
const card = message.signIn!;
// A login saved here is kept to every bot this browser signs in (server/bot-logins.ts cardBots).