From c21c29c1e7a67b70e9e34e1ac57b11bc1a5ae5f3 Mon Sep 17 00:00:00 2001 From: Kennix88 Date: Mon, 16 Dec 2024 14:46:15 +0800 Subject: [PATCH] project structure --- README.md | 4 +-- apps/HashRateGame/specs/index.spec.tsx | 2 +- apps/HashRateGame/src/app/(public)/layout.tsx | 30 +++++++++++++++++++ .../src/app/{ => (public)}/page.tsx | 0 .../app/(main)/_components/NavBar.tsx | 7 +++++ .../(telegram)/app/(main)/analytics/page.tsx | 3 ++ .../(telegram)/app/(main)/friends/page.tsx | 3 ++ .../app/(telegram)/app/(main)/games/page.tsx | 3 ++ .../src/app/(telegram)/app/(main)/layout.tsx | 15 ++++++++++ .../app/(telegram)/app/(main)/menu/page.tsx | 3 ++ .../app/(telegram)/app/(main)/mining/page.tsx | 3 ++ .../app/(telegram)/app/(main)/rating/page.tsx | 3 ++ .../app/(telegram)/app/(main)/tasks/page.tsx | 3 ++ .../src/app/{ => (telegram)/app}/layout.tsx | 6 ++-- apps/HashRateGame/src/app/api/hello/route.ts | 3 -- apps/HashRateGame/tailwind.config.js | 14 +++++---- apps/HashRateGame/tsconfig.json | 21 ++++++++++--- 17 files changed, 105 insertions(+), 18 deletions(-) create mode 100644 apps/HashRateGame/src/app/(public)/layout.tsx rename apps/HashRateGame/src/app/{ => (public)}/page.tsx (100%) create mode 100644 apps/HashRateGame/src/app/(telegram)/app/(main)/_components/NavBar.tsx create mode 100644 apps/HashRateGame/src/app/(telegram)/app/(main)/analytics/page.tsx create mode 100644 apps/HashRateGame/src/app/(telegram)/app/(main)/friends/page.tsx create mode 100644 apps/HashRateGame/src/app/(telegram)/app/(main)/games/page.tsx create mode 100644 apps/HashRateGame/src/app/(telegram)/app/(main)/layout.tsx create mode 100644 apps/HashRateGame/src/app/(telegram)/app/(main)/menu/page.tsx create mode 100644 apps/HashRateGame/src/app/(telegram)/app/(main)/mining/page.tsx create mode 100644 apps/HashRateGame/src/app/(telegram)/app/(main)/rating/page.tsx create mode 100644 apps/HashRateGame/src/app/(telegram)/app/(main)/tasks/page.tsx rename apps/HashRateGame/src/app/{ => (telegram)/app}/layout.tsx (64%) delete mode 100644 apps/HashRateGame/src/app/api/hello/route.ts diff --git a/README.md b/README.md index da51bd0..340daba 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ Telegram app/game (Telegram-mini-app) based on the play-to-earn principle. ![GitHub Repo stars](https://img.shields.io/github/stars/Kennix88/HashRateGame?style=for-the-badge&color=0891b2&labelColor=1c1917) [![wakatime](https://wakatime.com/badge/user/9268c051-c861-45cc-b927-3babf56c56d9/project/8ea93489-247b-4b6c-96db-f1013437caa0.svg?style=for-the-badge&color=0891b2&logoColor=1c1917)](https://github.com/Kennix88/HashRateGame) ![Title](https://img.shields.io/badge/HashRateGame%3A-blue?style=for-the-badge&color=3C5280) -[![Game Telegram Bot](https://img.shields.io/badge/earn-blue?style=for-the-badge&color=0891b2&labelColor=1c1917&logo=telegram&label=Bot)](https://t.me/https://t.me/HashRateGame_bot) -[![Game Telegram Channel](https://img.shields.io/endpoint?style=for-the-badge&color=0891b2&labelColor=1c1917&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2FHashRateGame&label=Community)](https://t.me/https://t.me/HashRateGame) +[![Game Telegram Bot](https://img.shields.io/badge/earn-blue?style=for-the-badge&color=0891b2&labelColor=1c1917&logo=telegram&label=Bot)](https://t.me/HashRateGame_bot) +[![Game Telegram Channel](https://img.shields.io/endpoint?style=for-the-badge&color=0891b2&labelColor=1c1917&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2FHashRateGame&label=Community)](https://t.me/HashRateGame) [![Game Telegram chat](https://img.shields.io/endpoint?label=Chat&style=for-the-badge&color=0891b2&labelColor=1c1917&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2FHashRateGame_chat)](https://t.me/HashRateGame_chat) ![Title](https://img.shields.io/badge/Me%3A-blue?style=for-the-badge&color=3C5280) [![Github followers](https://img.shields.io/github/followers/Kennix88?logo=github&style=for-the-badge&color=0891b2&labelColor=1c1917)](https://www.github.com/Kennix88) diff --git a/apps/HashRateGame/specs/index.spec.tsx b/apps/HashRateGame/specs/index.spec.tsx index b544e83..d9ce80c 100644 --- a/apps/HashRateGame/specs/index.spec.tsx +++ b/apps/HashRateGame/specs/index.spec.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { render } from '@testing-library/react'; -import Page from '../src/app/page'; +import Page from '../src/app/(public)/page'; describe('Page', () => { it('should render successfully', () => { diff --git a/apps/HashRateGame/src/app/(public)/layout.tsx b/apps/HashRateGame/src/app/(public)/layout.tsx new file mode 100644 index 0000000..a941ad4 --- /dev/null +++ b/apps/HashRateGame/src/app/(public)/layout.tsx @@ -0,0 +1,30 @@ +import { Noto_Sans } from 'next/dist/compiled/@next/font/dist/google' +import '../global.css' + +const NotoSans = Noto_Sans({ + subsets: ['latin', 'cyrillic', 'greek', 'devanagari'], + style: ['normal', 'italic'], + weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'], + display: 'swap', + variable: '--font-noto-sans', +}) + +export const metadata = { + title: 'Welcome to hash-rate-game', + description: 'Generated by create-nx-workspace', +} + +export default function RootLayout({ + children, +}: { + children: React.ReactNode +}) { + return ( + + + {children} + + + ) +} diff --git a/apps/HashRateGame/src/app/page.tsx b/apps/HashRateGame/src/app/(public)/page.tsx similarity index 100% rename from apps/HashRateGame/src/app/page.tsx rename to apps/HashRateGame/src/app/(public)/page.tsx diff --git a/apps/HashRateGame/src/app/(telegram)/app/(main)/_components/NavBar.tsx b/apps/HashRateGame/src/app/(telegram)/app/(main)/_components/NavBar.tsx new file mode 100644 index 0000000..2d83f6a --- /dev/null +++ b/apps/HashRateGame/src/app/(telegram)/app/(main)/_components/NavBar.tsx @@ -0,0 +1,7 @@ +export default function NavBar() { + return ( +
+ NavBar +
+ ) +} diff --git a/apps/HashRateGame/src/app/(telegram)/app/(main)/analytics/page.tsx b/apps/HashRateGame/src/app/(telegram)/app/(main)/analytics/page.tsx new file mode 100644 index 0000000..e2af5e8 --- /dev/null +++ b/apps/HashRateGame/src/app/(telegram)/app/(main)/analytics/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Analytics
+} diff --git a/apps/HashRateGame/src/app/(telegram)/app/(main)/friends/page.tsx b/apps/HashRateGame/src/app/(telegram)/app/(main)/friends/page.tsx new file mode 100644 index 0000000..2b411f9 --- /dev/null +++ b/apps/HashRateGame/src/app/(telegram)/app/(main)/friends/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Friends
+} diff --git a/apps/HashRateGame/src/app/(telegram)/app/(main)/games/page.tsx b/apps/HashRateGame/src/app/(telegram)/app/(main)/games/page.tsx new file mode 100644 index 0000000..f6440e8 --- /dev/null +++ b/apps/HashRateGame/src/app/(telegram)/app/(main)/games/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Games
+} diff --git a/apps/HashRateGame/src/app/(telegram)/app/(main)/layout.tsx b/apps/HashRateGame/src/app/(telegram)/app/(main)/layout.tsx new file mode 100644 index 0000000..e4d9553 --- /dev/null +++ b/apps/HashRateGame/src/app/(telegram)/app/(main)/layout.tsx @@ -0,0 +1,15 @@ +import '../../../global.css' +import NavBar from './_components/NavBar' + +export default function MainLayout({ + children, +}: { + children: React.ReactNode +}) { + return ( +
+
{children}
+ +
+ ) +} diff --git a/apps/HashRateGame/src/app/(telegram)/app/(main)/menu/page.tsx b/apps/HashRateGame/src/app/(telegram)/app/(main)/menu/page.tsx new file mode 100644 index 0000000..3cd7278 --- /dev/null +++ b/apps/HashRateGame/src/app/(telegram)/app/(main)/menu/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Menu
+} diff --git a/apps/HashRateGame/src/app/(telegram)/app/(main)/mining/page.tsx b/apps/HashRateGame/src/app/(telegram)/app/(main)/mining/page.tsx new file mode 100644 index 0000000..bce3733 --- /dev/null +++ b/apps/HashRateGame/src/app/(telegram)/app/(main)/mining/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Mining
+} diff --git a/apps/HashRateGame/src/app/(telegram)/app/(main)/rating/page.tsx b/apps/HashRateGame/src/app/(telegram)/app/(main)/rating/page.tsx new file mode 100644 index 0000000..dc5b965 --- /dev/null +++ b/apps/HashRateGame/src/app/(telegram)/app/(main)/rating/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Rating
+} diff --git a/apps/HashRateGame/src/app/(telegram)/app/(main)/tasks/page.tsx b/apps/HashRateGame/src/app/(telegram)/app/(main)/tasks/page.tsx new file mode 100644 index 0000000..b90a52a --- /dev/null +++ b/apps/HashRateGame/src/app/(telegram)/app/(main)/tasks/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Tasks
+} diff --git a/apps/HashRateGame/src/app/layout.tsx b/apps/HashRateGame/src/app/(telegram)/app/layout.tsx similarity index 64% rename from apps/HashRateGame/src/app/layout.tsx rename to apps/HashRateGame/src/app/(telegram)/app/layout.tsx index 21f8d04..c830374 100644 --- a/apps/HashRateGame/src/app/layout.tsx +++ b/apps/HashRateGame/src/app/(telegram)/app/layout.tsx @@ -1,8 +1,8 @@ -import './global.css'; +import '../../global.css'; export const metadata = { - title: 'Welcome to hash-rate-game', - description: 'Generated by create-nx-workspace', + title: '#HashRateGame', + description: '#HashRateGame - Telegram mini app', }; export default function RootLayout({ diff --git a/apps/HashRateGame/src/app/api/hello/route.ts b/apps/HashRateGame/src/app/api/hello/route.ts deleted file mode 100644 index de70bac..0000000 --- a/apps/HashRateGame/src/app/api/hello/route.ts +++ /dev/null @@ -1,3 +0,0 @@ -export async function GET(request: Request) { - return new Response('Hello, from API!'); -} diff --git a/apps/HashRateGame/tailwind.config.js b/apps/HashRateGame/tailwind.config.js index e1cf7ce..ee048c2 100644 --- a/apps/HashRateGame/tailwind.config.js +++ b/apps/HashRateGame/tailwind.config.js @@ -1,17 +1,21 @@ -const { createGlobPatternsForDependencies } = require('@nx/react/tailwind'); -const { join } = require('path'); +const { createGlobPatternsForDependencies } = require('@nx/react/tailwind') +const { join } = require('path') /** @type {import('tailwindcss').Config} */ module.exports = { content: [ join( __dirname, - '{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}' + '{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}', ), ...createGlobPatternsForDependencies(__dirname), ], theme: { - extend: {}, + extend: { + fontFamily: { + sans: ['var(--font-noto-sans)'], + }, + }, }, plugins: [], -}; +} diff --git a/apps/HashRateGame/tsconfig.json b/apps/HashRateGame/tsconfig.json index e441c99..d665963 100644 --- a/apps/HashRateGame/tsconfig.json +++ b/apps/HashRateGame/tsconfig.json @@ -9,7 +9,11 @@ "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, @@ -19,7 +23,10 @@ "name": "next" } ], - "types": ["jest", "node"] + "types": [ + "jest", + "node" + ] }, "include": [ "**/*.ts", @@ -28,7 +35,13 @@ "**/*.jsx", "../../apps/HashRateGame/.next/types/**/*.ts", "../../dist/apps/HashRateGame/.next/types/**/*.ts", - "next-env.d.ts" + "next-env.d.ts", + ".next/types/**/*.ts" ], - "exclude": ["node_modules", "jest.config.ts", "**/*.spec.ts", "**/*.test.ts"] + "exclude": [ + "node_modules", + "jest.config.ts", + "**/*.spec.ts", + "**/*.test.ts" + ] }