Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ MacOS = "macOS"
AKS = "AKS"
O_WRONLY = "O_WRONLY"
AIBridge = "AI Bridge"
# plural of SIEM, as in security information and event management
SIEMs = "SIEMs"

[default.extend-words]
AKS = "AKS"
Expand Down
24 changes: 2 additions & 22 deletions site/src/components/Paywall/Paywall.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArrowRightIcon, CheckIcon, ExternalLinkIcon } from "lucide-react";
import { ArrowRightIcon, CheckIcon } from "lucide-react";
import type React from "react";
import type { FC } from "react";
import { type LinkProps, Link as RouterLink } from "react-router";
Expand All @@ -14,10 +14,9 @@ export const PREMIUM_FEATURES = [
];

export const PREMIUM_PAGE_PATH = "/deployment/premium";
export const PREMIUM_PRICING_LINK = "https://coder.com/pricing";
export const PREMIUM_DEFAULT_DESCRIPTION =
"You need a Premium license to use this feature.";
export const PREMIUM_DEFAULT_HERO = "Get Access with Coder Premium";
export const PREMIUM_DEFAULT_HERO = "Get access with a Coder trial";

export type PaywallProps = React.ComponentProps<"div"> & {
message: string;
Expand Down Expand Up @@ -113,25 +112,6 @@ export const PaywallDescription: FC<React.ComponentProps<"p">> = ({
);
};

export const PaywallDocumentationLink: FC<React.ComponentProps<"a">> = ({
children = "Read the documentation",
className,
href,
...props
}) => {
return (
<a
href={href}
target="_blank"
rel="noreferrer"
className={cn("text-content-link font-medium mr-4", className)}
{...props}
>
{children} <ExternalLinkIcon className="size-icon-xs" />
</a>
);
};

export const PaywallSupergraphic: FC<React.ComponentProps<"div">> = ({
className,
...props
Expand Down
20 changes: 9 additions & 11 deletions site/src/components/Paywall/PaywallPremium.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { expect, within } from "storybook/test";
import { PREMIUM_PRICING_LINK } from "#/components/Paywall/Paywall";
import { PaywallPremium } from "./PaywallPremium";

const meta: Meta<typeof PaywallPremium> = {
Expand All @@ -21,21 +20,20 @@ export const CanViewLicenses: Story = {
const canvas = within(canvasElement);

await expect(
canvas.getByRole("heading", { name: /Coder Premium/ }),
canvas.getByRole("heading", { name: /Get access with a Coder trial/ }),
).toBeVisible();
await expect(
canvas.getByText("Start an unlimited 30-day trial today"),
).toBeVisible();
await expect(canvas.getByText("Start a 30-day trial today.")).toBeVisible();

const cta = canvas.getByRole("link", { name: "Start trial for free" });
await expect(cta).toBeVisible();
await expect(cta).toHaveAttribute("href", "/deployment/premium");
await expect(cta).not.toHaveAttribute("target", "_blank");

const pricing = canvas.getByRole("link", {
name: "Learn more about premium",
});
await expect(pricing).toBeVisible();
await expect(pricing).toHaveAttribute("href", PREMIUM_PRICING_LINK);
await expect(pricing).toHaveAttribute("target", "_blank");
await expect(
canvas.queryByRole("link", { name: "Learn more about premium" }),
).not.toBeInTheDocument();

await expect(
canvas.getByRole("heading", {
Expand Down Expand Up @@ -65,8 +63,8 @@ export const CannotViewLicenses: Story = {
canvas.queryByRole("link", { name: "Start trial for free" }),
).not.toBeInTheDocument();
await expect(
canvas.getByRole("link", { name: "Learn more about premium" }),
).toBeVisible();
canvas.queryByRole("link", { name: "Learn more about premium" }),
).not.toBeInTheDocument();
},
};

Expand Down
13 changes: 1 addition & 12 deletions site/src/components/Paywall/PaywallPremium.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ExternalLinkIcon } from "lucide-react";
import type { FC } from "react";
import { Supergraphic } from "#/components/Supergraphic/Supergraphic";
import { cn } from "#/utils/cn";
Expand All @@ -13,10 +12,9 @@ import {
PREMIUM_DEFAULT_HERO,
PREMIUM_FEATURES,
PREMIUM_PAGE_PATH,
PREMIUM_PRICING_LINK,
} from "./Paywall";

const DEFAULT_HERO_SUBTITLE = "Start a 30-day trial today.";
const DEFAULT_HERO_SUBTITLE = "Start an unlimited 30-day trial today";

const PaywallPremiumHeader: FC<React.ComponentProps<"div">> = ({
children,
Expand Down Expand Up @@ -88,15 +86,6 @@ const PaywallPremium = ({
<h3 className="m-0 font-semibold text-base leading-relaxed text-content-primary">
{description}
</h3>
<a
href={PREMIUM_PRICING_LINK}
target="_blank"
rel="noreferrer"
className="mt-4 inline-flex items-center gap-1.5 text-sm text-content-link underline underline-offset-2"
>
Learn more about premium
<ExternalLinkIcon aria-hidden="true" className="size-icon-sm" />
</a>
</div>
<PaywallFeatures className="flex-1 px-0" aria-label={message}>
{features.map((feature) => (
Expand Down
4 changes: 2 additions & 2 deletions site/src/components/Paywall/PaywallSmall.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export const CannotViewLicenses: Story = {
const canvas = within(canvasElement);

await expect(
canvas.getByRole("link", { name: "Learn more about premium" }),
).toBeVisible();
canvas.queryByRole("link", { name: "Learn more about premium" }),
).not.toBeInTheDocument();
await expect(
canvas.getByText(/contact your deployment administrator/i),
).toBeVisible();
Expand Down
5 changes: 0 additions & 5 deletions site/src/components/Paywall/PaywallSmall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
PaywallContent,
PaywallCTALink,
PaywallDescription,
PaywallDocumentationLink,
PaywallFeature,
PaywallFeatures,
PaywallGuidance,
Expand All @@ -16,7 +15,6 @@ import {
PREMIUM_DEFAULT_HERO,
PREMIUM_FEATURES,
PREMIUM_PAGE_PATH,
PREMIUM_PRICING_LINK,
} from "./Paywall";

const PaywallSmall = ({
Expand Down Expand Up @@ -50,9 +48,6 @@ const PaywallSmall = ({
>
{description}
</PaywallDescription>
<PaywallDocumentationLink href={PREMIUM_PRICING_LINK}>
Learn more about premium
</PaywallDocumentationLink>
</PaywallContent>
<PaywallStack className={cn(compact && "gap-4")}>
<PaywallFeatures className={cn(compact && "pr-0")}>
Expand Down
17 changes: 7 additions & 10 deletions site/src/pages/AIBridgePage/AIBridgeSessionsLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
import type { FC, PropsWithChildren } from "react";
import { Outlet } from "react-router";
import { Link } from "#/components/Link/Link";
import { Margins } from "#/components/Margins/Margins";
import {
PageHeader,
PageHeaderSubtitle,
PageHeaderTitle,
} from "#/components/PageHeader/PageHeader";
import { SettingsHeaderDocsLink } from "#/components/SettingsHeader/SettingsHeader";
import { docs } from "#/utils/docs";

const AIBridgeSessionsLayout: FC<PropsWithChildren> = () => {
return (
<Margins className="pb-12">
<PageHeader>
<PageHeader
actions={
<SettingsHeaderDocsLink href={docs("/ai-coder/ai-gateway/audit")} />
}
>
<PageHeaderTitle>
<div className="flex items-center gap-2">
<span>AI Sessions</span>
</div>
</PageHeaderTitle>
<PageHeaderSubtitle>
Review and audit AI activity, token usage, and prompt history across
sessions.{" "}
<Link
href={docs("/ai-coder/ai-gateway/audit")}
className="ml-auto"
target="_blank"
>
Learn how to audit AI sessions
</Link>
sessions.
</PageHeaderSubtitle>
</PageHeader>
<Outlet />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
MockPermissions,
mockApiError,
} from "#/testHelpers/entities";
import { docs } from "#/utils/docs";
import { GatewayKeysPageView } from "./GatewayKeysPageView";

const meta: Meta<typeof GatewayKeysPageView> = {
Expand Down Expand Up @@ -81,6 +82,12 @@ export const Paywall: Story = {

const cta = canvas.getByRole("link", { name: "Start trial for free" });
await expect(cta).toHaveAttribute("href", "/deployment/premium");
await expect(
canvas.getByRole("link", { name: /Read the docs/ }),
).toHaveAttribute(
"href",
docs("/ai-coder/ai-gateway/standalone#create-a-gateway-key"),
);
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import type { FC } from "react";
import type { AIGatewayKey } from "#/api/typesGenerated";
import { ErrorAlert } from "#/components/Alert/ErrorAlert";
import { Button } from "#/components/Button/Button";
import { Link } from "#/components/Link/Link";
import { PaywallPremium } from "#/components/Paywall/PaywallPremium";
import {
SettingsHeader,
SettingsHeaderDescription,
SettingsHeaderDocsLink,
SettingsHeaderTitle,
} from "#/components/SettingsHeader/SettingsHeader";
import {
Expand Down Expand Up @@ -47,19 +47,25 @@ export const GatewayKeysPageView: FC<GatewayKeysPageViewProps> = ({
<div>
<SettingsHeader
actions={
!showPaywall && (
<Button variant="outline" onClick={onCreateKey}>
<PlusIcon />
Create key
</Button>
)
<div className="flex flex-row gap-2 items-center">
<SettingsHeaderDocsLink
href={docs(
"/ai-coder/ai-gateway/standalone#create-a-gateway-key",
)}
/>
{!showPaywall && (
<Button variant="outline" onClick={onCreateKey}>
<PlusIcon />
Create key
</Button>
)}
</div>
}
>
<SettingsHeaderTitle>AI Gateway Keys</SettingsHeaderTitle>
<SettingsHeaderDescription>
Keys authenticate standalone AI Gateway replicas to this deployment.
The key value is shown only once when created.{" "}
<Link href={docs("/ai-coder/ai-gateway")}>View docs</Link>
The key value is shown only once when created.
</SettingsHeaderDescription>
</SettingsHeader>

Expand Down
4 changes: 4 additions & 0 deletions site/src/pages/AuditPage/AuditPageView.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
MockUserOwner,
} from "#/testHelpers/entities";
import { pixelWithTablet } from "#/testHelpers/pixel";
import { docs } from "#/utils/docs";
import { useResourceTypeFilterMenu } from "./AuditFilter";
import { AuditPageView } from "./AuditPageView";

Expand Down Expand Up @@ -100,6 +101,9 @@ export const NotVisible: Story = {

const cta = canvas.getByRole("link", { name: "Start trial for free" });
await expect(cta).toHaveAttribute("href", "/deployment/premium");
await expect(
canvas.getByRole("link", { name: /Read the docs/ }),
).toHaveAttribute("href", docs("/admin/security/audit-logs"));
},
};

Expand Down
8 changes: 7 additions & 1 deletion site/src/pages/AuditPage/AuditPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import {
type PaginationResult,
} from "#/components/PaginationWidget/PaginationContainer";
import { PaywallPremium } from "#/components/Paywall/PaywallPremium";
import { SettingsHeaderDocsLink } from "#/components/SettingsHeader/SettingsHeader";
import { Table, TableBody } from "#/components/Table/Table";
import { TableEmpty } from "#/components/TableEmpty/TableEmpty";
import { TableLoader } from "#/components/TableLoader/TableLoader";
import { Timeline } from "#/components/Timeline/Timeline";
import type { Permissions } from "#/modules/permissions";
import { docs } from "#/utils/docs";
import { AuditFilter } from "./AuditFilter";
import { AuditHelpPopover } from "./AuditHelpPopover";
import { AuditLogRow } from "./AuditLogRow/AuditLogRow";
Expand Down Expand Up @@ -49,7 +51,11 @@ export const AuditPageView: FC<AuditPageViewProps> = ({

return (
<Margins className="pb-12">
<PageHeader>
<PageHeader
actions={
<SettingsHeaderDocsLink href={docs("/admin/security/audit-logs")} />
}
>
<PageHeaderTitle>
<div className="flex flex-row gap-2 items-center">
<span>Audit</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
MockUserOwner,
} from "#/testHelpers/entities";
import { pixelWithTablet } from "#/testHelpers/pixel";
import { docs } from "#/utils/docs";
import { ConnectionLogPageView } from "./ConnectionLogPageView";

type FilterProps = ComponentProps<typeof ConnectionLogPageView>["filterProps"];
Expand Down Expand Up @@ -100,6 +101,9 @@ export const NotVisible: Story = {

const cta = canvas.getByRole("link", { name: "Start trial for free" });
await expect(cta).toHaveAttribute("href", "/deployment/premium");
await expect(
canvas.getByRole("link", { name: /Read the docs/ }),
).toHaveAttribute("href", docs("/admin/monitoring/connection-logs"));
},
};

Expand Down
10 changes: 9 additions & 1 deletion site/src/pages/ConnectionLogPage/ConnectionLogPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import {
type PaginationResult,
} from "#/components/PaginationWidget/PaginationContainer";
import { PaywallPremium } from "#/components/Paywall/PaywallPremium";
import { SettingsHeaderDocsLink } from "#/components/SettingsHeader/SettingsHeader";
import { Table, TableBody } from "#/components/Table/Table";
import { TableEmpty } from "#/components/TableEmpty/TableEmpty";
import { TableLoader } from "#/components/TableLoader/TableLoader";
import { Timeline } from "#/components/Timeline/Timeline";
import type { Permissions } from "#/modules/permissions";
import { docs } from "#/utils/docs";
import { ConnectionLogFilter } from "./ConnectionLogFilter";
import { ConnectionLogHelpPopover } from "./ConnectionLogHelpPopover";
import { ConnectionLogRow } from "./ConnectionLogRow/ConnectionLogRow";
Expand Down Expand Up @@ -48,7 +50,13 @@ export const ConnectionLogPageView: FC<ConnectionLogPageViewProps> = ({

return (
<Margins className="pb-12">
<PageHeader>
<PageHeader
actions={
<SettingsHeaderDocsLink
href={docs("/admin/monitoring/connection-logs")}
/>
}
>
<PageHeaderTitle>
<div className="flex flex-row gap-2 items-center">
<span>Connection Log</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const AIGovernanceSettingsPageView: FC<
<div>
<SettingsHeader
actions={
<SettingsHeaderDocsLink href={docs("/ai-coder/ai-gateway")} />
<SettingsHeaderDocsLink href={docs("/ai-coder/ai-governance")} />
}
>
<SettingsHeaderTitle hierarchy="secondary" level="h2">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { expect, within } from "storybook/test";
import { MockPermissions } from "#/testHelpers/entities";
import { docs } from "#/utils/docs";
import { AppearanceSettingsPageView } from "./AppearanceSettingsPageView";

const meta: Meta<typeof AppearanceSettingsPageView> = {
Expand Down Expand Up @@ -56,6 +57,9 @@ export const NotEntitled: Story = {

const cta = canvas.getByRole("link", { name: "Start trial for free" });
await expect(cta).toHaveAttribute("href", "/deployment/premium");
await expect(
canvas.getByRole("link", { name: /Read the docs/ }),
).toHaveAttribute("href", docs("/admin/setup/appearance"));
await expect(
canvas.queryByRole("form", { name: "Appearance settings" }),
).not.toBeInTheDocument();
Expand Down
Loading
Loading