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
158 changes: 156 additions & 2 deletions apps/ui/src/components/providers/hero.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { ExternalLink, Play } from "lucide-react";
import {
ExternalLink,
Play,
ShieldCheck,
ShieldAlert,
MapPin,
Database,
Eye,
Clock,
} from "lucide-react";

import { AuthLink } from "@/components/shared/auth-link";
import { Button } from "@/lib/components/button";
Expand All @@ -15,6 +24,42 @@ interface HeroProps {
providerId: ProviderId;
}

function DataPolicyBadge({
value,
labelTrue,
labelFalse,
dangerIfTrue = false,
}: {
value: boolean | null;
labelTrue: string;
labelFalse: string;
dangerIfTrue?: boolean;
}) {
if (value === null) {
return (
<span className="inline-flex items-center gap-1 rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground">
Unknown
</span>
);
}

const isDanger = dangerIfTrue ? value : !value;

if (isDanger) {
return (
<span className="inline-flex items-center gap-1 rounded-md bg-red-500/10 px-2 py-1 text-xs text-red-600 dark:text-red-400">
{value ? labelTrue : labelFalse}
</span>
);
}

return (
<span className="inline-flex items-center gap-1 rounded-md bg-green-500/10 px-2 py-1 text-xs text-green-600 dark:text-green-400">
{value ? labelTrue : labelFalse}
</span>
);
}

export function Hero({ providerId }: HeroProps) {
const config = getConfig();
const provider = providerDefinitions.find((p) => p.id === providerId)!;
Expand Down Expand Up @@ -70,8 +115,117 @@ export function Hero({ providerId }: HeroProps) {
</a>
</Button>
</div>

{(provider.dataPolicy || provider.headquarters) && (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is bad as it might now then show some other fields that exist below

<div className="mt-8 rounded-lg border bg-card p-4">
<h3 className="text-sm font-semibold mb-3 flex items-center gap-2">
{provider.dataPolicy?.apiTraining === false ? (
<ShieldCheck className="h-4 w-4 text-green-600 dark:text-green-400" />
) : (
<ShieldAlert className="h-4 w-4 text-muted-foreground" />
)}
Data & Privacy
</h3>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 text-sm">
{provider.headquarters && (
<div className="flex items-center gap-2">
<MapPin className="h-3.5 w-3.5 text-muted-foreground" />
<span className="text-muted-foreground">HQ:</span>
<span className="font-medium">{provider.headquarters}</span>
</div>
)}
{provider.dataPolicy && (
<>
<div className="flex items-center gap-2">
<Database className="h-3.5 w-3.5 text-muted-foreground" />
<span className="text-muted-foreground">
API Training:
</span>
<DataPolicyBadge
value={provider.dataPolicy.apiTraining}
labelTrue="Yes"
labelFalse="No"
dangerIfTrue
/>
</div>
<div className="flex items-center gap-2">
<Database className="h-3.5 w-3.5 text-muted-foreground" />
<span className="text-muted-foreground">
Consumer Training:
</span>
<DataPolicyBadge
value={provider.dataPolicy.consumerTraining}
labelTrue="Yes"
labelFalse="No"
dangerIfTrue
/>
</div>
<div className="flex items-center gap-2">
<Eye className="h-3.5 w-3.5 text-muted-foreground" />
<span className="text-muted-foreground">
Prompt Logging:
</span>
<DataPolicyBadge
value={provider.dataPolicy.promptLogging}
labelTrue="Yes"
labelFalse="No"
dangerIfTrue
/>
</div>
{provider.dataPolicy.retentionPeriod !== undefined && (
<div className="flex items-center gap-2">
<Clock className="h-3.5 w-3.5 text-muted-foreground" />
<span className="text-muted-foreground">
Retention:
</span>
<span className="font-medium">
{provider.dataPolicy.retentionPeriod ?? "Unknown"}
</span>
</div>
)}
{provider.dataPolicy.gdpr !== undefined && (
<div className="flex items-center gap-2">
<ShieldCheck className="h-3.5 w-3.5 text-muted-foreground" />
<span className="text-muted-foreground">GDPR:</span>
<DataPolicyBadge
value={provider.dataPolicy.gdpr}
labelTrue="Compliant"
labelFalse="No"
/>
</div>
)}
{provider.dataPolicy.soc2 !== undefined && (
<div className="flex items-center gap-2">
<ShieldCheck className="h-3.5 w-3.5 text-muted-foreground" />
<span className="text-muted-foreground">SOC2:</span>
<DataPolicyBadge
value={provider.dataPolicy.soc2}
labelTrue="Certified"
labelFalse="No"
/>
</div>
)}
{provider.dataPolicy.iso27001 !== undefined && (
<div className="flex items-center gap-2">
<ShieldCheck className="h-3.5 w-3.5 text-muted-foreground" />
<span className="text-muted-foreground">
ISO 27001:
</span>
<DataPolicyBadge
value={provider.dataPolicy.iso27001}
labelTrue="Certified"
labelFalse="No"
/>
</div>
)}
</>
)}
</div>
</div>
)}

{(provider.termsUrl || provider.privacyPolicyUrl) && (
<div className="mt-6 flex items-center gap-x-4 text-sm text-muted-foreground">
<div className="mt-4 flex items-center gap-x-4 text-sm text-muted-foreground">
{provider.termsUrl && (
<a
href={provider.termsUrl}
Expand Down
22 changes: 18 additions & 4 deletions apps/ui/src/components/providers/providers-grid.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { ExternalLink, ArrowRight } from "lucide-react";
import { ExternalLink, ArrowRight, ShieldCheck, MapPin } from "lucide-react";
import { useRouter } from "next/navigation";

import {
Expand Down Expand Up @@ -103,9 +103,23 @@ export function ProvidersGrid() {
</CardDescription>
</div>
<div className="flex items-center justify-between pt-2 border-t">
<span className="text-sm font-medium">
{modelsCount} model{modelsCount !== 1 ? "s" : ""}
</span>
<div className="flex items-center gap-2">
<span className="text-sm font-medium">
{modelsCount} model{modelsCount !== 1 ? "s" : ""}
</span>
{provider.headquarters && (
<span className="inline-flex items-center gap-0.5 text-xs text-muted-foreground">
<MapPin className="h-3 w-3" />
{provider.headquarters}
</span>
)}
{provider.dataPolicy?.apiTraining === false && (
<span className="inline-flex items-center gap-0.5 rounded bg-green-500/10 px-1.5 py-0.5 text-xs text-green-600 dark:text-green-400">
<ShieldCheck className="h-3 w-3" />
No training
</span>
)}
</div>
{provider.website && (
<a
href={provider.website}
Expand Down
Loading
Loading