|
|
<!DOCTYPE html>
|
|
|
<html lang="vi">
|
|
|
|
|
|
<head>
|
|
|
<meta charset="UTF-8" />
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
<title>Chat App with Auth</title>
|
|
|
<script src="https://www.gstatic.com/firebasejs/10.12.2/firebase-app-compat.js"></script>
|
|
|
<script src="https://www.gstatic.com/firebasejs/10.12.2/firebase-auth-compat.js"></script>
|
|
|
<script src="https://www.gstatic.com/firebasejs/10.12.2/firebase-database-compat.js"></script>
|
|
|
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet" />
|
|
|
<link rel="stylesheet" href="style.css" />
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
<div class="container">
|
|
|
<div id="auth-section">
|
|
|
<h2 id="auth-title">Đăng nhập</h2>
|
|
|
<form id="login-form">
|
|
|
<div class="form-group">
|
|
|
<label>Email</label>
|
|
|
<input type="email" id="login-email" required />
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
<label>Mật khẩu</label>
|
|
|
<input type="password" id="login-password" required />
|
|
|
</div>
|
|
|
<button type="submit">Đăng nhập</button>
|
|
|
<button type="button" class="google-btn" id="google-login">Đăng nhập với Google</button>
|
|
|
</form>
|
|
|
|
|
|
<form id="register-form" class="hidden">
|
|
|
<div class="form-group">
|
|
|
<label>Tên tài khoản</label>
|
|
|
<input type="text" id="register-username" required />
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
<label>Email</label>
|
|
|
<input type="email" id="register-email" required />
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
<label>Mật khẩu</label>
|
|
|
<input type="password" id="register-password" required />
|
|
|
</div>
|
|
|
<button type="submit">Đăng ký</button>
|
|
|
</form>
|
|
|
|
|
|
<div class="switch">
|
|
|
<a href="#" id="toggle-auth">Chưa có tài khoản? Đăng ký</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div id="chat-section" class="hidden">
|
|
|
<div class="chat-header">
|
|
|
<button id="roomListToggle" class="menu-btn">☰</button>
|
|
|
<h2>Xin chào, <span id="display-name"></span></h2>
|
|
|
<span id="current-room-name">Room chung</span>
|
|
|
</div>
|
|
|
|
|
|
<div class="chat-container">
|
|
|
<div id="room-sidebar" class="room-sidebar">
|
|
|
<div class="sidebar-header">
|
|
|
<h3>Danh sách Room</h3>
|
|
|
<input type="text" id="roomSearchInput" placeholder="Tìm kiếm phòng..." class="room-search-input">
|
|
|
<div class="room-actions">
|
|
|
<button id="createRoomBtn" class="create-room-btn">+ Tạo Room</button>
|
|
|
<button id="joinRoomBtn" class="join-room-btn">Tham gia Room</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div id="room-list" class="room-list"></div>
|
|
|
<div id="search-results" class="search-results hidden">
|
|
|
<h4>Kết quả tìm kiếm:</h4>
|
|
|
<div id="search-room-list" class="room-list"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="chat-main">
|
|
|
<div class="chat-box" id="chat-box"></div>
|
|
|
<div id="mediaPreview"></div>
|
|
|
<div id="inputArea">
|
|
|
<button class="media-btn" onclick="document.getElementById('imageInput').click()" title="Gửi ảnh">📷</button>
|
|
|
<button class="media-btn" onclick="document.getElementById('videoInput').click()" title="Gửi video">🎥</button>
|
|
|
<input type="file" id="imageInput" multiple accept="image/*">
|
|
|
<input type="file" id="videoInput" accept="video/*">
|
|
|
<input type="text" id="chat-input" placeholder="Nhập tin nhắn..." />
|
|
|
<button onclick="sendMessage()">Gửi</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<script src="script.js"></script>
|
|
|
</body>
|
|
|
|
|
|
</html>
|
|
|
|