From d3d1ba1d79a5778b2a3463118873358290eb673f Mon Sep 17 00:00:00 2001 From: Diego Cornejo Date: Fri, 22 Nov 2024 08:14:13 -0600 Subject: [PATCH] chore: clean project and prepare for production --- .env.example | 4 +- .vscode/extensions.json | 5 +- astro.config.mjs | 2 +- package.json | 118 ++++++++++-------- public/favicon.svg | 9 -- public/github_logo.svg | 1 - src/components/Auth/SignInForm.astro | 42 ------- src/components/Auth/SignInForm.tsx | 2 +- src/components/Avatar/Avatar.astro | 13 -- src/components/Avatar/AvatarGroup.astro | 26 ---- src/components/Avatar/AvatarIndicator.astro | 14 --- src/components/Avatar/AvatarRing.astro | 14 --- src/components/Banner.tsx | 4 +- src/components/Breadcrumb.astro | 52 -------- src/components/Cards/AchievementCard.astro | 14 +-- src/components/Cards/DuelistCard.astro | 43 ------- src/components/Cards/DuelistCard.tsx | 2 +- src/components/Cards/FeatureCard.astro | 13 +- src/components/Footer.astro | 12 +- .../NavBar/AnnouncementsDropdown.astro | 2 +- src/components/NavBar/Navbar.astro | 2 +- src/components/NavBar/helper.ts | 2 +- src/components/NavBar/menuItems.ts | 2 +- src/components/Rating.astro | 13 -- src/components/Rating.tsx | 4 +- src/components/Settings/SettingsForm.tsx | 3 - src/layouts/Layout.astro | 15 +-- src/pages/duelists/[id]/[banlist].astro | 11 +- src/pages/index.astro | 6 +- src/pages/tournaments.astro | 2 +- src/sections/Crew.astro | 2 +- src/sections/Download.astro | 2 +- src/sections/Faqs.astro | 2 +- src/sections/Features.astro | 2 +- src/sections/News.tsx | 4 +- src/sections/Ranking.astro | 83 ------------ src/sections/Ranking.tsx | 2 +- src/stores/sessionStore.ts | 2 +- src/types/{index.d.ts => types.d.ts} | 0 tailwind.config.mjs | 7 -- tsconfig.json | 5 +- 41 files changed, 120 insertions(+), 443 deletions(-) delete mode 100644 public/favicon.svg delete mode 100644 public/github_logo.svg delete mode 100644 src/components/Auth/SignInForm.astro delete mode 100644 src/components/Avatar/Avatar.astro delete mode 100644 src/components/Avatar/AvatarGroup.astro delete mode 100644 src/components/Avatar/AvatarIndicator.astro delete mode 100644 src/components/Avatar/AvatarRing.astro delete mode 100644 src/components/Breadcrumb.astro delete mode 100644 src/components/Cards/DuelistCard.astro delete mode 100644 src/components/Rating.astro delete mode 100644 src/sections/Ranking.astro rename src/types/{index.d.ts => types.d.ts} (100%) diff --git a/.env.example b/.env.example index 0092434..f4e32d5 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,4 @@ PUBLIC_API_URL=http://localhost:3000/api/v1 -PUBLIC_CACHET_API_URL="https://status.evolutionygo.com" \ No newline at end of file +PUBLIC_CACHET_API_URL=https://status.evolutionygo.com +PUBLIC_ANALYTICS_URL=https://analytics.evolutionygo.com +PUBLIC_ANALYTICS_ID=1234567890 \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 22a1505..f3c3817 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,4 +1,7 @@ { - "recommendations": ["astro-build.astro-vscode"], + "recommendations": [ + "astro-build.astro-vscode", + "oxc.oxc-vscode" + ], "unwantedRecommendations": [] } diff --git a/astro.config.mjs b/astro.config.mjs index ebb4ad1..2dc1145 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -25,7 +25,7 @@ export default defineConfig({ } } }, - site: 'https://beta.evolutionygo.com', + site: 'https://evolutionygo.com', output: 'server', adapter: vercel() }); \ No newline at end of file diff --git a/package.json b/package.json index 529a666..2527adc 100644 --- a/package.json +++ b/package.json @@ -1,54 +1,66 @@ { - "name": "evolutionygo-web-ranking", - "type": "module", - "version": "0.0.1", - "scripts": { - "dev": "astro dev", - "start": "astro dev", - "build": "astro check && astro build", - "preview": "astro preview", - "astro": "astro", - "lint": "oxlint", - "lint:fix": "oxlint --fix", - "prepare": "husky" - }, - "dependencies": { - "@astrojs/check": "^0.9.4", - "@astrojs/react": "^3.6.2", - "@astrojs/sitemap": "^3.2.1", - "@astrojs/tailwind": "^5.1.2", - "@astrojs/vercel": "^7.8.2", - "@fontsource-variable/plus-jakarta-sans": "^5.1.0", - "@iconify-json/ic": "^1.2.1", - "@iconify-json/mdi": "^1.2.1", - "@nanostores/persistent": "0.10.2", - "@nanostores/react": "0.8.0", - "@playform/compress": "^0.1.6", - "@types/react": "^18.3.12", - "@types/react-dom": "^18.3.1", - "astro": "^4.16.8", - "astro-icon": "^1.1.2", - "nanostores": "0.11.3", - "react": "^18.3.1", - "react-dom": "^18.3.1", - "react-svg": "16.1.34", - "sonner": "1.7.0", - "swiper": "11.1.14", - "tailwindcss": "^3.4.14", - "typescript": "^5.6.3" - }, - "devDependencies": { - "@commitlint/cli": "^19.6.0", - "@commitlint/config-conventional": "^19.6.0", - "@tailwindcss/typography": "^0.5.15", - "daisyui": "^4.12.14", - "husky": "^9.1.7", - "lint-staged": "^15.2.10", - "oxlint": "^0.11.1" - }, - "lint-staged": { - "*.{astro,js,jsx,ts,tsx}": [ - "oxlint" - ] - } -} + "name": "evolutionygo-web-ranking", + "type": "module", + "version": "1.0.0", + "author": "Diego Cornejo (https://diegocornejo.com)", + "license": "ISC", + "repository": "https://github.com/diegofcornejo/evolutionygo-web-ranking", + "bugs": "https://github.com/diegofcornejo/evolutionygo-web-ranking/issues", + "homepage": "https://evolutionygo.com", + "keywords": [ + "ygo", + "yugioh", + "ygopro", + "astrojs", + "astro" + ], + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro check && astro build", + "preview": "astro preview", + "astro": "astro", + "lint": "oxlint", + "lint:fix": "oxlint --fix", + "prepare": "husky" + }, + "dependencies": { + "@astrojs/check": "^0.9.4", + "@astrojs/react": "^3.6.2", + "@astrojs/sitemap": "^3.2.1", + "@astrojs/tailwind": "^5.1.2", + "@astrojs/vercel": "^7.8.2", + "@fontsource-variable/plus-jakarta-sans": "^5.1.0", + "@iconify-json/ic": "^1.2.1", + "@iconify-json/mdi": "^1.2.1", + "@nanostores/persistent": "0.10.2", + "@nanostores/react": "0.8.0", + "@playform/compress": "^0.1.6", + "@types/react": "^18.3.12", + "@types/react-dom": "^18.3.1", + "astro": "^4.16.8", + "astro-icon": "^1.1.2", + "nanostores": "0.11.3", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-svg": "16.1.34", + "sonner": "1.7.0", + "swiper": "11.1.14", + "tailwindcss": "^3.4.14", + "typescript": "^5.6.3" + }, + "devDependencies": { + "@commitlint/cli": "^19.6.0", + "@commitlint/config-conventional": "^19.6.0", + "@tailwindcss/typography": "^0.5.15", + "daisyui": "^4.12.14", + "husky": "^9.1.7", + "lint-staged": "^15.2.10", + "oxlint": "^0.11.1" + }, + "lint-staged": { + "*.{astro,js,jsx,ts,tsx}": [ + "oxlint" + ] + } +} \ No newline at end of file diff --git a/public/favicon.svg b/public/favicon.svg deleted file mode 100644 index f157bd1..0000000 --- a/public/favicon.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/public/github_logo.svg b/public/github_logo.svg deleted file mode 100644 index d5e6491..0000000 --- a/public/github_logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/Auth/SignInForm.astro b/src/components/Auth/SignInForm.astro deleted file mode 100644 index 43477b3..0000000 --- a/src/components/Auth/SignInForm.astro +++ /dev/null @@ -1,42 +0,0 @@ ---- -if (Astro.request.method === "POST") { - try { - const data = await Astro.request.formData(); - const email = data.get("email"); - const password = data.get("password"); - console.log(email, password); - } catch (error) { - console.error(error); - } -} ---- - -
- - - -
\ No newline at end of file diff --git a/src/components/Auth/SignInForm.tsx b/src/components/Auth/SignInForm.tsx index b41997b..1ff2d9d 100644 --- a/src/components/Auth/SignInForm.tsx +++ b/src/components/Auth/SignInForm.tsx @@ -1,6 +1,6 @@ import { useState } from 'react'; import { ReactSVG } from 'react-svg' -import type { Session } from '@types'; +import type { Session } from 'src/types/types'; import { updateSession } from '@stores/sessionStore'; export default function LoginForm({ dialog }: { dialog: string }) { diff --git a/src/components/Avatar/Avatar.astro b/src/components/Avatar/Avatar.astro deleted file mode 100644 index 6e6972b..0000000 --- a/src/components/Avatar/Avatar.astro +++ /dev/null @@ -1,13 +0,0 @@ ---- -interface Props { - size: number; -} - -const { size } = Astro.props; ---- - -
-
- -
-
\ No newline at end of file diff --git a/src/components/Avatar/AvatarGroup.astro b/src/components/Avatar/AvatarGroup.astro deleted file mode 100644 index 6bb94dd..0000000 --- a/src/components/Avatar/AvatarGroup.astro +++ /dev/null @@ -1,26 +0,0 @@ ---- -import Avatar from './Avatar.astro'; - -interface Props { - size: number; - avatars: number[]; - maxShow: number; -} - -let { size, avatars, maxShow} = Astro.props; -const quantity = avatars.length - maxShow; -avatars = avatars.slice(0, maxShow); ---- - -
- {avatars.map((item) => ( - - ))} - {quantity > 0 && ( -
-
- +{quantity} -
-
- )} -
diff --git a/src/components/Avatar/AvatarIndicator.astro b/src/components/Avatar/AvatarIndicator.astro deleted file mode 100644 index 36e5869..0000000 --- a/src/components/Avatar/AvatarIndicator.astro +++ /dev/null @@ -1,14 +0,0 @@ ---- -interface Props { - size: number; - online: boolean; -} - -const { size, online } = Astro.props; ---- - -
-
- -
-
\ No newline at end of file diff --git a/src/components/Avatar/AvatarRing.astro b/src/components/Avatar/AvatarRing.astro deleted file mode 100644 index 9eba4bc..0000000 --- a/src/components/Avatar/AvatarRing.astro +++ /dev/null @@ -1,14 +0,0 @@ ---- -interface Props { - size: number; - color: string; -} - -const { size, color } = Astro.props; ---- - -
-
- -
-
\ No newline at end of file diff --git a/src/components/Banner.tsx b/src/components/Banner.tsx index b74cfba..54a15c3 100644 --- a/src/components/Banner.tsx +++ b/src/components/Banner.tsx @@ -1,7 +1,7 @@ -import type { News as BannerProps} from '@types'; +import type { News as Props} from 'src/types/types'; import { ReactSVG } from 'react-svg' -export default ({ image, title, description, buttonText, buttonLink }: BannerProps) => { +export default ({ image, title, description, buttonText, buttonLink }: Props) => { return (
diff --git a/src/components/Breadcrumb.astro b/src/components/Breadcrumb.astro deleted file mode 100644 index 92166c7..0000000 --- a/src/components/Breadcrumb.astro +++ /dev/null @@ -1,52 +0,0 @@ - \ No newline at end of file diff --git a/src/components/Cards/AchievementCard.astro b/src/components/Cards/AchievementCard.astro index db517f0..a14e8cd 100644 --- a/src/components/Cards/AchievementCard.astro +++ b/src/components/Cards/AchievementCard.astro @@ -1,18 +1,8 @@ --- import { Icon } from 'astro-icon/components'; +import type { Achievement } from 'src/types/types'; -interface Props { - id: string; - icon: string; - name: string; - labels: string[]; - unlockedAt: Date; - description: string; - earnedPoints: number; - color?: string; -} - -const { icon, name, labels = [], unlockedAt, description, earnedPoints, color = '#F5BF50'} = Astro.props; +const { icon, name, labels = [], unlockedAt, description, earnedPoints, color = '#F5BF50' } = Astro.props as Achievement; ---
diff --git a/src/components/Cards/DuelistCard.astro b/src/components/Cards/DuelistCard.astro deleted file mode 100644 index 01d2056..0000000 --- a/src/components/Cards/DuelistCard.astro +++ /dev/null @@ -1,43 +0,0 @@ ---- -import Rating from '../Rating.astro'; - -interface Props { - userId: number; - username: string; - points: number; - wins: number; - losses: number; - winRate: number; - position: number; -} - -const { userId, username, points, wins, losses, winRate, position } = Astro.props; -const image = `https://ui-avatars.com/api/?name=${username}&background=random&size=128`; -const rating = 1 + (winRate / 100) * 4; ---- - - -
-
- {username} -
- -
-
-

- #{position} {username} -

-

Points: {points}

-

Wins: {wins}

-

Losses: {losses}

-

Win Rate: {winRate.toFixed(2)}%

-
-
diff --git a/src/components/Cards/DuelistCard.tsx b/src/components/Cards/DuelistCard.tsx index 5b0f379..319b779 100644 --- a/src/components/Cards/DuelistCard.tsx +++ b/src/components/Cards/DuelistCard.tsx @@ -1,5 +1,5 @@ -import type { Duelist } from '@types'; +import type { Duelist } from 'src/types/types'; import Rating from '@components/Rating'; interface Props extends Duelist { diff --git a/src/components/Cards/FeatureCard.astro b/src/components/Cards/FeatureCard.astro index a315467..11c38e0 100644 --- a/src/components/Cards/FeatureCard.astro +++ b/src/components/Cards/FeatureCard.astro @@ -1,15 +1,14 @@ --- import { Icon } from 'astro-icon/components'; -interface Props { - title: string; - description: string; - icon: string; -} -const { title, description, icon } = Astro.props; +import type { Feature } from 'src/types/types'; + +const { title, description, icon } = Astro.props as Feature; ---
-
+
diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 2c39a6f..97255da 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -1,7 +1,6 @@ --- import { Icon } from "astro-icon/components"; -const webRepo = 'https://github.com/Evolution-YGO/evolution-web'; -const serverRepo = 'https://github.com/Evolution-YGO/evolution-server'; +const githubUrl = 'https://github.com/evolutionygo'; ---
@@ -25,17 +24,18 @@ const serverRepo = 'https://github.com/Evolution-YGO/evolution-server';