Refine embedded portal homepage

This commit is contained in:
2026-04-15 18:03:06 +08:00
parent c809ab16e6
commit 004cdd9fc9
3 changed files with 809 additions and 145 deletions

View File

@@ -2,7 +2,6 @@
import { motion } from "motion/react";
import {
Activity,
MonitorCheck,
BookOpen,
BarChart3,
@@ -11,13 +10,21 @@ import {
Zap,
Shield,
Server,
Globe,
RefreshCw,
Puzzle,
} from "lucide-react";
import { useI18n } from "@/lib/i18n";
import { useI18n, type TranslationKey } from "@/lib/i18n";
/* ═══════════════════════════════════════════════════════
Configure service URLs here.
Change these to your actual endpoints.
═══════════════════════════════════════════════════════ */
const PLATFORM_URL = "http://192.168.111.90:8016/console/personal";
const SERVICE_URLS: Record<string, string> = {
monitoring: "http://192.168.111.90:8018",
docs: "http://192.168.111.90:8087/sinocode/current/",
analytics: "http://192.168.111.90:8019",
};
/* ═══ Data ═══ */
const SERVICES = [
{
key: "monitoring" as const,
@@ -42,11 +49,44 @@ const SERVICES = [
},
];
const SERVICE_URLS: Record<string, string> = {
monitoring: "http://192.168.111.90:8018",
docs: "http://192.168.111.90:8087/sinocode/current/",
analytics: "http://192.168.111.90:8019",
interface FeatureItem {
icon: typeof Zap;
titleKey: TranslationKey;
descKey: TranslationKey;
}
const FEATURES: FeatureItem[] = [
{ icon: Zap, titleKey: "portal.features.unified", descKey: "portal.features.unifiedDesc" },
{ icon: Shield, titleKey: "portal.features.security", descKey: "portal.features.securityDesc" },
{ icon: BarChart3, titleKey: "portal.features.monitor", descKey: "portal.features.monitorDesc" },
{ icon: Globe, titleKey: "portal.features.global", descKey: "portal.features.globalDesc" },
{ icon: RefreshCw, titleKey: "portal.features.failover", descKey: "portal.features.failoverDesc" },
{ icon: Puzzle, titleKey: "portal.features.flexible", descKey: "portal.features.flexibleDesc" },
];
interface ModelItem { name: string; provider: string; }
const MODELS: ModelItem[] = [
{ name: "Claude", provider: "Anthropic" },
{ name: "GPT", provider: "OpenAI" },
{ name: "Gemini", provider: "Google" },
{ name: "DeepSeek", provider: "DeepSeek" },
{ name: "Grok", provider: "xAI" },
];
interface ToolItem { name: string; tag: string; }
const TOOLS: ToolItem[] = [
{ name: "Claude Code", tag: "Anthropic" },
{ name: "Codex", tag: "OpenAI" },
{ name: "Gemini CLI", tag: "Google" },
{ name: "OpenCode", tag: "Community" },
{ name: "Droid", tag: "Community" },
];
const fadeUp = {
hidden: { opacity: 0, y: 24 },
visible: { opacity: 1, y: 0, transition: { duration: 0.5, ease: "easeOut" as const } },
};
const stagger = { visible: { transition: { staggerChildren: 0.08 } } };
export default function PortalPage() {
const { t } = useI18n();
@@ -59,13 +99,11 @@ export default function PortalPage() {
return (
<div className="portal-page">
{/* ── Background layers ── */}
{/* ── Background layers (preserved) ── */}
<div className="portal-grid" />
<div className="portal-orb portal-orb--1" />
<div className="portal-orb portal-orb--2" />
<div className="portal-orb portal-orb--3" />
{/* Decorative floating particles */}
<div className="portal-particles">
{Array.from({ length: 6 }).map((_, i) => (
<div key={i} className="portal-particle" style={{
@@ -77,123 +115,248 @@ export default function PortalPage() {
))}
</div>
{/* ── Header / Branding ── */}
<motion.div
className="portal-header"
initial={{ opacity: 0, y: -40 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.9, ease: [0.22, 1, 0.36, 1] }}
>
{/* Logo mark */}
<motion.div
className="portal-logo-mark"
initial={{ scale: 0.5, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
transition={{ delay: 0.2, duration: 0.6, ease: "backOut" }}
>
<Activity className="h-6 w-6" />
</motion.div>
<main className="portal-main">
{/* ── 2. HERO ── */}
<section className="portal-hero">
<div className="portal-hero-scan" />
<div className="portal-container portal-hero-grid">
<motion.div className="portal-hero-copy" initial="hidden" animate="visible" variants={stagger}>
<motion.div className="portal-hero-badge" variants={fadeUp}>
{t("portal.hero.badge")}
</motion.div>
<motion.h1 variants={fadeUp}>
<span className="gradient-text">SinoCode</span>
<span className="hero-sub">{t("portal.subtitle")}</span>
</motion.h1>
<motion.p className="portal-hero-desc" variants={fadeUp}>
{t("portal.hero.desc")}
</motion.p>
<motion.div className="portal-hero-actions" variants={fadeUp}>
<a
href={PLATFORM_URL}
target="_blank"
rel="noopener noreferrer"
className="btn-accent rounded-sm px-6 py-3 font-mono text-sm tracking-wider uppercase no-underline font-medium"
style={{ background: "var(--accent)", color: "var(--background)", borderColor: "var(--accent)" }}
>
{t("portal.hero.cta")}
</a>
<a
href={SERVICE_URLS.docs}
target="_blank"
rel="noopener noreferrer"
className="btn-accent rounded-sm px-6 py-3 font-mono text-sm tracking-wider uppercase no-underline"
>
{t("portal.hero.docs")}
</a>
</motion.div>
</motion.div>
<h1 className="portal-title">
<span className="portal-title-glow">Sino</span>
<span className="portal-title-accent">Code</span>
</h1>
<motion.p
className="portal-subtitle"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ delay: 0.5, duration: 0.8 }}
>
{t("portal.subtitle")}
</motion.p>
{/* Animated scan divider */}
<motion.div
className="portal-divider"
initial={{ scaleX: 0 }}
animate={{ scaleX: 1 }}
transition={{ delay: 0.6, duration: 0.8, ease: [0.22, 1, 0.36, 1] }}
>
<div className="portal-divider-scan" />
</motion.div>
</motion.div>
{/* ── Service Cards ── */}
<div className="portal-cards">
{SERVICES.map((service, i) => {
const Icon = service.icon;
const DecorIcon = service.decorIcon;
const info = i18nMap[service.key];
const url = SERVICE_URLS[service.key];
return (
<motion.a
key={service.key}
href={url}
target="_blank"
rel="noopener noreferrer"
className="portal-card"
style={{
"--card-accent": `var(${service.accentVar})`,
"--card-glow": service.glowColor,
} as React.CSSProperties}
initial={{ opacity: 0, y: 50, scale: 0.95 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
transition={{
delay: 0.4 + i * 0.15,
duration: 0.7,
ease: [0.22, 1, 0.36, 1],
}}
whileHover={{
y: -10,
transition: { type: "spring", stiffness: 400, damping: 25 },
}}
<motion.div
className="portal-hero-panel glass"
initial={{ opacity: 0, x: 32, y: 24 }}
animate={{ opacity: 1, x: 0, y: 0 }}
transition={{ delay: 0.2, duration: 0.65, ease: [0.22, 1, 0.36, 1] }}
>
{/* Corner brackets */}
<span className="portal-corner portal-corner--tl" />
<span className="portal-corner portal-corner--tr" />
<span className="portal-corner portal-corner--bl" />
<span className="portal-corner portal-corner--br" />
{/* Decorative bg icon */}
<DecorIcon className="portal-card-decor" />
{/* Icon container */}
<div className="portal-card-icon">
<Icon strokeWidth={1.5} />
<div className="portal-panel-header">
<div>
<div className="portal-panel-label">{t("portal.services.tag")}</div>
<div className="portal-panel-title">{t("common.systemOnline")}</div>
</div>
<div className="portal-status-dot" />
</div>
{/* Text content */}
<h3 className="portal-card-title">{info.title}</h3>
<p className="portal-card-desc">{info.desc}</p>
<div className="portal-panel-shortcuts">
{SERVICES.map((service) => {
const Icon = service.icon;
const info = i18nMap[service.key];
const url = SERVICE_URLS[service.key];
{/* Enter indicator */}
<div className="portal-card-action">
<span className="portal-card-action-text">{t("portal.enter")}</span>
<ArrowUpRight className="portal-card-action-icon" />
return (
<a
key={service.key}
href={url}
target="_blank"
rel="noopener noreferrer"
className="portal-shortcut"
style={{
"--card-accent": `var(${service.accentVar})`,
"--card-glow": service.glowColor,
} as React.CSSProperties}
>
<div className="portal-shortcut-icon">
<Icon size={18} strokeWidth={1.7} />
</div>
<div className="portal-shortcut-copy">
<span className="portal-shortcut-title">{info.title}</span>
<span className="portal-shortcut-desc">{info.desc}</span>
</div>
<ArrowUpRight className="portal-shortcut-arrow" />
</a>
);
})}
</div>
</motion.div>
</div>
{/* Bottom highlight bar */}
<div className="portal-card-bar" />
</motion.a>
);
})}
</div>
<div className="portal-hero-voltage" aria-hidden="true">
{Array.from({ length: 5 }).map((_, i) => (
<div key={i} className="portal-voltage-bar" />
))}
</div>
</section>
{/* ── Footer status ── */}
<motion.div
className="portal-footer"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ delay: 1.2, duration: 0.6 }}
>
<div className="portal-status-dot" />
<span className="portal-status-text">
<Server className="inline-block h-3 w-3 mr-1" style={{ verticalAlign: "-1px" }} />
System Online
</span>
</motion.div>
{/* ── 3. FEATURES ── */}
<section id="features" className="portal-section">
<div className="portal-container">
<motion.div initial="hidden" whileInView="visible" viewport={{ once: true }} variants={fadeUp}>
<div className="portal-section-tag">{t("portal.features.tag")}</div>
<h2 className="portal-section-title">{t("portal.features.title")}</h2>
</motion.div>
<motion.div
className="portal-features-grid"
initial="hidden"
whileInView="visible"
viewport={{ once: true, amount: 0.2 }}
variants={stagger}
>
{FEATURES.map((f) => {
const Icon = f.icon;
return (
<motion.div key={f.titleKey} className="glass portal-feature-card p-6" variants={fadeUp}>
<div
className="flex items-center justify-center w-10 h-10 rounded-lg mb-4"
style={{ background: "var(--btn-active-bg)", border: "1px solid var(--surface-border)", color: "var(--text-accent)" }}
>
<Icon size={20} />
</div>
<h3 className="text-sm font-semibold tracking-wide mb-2 text-t-primary">{t(f.titleKey)}</h3>
<p className="text-sm leading-relaxed text-t-muted">{t(f.descKey)}</p>
</motion.div>
);
})}
</motion.div>
</div>
</section>
{/* ── 4. SERVICES ── */}
<section id="services" className="portal-section">
<div className="portal-container">
<motion.div initial="hidden" whileInView="visible" viewport={{ once: true }} variants={fadeUp}>
<div className="portal-section-tag">{t("portal.services.tag")}</div>
<h2 className="portal-section-title">{t("portal.services.title")}</h2>
</motion.div>
<div className="portal-cards">
{SERVICES.map((service, i) => {
const Icon = service.icon;
const DecorIcon = service.decorIcon;
const info = i18nMap[service.key];
const url = SERVICE_URLS[service.key];
return (
<motion.a
key={service.key}
href={url}
target="_blank"
rel="noopener noreferrer"
className="portal-card"
style={{
"--card-accent": `var(${service.accentVar})`,
"--card-glow": service.glowColor,
} as React.CSSProperties}
initial={{ opacity: 0, y: 40 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{ delay: i * 0.1, duration: 0.5, ease: [0.22, 1, 0.36, 1] }}
whileHover={{ y: -10, transition: { type: "spring", stiffness: 400, damping: 25 } }}
>
<span className="portal-corner portal-corner--tl" />
<span className="portal-corner portal-corner--tr" />
<span className="portal-corner portal-corner--bl" />
<span className="portal-corner portal-corner--br" />
<DecorIcon className="portal-card-decor" />
<div className="portal-card-icon"><Icon strokeWidth={1.5} /></div>
<h3 className="portal-card-title">{info.title}</h3>
<p className="portal-card-desc">{info.desc}</p>
<div className="portal-card-action">
<span>{t("portal.enter")}</span>
<ArrowUpRight className="portal-card-action-icon" />
</div>
<div className="portal-card-bar" />
</motion.a>
);
})}
</div>
</div>
</section>
{/* ── 5. ECOSYSTEM ── */}
<section id="ecosystem" className="portal-section">
<div className="portal-container">
<motion.div initial="hidden" whileInView="visible" viewport={{ once: true }} variants={fadeUp}>
<div className="portal-section-tag">{t("portal.ecosystem.tag")}</div>
<h2 className="portal-section-title">{t("portal.ecosystem.title")}</h2>
</motion.div>
<motion.div initial="hidden" whileInView="visible" viewport={{ once: true }} variants={fadeUp}>
<h3 className="text-sm font-mono tracking-widest uppercase text-t-muted mb-4">{t("portal.ecosystem.models")}</h3>
</motion.div>
<motion.div className="portal-model-grid mb-10" initial="hidden" whileInView="visible" viewport={{ once: true, amount: 0.2 }} variants={stagger}>
{MODELS.map((m) => (
<motion.div key={m.name} className="glass portal-model-card p-5 rounded-xl" variants={fadeUp}>
<div className="text-base font-bold tracking-wide text-t-primary mb-1">{m.name}</div>
<div className="text-xs font-mono text-t-muted tracking-wider uppercase">{m.provider}</div>
</motion.div>
))}
</motion.div>
<motion.div initial="hidden" whileInView="visible" viewport={{ once: true }} variants={fadeUp}>
<h3 className="text-sm font-mono tracking-widest uppercase text-t-muted mb-1">{t("portal.ecosystem.tools")}</h3>
<p className="text-sm text-t-muted mb-4">{t("portal.ecosystem.toolsDesc")}</p>
</motion.div>
<motion.div className="portal-model-grid" initial="hidden" whileInView="visible" viewport={{ once: true, amount: 0.2 }} variants={stagger}>
{TOOLS.map((tool) => (
<motion.div key={tool.name} className="glass portal-tool-card p-5 rounded-xl" variants={fadeUp}>
<div className="text-sm font-semibold tracking-wide text-t-primary mb-1">{tool.name}</div>
<div className="text-xs font-mono tracking-wider uppercase" style={{ color: "var(--accent-purple)" }}>{tool.tag}</div>
</motion.div>
))}
</motion.div>
</div>
</section>
{/* ── 6. DISCLAIMER ── */}
<section className="portal-disclaimer">
<div className="portal-container">
<motion.div initial="hidden" whileInView="visible" viewport={{ once: true }} variants={fadeUp}>
<div className="portal-section-tag">{t("portal.disclaimer.tag")}</div>
<h2 className="portal-section-title">{t("portal.disclaimer.title")}</h2>
</motion.div>
<motion.div className="glass portal-disclaimer-panel rounded-xl" initial="hidden" whileInView="visible" viewport={{ once: true }} variants={fadeUp}>
<p className="text-sm leading-loose text-t-secondary mb-3">{t("portal.disclaimer.p1")}</p>
<p className="text-sm leading-loose text-t-secondary mb-4">{t("portal.disclaimer.p2")}</p>
<div className="pt-3 border-t" style={{ borderColor: "var(--surface-border)" }}>
<span className="text-xs font-mono text-t-muted tracking-wider">{t("portal.disclaimer.copyright")}</span>
</div>
</motion.div>
</div>
</section>
{/* ── Footer status ── */}
<motion.div
className="portal-footer portal-container"
initial={{ opacity: 0 }}
whileInView={{ opacity: 1 }}
viewport={{ once: true }}
transition={{ duration: 0.6 }}
>
<div className="portal-status-dot" />
<span className="portal-status-text">
<Server className="inline-block h-3 w-3 mr-1" style={{ verticalAlign: "-1px" }} />
{t("common.systemOnline")}
</span>
</motion.div>
</main>
</div>
);
}