From a42b5447986e6388a3c834283c0788aa9c19b408 Mon Sep 17 00:00:00 2001
From: dyzulk <66510723+dyzulk@users.noreply.github.com>
Date: Thu, 8 Jan 2026 13:27:06 +0700
Subject: [PATCH] Refactor: Simplify CaCard UI and move Smart CLI to Install
Guide
---
src/app/(public)/HomeClient.tsx | 91 ++++++++++++++++-----------------
1 file changed, 45 insertions(+), 46 deletions(-)
diff --git a/src/app/(public)/HomeClient.tsx b/src/app/(public)/HomeClient.tsx
index 2049de1..751fa49 100644
--- a/src/app/(public)/HomeClient.tsx
+++ b/src/app/(public)/HomeClient.tsx
@@ -237,26 +237,49 @@ function OsGuideContent({ title, steps, selectedOs, certificates, t, linuxDistro
{t('guide_linux_shortcut_desc')}
+ {/* Distro Selection for Individual Certs */}
+
+
+
+
+
+
+
- {/* Root CAs */}
- {certificates.filter(c => c.type === 'root').map(c => (
-
- ))}
-
- {/* Intermediate CAs */}
- {certificates.filter(c => c.type !== 'root').map(c => (
-
- ))}
+ {/* Function to generate smart command */}
+ {(() => {
+ const getSmartCommand = (url: string | null) => {
+ if (!url) return '';
+ if (linuxDistro === 'debian') return `sudo apt install -y curl && curl -sL ${url} | sudo bash`;
+ if (linuxDistro === 'rhel') return `(sudo yum install -y curl || sudo dnf install -y curl) && curl -sL ${url} | sudo bash`;
+ if (linuxDistro === 'arch') return `sudo pacman -Sy curl && curl -sL ${url} | sudo bash`;
+ return `curl -sL ${url} | sudo bash`;
+ };
+
+ return (
+ <>
+ {/* Root CAs */}
+ {certificates.filter(c => c.type === 'root').map(c => (
+
+ ))}
+
+ {/* Intermediate CAs */}
+ {certificates.filter(c => c.type !== 'root').map(c => (
+
+ ))}
+ >
+ );
+ })()}
)}
@@ -264,7 +287,7 @@ function OsGuideContent({ title, steps, selectedOs, certificates, t, linuxDistro
);
}
-function CaCard({ cert, isRoot, t, selectedOs, setSelectedOs, linuxDistro, setLinuxDistro }: { cert: CaCertificate, isRoot: boolean, t: any, selectedOs: string, setSelectedOs: (os: any) => void, linuxDistro?: string, setLinuxDistro?: (distro: any) => void }) {
+function CaCard({ cert, isRoot, t, selectedOs, setSelectedOs }: { cert: CaCertificate, isRoot: boolean, t: any, selectedOs: string, setSelectedOs: (os: any) => void }) {
return (
{/* Sync Status Badge */}
@@ -342,30 +365,6 @@ function CaCard({ cert, isRoot, t, selectedOs, setSelectedOs, linuxDistro, setLi
variant="gray"
isFullWidth
/>
-
- {selectedOs === 'linux' && setLinuxDistro && (
-
-
-
-
-
-
-
-
- {linuxDistro === 'debian' && (
-
- )}
- {linuxDistro === 'rhel' && (
-
- )}
- {linuxDistro === 'arch' && (
-
- )}
- {linuxDistro === 'other' && (
-
- )}
-
- )}
)}
@@ -634,7 +633,7 @@ export default function HomeClient() {
{familyCerts.filter(c => c.type === 'root').map((cert) => (
-
+
))}
@@ -649,7 +648,7 @@ export default function HomeClient() {
{familyCerts.filter(c => c.type !== 'root').map((cert) => (
-
+
))}