# All files / src/app/demo page.tsx

0% Statements 0/68
0% Branches 0/1
0% Functions 0/1
0% Lines 0/68

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69

     'use client';

    import { useState } from 'react';
    import dynamic from 'next/dynamic';
    import { motion } from 'framer-motion';
    import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
    import { Sparkle } from '@phosphor-icons/react';
    import { DEMO_CODE } from '@/components/demo/demo-constants';
    import { DemoFeatureCards } from '@/components/demo/DemoFeatureCards';
    import { PageLayout } from '../PageLayout';

    export const dynamicParams = true

    // Dynamically import SplitScreenEditor to avoid SSR issues with Pyodide
    const SplitScreenEditor = dynamic(
      () => import('@/components/features/snippet-editor/SplitScreenEditor').then(mod => ({ default: mod.SplitScreenEditor })),
      { ssr: false }
    );

    export default function DemoPage() {
      const [code, setCode] = useState(DEMO_CODE);

      return (
        <PageLayout>
          <motion.div
            initial={{ opacity: 0, y: 20 }}
            animate={{ opacity: 1, y: 0 }}
            transition={{ duration: 0.4 }}
            className="space-y-8"
          >
            <div className="mb-8">
              <div className="flex items-center gap-3 mb-2">
                <div className="h-10 w-10 rounded-lg bg-gradient-to-br from-accent to-primary flex items-center justify-center">
                  <Sparkle className="h-5 w-5 text-primary-foreground" weight="fill" />
                </div>
                <h2 className="text-3xl font-bold tracking-tight">Split-Screen Demo</h2>
              </div>
              <p className="text-muted-foreground">
                Experience live React component editing with real-time preview. Edit the code on the left and watch it update instantly on the right.
              </p>
            </div>

            <Card className="border-accent/20 bg-card/50 backdrop-blur">
              <CardHeader>
                <CardTitle className="flex items-center gap-2">
                  <Sparkle className="h-5 w-5 text-accent" weight="fill" />
                  Interactive Code Editor
                </CardTitle>
                <CardDescription>
                  This editor supports JSX, TSX, JavaScript, and TypeScript with live preview.
                  Try switching between Code, Split, and Preview modes using the buttons above the editor.
                </CardDescription>
              </CardHeader>
              <CardContent>
                <SplitScreenEditor
                  value={code}
                  onChange={setCode}
                  language="JSX"
                  height="600px"
                />
              </CardContent>
            </Card>

            <DemoFeatureCards />
          </motion.div>
        </PageLayout>
      );
    }