fixed firebase listeners, changed icon, name generation

optimize-reads
Simon Huang 5 years ago
parent 70bf0ac439
commit da49b2268b

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 149 KiB

@ -15,7 +15,7 @@ const About: React.FC<AboutProps> = ({ pane }) => {
<IonGrid style={{ display: pane === 'about' ? null : 'none' }} class="about-grid"> <IonGrid style={{ display: pane === 'about' ? null : 'none' }} class="about-grid">
<IonRow> <IonRow>
<IonCol> <IonCol>
<span>Any feedback is welcome! </span> <span>Any feedback, questions, or issues? </span>
<span role="img" aria-label="Turtle"> <span role="img" aria-label="Turtle">
🐢🐢 🐢🐢
</span> </span>

@ -60,7 +60,7 @@ const Room: React.FC<RouteComponentProps<{ roomId: string }>> = ({ match }) => {
if (userId !== '' && validRoom) { if (userId !== '' && validRoom) {
const populateRoom = () => { const populateRoom = () => {
const roomRef = rtdb.ref('/rooms/' + roomId); const roomRef = rtdb.ref('/rooms/' + roomId);
const availableRef = rtdb.ref('/available/'); const availableRef = rtdb.ref('/available/' + roomId);
// Keep track of online user presence in realtime database rooms // Keep track of online user presence in realtime database rooms
roomRef.on('value', async (snapshot) => { roomRef.on('value', async (snapshot) => {
@ -105,8 +105,8 @@ const Room: React.FC<RouteComponentProps<{ roomId: string }>> = ({ match }) => {
// Unsubscribe listeners // Unsubscribe listeners
return () => { return () => {
roomRef.off('value'); roomRef.off('value');
rtdb.ref('.info/connected').off('value');
roomRef.child('userCount').off('value'); roomRef.child('userCount').off('value');
availableRef.off('child_removed');
}; };
}; };

@ -4,12 +4,19 @@ const adjectives = [
'Adamant', 'Adamant',
'Adorable', 'Adorable',
'Anxious', 'Anxious',
'Awesome',
'Barbarous',
'Bent', 'Bent',
'Bright', 'Bright',
'Careful',
'Clean',
'Coherent', 'Coherent',
'Curious', 'Curious',
'Diligent', 'Diligent',
'Disastrous',
'Earthy', 'Earthy',
'Erratic',
'Famous',
'Fascinated', 'Fascinated',
'Foreign', 'Foreign',
'Hateful', 'Hateful',
@ -22,35 +29,48 @@ const adjectives = [
'Naughty', 'Naughty',
'Neat', 'Neat',
'Nifty', 'Nifty',
'Nostalgic',
'Parallel', 'Parallel',
'Quack', 'Quack',
'Questionable',
'Roomy', 'Roomy',
'Sedate', 'Sedate',
'Sharp', 'Sharp',
'Silent', 'Silent',
'Terrible',
'Unequal', 'Unequal',
]; ];
const animals = [ const animals = [
'Chimpanzee', 'Ape',
'Basilisk',
'Bison', 'Bison',
'Squirrel', 'Chameleon',
'Lemur', 'Chimpanzee',
'Wolf', 'Chinchilla',
'Dingo', 'Chipmunk',
'Colt', 'Colt',
'Seal',
'Cougar', 'Cougar',
'Ram', 'Cow',
'Parakeet', 'Dingo',
'Fawn',
'Fish',
'Goat', 'Goat',
'Ape',
'Basilisk',
'Oryx',
'Iguana', 'Iguana',
'Stallion',
'Jackal', 'Jackal',
'Lemur',
'Lion',
'Moose',
'Ocelot',
'Opossum',
'Oryx',
'Parakeet',
'Ram',
'Seal',
'Snake', 'Snake',
'Squirrel',
'Stallion',
'Wolf',
'Zebra', 'Zebra',
]; ];
@ -69,8 +89,8 @@ const animals = [
// }; // };
export const generateAnonName = (): string => { export const generateAnonName = (): string => {
const adj: string = adjectives[Math.floor(Math.random() * 30)]; const adj: string = adjectives[Math.floor(Math.random() * 40)];
const animal: string = animals[Math.floor(Math.random() * 20)]; const animal: string = animals[Math.floor(Math.random() * 30)];
return adj + ' ' + animal; return adj + ' ' + animal;
}; };

Loading…
Cancel
Save