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">
<IonRow>
<IonCol>
<span>Any feedback is welcome! </span>
<span>Any feedback, questions, or issues? </span>
<span role="img" aria-label="Turtle">
🐢🐢
</span>

@ -60,7 +60,7 @@ const Room: React.FC<RouteComponentProps<{ roomId: string }>> = ({ match }) => {
if (userId !== '' && validRoom) {
const populateRoom = () => {
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
roomRef.on('value', async (snapshot) => {
@ -105,8 +105,8 @@ const Room: React.FC<RouteComponentProps<{ roomId: string }>> = ({ match }) => {
// Unsubscribe listeners
return () => {
roomRef.off('value');
rtdb.ref('.info/connected').off('value');
roomRef.child('userCount').off('value');
availableRef.off('child_removed');
};
};

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

Loading…
Cancel
Save