├── scrapers ├── naruto-fandom.js ├── leaf-ninja │ ├── villages.js │ ├── clans.js │ └── characters.js └── leaf-ninja.js ├── .ignore ├── src ├── client │ ├── styles │ │ ├── Admin.module.scss │ │ ├── Footer.module.scss │ │ ├── Layout.module.scss │ │ ├── Badge.module.scss │ │ ├── EditableTable.scss │ │ ├── Contribute.module.scss │ │ ├── FilterBar.module.scss │ │ ├── Nav.module.scss │ │ ├── Explorer.module.scss │ │ ├── EditDrawer.module.scss │ │ ├── Home.module.scss │ │ ├── Sidebar.module.scss │ │ ├── reset.scss │ │ ├── Card.module.scss │ │ ├── Docs.module.scss │ │ ├── index.scss │ │ └── FilterDrawer.module.scss │ ├── .dockerignore │ ├── next-env.d.ts │ ├── public │ │ ├── lock.png │ │ ├── sand.png │ │ ├── star.png │ │ ├── test.png │ │ ├── favicon.ico │ │ ├── flower.png │ │ ├── waterfall.svg │ │ ├── mist.svg │ │ ├── grass.svg │ │ ├── sand.svg │ │ ├── earth.svg │ │ ├── brand2.svg │ │ ├── brand.svg │ │ ├── whirling-tides.svg │ │ ├── edit2.svg │ │ ├── springs.svg │ │ ├── rain.svg │ │ ├── sound.svg │ │ ├── github.svg │ │ ├── unknown.svg │ │ ├── twitch.svg │ │ ├── cloud.svg │ │ ├── more.svg │ │ ├── sharingan.svg │ │ ├── cancel.svg │ │ └── naruto64.svg │ ├── .prettierrc │ ├── shared │ │ ├── interfaces │ │ │ ├── Filters.ts │ │ │ ├── Village.ts │ │ │ ├── Info.ts │ │ │ ├── DataTable.ts │ │ │ ├── index.ts │ │ │ └── Result.ts │ │ ├── utils │ │ │ ├── index.ts │ │ │ ├── truncateString.ts │ │ │ └── getObjectDifferences.ts │ │ ├── enums │ │ │ └── villages.ts │ │ ├── AppContext.tsx │ │ └── constants │ │ │ └── village.ts │ ├── Dockerfile │ ├── components │ │ ├── documentation │ │ │ ├── VillageSchema.tsx │ │ │ ├── ClanSchema.tsx │ │ │ ├── CharacterSchema.tsx │ │ │ ├── PaginationSchema.tsx │ │ │ ├── PaginationSnippet.tsx │ │ │ ├── VillageSingle.tsx │ │ │ ├── VillageAll.tsx │ │ │ ├── CharacterSingle.tsx │ │ │ ├── ClanSingle.tsx │ │ │ ├── ClanAll.tsx │ │ │ ├── CharacterAll.tsx │ │ │ ├── ClanFilter.tsx │ │ │ └── CharacterFilter.tsx │ │ ├── Layout.tsx │ │ ├── Badge.tsx │ │ ├── Footer.tsx │ │ ├── CodeSnippet.tsx │ │ ├── GoogleTag.tsx │ │ ├── DataTable.tsx │ │ ├── Card.tsx │ │ ├── Nav.tsx │ │ ├── Sidebar.tsx │ │ ├── EditableTable.tsx │ │ ├── EditDrawer.tsx │ │ ├── FilterBar.tsx │ │ └── FilterDrawer.tsx │ ├── hooks │ │ ├── useDebouncedValue.ts │ │ ├── useClickOutside.ts │ │ ├── useKeyPress.ts │ │ ├── useWindowSize.ts │ │ └── useIntersectionObserver.ts │ ├── data │ │ ├── village-schema.ts │ │ ├── pagination-schema.ts │ │ ├── clan-schema.ts │ │ ├── character-schema.ts │ │ └── sections.ts │ ├── .gitignore │ ├── tsconfig.json │ ├── pages │ │ ├── index.tsx │ │ ├── contribute.tsx │ │ ├── _app.tsx │ │ ├── explorer.tsx │ │ └── docs.tsx │ ├── package.json │ └── README.md └── server │ ├── utils │ ├── constants.ts │ └── errors.ts │ ├── .dockerignore │ ├── graphql │ ├── clan │ │ ├── index.ts │ │ ├── clans-type.ts │ │ ├── clan-type.ts │ │ └── clan-resolver.ts │ ├── village │ │ ├── index.ts │ │ ├── village-type.ts │ │ ├── village-service.ts │ │ ├── villages-type.ts │ │ └── village-resolver.ts │ ├── character │ │ ├── index.ts │ │ ├── character-input.ts │ │ ├── characters-type.ts │ │ ├── character-type.ts │ │ └── character-resolver.ts │ └── info-type.ts │ ├── villages.csv │ ├── Dockerfile │ ├── database │ ├── seeders │ │ ├── index.ts │ │ ├── village.ts │ │ ├── clan.ts │ │ ├── cleanup-clan-image.ts │ │ ├── character.ts │ │ └── cleanup-character-image.ts │ └── index.ts │ ├── tsconfig.json │ ├── createExpressServer.ts │ ├── index.ts │ ├── createGraphqlServer.ts │ ├── package.json │ └── clans.csv ├── .gitignore ├── .prettierrc ├── docker-compose.yml ├── NOTES.md ├── README.md └── LICENSE /scrapers/naruto-fandom.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ignore: -------------------------------------------------------------------------------- 1 | .git 2 | node_modules 3 | -------------------------------------------------------------------------------- /src/client/styles/Admin.module.scss: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/server/utils/constants.ts: -------------------------------------------------------------------------------- 1 | export const limit = 40; 2 | -------------------------------------------------------------------------------- /src/server/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | -------------------------------------------------------------------------------- /src/client/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .DS_STORE 4 | **/.DS_Store 5 | mongo 6 | **/.env 7 | -------------------------------------------------------------------------------- /src/client/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /src/client/public/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bautistaaa/narutoQL/HEAD/src/client/public/lock.png -------------------------------------------------------------------------------- /src/client/public/sand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bautistaaa/narutoQL/HEAD/src/client/public/sand.png -------------------------------------------------------------------------------- /src/client/public/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bautistaaa/narutoQL/HEAD/src/client/public/star.png -------------------------------------------------------------------------------- /src/client/public/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bautistaaa/narutoQL/HEAD/src/client/public/test.png -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "es5", 4 | "arrowParens": "avoid" 5 | } 6 | -------------------------------------------------------------------------------- /src/client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bautistaaa/narutoQL/HEAD/src/client/public/favicon.ico -------------------------------------------------------------------------------- /src/client/public/flower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bautistaaa/narutoQL/HEAD/src/client/public/flower.png -------------------------------------------------------------------------------- /src/client/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "es5", 4 | "bracketSpacing": true, 5 | "arrowParens": "always" 6 | } 7 | -------------------------------------------------------------------------------- /src/client/shared/interfaces/Filters.ts: -------------------------------------------------------------------------------- 1 | interface Filters { 2 | name: string; 3 | ranks: string[]; 4 | villages: string[]; 5 | } 6 | 7 | export default Filters; 8 | -------------------------------------------------------------------------------- /src/client/shared/interfaces/Village.ts: -------------------------------------------------------------------------------- 1 | interface Village { 2 | color: string; 3 | imgSrc: string; 4 | filterValue: string; 5 | } 6 | 7 | export default Village 8 | -------------------------------------------------------------------------------- /src/client/shared/interfaces/Info.ts: -------------------------------------------------------------------------------- 1 | interface Info { 2 | count: number; 3 | pages: number; 4 | next: number; 5 | prev: number; 6 | } 7 | 8 | export default Info; 9 | -------------------------------------------------------------------------------- /src/client/shared/utils/index.ts: -------------------------------------------------------------------------------- 1 | export { default as getObjectDifferences } from './getObjectDifferences'; 2 | export { default as truncateString } from './truncateString'; 3 | -------------------------------------------------------------------------------- /src/server/graphql/clan/index.ts: -------------------------------------------------------------------------------- 1 | export { ClanResolver } from './clan-resolver'; 2 | export { Clan, ClanModel } from './clan-type'; 3 | export { Clans, GetClanArgs } from './clans-type'; 4 | -------------------------------------------------------------------------------- /src/client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 2 | 3 | RUN mkdir /client 4 | 5 | WORKDIR /client 6 | 7 | COPY package*.json ./ 8 | 9 | RUN npm install 10 | 11 | COPY . . 12 | 13 | EXPOSE 3000 14 | 15 | CMD ["npm", "run", "dev"] 16 | -------------------------------------------------------------------------------- /src/client/shared/interfaces/DataTable.ts: -------------------------------------------------------------------------------- 1 | export interface BodyItem { 2 | key: string; 3 | type: string; 4 | description: string; 5 | } 6 | export interface DataTable { 7 | headers: string[]; 8 | body: BodyItem[]; 9 | } 10 | -------------------------------------------------------------------------------- /src/server/utils/errors.ts: -------------------------------------------------------------------------------- 1 | class NotFoundError extends Error { 2 | statusCode: number; 3 | 4 | constructor(message: string) { 5 | super(message); 6 | this.statusCode = 404; 7 | } 8 | } 9 | 10 | export default NotFoundError; 11 | -------------------------------------------------------------------------------- /src/client/shared/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | export type { default as Filters } from './Filters'; 2 | export type { default as Info } from './Info'; 3 | export type { default as Result } from './Result'; 4 | export type { default as Village } from './Village'; 5 | -------------------------------------------------------------------------------- /src/client/styles/Footer.module.scss: -------------------------------------------------------------------------------- 1 | .footer { 2 | background: white; 3 | height: 50px; 4 | width: 100%; 5 | padding: 15px; 6 | position: fixed; 7 | bottom: 0; 8 | left: 0; 9 | z-index: 399; 10 | border-top: 1px solid #d6d6d6; 11 | } 12 | -------------------------------------------------------------------------------- /src/server/graphql/village/index.ts: -------------------------------------------------------------------------------- 1 | export { VillageResolver } from './village-resolver'; 2 | export { VillageService } from './village-service'; 3 | export { Village, VillageModel } from './village-type'; 4 | export { Villages, GetVillagesArgs } from './villages-type'; 5 | -------------------------------------------------------------------------------- /src/client/shared/utils/truncateString.ts: -------------------------------------------------------------------------------- 1 | const truncateString = (value: string, limit: number): string => { 2 | if (value.length <= limit) { 3 | return value; 4 | } 5 | 6 | return `${value.slice(0, limit)}...`; 7 | }; 8 | 9 | export default truncateString; 10 | -------------------------------------------------------------------------------- /src/client/styles/Layout.module.scss: -------------------------------------------------------------------------------- 1 | .wrapper { 2 | display: flex; 3 | flex-direction: column; 4 | height: 100%; 5 | width: 100%; 6 | } 7 | 8 | .main { 9 | flex: 1; 10 | display: flex; 11 | flex-direction: column; 12 | margin-top: 50px; 13 | padding: 20px; 14 | } 15 | -------------------------------------------------------------------------------- /src/server/graphql/character/index.ts: -------------------------------------------------------------------------------- 1 | export { CharacterInput } from './character-input'; 2 | export { CharacterResolver } from './character-resolver'; 3 | export { Character, CharacterModel } from './character-type'; 4 | export { Characters, GetCharactersArgs, UpdateCharacterInput } from './characters-type'; 5 | -------------------------------------------------------------------------------- /src/client/components/documentation/VillageSchema.tsx: -------------------------------------------------------------------------------- 1 | import { FC } from 'react'; 2 | import villageSchema from '../../data/village-schema'; 3 | import DataTable from '../DataTable'; 4 | 5 | const VillageSchema: FC = () => { 6 | return ; 7 | }; 8 | 9 | export default VillageSchema; 10 | -------------------------------------------------------------------------------- /src/client/components/documentation/ClanSchema.tsx: -------------------------------------------------------------------------------- 1 | import { FC } from 'react'; 2 | import characterSchema from '../../data/character-schema'; 3 | import DataTable from '../DataTable'; 4 | 5 | const CharacterSchema: FC = () => { 6 | return ; 7 | }; 8 | 9 | export default CharacterSchema; 10 | -------------------------------------------------------------------------------- /src/client/components/documentation/CharacterSchema.tsx: -------------------------------------------------------------------------------- 1 | import { FC } from 'react'; 2 | import characterSchema from '../../data/character-schema'; 3 | import DataTable from '../DataTable'; 4 | 5 | const CharacterSchema: FC = () => { 6 | return ; 7 | }; 8 | 9 | export default CharacterSchema; 10 | -------------------------------------------------------------------------------- /src/client/shared/utils/getObjectDifferences.ts: -------------------------------------------------------------------------------- 1 | const getObjectDifferences = (original: T, incoming: U) => { 2 | const incomingEntries = Object.entries(incoming); 3 | const diff = incomingEntries.filter(([k, v]) => v !== original[k]); 4 | 5 | return Object.fromEntries(diff); 6 | }; 7 | 8 | export default getObjectDifferences; 9 | -------------------------------------------------------------------------------- /src/server/villages.csv: -------------------------------------------------------------------------------- 1 | name 2 | leaf village 3 | rock village 4 | mist village 5 | cloud village 6 | sand village 7 | rain village 8 | waterfall village 9 | grass village 10 | sound village 11 | hot springs village 12 | whirling tides village 13 | stone village 14 | star village 15 | heat haze village 16 | craftsman village 17 | lock village 18 | pink flower village 19 | -------------------------------------------------------------------------------- /src/client/shared/interfaces/Result.ts: -------------------------------------------------------------------------------- 1 | interface Result { 2 | _id: number; 3 | age: number; 4 | avatarSrc: string; 5 | description: string; 6 | firstAnimeAppearance: string; 7 | firstMangaAppearance: string; 8 | name: string; 9 | nameMeaning: string; 10 | notableQuotes: string; 11 | rank: string; 12 | village: string; 13 | } 14 | 15 | export default Result; 16 | -------------------------------------------------------------------------------- /src/server/graphql/village/village-type.ts: -------------------------------------------------------------------------------- 1 | import { getModelForClass, prop } from '@typegoose/typegoose'; 2 | import { Field, ID, ObjectType } from 'type-graphql'; 3 | 4 | @ObjectType() 5 | export class Village { 6 | @Field(() => ID) 7 | _id: string; 8 | 9 | @prop() 10 | @Field() 11 | name: string; 12 | } 13 | 14 | export const VillageModel = getModelForClass(Village); 15 | -------------------------------------------------------------------------------- /src/client/public/waterfall.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/server/graphql/info-type.ts: -------------------------------------------------------------------------------- 1 | import { Field, Int, ObjectType } from 'type-graphql'; 2 | 3 | @ObjectType() 4 | class Info { 5 | @Field(() => Int) 6 | count: number; 7 | 8 | @Field(() => Int) 9 | pages: number; 10 | 11 | @Field(() => Int, { nullable: true }) 12 | next: number; 13 | 14 | @Field(() => Int, { nullable: true }) 15 | prev: number; 16 | } 17 | 18 | export default Info; 19 | -------------------------------------------------------------------------------- /src/client/components/Layout.tsx: -------------------------------------------------------------------------------- 1 | import { FC } from 'react'; 2 | import Nav from './Nav'; 3 | import Footer from './Footer'; 4 | 5 | import styles from '../styles/Layout.module.scss'; 6 | 7 | const Layout: FC = props => ( 8 |
9 |
13 | ); 14 | 15 | export default Layout; 16 | -------------------------------------------------------------------------------- /src/server/graphql/character/character-input.ts: -------------------------------------------------------------------------------- 1 | import { Field, InputType, ObjectType } from 'type-graphql'; 2 | 3 | @ObjectType() 4 | @InputType('CharacterInput') 5 | export class CharacterInput { 6 | @Field({ nullable: true }) 7 | name?: string; 8 | 9 | @Field(() => [String],{ nullable: true }) 10 | rank?: string[]; 11 | 12 | @Field(() => [String],{ nullable: true }) 13 | village?: string[]; 14 | } 15 | -------------------------------------------------------------------------------- /src/server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 2 | 3 | RUN mkdir /server 4 | 5 | WORKDIR /server 6 | 7 | COPY package*.json ./ 8 | 9 | RUN npm install 10 | 11 | COPY . . 12 | 13 | EXPOSE 8000 14 | 15 | ARG MONGOPORT 16 | ARG MONGOUSER 17 | ARG MONGO_URL 18 | ARG PORT 19 | ARG RAILWAY_ENVIRONMENT 20 | ARG RAILWAY_STATIC_URL 21 | ARG MONGOHOST 22 | ARG MONGOPASSWORD 23 | 24 | RUN npm run build 25 | 26 | CMD ["npm", "start"] 27 | -------------------------------------------------------------------------------- /src/client/public/mist.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/client/components/Badge.tsx: -------------------------------------------------------------------------------- 1 | import { FC } from 'react'; 2 | import { VILLAGE_MAP } from '../shared/constants/village'; 3 | import styles from '../styles/Badge.module.scss'; 4 | 5 | const Badge: FC<{ village: string }> = ({ village }) => { 6 | const path = VILLAGE_MAP[village]?.imgSrc ?? 'unknown.svg'; 7 | return ( 8 |
9 | 10 |
11 | ); 12 | }; 13 | 14 | export default Badge; 15 | -------------------------------------------------------------------------------- /src/client/shared/enums/villages.ts: -------------------------------------------------------------------------------- 1 | export enum Villages { 2 | 'cloud' = 'cloud.svg', 3 | 'grass' = 'grass.svg', 4 | 'springs' = 'springs.svg', 5 | 'leaf' = 'brand2.svg', 6 | 'mist' = 'mist.svg', 7 | 'flower' = 'flower.png', 8 | 'rain' = 'rain.svg', 9 | 'sound' = 'sound.svg', 10 | 'star' = 'star.png', 11 | 'rock' = 'earth.svg', 12 | 'sand' = 'sand.svg', 13 | 'waterfall' = 'waterfall.svg', 14 | 'tides' = 'whirling-tides.svg', 15 | } 16 | -------------------------------------------------------------------------------- /src/client/styles/Badge.module.scss: -------------------------------------------------------------------------------- 1 | .badge { 2 | display: flex; 3 | align-items: center; 4 | justify-content: center; 5 | border-radius: 50%; 6 | width: 35px; 7 | height: 35px; 8 | border: 1px solid rgba(0, 0, 0, 0.6); 9 | background: #c9c9c9; 10 | overflow: hidden; 11 | position: absolute; 12 | bottom: 5px; 13 | left: 5px; 14 | box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23); 15 | img { 16 | width: 25px; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/client/components/documentation/PaginationSchema.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC } from 'react'; 2 | import paginationSchema from '../../data/pagination-schema'; 3 | import DataTable from '../DataTable'; 4 | import PaginationSnippet from './PaginationSnippet'; 5 | 6 | const PaginationSchema: FC = () => { 7 | return ( 8 |
9 | 10 | 11 |
12 | ); 13 | }; 14 | 15 | export default PaginationSchema; 16 | -------------------------------------------------------------------------------- /src/client/public/grass.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/client/components/Footer.tsx: -------------------------------------------------------------------------------- 1 | import Link from 'next/link'; 2 | import { FC } from 'react'; 3 | 4 | import styles from '../styles/Footer.module.scss'; 5 | 6 | const Footer: FC = () => { 7 | return ( 8 |
9 | Want to contribute? Click{' '} 10 | 11 | here 12 | 13 | ! 14 |
15 | ); 16 | }; 17 | 18 | export default Footer; 19 | -------------------------------------------------------------------------------- /src/client/hooks/useDebouncedValue.ts: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from 'react'; 2 | 3 | const useDebounce = (value: T, delay: number): T => { 4 | const [debouncedValue, setDebouncedValue] = useState(value); 5 | 6 | useEffect(() => { 7 | const handler = setTimeout(() => { 8 | setDebouncedValue(value); 9 | }, delay); 10 | 11 | return () => { 12 | clearTimeout(handler); 13 | }; 14 | }, [value, delay]); 15 | 16 | return debouncedValue; 17 | }; 18 | 19 | export default useDebounce; 20 | -------------------------------------------------------------------------------- /src/client/public/sand.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/client/data/village-schema.ts: -------------------------------------------------------------------------------- 1 | import { DataTable } from '../shared/interfaces/DataTable'; 2 | 3 | const villageSchema: DataTable = { 4 | headers: ['Field', 'Type', 'Description'], 5 | body: [ 6 | { 7 | key: '_id', 8 | type: 'ID', 9 | description: 10 | 'ID of village, helpful when trying to query individual village.', 11 | }, 12 | { 13 | key: 'name', 14 | type: 'String', 15 | description: 'Name of village.', 16 | }, 17 | ], 18 | }; 19 | 20 | export default villageSchema; 21 | -------------------------------------------------------------------------------- /src/client/styles/EditableTable.scss: -------------------------------------------------------------------------------- 1 | .wrapper { 2 | padding: 1rem; 3 | 4 | table { 5 | border-spacing: 0; 6 | border: 1px solid black; 7 | 8 | tr { 9 | :last-child { 10 | td { 11 | border-bottom: 0; 12 | } 13 | } 14 | } 15 | 16 | th, 17 | td { 18 | margin: 0; 19 | padding: 0.5rem; 20 | border-bottom: 1px solid black; 21 | border-right: 1px solid black; 22 | 23 | :last-child { 24 | border-right: 0; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env.local 29 | .env.development.local 30 | .env.test.local 31 | .env.production.local 32 | 33 | # vercel 34 | .vercel 35 | -------------------------------------------------------------------------------- /src/server/graphql/village/village-service.ts: -------------------------------------------------------------------------------- 1 | import { Service } from 'typedi'; 2 | import { Village } from './village-type'; 3 | 4 | @Service() 5 | export class VillageService { 6 | //private readonly villages: Village[] = [ 7 | //{ 8 | //name: 'Hidden Leaf Village', 9 | //}, 10 | //{ 11 | //name: 'Hidden Cloud Village', 12 | //}, 13 | //{ 14 | //name: 'Hidden Rock Village', 15 | //}, 16 | //]; 17 | //async getAll() { 18 | //return this.villages; 19 | //} 20 | //async findById(id: string) { 21 | //return this.villages[1]; 22 | //} 23 | } 24 | -------------------------------------------------------------------------------- /src/client/public/earth.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/client/public/brand2.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/server/database/seeders/index.ts: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | import { connectDb } from '../'; 3 | import seedVillage from './village'; 4 | import seedClan from './clan'; 5 | import seedCharacter from './character'; 6 | 7 | async function seedDatabase() { 8 | const mongoose = await connectDb(); 9 | 10 | console.log(`Connected to database: ${mongoose.connection.name}...`); 11 | await seedVillage(); 12 | await seedClan(); 13 | await seedCharacter(); 14 | 15 | console.log('Finished seeding all collections!'); 16 | process.exit(0); 17 | } 18 | 19 | seedDatabase(); 20 | -------------------------------------------------------------------------------- /src/server/graphql/village/villages-type.ts: -------------------------------------------------------------------------------- 1 | import { ArgsType, Field, Int, ObjectType } from 'type-graphql'; 2 | import { DocumentType } from '@typegoose/typegoose'; 3 | 4 | import { Village } from './'; 5 | import Info from '../info-type'; 6 | 7 | @ObjectType() 8 | export class Villages { 9 | @Field(() => Info, { nullable: true }) 10 | info?: Info; 11 | 12 | @Field(() => [Village], { nullable: true }) 13 | results?: DocumentType[]; 14 | } 15 | 16 | @ArgsType() 17 | export class GetVillagesArgs { 18 | @Field(() => Int, { nullable: true }) 19 | page?: number; 20 | } 21 | -------------------------------------------------------------------------------- /src/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "emitDecoratorMetadata": true, 5 | "esModuleInterop": true, 6 | "experimentalDecorators": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "lib": ["es2019", "esnext.asynciterable"], 9 | "module": "commonjs", 10 | "noImplicitAny": false, 11 | "outDir": "dist/server", 12 | "resolveJsonModule": true, 13 | "rootDir": ".", 14 | "target": "es2018", 15 | "paths": { "@utils/*": ["./utils/*"] } 16 | }, 17 | "exclude": ["node_modules", "**/*.spec.ts"], 18 | "include": ["**/*.ts"] 19 | } 20 | -------------------------------------------------------------------------------- /src/server/graphql/clan/clans-type.ts: -------------------------------------------------------------------------------- 1 | import { ArgsType, Field, Int, ObjectType } from 'type-graphql'; 2 | import { DocumentType } from '@typegoose/typegoose'; 3 | 4 | import { Clan } from './'; 5 | import Info from '../info-type'; 6 | 7 | @ObjectType() 8 | export class Clans { 9 | @Field(() => Info, { nullable: true }) 10 | info?: Info; 11 | 12 | @Field(() => [Clan], { nullable: true }) 13 | results?: DocumentType[]; 14 | } 15 | 16 | @ArgsType() 17 | export class GetClanArgs { 18 | @Field(() => Int, { nullable: true }) 19 | page?: number; 20 | 21 | @Field({ nullable: true }) 22 | village?: string; 23 | } 24 | -------------------------------------------------------------------------------- /src/client/styles/Contribute.module.scss: -------------------------------------------------------------------------------- 1 | .wrapper { 2 | height: 100%; 3 | width: 100%; 4 | font-weight: 300; 5 | padding-top: 50px; 6 | } 7 | 8 | .header { 9 | font-weight: 500; 10 | font-size: 1.5rem; 11 | margin-bottom: 20px; 12 | } 13 | 14 | .blurb { 15 | text-align: center; 16 | > p { 17 | font-size: 1.2rem; 18 | margin-bottom: 15px; 19 | } 20 | } 21 | 22 | .explore, 23 | .attention { 24 | font-weight: bold; 25 | } 26 | 27 | .explore { 28 | cursor: pointer; 29 | background: #ef8755; 30 | padding: 5px 10px; 31 | display: inline-block; 32 | color: white; 33 | border-radius: 5px; 34 | } 35 | -------------------------------------------------------------------------------- /src/client/components/CodeSnippet.tsx: -------------------------------------------------------------------------------- 1 | import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; 2 | import { tomorrow } from 'react-syntax-highlighter/dist/cjs/styles/prism'; 3 | import { FC } from 'react'; 4 | 5 | const customStyle = { fontSize: '14px' }; 6 | const CodeSnippet: FC<{ language: string; code: string }> = ({ 7 | code, 8 | language = 'javascript', 9 | }) => { 10 | return ( 11 | 16 | {code} 17 | 18 | ); 19 | }; 20 | 21 | export default CodeSnippet; 22 | -------------------------------------------------------------------------------- /src/client/public/brand.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/server/database/index.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | import mongoose from 'mongoose'; 3 | 4 | const dbUrl = process.env.MONGO_URL; 5 | const connectDb = () => { 6 | if (dbUrl) { 7 | return mongoose.connect(dbUrl); 8 | } 9 | console.error(`no db url provided!!`); 10 | throw Error('no db connected'); 11 | }; 12 | const disconnectDb = () => { 13 | mongoose.connection.close(function () { 14 | console.log( 15 | 'Mongoose default connection with DB :' + 16 | dbUrl + 17 | ' is disconnected through app termination' 18 | ); 19 | process.exit(0); 20 | }); 21 | }; 22 | 23 | export { connectDb, disconnectDb }; 24 | -------------------------------------------------------------------------------- /src/server/graphql/clan/clan-type.ts: -------------------------------------------------------------------------------- 1 | import { getModelForClass, prop } from '@typegoose/typegoose'; 2 | import { Field, ID, ObjectType } from 'type-graphql'; 3 | 4 | @ObjectType() 5 | export class Clan { 6 | @prop() 7 | @Field() 8 | avatarSrc: string; 9 | 10 | @prop() 11 | @Field() 12 | description: string; 13 | 14 | @Field(() => ID) 15 | _id: string; 16 | 17 | @prop() 18 | @Field() 19 | name: string; 20 | 21 | @prop() 22 | @Field({ nullable: true }) 23 | signatureAbilities: string; 24 | 25 | @prop() 26 | @Field({ nullable: true }) 27 | village: string; 28 | } 29 | 30 | export const ClanModel = getModelForClass(Clan); 31 | -------------------------------------------------------------------------------- /src/client/shared/AppContext.tsx: -------------------------------------------------------------------------------- 1 | import React, { useContext, useState } from 'react'; 2 | 3 | type AppContextProps = { 4 | isSidebarOpen: boolean; 5 | setIsSidebarOpen: Function; 6 | }; 7 | const AppContext = React.createContext>({}); 8 | 9 | const useAppContext = () => useContext(AppContext); 10 | 11 | const AppProvider = ({ children }) => { 12 | const [isSidebarOpen, setIsSidebarOpen] = useState(false); 13 | const value = { 14 | isSidebarOpen, 15 | setIsSidebarOpen, 16 | }; 17 | 18 | return {children}; 19 | }; 20 | 21 | export { AppProvider, useAppContext }; 22 | -------------------------------------------------------------------------------- /src/client/public/whirling-tides.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/client/components/GoogleTag.tsx: -------------------------------------------------------------------------------- 1 | import Head from 'next/head' 2 | 3 | const GoogleTag = () => { 4 | return ( 5 | 6 |