mirror of
https://codeberg.org/JasterV/intisync.ex.git
synced 2026-04-26 18:10:07 +00:00
implement the lobby page and Puid generation
This commit is contained in:
parent
a03a2b69db
commit
c7758fabbb
4 changed files with 29 additions and 1 deletions
6
lib/intisync/puid.ex
Normal file
6
lib/intisync/puid.ex
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
defmodule Intisync.Puid do
|
||||
@doc """
|
||||
Generate Probably unique identifiers
|
||||
"""
|
||||
use Puid
|
||||
end
|
||||
11
lib/intisync_web/live/lobby_live.ex
Normal file
11
lib/intisync_web/live/lobby_live.ex
Normal 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
|
||||
11
lib/intisync_web/live/lobby_live.html.heex
Normal file
11
lib/intisync_web/live/lobby_live.html.heex
Normal 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>
|
||||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue