diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..bffb357 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/.gitignore b/.gitignore index aee1653..358f86c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,39 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts + # IDEs .idea/ .vscode/ @@ -5,9 +41,6 @@ # Logs logs *.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* firebase-debug.log* firebase-debug.*.log* diff --git a/.images/preview.png b/.images/preview.png deleted file mode 100644 index 85adb75..0000000 Binary files a/.images/preview.png and /dev/null differ diff --git a/README.md b/README.md index e07922b..ed05602 100644 --- a/README.md +++ b/README.md @@ -20,5 +20,5 @@ npm install -g firebase-tools To test this website on your local machine, just run the following command: ``` -firebase emulators:start --only hosting +yarn serve ``` \ No newline at end of file diff --git a/firebase.json b/firebase.json index ff763e5..d847f8c 100644 --- a/firebase.json +++ b/firebase.json @@ -8,6 +8,10 @@ "**/node_modules/**" ], "rewrites": [ + { + "source": "**", + "function": "nextjsFunc" + }, { "source": "/events/**", "dynamicLinks": true @@ -17,5 +21,13 @@ "dynamicLinks": true } ] + }, + "functions": { + "runtime": "nodejs16", + "source": ".", + "predeploy": [ + "npm --prefix \"$PROJECT_DIR\" install", + "npm --prefix \"$PROJECT_DIR\" run build" + ] } } diff --git a/firebaseFunctions.js b/firebaseFunctions.js new file mode 100644 index 0000000..09dcbc8 --- /dev/null +++ b/firebaseFunctions.js @@ -0,0 +1,18 @@ +const { join } = require('path') +const { https } = require('firebase-functions') +const next = require('next') + +const nextjsDistDir = join('src', require('./next.config.js').distDir) +console.log(nextjsDistDir); + +const nextjsServer = next({ + dev: false, + conf: { + distDir: nextjsDistDir, + }, +}) +const nextjsHandle = nextjsServer.getRequestHandler() + +exports.nextjsFunc = https.onRequest((req, res) => { + return nextjsServer.prepare().then(() => nextjsHandle(req, res)) +}) \ No newline at end of file diff --git a/next.config.js b/next.config.js new file mode 100644 index 0000000..dd7581c --- /dev/null +++ b/next.config.js @@ -0,0 +1,13 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = { + distDir: ".next", + reactStrictMode: true, + rewrites: async () => [ + { + source: "/public/creator.html", + destination: "/api/creator.js", + }, + ], +}; + +module.exports = nextConfig; diff --git a/package.json b/package.json new file mode 100644 index 0000000..a5a7513 --- /dev/null +++ b/package.json @@ -0,0 +1,44 @@ +{ + "name": "bondscape-website", + "version": "0.1.0", + "private": true, + "main": "firebaseFunctions.js", + "type": "commonjs", + "engines": { + "node": ">=16" + }, + "scripts": { + "dev": "next", + "build": "next build", + "start": "next start", + "serve": "yarn build && firebase emulators:start --only functions,hosting", + "shell": "yarn build && firebase functions:shell", + "deploy": "firebase deploy --only functions,hosting", + "logs": "firebase functions:log" + }, + "dependencies": { + "@types/node": "20.6.1", + "@types/react": "18.2.21", + "@types/react-dom": "18.2.7", + "autoprefixer": "10.4.15", + "cross-env": "^7.0.3", + "eslint": "8.49.0", + "eslint-config-next": "13.4.19", + "firebase-admin": "^11.10.1", + "firebase-functions": "^4.4.1", + "next": "13.4.19", + "next-seo": "^6.1.0", + "path": "^0.12.7", + "postcss": "8.4.29", + "prettier": "^3.0.3", + "react": "18.2.0", + "react-dom": "18.2.0", + "react-responsive": "^9.0.2", + "tailwindcss": "3.3.3", + "typescript": "5.2.2", + "use-places-autocomplete": "^4.0.1" + }, + "devDependencies": { + "@types/google.maps": "^3.54.1" + } +} diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..33ad091 --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/public/creator.html b/public/creator.html index 49a3ba7..fc4cfe7 100644 --- a/public/creator.html +++ b/public/creator.html @@ -1,159 +1,158 @@ -
- - -Welcome to the Bondscape event creator!
-With this tool you can create a new Bondscape event. All you have to do is:
-- Note: This tool can only be used by people possessing an admin key. -
- - + +Event created!
+ +ID:
+ +QR Code to view the event details:
+ + +QR Code to join the event:
+ +