This commit is contained in:
2026-07-04 19:27:17 +09:00
parent 34cd5ad2e7
commit ba6a0b2c17
30 changed files with 2935 additions and 247 deletions
+26 -32
View File
@@ -27,43 +27,39 @@ defmodule Rsh26poolWeb.Layouts do
"""
attr :flash, :map, required: true, doc: "the map of flash messages"
attr :current_scope, :map,
attr :current_participant, :map,
default: nil,
doc: "the current [scope](https://phoenix.hexdocs.pm/scopes.html)"
doc: "the currently logged-in participant, if any"
slot :inner_block, required: true
def app(assigns) do
~H"""
<header class="navbar px-4 sm:px-6 lg:px-8">
<header class="navbar bg-base-100 border-b border-base-200 px-4 sm:px-6 lg:px-8">
<div class="flex-1">
<a href="/" class="flex-1 flex w-fit items-center gap-2">
<img src={~p"/images/logo.svg"} width="36" />
<span class="text-sm font-semibold">v{Application.spec(:phoenix, :vsn)}</span>
</a>
<.link navigate={~p"/"} class="flex items-center gap-2 text-lg font-bold">
<.icon name="hero-check-badge" class="size-7 text-primary" />
<span>みんなで投票</span>
</.link>
</div>
<div class="flex-none">
<ul class="flex flex-column px-1 space-x-4 items-center">
<li>
<a href="https://phoenixframework.org/" class="btn btn-ghost">Website</a>
</li>
<li>
<a href="https://github.com/phoenixframework/phoenix" class="btn btn-ghost">GitHub</a>
</li>
<li>
<.theme_toggle />
</li>
<li>
<a href="https://phoenix.hexdocs.pm/overview.html" class="btn btn-primary">
Get Started <span aria-hidden="true">&rarr;</span>
</a>
</li>
</ul>
<div class="flex-none flex items-center gap-3">
<.theme_toggle />
<div :if={@current_participant} class="flex items-center gap-2">
<span class="hidden sm:inline text-sm text-base-content/70">
{@current_participant.name} さん
</span>
<.form for={%{}} action={~p"/logout"} method="delete">
<button class="btn btn-sm btn-ghost gap-1" type="submit">
<.icon name="hero-arrow-right-on-rectangle" class="size-4" />
<span class="hidden sm:inline">ログアウト</span>
</button>
</.form>
</div>
</div>
</header>
<main class="px-4 py-20 sm:px-6 lg:px-8">
<div class="mx-auto max-w-2xl space-y-4">
<main class="px-4 py-10 sm:px-6 lg:px-8">
<div class="mx-auto max-w-3xl space-y-6">
{render_slot(@inner_block)}
</div>
</main>
@@ -91,7 +87,7 @@ defmodule Rsh26poolWeb.Layouts do
<.flash
id="client-error"
kind={:error}
title={gettext("We can't find the internet")}
title="インターネットに接続できません"
phx-disconnected={
show(".phx-client-error #client-error")
|> JS.remove_attribute("hidden", to: ".phx-client-error #client-error")
@@ -99,14 +95,13 @@ defmodule Rsh26poolWeb.Layouts do
phx-connected={hide("#client-error") |> JS.set_attribute({"hidden", ""})}
hidden
>
{gettext("Attempting to reconnect")}
<.icon name="hero-arrow-path" class="ml-1 size-3 motion-safe:animate-spin" />
再接続を試みています <.icon name="hero-arrow-path" class="ml-1 size-3 motion-safe:animate-spin" />
</.flash>
<.flash
id="server-error"
kind={:error}
title={gettext("Something went wrong!")}
title="問題が発生しました"
phx-disconnected={
show(".phx-server-error #server-error")
|> JS.remove_attribute("hidden", to: ".phx-server-error #server-error")
@@ -114,8 +109,7 @@ defmodule Rsh26poolWeb.Layouts do
phx-connected={hide("#server-error") |> JS.set_attribute({"hidden", ""})}
hidden
>
{gettext("Attempting to reconnect")}
<.icon name="hero-arrow-path" class="ml-1 size-3 motion-safe:animate-spin" />
再接続を試みています <.icon name="hero-arrow-path" class="ml-1 size-3 motion-safe:animate-spin" />
</.flash>
</div>
"""
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<html lang="ja">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} />
<.live_title default="Rsh26pool" suffix=" · Phoenix Framework" phx-no-format>{assigns[:page_title]}</.live_title>
<.live_title default="みんなで投票" suffix=" · 投票アプリ" phx-no-format>{assigns[:page_title]}</.live_title>
<link phx-track-static rel="stylesheet" href={~p"/assets/css/app.css"} />
<script defer phx-track-static type="text/javascript" src={~p"/assets/js/app.js"}>
</script>