From 872fdf3b1ce2ec16d76d27f6ece926f45746fd28 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Sat, 19 Dec 2020 14:28:27 -0800 Subject: [PATCH 1/7] Add more bottom spacing Yeah yeah, still too lazy to learn CSS --- incrypt.html | 1 + index.html | 1 + 2 files changed, 2 insertions(+) diff --git a/incrypt.html b/incrypt.html index da6a122f..9aaa0ee8 100644 --- a/incrypt.html +++ b/incrypt.html @@ -110,6 +110,7 @@

Now Playing

>, with {{ allPlayers(openRoom) }} ({{ moment(openRoom.lastUpdateTime).fromNow() }})

+




diff --git a/index.html b/index.html index f0fdd235..ff1b074f 100644 --- a/index.html +++ b/index.html @@ -125,6 +125,7 @@

Open Rooms

>, with {{ openRoom.players.join(', ') }} ({{ moment(openRoom.lastUpdateTime).fromNow() }})

+




From e3c9a3020344e921b723647f3619104d476ead18 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Sat, 19 Dec 2020 16:30:46 -0800 Subject: [PATCH 2/7] Show existence of the newest 5 private rooms --- firebase-network.js | 6 +++--- index.html | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/firebase-network.js b/firebase-network.js index f857274b..301bb600 100644 --- a/firebase-network.js +++ b/firebase-network.js @@ -40,14 +40,14 @@ export async function getRoom(room) { return doc.data(); } -export async function listRooms() { +export async function listRooms(limit = 20, publicRoom = true) { const db = firebase.firestore(); const docs = await db .collection(COLLECTION) - .where('public', '==', true) + .where('public', '==', publicRoom) .orderBy('lastUpdateTime', 'desc') // TODO: limit to last 7 days instead. - .limit(20) + .limit(limit) .get(); const rooms = []; diff --git a/index.html b/index.html index ff1b074f..60c29c6c 100644 --- a/index.html +++ b/index.html @@ -118,13 +118,17 @@

+

Private Rooms

+

+ {{ "Private room" }} with {{ privateRoom.players[0] }} + and {{ privateRoom.players.length }} others + ({{ moment(privateRoom.lastUpdateTime).fromNow() }}) +

Open Rooms

- +

+ {{ openRoom.name }}, with {{ openRoom.players.join(', ') }} ({{ moment(openRoom.lastUpdateTime).fromNow() }}) +






@@ -473,6 +477,7 @@

History

data: { user: {}, allRooms: [], + privateRooms: [], room: { name: randomWord('adjectives') + '-' + randomWord('nouns'), history: [], @@ -491,7 +496,8 @@

History

this.CATEGORY_ORDER = ['nouns', 'verbs', 'adjectives', 'compounds', 'custom']; }, async mounted() { - this.allRooms = (await listRooms()).filter((room) => room.players.length > 0); + this.allRooms = (await listRooms(20, true)).filter((room) => room.players.length > 0); + this.privateRooms = (await listRooms(5, false)).filter((room) => room.players.length > 0); const parsedUrl = new URL(window.location.href); const roomName = parsedUrl.searchParams.get('room'); const playerName = parsedUrl.searchParams.get('player'); From 3ebacbbafe9f786e467f3b50778cdd89ebff2e74 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Sat, 19 Dec 2020 16:59:33 -0800 Subject: [PATCH 3/7] List rooms asynchronously --- index.html | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index 60c29c6c..e4fe8f79 100644 --- a/index.html +++ b/index.html @@ -118,17 +118,19 @@

-

Private Rooms

-

- {{ "Private room" }} with {{ privateRoom.players[0] }} - and {{ privateRoom.players.length }} others - ({{ moment(privateRoom.lastUpdateTime).fromNow() }}) -

-

Open Rooms

-

- {{ openRoom.name }}, with {{ openRoom.players.join(', ') }} ({{ moment(openRoom.lastUpdateTime).fromNow() }}) -

+
+

Private Rooms

+

+ {{ "Private room" }} with {{ privateRoom.players[0] }} + and {{ privateRoom.players.length }} others + ({{ moment(privateRoom.lastUpdateTime).fromNow() }}) +

+

Open Rooms

+

+ {{ openRoom.name }}, with {{ openRoom.players.join(', ') }} ({{ moment(openRoom.lastUpdateTime).fromNow() }}) +

+





@@ -496,8 +498,7 @@

History

this.CATEGORY_ORDER = ['nouns', 'verbs', 'adjectives', 'compounds', 'custom']; }, async mounted() { - this.allRooms = (await listRooms(20, true)).filter((room) => room.players.length > 0); - this.privateRooms = (await listRooms(5, false)).filter((room) => room.players.length > 0); + this.populateHome(); // Begin listing rooms, but don't wait for the result to mount const parsedUrl = new URL(window.location.href); const roomName = parsedUrl.searchParams.get('room'); const playerName = parsedUrl.searchParams.get('player'); @@ -541,6 +542,10 @@

History

moment, listRooms, dedupe, + async populateHome() { + this.privateRooms = (await listRooms(5, false)).filter((room) => room.players.length > 0); + this.allRooms = (await listRooms(20, true)).filter((room) => room.players.length > 0); + }, async enterRoom() { if (!this.player.name) { this.$refs.navbar.logIn(); From e9baaeaf3ef16c6d6be344f5a9e5ca2c7463948f Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Sun, 20 Dec 2020 09:31:28 -0800 Subject: [PATCH 4/7] Upsell with private rooms on homepage --- index.html | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index e4fe8f79..9d6181a9 100644 --- a/index.html +++ b/index.html @@ -80,17 +80,35 @@
- - + + +

Second Chat

+

@@ -117,17 +125,18 @@

Mod tools

partner: 'carol', chatlog: {...} } - murder: { - target: 'bob' - } } main2: { // 120s + murder: { + target: 'bob', + approved: 'SORCERER', + } chatlog: {...} } night: { // 60s assasination: { target: 'alice', - // flavor: 'Alice tripped on a suspiciously placed rock and died' + // flavor: 'A ambitious caption fired Alice, and they died'???? } } }