implement the lobby page and Puid generation

This commit is contained in:
Victor Martinez 2024-03-29 15:54:33 +01:00
parent a03a2b69db
commit c7758fabbb
4 changed files with 29 additions and 1 deletions

6
lib/intisync/puid.ex Normal file
View file

@ -0,0 +1,6 @@
defmodule Intisync.Puid do
@doc """
Generate Probably unique identifiers
"""
use Puid
end

View file

@ -0,0 +1,11 @@
defmodule IntisyncWeb.LobbyLive do
use IntisyncWeb, :live_view
def mount(_params, _session, socket), do: {:ok, socket}
def handle_event("create_session", _params, socket) do
session_id = Intisync.Puid.generate()
{:noreply, redirect(socket, to: ~p"/sessions/#{session_id}")}
end
end

View file

@ -0,0 +1,11 @@
<header class="flex flex-col items-center mb-20">
<h1 class="text-8xl font-bold text-indigo-500">
IntiSync
</h1>
</header>
<section id="lobby-buttons" class="flex flex-col items-center">
<.button class="py-5 text-2xl" id="create-session-btn" type="button" phx-click="create_session">
<.icon name="hero-fire-solid" class="mr-1.5 -ml-0.5" /> Create session
</.button>
</section>

View file

@ -17,7 +17,7 @@ defmodule IntisyncWeb.Router do
scope "/", IntisyncWeb do
pipe_through :browser
get "/", PageController, :home
live "/", LobbyLive
end
# Other scopes may use custom stacks.