From 49a95cf8925658187fdd9f6f4f1aa11d4793dc15 Mon Sep 17 00:00:00 2001 From: dyzulk <66510723+dyzulk@users.noreply.github.com> Date: Thu, 8 Jan 2026 15:00:26 +0700 Subject: [PATCH] feat(home): simplify homepage and link to docs --- src/app/(public)/HomeClient.tsx | 244 +++----------------------------- 1 file changed, 17 insertions(+), 227 deletions(-) diff --git a/src/app/(public)/HomeClient.tsx b/src/app/(public)/HomeClient.tsx index 7d17c7f..46c961b 100644 --- a/src/app/(public)/HomeClient.tsx +++ b/src/app/(public)/HomeClient.tsx @@ -128,168 +128,10 @@ function CliSnippet({ label, command, t }: { label: string, command: string, t: ); } -function OsGuideContent({ title, steps, selectedOs, certificates, t, linuxDistro, setLinuxDistro }: { title: string, steps: string[], selectedOs: string, certificates: CaCertificate[], t: any, linuxDistro?: string, setLinuxDistro?: (distro: any) => void }) { - return ( -
-
-

-
- {title} -

- -
+// OsGuideContent removed in favor of centralized documentation - {/* Global Bundle Section (Recommendations) */} -
-
-
- {t('recommended')} -
-
-
- - - -
-
-
- {t('bundle_guide_title')} -
-

- {t('bundle_guide_desc')} -

- - {(selectedOs === 'linux' || selectedOs === 'windows' || selectedOs === 'macos') && ( -
- {(selectedOs === 'linux') && ( -
-
- - - - -
- - {linuxDistro === 'debian' && ( - - )} - {linuxDistro === 'rhel' && ( - - )} - {linuxDistro === 'arch' && ( - - )} - {linuxDistro === 'other' && ( - - )} -
- )} - {(selectedOs === 'windows' || selectedOs === 'macos') && ( -
- : } - onClick={() => {}} - variant="blue" - /> -
- )} -
- )} -
-
-
-
- {selectedOs === 'linux' && ( -
-
-
- - {t('guide_linux_shortcut_title')} -
-

{t('guide_linux_shortcut_desc')}

-
- - {/* Distro Selection for Individual Certs */} -
- - - - -
- -
- {/* 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 => ( - - ))} - - ); - })()} -
-
- )} -
- ); -} - -function CaCard({ cert, isRoot, t, selectedOs, setSelectedOs }: { cert: CaCertificate, isRoot: boolean, t: any, selectedOs: string, setSelectedOs: (os: any) => void }) { +function CaCard({ cert, isRoot, t }: { cert: CaCertificate, isRoot: boolean, t: any }) { return (
{/* Sync Status Badge */} @@ -327,48 +169,19 @@ function CaCard({ cert, isRoot, t, selectedOs, setSelectedOs }: { cert: CaCertif
-
- } - onClick={() => {}} - /> - } - onClick={() => setSelectedOs('mobile')} - variant="green" - /> - } - onClick={() => setSelectedOs('windows')} - variant="blue" - /> - } - onClick={() => setSelectedOs('macos')} - variant="gray" - /> + - - {cert.linux_cdn_url && ( -
- } - onClick={() => setSelectedOs('linux')} - variant="gray" - isFullWidth - /> -
- )}
); } @@ -448,8 +261,7 @@ export default function HomeClient() { const t = useTranslations("Home"); const [certificates, setCertificates] = useState([]); const [loadingCerts, setLoadingCerts] = useState(true); - const [selectedOs, setSelectedOs] = useState<'windows' | 'macos' | 'linux' | 'mobile'>('windows'); - const [linuxDistro, setLinuxDistro] = useState<'debian' | 'rhel' | 'arch' | 'other'>('debian'); + useEffect(() => { const fetchCertificates = async () => { @@ -635,7 +447,7 @@ export default function HomeClient() {
{familyCerts.filter(c => c.type === 'root').map((cert) => ( - + ))}
@@ -650,34 +462,12 @@ export default function HomeClient() {
{familyCerts.filter(c => c.type !== 'root').map((cert) => ( - + ))}
))} - - {/* OS Selection Tabs for Global Guide */} -
-
-

{t('install_guide_title')}

-

{t('install_guide_desc')}

-
- -
- setSelectedOs('windows')} icon={} /> - setSelectedOs('macos')} icon={} /> - setSelectedOs('linux')} icon={} /> - setSelectedOs('mobile')} icon={} /> -
- -
- {selectedOs === 'windows' && } - {selectedOs === 'macos' && } - {selectedOs === 'linux' && } - {selectedOs === 'mobile' && } -
-
)}