From f58a45df06468c34a0b892cf8b76174d82616a90 Mon Sep 17 00:00:00 2001 From: Neshura Date: Sat, 3 Dec 2022 21:02:24 +0100 Subject: [PATCH] Content Migration from websites repo --- .eslintrc.json | 10 + .gitignore | 18 + Dockerfile | 50 + README.md | 1 - components/footer.tsx | 11 + components/layout.tsx | 31 + components/navbar.tsx | 25 + interfaces/LinkTypes.ts | 7 + interfaces/ServerType.ts | 32 + next.config.js | 8 + package-lock.json | 5110 ++++++++++++++++++++++++++++++++++ package.json | 28 + pages/1_18_2.tsx | 81 + pages/_app.tsx | 14 + pages/api/navbar.tsx | 15 + pages/api/servers.tsx | 15 + pages/index.tsx | 54 + public/favicon.ico | Bin 0 -> 67646 bytes public/fonts/Minecraftia.ttf | Bin 0 -> 18236 bytes styles/Home.module.css | 194 ++ styles/Server.module.css | 101 + styles/globals.css | 27 + tsconfig.json | 26 + yarn.lock | 1718 ++++++++++++ 24 files changed, 7575 insertions(+), 1 deletion(-) create mode 100644 .eslintrc.json create mode 100755 .gitignore create mode 100644 Dockerfile delete mode 100644 README.md create mode 100644 components/footer.tsx create mode 100644 components/layout.tsx create mode 100644 components/navbar.tsx create mode 100644 interfaces/LinkTypes.ts create mode 100644 interfaces/ServerType.ts create mode 100755 next.config.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 pages/1_18_2.tsx create mode 100755 pages/_app.tsx create mode 100644 pages/api/navbar.tsx create mode 100644 pages/api/servers.tsx create mode 100755 pages/index.tsx create mode 100644 public/favicon.ico create mode 100644 public/fonts/Minecraftia.ttf create mode 100755 styles/Home.module.css create mode 100644 styles/Server.module.css create mode 100755 styles/globals.css create mode 100644 tsconfig.json create mode 100644 yarn.lock diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..a7610f3 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,10 @@ +{ + "extends": "next/core-web-vitals", + "settings": { + "import/resolver": { + "node": { + "extensions": [".js", ".jsx", ".ts", ".tsx"] + } + } + } +} diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..3c0b22c --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# do not track installed modules +/node_modules + +# do not track built files +/.next +*.tsbuildinfo +next-env.d.ts + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# production +/build +/confs + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cc2de22 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,50 @@ +## INIT STEP +# Install dependencies only when needed +FROM node:16-alpine AS deps + +RUN apk add --no-cache libc6-compat +WORKDIR /app + +# Copy the files needed to install deps +COPY package.json yarn.lock ./ +RUN yarn install --frozen-lockfile + +## BUILD STEP +# Rebuild the source code only when needed +FROM node:16-alpine AS builder + +WORKDIR /app + +# Copy node_modules installed by the deps step +COPY --from=deps /app/node_modules ./node_modules + +COPY . . + +RUN yarn build + +## RUN STEP +FROM node:16-alpine AS runner + +LABEL author="neshura@proton.me" +WORKDIR /usr/src/ap + +ENV NODE_ENV production + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +COPY --from=builder /app/public ./public +COPY --from=builder /app/node_modules ./node_modules + +# Automatically leverage output traces to reduce image size +# https://nextjs.org/docs/advanced-features/output-file-tracing +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static + +USER nextjs + +# expose port 3000 +ENV PORT 3000 +EXPOSE 3000 + +CMD [ "yarn", "start" ] diff --git a/README.md b/README.md deleted file mode 100644 index 09b6a75..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# minecraft diff --git a/components/footer.tsx b/components/footer.tsx new file mode 100644 index 0000000..414cf42 --- /dev/null +++ b/components/footer.tsx @@ -0,0 +1,11 @@ +import styles from '/styles/Home.module.css' + +const Footer = () => { + return ( + + ); +} + +export default Footer; \ No newline at end of file diff --git a/components/layout.tsx b/components/layout.tsx new file mode 100644 index 0000000..d43d8a3 --- /dev/null +++ b/components/layout.tsx @@ -0,0 +1,31 @@ +import Footer from './footer' +import Navbar from './navbar' +import styles from '/styles/Home.module.css' +import UseSWR from 'swr' + +const fetcher = (url:string) => fetch(url).then((res) => res.json()) + +function Layout({ children }: {children: React.ReactNode} ):JSX.Element { + const { data, error } = UseSWR('/api/navbar', fetcher) + + let layout: JSX.Element = <> + + if (error) layout = <>
Failed to load data
+ if (!data) { + layout = <> + } + if(data) { + layout = + <> + +
+ {children} +
+