Skip to content

Instantly share code, notes, and snippets.

@AsaoluElijah
Created June 16, 2025 15:26
Show Gist options
  • Save AsaoluElijah/cb4cb231f7ca2c36629601ccc20aca79 to your computer and use it in GitHub Desktop.
Save AsaoluElijah/cb4cb231f7ca2c36629601ccc20aca79 to your computer and use it in GitHub Desktop.
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Permit.io RBAC Group Chat</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap"
rel="stylesheet"
/>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
lato: ["Lato", "sans-serif"],
},
},
},
};
</script>
<script src="/socket.io/socket.io.js"></script>
</head>
<body class="bg-gray-50 font-lato">
<div class="container mx-auto px-4 py-8 max-w-6xl">
<!-- App Title -->
<div class="text-center mb-12">
<h1 class="text-4xl font-bold text-gray-800 mb-2">
Permit.io RBAC Group Chat
</h1>
<p class="text-gray-600">
Role-based access control for secure group messaging
</p>
</div>
<div
id="loginForm"
class="max-w-md mx-auto mt-8 p-8 bg-white rounded-xl shadow-lg text-center"
>
<h2 class="text-2xl font-bold text-gray-800 mb-6">Join the Chat</h2>
<input
type="email"
id="email"
placeholder="Enter your email"
required
class="w-full px-4 py-3 mb-4 border-2 border-gray-200 rounded-lg focus:border-blue-500 focus:outline-none transition-colors"
/>
<button
onclick="joinChat()"
class="w-full px-4 py-3 bg-orange-200 text-black rounded-lg hover:bg-orange-400 transition-colors"
>
Join Chat
</button>
</div>
<div
id="chatContainer"
class="hidden h-[calc(80vh-4rem)] bg-white rounded-xl shadow-lg overflow-hidden flex flex-col"
>
<div
id="statusBar"
class="hidden px-4 py-3 bg-orange-200 text-black flex justify-between items-center"
>
<span id="userStatus" class="font-medium"></span>
<button
onclick="logout()"
class="px-3 py-1 text-sm font-bold bg-gray-100 text-red-500 rounded hover:bg-gray-100 transition-colors"
>
Logout
</button>
</div>
<div class="flex flex-1 overflow-hidden">
<div class="flex-1 flex flex-col min-h-0">
<div
id="messages"
class="flex-1 p-6 overflow-y-auto bg-gray-50"
></div>
<div class="border-t border-gray-200 bg-white">
<textarea
id="messageInput"
class="w-full h-[60px] px-4 py-3 focus:outline-none resize-none bg-white"
placeholder="Type your message..."
rows="1"
></textarea>
</div>
</div>
<div
id="users"
class="w-[300px] p-6 bg-white border-l border-gray-200 overflow-y-auto"
></div>
</div>
</div>
<div
id="errorMessage"
class="fixed top-4 right-4 px-6 py-3 bg-red-500 text-white rounded-lg shadow-lg hidden transform transition-transform duration-300 translate-x-full"
></div>
</div>
<script src="script.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment