From cd8aab3a511091ce378ff7ebcaa42bf979f00882 Mon Sep 17 00:00:00 2001 From: LofiSu Date: Sun, 26 Jan 2025 22:34:40 +0800 Subject: refactor: rewrite --- src/App.tsx | 13 ----- src/HomePage.tsx | 90 --------------------------------- src/app/components/RepoCard.tsx | 24 +++++++++ src/app/components/StatsCard.tsx | 27 ++++++++++ src/app/components/ThreeBackground.tsx | 79 +++++++++++++++++++++++++++++ src/app/favicon.ico | Bin 0 -> 25931 bytes src/app/globals.css | 21 ++++++++ src/app/layout.tsx | 34 +++++++++++++ src/app/page.tsx | 32 ++++++++++++ src/assets/react.svg | 1 - src/components/FeatureCard.tsx | 28 ---------- src/components/StatsCard.tsx | 26 ---------- src/components/ThreeBackground.tsx | 72 -------------------------- src/vite-env.d.ts | 1 - 14 files changed, 217 insertions(+), 231 deletions(-) delete mode 100644 src/App.tsx delete mode 100644 src/HomePage.tsx create mode 100644 src/app/components/RepoCard.tsx create mode 100644 src/app/components/StatsCard.tsx create mode 100644 src/app/components/ThreeBackground.tsx create mode 100644 src/app/favicon.ico create mode 100644 src/app/globals.css create mode 100644 src/app/layout.tsx create mode 100644 src/app/page.tsx delete mode 100644 src/assets/react.svg delete mode 100644 src/components/FeatureCard.tsx delete mode 100644 src/components/StatsCard.tsx delete mode 100644 src/components/ThreeBackground.tsx delete mode 100644 src/vite-env.d.ts (limited to 'src') diff --git a/src/App.tsx b/src/App.tsx deleted file mode 100644 index b708bf5..0000000 --- a/src/App.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react'; -import { NextUIProvider } from '@nextui-org/react'; -import HomePage from './HomePage'; - -const App: React.FC = () => { - return ( - - - - ); -}; - -export default App; diff --git a/src/HomePage.tsx b/src/HomePage.tsx deleted file mode 100644 index 4498a85..0000000 --- a/src/HomePage.tsx +++ /dev/null @@ -1,90 +0,0 @@ -import React from 'react'; -import { motion } from 'framer-motion'; -// import { FaGithub, FaDiscord } from 'react-icons/fa'; -// import { SiPython, SiTypescript, SiReact } from 'react-icons/si'; -import { Button, Card } from '@nextui-org/react'; -import { ThreeBackground } from './components/ThreeBackground'; -import { StatsCard } from './components/StatsCard'; -import { FeatureCard } from './components/FeatureCard'; - -const HomePage: React.FC = () => { - return ( -
- - {/* Hero Section */} -
- -

- HydroRoll -

-

- 下一代开源 TRPG 骰子机器人框架,为你的游戏体验带来无限可能 -

-
- - -
-
-
- - {/* Features Section */} -
-
-

- 核心特性 -

-
- } - title="Python 驱动" - description="基于 Python 构建,提供灵活且强大的插件系统" - /> - } - title="TypeScript 支持" - description="完整的 TypeScript 类型支持,提供更好的开发体验" - /> - } - title="现代化框架" - description="采用现代化的框架设计,支持多平台部署" - /> -
-
-
- - {/* Stats Section */} -
-
-
- - - -
-
-
-
- ); -}; - -export default HomePage; diff --git a/src/app/components/RepoCard.tsx b/src/app/components/RepoCard.tsx new file mode 100644 index 0000000..412e572 --- /dev/null +++ b/src/app/components/RepoCard.tsx @@ -0,0 +1,24 @@ +import React from "react"; +import * as motion from "motion/react-client"; +import { Card } from "@nextui-org/react"; + +interface RepoCardProps { + title: string; + description: string; +} + +export const RepoCard: React.FC = ({ title, description }) => { + return ( + + +
+

{title}

+

{description}

+
+
+
+ ); +}; diff --git a/src/app/components/StatsCard.tsx b/src/app/components/StatsCard.tsx new file mode 100644 index 0000000..d2213d6 --- /dev/null +++ b/src/app/components/StatsCard.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +// import { motion } from 'framer-motion'; +import * as motion from "motion/react-client"; +import { Card } from '@nextui-org/react'; + +interface StatsCardProps { + title: string; + value: string; +} + +export const StatsCard: React.FC = ({ title, value }) => { + return ( + + +
+

{value}

+

{title}

+
+
+
+ ); +}; diff --git a/src/app/components/ThreeBackground.tsx b/src/app/components/ThreeBackground.tsx new file mode 100644 index 0000000..5040e3c --- /dev/null +++ b/src/app/components/ThreeBackground.tsx @@ -0,0 +1,79 @@ +"use client"; + +import React, { useEffect, useRef } from "react"; +import * as THREE from "three"; + +export const ThreeBackground: React.FC = () => { + const containerRef = useRef(null); + + useEffect(() => { + if (!containerRef.current) return; + + const scene = new THREE.Scene(); + const camera = new THREE.PerspectiveCamera( + 75, + window.innerWidth / window.innerHeight, + 0.1, + 1000 + ); + const renderer = new THREE.WebGLRenderer({ alpha: true }); + + renderer.setSize(window.innerWidth, window.innerHeight); + containerRef.current.appendChild(renderer.domElement); + + // Create particles + const geometry = new THREE.BufferGeometry(); + const vertices = []; + + for (let i = 0; i < 5000; i++) { + vertices.push( + THREE.MathUtils.randFloatSpread(2000), // x + THREE.MathUtils.randFloatSpread(2000), // y + THREE.MathUtils.randFloatSpread(2000) // z + ); + } + + geometry.setAttribute( + "position", + new THREE.Float32BufferAttribute(vertices, 3) + ); + + const material = new THREE.PointsMaterial({ + color: 0x88ccff, + size: 2, + transparent: true, + opacity: 0.5, + }); + + const particles = new THREE.Points(geometry, material); + scene.add(particles); + + camera.position.z = 1000; + + const animate = () => { + requestAnimationFrame(animate); + particles.rotation.x += 0.0001; + particles.rotation.y += 0.0001; + renderer.render(scene, camera); + }; + + animate(); + + const handleResize = () => { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); + }; + + window.addEventListener("resize", handleResize); + + return () => { + window.removeEventListener("resize", handleResize); + containerRef.current?.removeChild(renderer.domElement); + }; + }, []); + + return ( +
+ ); +}; diff --git a/src/app/favicon.ico b/src/app/favicon.ico new file mode 100644 index 0000000..718d6fe Binary files /dev/null and b/src/app/favicon.ico differ diff --git a/src/app/globals.css b/src/app/globals.css new file mode 100644 index 0000000..6b717ad --- /dev/null +++ b/src/app/globals.css @@ -0,0 +1,21 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +:root { + --background: #ffffff; + --foreground: #171717; +} + +@media (prefers-color-scheme: dark) { + :root { + --background: #0a0a0a; + --foreground: #ededed; + } +} + +body { + color: var(--foreground); + background: var(--background); + font-family: Arial, Helvetica, sans-serif; +} diff --git a/src/app/layout.tsx b/src/app/layout.tsx new file mode 100644 index 0000000..f7fa87e --- /dev/null +++ b/src/app/layout.tsx @@ -0,0 +1,34 @@ +import type { Metadata } from "next"; +import { Geist, Geist_Mono } from "next/font/google"; +import "./globals.css"; + +const geistSans = Geist({ + variable: "--font-geist-sans", + subsets: ["latin"], +}); + +const geistMono = Geist_Mono({ + variable: "--font-geist-mono", + subsets: ["latin"], +}); + +export const metadata: Metadata = { + title: "Create Next App", + description: "Generated by create next app", +}; + +export default function RootLayout({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) { + return ( + + + {children} + + + ); +} diff --git a/src/app/page.tsx b/src/app/page.tsx new file mode 100644 index 0000000..5963c01 --- /dev/null +++ b/src/app/page.tsx @@ -0,0 +1,32 @@ +import React from "react"; +import * as motion from "motion/react-client"; +import { ThreeBackground } from "./components/ThreeBackground"; + +const HomePage: React.FC = () => { + return ( +
+ + {/* Hero */} +
+ +

+ HydroRoll +

+

+ Infinity Rule Book 📖 ~ (Or Rules Packages?) +

+
+
+
+ ); +}; + +export default HomePage; diff --git a/src/assets/react.svg b/src/assets/react.svg deleted file mode 100644 index 6c87de9..0000000 --- a/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/FeatureCard.tsx b/src/components/FeatureCard.tsx deleted file mode 100644 index 5f8a95d..0000000 --- a/src/components/FeatureCard.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import React from 'react'; -import { motion } from 'framer-motion'; -import { Card } from '@nextui-org/react'; - -interface FeatureCardProps { - icon: React.ReactNode; - title: string; - description: string; -} - -export const FeatureCard: React.FC = ({ icon, title, description }) => { - return ( - - -
-
- {icon} -
-

{title}

-

{description}

-
-
-
- ); -}; diff --git a/src/components/StatsCard.tsx b/src/components/StatsCard.tsx deleted file mode 100644 index 237f5dc..0000000 --- a/src/components/StatsCard.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; -import { motion } from 'framer-motion'; -import { Card } from '@nextui-org/react'; - -interface StatsCardProps { - title: string; - value: string; -} - -export const StatsCard: React.FC = ({ title, value }) => { - return ( - - -
-

{value}

-

{title}

-
-
-
- ); -}; diff --git a/src/components/ThreeBackground.tsx b/src/components/ThreeBackground.tsx deleted file mode 100644 index 1a6337c..0000000 --- a/src/components/ThreeBackground.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import React, { useEffect, useRef } from 'react'; -import * as THREE from 'three'; - -export const ThreeBackground: React.FC = () => { - const containerRef = useRef(null); - - useEffect(() => { - if (!containerRef.current) return; - - const scene = new THREE.Scene(); - const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); - const renderer = new THREE.WebGLRenderer({ alpha: true }); - - renderer.setSize(window.innerWidth, window.innerHeight); - containerRef.current.appendChild(renderer.domElement); - - // Create particles - const geometry = new THREE.BufferGeometry(); - const vertices = []; - - for (let i = 0; i < 5000; i++) { - vertices.push( - THREE.MathUtils.randFloatSpread(2000), // x - THREE.MathUtils.randFloatSpread(2000), // y - THREE.MathUtils.randFloatSpread(2000) // z - ); - } - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - - const material = new THREE.PointsMaterial({ - color: 0x88ccff, - size: 2, - transparent: true, - opacity: 0.5 - }); - - const particles = new THREE.Points(geometry, material); - scene.add(particles); - - camera.position.z = 1000; - - const animate = () => { - requestAnimationFrame(animate); - particles.rotation.x += 0.0001; - particles.rotation.y += 0.0001; - renderer.render(scene, camera); - }; - - animate(); - - const handleResize = () => { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); - }; - - window.addEventListener('resize', handleResize); - - return () => { - window.removeEventListener('resize', handleResize); - containerRef.current?.removeChild(renderer.domElement); - }; - }, []); - - return ( -
- ); -}; diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts deleted file mode 100644 index 11f02fe..0000000 --- a/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// -- cgit v1.2.3-70-g09d2