mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 00:35:32 +08:00
feat: improve empty state guidance for first-run experience
Show detailed import instructions and conditionally display common config snippet hint for Claude/Codex/Gemini (not OpenCode/OpenClaw).
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
import { Download, Users } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import type { AppId } from "@/lib/api/types";
|
||||
|
||||
interface ProviderEmptyStateProps {
|
||||
appId: AppId;
|
||||
onCreate?: () => void;
|
||||
onImport?: () => void;
|
||||
}
|
||||
|
||||
export function ProviderEmptyState({
|
||||
appId,
|
||||
onCreate,
|
||||
onImport,
|
||||
}: ProviderEmptyStateProps) {
|
||||
const { t } = useTranslation();
|
||||
const showSnippetHint =
|
||||
appId === "claude" || appId === "codex" || appId === "gemini";
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center rounded-lg border border-dashed border-border p-10 text-center">
|
||||
@@ -19,9 +24,14 @@ export function ProviderEmptyState({
|
||||
<Users className="h-7 w-7 text-muted-foreground" />
|
||||
</div>
|
||||
<h3 className="text-lg font-semibold">{t("provider.noProviders")}</h3>
|
||||
<p className="mt-2 max-w-sm text-sm text-muted-foreground">
|
||||
<p className="mt-2 max-w-lg text-sm text-muted-foreground">
|
||||
{t("provider.noProvidersDescription")}
|
||||
</p>
|
||||
{showSnippetHint && (
|
||||
<p className="mt-1 max-w-lg text-sm text-muted-foreground">
|
||||
{t("provider.noProvidersDescriptionSnippet")}
|
||||
</p>
|
||||
)}
|
||||
<div className="mt-6 flex flex-col gap-2">
|
||||
{onImport && (
|
||||
<Button onClick={onImport}>
|
||||
|
||||
@@ -298,6 +298,7 @@ export function ProviderList({
|
||||
if (sortedProviders.length === 0) {
|
||||
return (
|
||||
<ProviderEmptyState
|
||||
appId={appId}
|
||||
onCreate={onCreate}
|
||||
onImport={() => importMutation.mutate()}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user