mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-10 03:22:05 +00:00
Merge resolved conflicts in web/src/{i18n/{en,zh,types}.ts,lib/api.ts}
by keeping both this branch's `profiles` additions and upstream's new
`models` page additions.
Copilot review feedback:
- Implement POST /api/profiles/{name}/open-terminal endpoint (already
present); align Windows branch to `cmd.exe /c start "" <cmd>` so it
matches the new test and spawns a fresh window instead of /k reusing
the parent console.
- Move backslash escaping out of the macOS AppleScript f-string
expression (Python <3.12 disallows backslashes inside f-string
expression parts).
- Patch `_get_wrapper_dir` via monkeypatch in
test_profiles_create_creates_wrapper_alias_when_safe so the test no
longer writes to the real `~/.local/bin`.
- Extend test_dashboard_browser_safe_imports to scan `.ts` files in
addition to `.tsx`.
- Switch upstream's new ModelsPage.tsx away from the `@nous-research/ui`
root barrel onto per-component subpaths to satisfy the stricter scan.
- Fix NouiTypography `leading-1.4` -> `leading-[1.4]` so Tailwind
actually emits the line-height for the `sm` variant.
- Guard ProfilesPage.openSoulEditor against out-of-order responses by
tracking the latest requested profile via a ref.
- Replace ProfilesPage's hand-rolled setup command with a fetch to
`/api/profiles/{name}/setup-command` so the copied command always
matches what the backend would actually run (handles wrapper-alias
collisions and reserved names correctly).
- Wire SOUL.md textarea label `htmlFor` -> textarea `id` so screen
readers and clicking the label work as expected.
63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
import { forwardRef, type ElementType, type HTMLAttributes, type ReactNode } from "react";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
type TypographyProps = HTMLAttributes<HTMLElement> & {
|
|
as?: ElementType;
|
|
children?: ReactNode;
|
|
compressed?: boolean;
|
|
courier?: boolean;
|
|
expanded?: boolean;
|
|
mondwest?: boolean;
|
|
mono?: boolean;
|
|
sans?: boolean;
|
|
variant?: "sm" | "md" | "lg" | "xl";
|
|
};
|
|
|
|
const variantClasses: Record<NonNullable<TypographyProps["variant"]>, string> = {
|
|
sm: "leading-[1.4] text-[.9375rem] tracking-[0.1875rem]",
|
|
md: "text-[2.625rem] leading-[1] tracking-[0.0525rem]",
|
|
lg: "text-[2.625rem] leading-[1] tracking-[0.0525rem]",
|
|
xl: "text-[4.5rem] leading-[1] tracking-[0.135rem]",
|
|
};
|
|
|
|
export const Typography = forwardRef<HTMLElement, TypographyProps>(function Typography(
|
|
{
|
|
as: Component = "span",
|
|
className,
|
|
compressed,
|
|
courier,
|
|
expanded,
|
|
mondwest,
|
|
mono,
|
|
sans,
|
|
variant,
|
|
...props
|
|
},
|
|
ref,
|
|
) {
|
|
const hasFontVariant = compressed || courier || expanded || mondwest || mono || sans;
|
|
|
|
return (
|
|
<Component
|
|
className={cn(
|
|
compressed && "font-compressed",
|
|
courier && "font-courier",
|
|
expanded && "font-expanded",
|
|
mondwest && "font-mondwest tracking-[0.1875rem]",
|
|
mono && "font-mono",
|
|
(!hasFontVariant || sans) && "font-sans",
|
|
variant && variantClasses[variant],
|
|
className,
|
|
)}
|
|
ref={ref}
|
|
{...props}
|
|
/>
|
|
);
|
|
});
|
|
|
|
export const H2 = forwardRef<HTMLHeadingElement, Omit<TypographyProps, "as">>(function H2(
|
|
{ className, variant = "lg", ...props },
|
|
ref,
|
|
) {
|
|
return <Typography as="h2" className={cn("font-bold", className)} variant={variant} ref={ref} {...props} />;
|
|
});
|