evOo-local/packages/ui-web/src/bot-avatar.tsx
cynarAI a55ed44394
One product: evOo updates and name, phone actions, German on mobile, working account deletion, consistent settings (#168)
* Pull updates from evOo instead of the upstream Rakazo repository

The in-app server updater, the image-based compose files and the desktop
auto-updater still pointed at elie222/rakazo, so updating an evOo install
would have pulled Rakazo. They now follow cynarAI/evOo-local, where the
publish workflow already pushes the images. The disabled Rakazo production
deploy job is gone from CI; evo deploys itself.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ

* Call the product evOo everywhere people see its name

The desktop setup window and menu, account emails, the iOS app name and
permission prompts, sign-in headings, messages bots post into connected chat
apps, the web fetch user agent, issue templates and the marketing site still
said Rakazo, or EvOo. They now say evOo. The marketing site no longer calls
evOo an alternative to itself.

Internal identifiers (package scopes, env vars, bundle ids, the desktop
productName that keys its data folder and keychain entry) stay as they are.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ

* Open conversation actions by holding a row on a phone

Pin, move to folder, mark unread, duplicate, archive and delete only opened
on right-click, which iOS Safari never fires. Holding a conversation or a
folder header now dispatches the same contextmenu event, so the existing menu
opens under the finger; Android's own long-press event is not doubled and the
lift does not also open the conversation.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ

* Give small chrome icons a 44px touch area on phones

The browser and computer toggles, the activity bell, the create button and the
section plus buttons were 18 to 36 px targets. On touch screens each now gets
an invisible 44px hit area without changing how it looks; the create button
uses the same plus icon as the rest of the sidebar instead of a text glyph,
and the computer toggle gets an accessible name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ

* Add German to the mobile app

German speakers saw the phone app in English because the mobile UI only
knew English, Simplified Chinese, and Russian. The app now ships a German
catalog covering every mobile chrome string, follows a German device
language (de, de-DE, de-AT, de-CH, ...), and offers Deutsch in the Account
language picker.

Strings that also exist in the web German catalog reuse its wording so
web and phone say the same thing; the rest follow the same terms and the
informal "du".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ

* Use the evOo sign-in strings in the German phone catalog

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ

* Make account deletion work and give settings one section style

Deleting an account posted to the auth endpoint without a JSON content
type, so the server refused it and the button did nothing. The privacy
page now deletes through the auth client and returns to sign-in. It also
drops the claims it could not verify, the export button that only showed
an alert, and its own padding, and shows where the data and the computer
live. Notifications and media settings use the same SettingsSection.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ

* Use status tokens, the shared switch and one German glossary

Voice stage dots, the onboarding progress bar and the Voice First button
used raw emerald, violet, cyan and rose; they now use foreground, success
and destructive like the rest of the app. The routine editor's hand-built
switch is the shared Switch. German says Unterhaltung for threads and
Space consistently on web and phone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ

* Expect the evOo setup copy in the desktop e2e specs

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ

* Translate the voice preview label in the German phone catalog

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ

* Wait for the main thread URL without waiting for every resource

openMainBotThread already navigated with domcontentloaded; its URL check
then waited for the full load event, which can exceed 20 s on a busy
runner. The composer check that follows covers readiness.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-06 00:38:31 +02:00

222 lines
6.5 KiB
TypeScript

import type { OoMoment } from "@rakazo/core";
import {
ACTIVE_RUN_STATUSES,
DEFAULT_OO_AVATAR,
decodeOoAvatar,
OO_CLASSIC_SHAPE_COUNT,
OO_SUCCESS_SECONDS,
ooIdentityShapeIndex,
ooMomentAfterStatus,
ooMomentForStatus,
resolveOoColor,
} from "@rakazo/core";
import { memo, useEffect, useId, useMemo, useRef, useState } from "react";
import { normalizeEvooPose } from "./evoo-character/pose-map.js";
import type { EvooPose } from "./evoo-character/types.js";
import { cn } from "./lib/utils.js";
import { OoFigure } from "./oo-figure.js";
import "./styles.css";
export function parseBotAvatar(
rawColor: string,
_identity?: string,
): {
color: string;
shapeIndex?: number;
isImage: boolean;
imageUrl?: string;
} {
if (!rawColor) return { color: "#F97316", isImage: false };
// Only data: image URLs are rendered. Arbitrary http(s)/blob values in `color`
// must not become <img src> (SSRF / tracking when other members view the bot).
if (rawColor.startsWith("data:image/")) {
return { color: "#F97316", isImage: true, imageUrl: rawColor };
}
const look = decodeOoAvatar(rawColor);
if (!look) return { color: "#F97316", isImage: false };
return {
color: look.color || "#F97316",
shapeIndex: look.shape ?? undefined,
isImage: false,
};
}
/** Mascot poses that have their own Oo moment under another name. */
const POSE_MOMENT: Partial<Record<EvooPose, OoMoment>> = {
analyzing: "reading",
skeptical: "thinking",
curious: "idle",
delighted: "success",
error: "concerned",
collaborating: "working",
};
/** Mascot pose → Oo moment; every canonical pose has one. */
export function ooMomentForPose(pose: EvooPose): OoMoment {
const canonical = normalizeEvooPose(pose);
return POSE_MOMENT[canonical] ?? (canonical as OoMoment);
}
/** A short moment after a status change, such as joy when a run finishes. */
export function useOoStatusMoment(status?: string): OoMoment | null {
const previous = useRef(status);
const [moment, setMoment] = useState<OoMoment | null>(null);
useEffect(() => {
const next = ooMomentAfterStatus(previous.current, status);
previous.current = status;
setMoment(next);
if (!next) return;
const timer = setTimeout(() => setMoment(null), OO_SUCCESS_SECONDS * 1000);
return () => clearTimeout(timer);
}, [status]);
return moment;
}
export interface BotAvatarProps {
color: string;
size?: number;
status?: string;
identity?: string;
/** Explicit mascot pose; when omitted, derived from `status`. */
pose?: EvooPose;
/** Explicit moment; wins over `pose` and `status`. */
moment?: OoMoment;
/** Draw one still frame. */
still?: boolean;
/** Eyes follow the pointer and a tap boops the Oo. */
interactive?: boolean;
className?: string;
}
function WorkingRing({ size, color }: { size: number; color: string }) {
const id = useId().replace(/[^a-zA-Z0-9-_]/g, "");
return (
<svg
className="rakazo-bot-avatar-ring absolute pointer-events-none"
style={{ inset: -4, width: size + 8, height: size + 8 }}
viewBox="0 0 48 48"
fill="none"
aria-hidden="true"
>
<circle
cx="24"
cy="24"
r="22"
stroke={`url(#${id}-ring)`}
strokeWidth="3.2"
strokeLinecap="round"
strokeDasharray="45 80"
/>
<defs>
<linearGradient id={`${id}-ring`} x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stopColor={color} stopOpacity="1" />
<stop offset="100%" stopColor={color} stopOpacity="0" />
</linearGradient>
</defs>
</svg>
);
}
export const BotAvatar = memo(function BotAvatar({
color,
size = 36,
status,
identity = "",
pose,
moment,
still,
interactive,
className,
}: BotAvatarProps) {
const isWorking = ACTIVE_RUN_STATUSES.some((s) => s === status);
const parsed = useMemo(() => parseBotAvatar(color, identity), [color, identity]);
const look = useMemo(
() => (parsed.isImage ? null : (decodeOoAvatar(color) ?? DEFAULT_OO_AVATAR)),
[color, parsed.isImage],
);
const effectiveId = identity || parsed.color || "agent";
const colorDef = useMemo(
() => resolveOoColor(effectiveId, parsed.color),
[effectiveId, parsed.color],
);
const statusMoment = useOoStatusMoment(status);
const activeMoment =
moment ?? statusMoment ?? (pose ? ooMomentForPose(pose) : ooMomentForStatus(status));
if (parsed.isImage && parsed.imageUrl) {
return (
<div
className={cn(
"rakazo-bot-avatar relative overflow-hidden rounded-full flex items-center justify-center select-none bg-secondary shrink-0 border border-border",
className,
)}
data-working={isWorking}
style={{ width: size, height: size }}
>
{isWorking ? <WorkingRing size={size} color={colorDef.light} /> : null}
<img src={parsed.imageUrl} alt="" className="h-full w-full object-cover" />
</div>
);
}
return (
<div
className={cn(
"rakazo-bot-avatar relative inline-flex items-center justify-center shrink-0 select-none",
className,
)}
style={{ width: size, height: size }}
data-working={isWorking}
>
{isWorking ? <WorkingRing size={size} color={colorDef.light} /> : null}
<OoFigure
avatar={look ?? DEFAULT_OO_AVATAR}
color={colorDef.hex}
fallbackShape={look?.shape ?? ooIdentityShapeIndex(effectiveId)}
moment={activeMoment}
size={size}
still={still}
interactive={interactive}
/>
</div>
);
});
/** A classic silhouette in the picker, drawn as the Oo it would become. */
export function OoShapePreview({
shapeIndex,
color,
selected,
onClick,
}: {
shapeIndex: number;
color: string;
selected?: boolean;
onClick?: () => void;
}) {
const colorDef = resolveOoColor("preview", color);
return (
<button
type="button"
onClick={onClick}
aria-label="evOo"
aria-pressed={selected ?? false}
className={cn(
"relative flex size-11 items-center justify-center rounded-xl transition-transform hover:scale-105 active:scale-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-popover",
selected
? "ring-2 ring-primary ring-offset-2 ring-offset-popover bg-foreground/10"
: "hover:bg-foreground/5",
)}
>
<OoFigure
avatar={DEFAULT_OO_AVATAR}
color={colorDef.hex}
fallbackShape={shapeIndex % OO_CLASSIC_SHAPE_COUNT}
moment="idle"
size={40}
still
/>
</button>
);
}