Skip to content

Commit

Permalink
Develop game creation interface
Browse files Browse the repository at this point in the history
  • Loading branch information
staadecker committed Feb 26, 2024
1 parent 31eef8b commit a9521f7
Show file tree
Hide file tree
Showing 158 changed files with 19,042 additions and 18,034 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DOMAIN="http://localhost:1234"
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DOMAIN="https://pop-uoft.web.app"
920 changes: 920 additions & 0 deletions .firebase/hosting.ZGlzdA.cache

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "pop-uoft"
}
}
20 changes: 20 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
'on':
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_POP_UOFT }}'
channelId: live
projectId: pop-uoft
17 changes: 17 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR
'on': pull_request
jobs:
build_and_preview:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_POP_UOFT }}'
projectId: pop-uoft
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": false
}
20 changes: 20 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
4 changes: 4 additions & 0 deletions firestore.indexes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"indexes": [],
"fieldOverrides": []
}
13 changes: 13 additions & 0 deletions firestore.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rules_version = '2';

service cloud.firestore {
match /databases/{database}/documents {
allow read, write: if false;
match /games/{gameId} {
allow read: if true;
}
match /games/{gameId}/users/{userId=**} {
allow read, write: if true;
}
}
}
22 changes: 20 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "pop-uoft",
"version": "1.0.0",
"main": "index.js",
"repository": "https://github.com/staadecker/pop-uoft",
"author": "Martin Staadecker",
"license": "MIT",
Expand All @@ -10,19 +9,38 @@
"browserslist": "defaults",
"scripts": {
"start": "parcel",
"build": "parcel build"
"build": "parcel build",
"deploy": "yarn build && firebase deploy"
},
"dependencies": {
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@excalidraw/excalidraw": "^0.17.3",
"@lexical/clipboard": "^0.13.1",
"@lexical/code": "^0.13.1",
"@lexical/file": "^0.13.1",
"@lexical/link": "^0.13.1",
"@lexical/list": "^0.13.1",
"@lexical/overflow": "^0.13.1",
"@lexical/react": "^0.13.1",
"@lexical/rich-text": "^0.13.1",
"@lexical/selection": "^0.13.1",
"@lexical/table": "^0.13.1",
"@lexical/text": "^0.13.1",
"@lexical/utils": "^0.13.1",
"@lexical/yjs": "^0.13.1",
"@material-ui/core": "^4.12.4",
"@mui/lab": "^5.0.0-alpha.166",
"@mui/material": "^5.15.11",
"firebase": "^10.8.0",
"katex": "^0.16.9",
"lexical": "^0.13.1",
"lodash-es": "^4.17.21",
"prettier": "^2.3.2",
"qrcode.react": "^3.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.12",
"react-router-dom": "^6.22.1",
"yjs": "^13.6.12"
},
Expand Down
102 changes: 0 additions & 102 deletions src/backend/fetchGame.tsx

This file was deleted.

14 changes: 8 additions & 6 deletions src/backend/firebase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { FirebaseApp, initializeApp } from "firebase/app";
import { Auth, User, getAuth, signInAnonymously } from "firebase/auth";
import { Firestore, getFirestore } from "firebase/firestore";
import { createContext, useEffect, useState } from "react";
import React from "react";

export type Context = {
app: FirebaseApp;
Expand Down Expand Up @@ -41,11 +40,14 @@ export const FirebaseAppProvider = (props: { children: React.ReactNode }) => {
const context = getFirebaseContext();

useEffect(() => {
signInAnonymously(context.auth).then((userCredential) => {
setCurrentUser(userCredential.user);
}).catch((error) => {
console.error(error);
});
signInAnonymously(context.auth)
.then((userCredential) => {
console.log("Signed in as: ", userCredential.user.uid);
setCurrentUser(userCredential.user);
})
.catch((error) => {
console.error(error);
});
}, []);

return (
Expand Down
Loading

0 comments on commit a9521f7

Please sign in to comment.