Add better navigation
This commit is contained in:
		
					parent
					
						
							
								c2d7156033
							
						
					
				
			
			
				commit
				
					
						4f599dcb7b
					
				
			
		
					 5 changed files with 27 additions and 1 deletions
				
			
		| 
						 | 
					@ -94,6 +94,10 @@ export class ConferenceCallManager extends EventEmitter {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static logout() {
 | 
				
			||||||
 | 
					    localStorage.removeItem("matrix-auth-store");
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static async register(homeserverUrl, username, password) {
 | 
					  static async register(homeserverUrl, username, password) {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
      const registrationClient = matrixcs.createClient(homeserverUrl);
 | 
					      const registrationClient = matrixcs.createClient(homeserverUrl);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -124,6 +124,7 @@ export function useVideoRoom(manager, roomId, timeout = 5000) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return () => {
 | 
					    return () => {
 | 
				
			||||||
      window.removeEventListener("beforeunload", onBeforeUnload);
 | 
					      window.removeEventListener("beforeunload", onBeforeUnload);
 | 
				
			||||||
 | 
					      manager.leaveCall();
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  }, [manager]);
 | 
					  }, [manager]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,6 +60,15 @@ export function JoinOrCreateRoom({ manager }) {
 | 
				
			||||||
    [manager]
 | 
					    [manager]
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const onLogout = useCallback(
 | 
				
			||||||
 | 
					    (e) => {
 | 
				
			||||||
 | 
					      e.preventDefault();
 | 
				
			||||||
 | 
					      manager.logout();
 | 
				
			||||||
 | 
					      history.push("/");
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    [manager]
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <div className="page">
 | 
					    <div className="page">
 | 
				
			||||||
      <h1>Matrix Video Chat</h1>
 | 
					      <h1>Matrix Video Chat</h1>
 | 
				
			||||||
| 
						 | 
					@ -99,6 +108,9 @@ export function JoinOrCreateRoom({ manager }) {
 | 
				
			||||||
          </li>
 | 
					          </li>
 | 
				
			||||||
        ))}
 | 
					        ))}
 | 
				
			||||||
      </ul>
 | 
					      </ul>
 | 
				
			||||||
 | 
					      <button type="button" onClick={onLogout}>
 | 
				
			||||||
 | 
					        Log Out
 | 
				
			||||||
 | 
					      </button>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@ limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import React, { useEffect, useMemo, useRef, useState } from "react";
 | 
					import React, { useEffect, useMemo, useRef, useState } from "react";
 | 
				
			||||||
import styles from "./Room.module.css";
 | 
					import styles from "./Room.module.css";
 | 
				
			||||||
import { useParams, useLocation } from "react-router-dom";
 | 
					import { useParams, useLocation, Link } from "react-router-dom";
 | 
				
			||||||
import { useVideoRoom } from "./ConferenceCallManagerHooks";
 | 
					import { useVideoRoom } from "./ConferenceCallManagerHooks";
 | 
				
			||||||
import { DevTools } from "./DevTools";
 | 
					import { DevTools } from "./DevTools";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,6 +54,9 @@ export function Room({ manager }) {
 | 
				
			||||||
    <div className={styles.room}>
 | 
					    <div className={styles.room}>
 | 
				
			||||||
      {!loading && room && (
 | 
					      {!loading && room && (
 | 
				
			||||||
        <div className={styles.header}>
 | 
					        <div className={styles.header}>
 | 
				
			||||||
 | 
					          <div className={styles.backNav}>
 | 
				
			||||||
 | 
					            <Link to="/">Back</Link>
 | 
				
			||||||
 | 
					          </div>
 | 
				
			||||||
          <h3>{room.name}</h3>
 | 
					          <h3>{room.name}</h3>
 | 
				
			||||||
          <div className={styles.userNav}>
 | 
					          <div className={styles.userNav}>
 | 
				
			||||||
            <h5>{manager.client.getUserId()}</h5>
 | 
					            <h5>{manager.client.getUserId()}</h5>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,6 +32,12 @@ limitations under the License.
 | 
				
			||||||
  height: 64px;
 | 
					  height: 64px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.backNav {
 | 
				
			||||||
 | 
					  position: absolute;
 | 
				
			||||||
 | 
					  left: 0;
 | 
				
			||||||
 | 
					  padding: 0 8px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.userNav {
 | 
					.userNav {
 | 
				
			||||||
  position: absolute;
 | 
					  position: absolute;
 | 
				
			||||||
  right: 0;
 | 
					  right: 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue