Skip to content

Commit a62be25

Browse files
feat: Add static demo mode with placeholder buttons and toast notifications
1 parent b8f74c6 commit a62be25

2 files changed

Lines changed: 74 additions & 27 deletions

File tree

apps/web/src/app/page.tsx

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import { Marquee } from "@/components/ui/marquee";
1515
import BorderGlow from '@/components/BorderGlow';
1616
import { useTheme } from '@/hooks/use-theme';
1717
import CountUp from '@/components/ui/count-up';
18+
import { toast } from 'sonner';
19+
20+
const isStaticDemo = !!process.env.NEXT_PUBLIC_BASE_PATH;
1821

1922
const mockSpaces = [
2023
{
@@ -242,9 +245,18 @@ export default function Home() {
242245
transition={{ duration: 0.5, delay: 0.3, ease: "easeOut" }}
243246
className="flex flex-col sm:flex-row items-center justify-center gap-4"
244247
>
245-
<Link href="/auth/register" className="w-full sm:w-auto px-8 py-4 bg-blue-600 hover:bg-blue-700 text-white rounded-full font-medium text-lg transition shadow-lg shadow-blue-500/30 hover:shadow-blue-500/40 hover:-translate-y-0.5 flex items-center justify-center gap-2">
246-
开始免费使用 <ArrowRight className="w-5 h-5" />
247-
</Link>
248+
{isStaticDemo ? (
249+
<button
250+
onClick={() => toast.info('功能开发中,敬请期待!')}
251+
className="w-full sm:w-auto px-8 py-4 bg-blue-600 hover:bg-blue-700 text-white rounded-full font-medium text-lg transition shadow-lg shadow-blue-500/30 hover:shadow-blue-500/40 hover:-translate-y-0.5 flex items-center justify-center gap-2 cursor-pointer"
252+
>
253+
开始免费使用 <ArrowRight className="w-5 h-5" />
254+
</button>
255+
) : (
256+
<Link href="/auth/register" className="w-full sm:w-auto px-8 py-4 bg-blue-600 hover:bg-blue-700 text-white rounded-full font-medium text-lg transition shadow-lg shadow-blue-500/30 hover:shadow-blue-500/40 hover:-translate-y-0.5 flex items-center justify-center gap-2">
257+
开始免费使用 <ArrowRight className="w-5 h-5" />
258+
</Link>
259+
)}
248260
<Link href="/explore" className="w-full sm:w-auto px-8 py-4 bg-white dark:bg-gray-800 text-gray-900 dark:text-white border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700 hover:-translate-y-0.5 rounded-full font-medium text-lg transition flex items-center justify-center gap-2">
249261
探索公开知识库
250262
</Link>
@@ -727,12 +739,21 @@ export default function Home() {
727739
colors={['#6366f1', '#3b82f6', '#60a5fa']}
728740
className="w-full sm:w-auto"
729741
>
730-
<Link
731-
href="/auth/register"
732-
className="inline-flex items-center justify-center gap-2.5 w-full px-10 py-4 text-white font-semibold text-base transition-opacity duration-150 hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60 focus-visible:ring-offset-2 focus-visible:ring-offset-transparent"
733-
>
734-
免费开始使用 <ArrowRight className="w-5 h-5" />
735-
</Link>
742+
{isStaticDemo ? (
743+
<button
744+
onClick={() => toast.info('功能开发中,敬请期待!')}
745+
className="inline-flex items-center justify-center gap-2.5 w-full px-10 py-4 text-white font-semibold text-base transition-opacity duration-150 hover:opacity-90 cursor-pointer"
746+
>
747+
免费开始使用 <ArrowRight className="w-5 h-5" />
748+
</button>
749+
) : (
750+
<Link
751+
href="/auth/register"
752+
className="inline-flex items-center justify-center gap-2.5 w-full px-10 py-4 text-white font-semibold text-base transition-opacity duration-150 hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60 focus-visible:ring-offset-2 focus-visible:ring-offset-transparent"
753+
>
754+
免费开始使用 <ArrowRight className="w-5 h-5" />
755+
</Link>
756+
)}
736757
</BorderGlow>
737758
<Link
738759
href="/explore"

apps/web/src/components/layout/public-header.tsx

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import { cn } from '@/lib/utils';
99
import { getCdnUrl } from '@/lib/cdn';
1010
import { LogOut, LayoutDashboard, UserCircle, FolderOpen, SlidersHorizontal, ChevronRight, Github, Sun, Moon, Menu, X } from 'lucide-react';
1111
import { useTheme } from '@/hooks/use-theme';
12+
import { toast } from 'sonner';
13+
14+
const isStaticDemo = !!process.env.NEXT_PUBLIC_BASE_PATH;
1215
import {
1316
DropdownMenu,
1417
DropdownMenuContent,
@@ -288,17 +291,31 @@ export function PublicHeader() {
288291
)}
289292

290293
{/* Login — desktop only */}
291-
<Link
292-
href="/auth/login"
293-
className={cn(
294-
"hidden md:inline-flex text-sm font-medium px-3.5 py-1.5 rounded-lg transition-all duration-200",
295-
isTransparent
296-
? "bg-white/15 text-white border border-white/30 backdrop-blur-sm hover:bg-white/25 hover:border-white/50 shadow-[0_0_15px_rgba(255,255,255,0.15)]"
297-
: "bg-blue-600 hover:bg-blue-700 text-white shadow-sm hover:shadow-md"
298-
)}
299-
>
300-
登录
301-
</Link>
294+
{isStaticDemo ? (
295+
<button
296+
onClick={() => toast.info('功能开发中,敬请期待!')}
297+
className={cn(
298+
"hidden md:inline-flex text-sm font-medium px-3.5 py-1.5 rounded-lg transition-all duration-200 cursor-pointer",
299+
isTransparent
300+
? "bg-white/15 text-white border border-white/30 backdrop-blur-sm hover:bg-white/25 hover:border-white/50 shadow-[0_0_15px_rgba(255,255,255,0.15)]"
301+
: "bg-blue-600 hover:bg-blue-700 text-white shadow-sm hover:shadow-md"
302+
)}
303+
>
304+
登录
305+
</button>
306+
) : (
307+
<Link
308+
href="/auth/login"
309+
className={cn(
310+
"hidden md:inline-flex text-sm font-medium px-3.5 py-1.5 rounded-lg transition-all duration-200",
311+
isTransparent
312+
? "bg-white/15 text-white border border-white/30 backdrop-blur-sm hover:bg-white/25 hover:border-white/50 shadow-[0_0_15px_rgba(255,255,255,0.15)]"
313+
: "bg-blue-600 hover:bg-blue-700 text-white shadow-sm hover:shadow-md"
314+
)}
315+
>
316+
登录
317+
</Link>
318+
)}
302319
</>
303320
)}
304321

@@ -383,13 +400,22 @@ export function PublicHeader() {
383400
</div>
384401
) : (
385402
<div className="pt-2 border-t border-gray-200 dark:border-white/[0.08] mt-2">
386-
<Link
387-
href="/auth/login"
388-
onClick={() => toggleMobileMenu(false)}
389-
className="block px-3 py-3 rounded-lg text-[15px] font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-500/10 transition-colors"
390-
>
391-
登录
392-
</Link>
403+
{isStaticDemo ? (
404+
<button
405+
onClick={() => { toast.info('功能开发中,敬请期待!'); toggleMobileMenu(false); }}
406+
className="block w-full text-left px-3 py-3 rounded-lg text-[15px] font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-500/10 transition-colors cursor-pointer"
407+
>
408+
登录
409+
</button>
410+
) : (
411+
<Link
412+
href="/auth/login"
413+
onClick={() => toggleMobileMenu(false)}
414+
className="block px-3 py-3 rounded-lg text-[15px] font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-500/10 transition-colors"
415+
>
416+
登录
417+
</Link>
418+
)}
393419
</div>
394420
)}
395421
</nav>

0 commit comments

Comments
 (0)