Skip to content

Commit

Permalink
Upgrade to LiveView 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ghenry committed Jan 14, 2025
1 parent 2b7f701 commit abaa3f6
Show file tree
Hide file tree
Showing 39 changed files with 231 additions and 231 deletions.
6 changes: 3 additions & 3 deletions lib/sentrypeer/emails/templates/emails/layout.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><%= assigns[:title] %></title>
<title>{assigns[:title]}</title>
<style>
<%= Phoenix.HTML.raw Sentrypeer.Emails.EmailStyles.utility_classes() %>
</style>
Expand All @@ -17,15 +17,15 @@
<table class="main" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="content-wrap">
<%= @inner_content %>
{@inner_content}
</td>
</tr>
</table>
<div class="footer">
<table width="100%">
<tr>
<td class="align-center content-block">
Copyright <%= DateTime.utc_now().year %>. All rights reserved.<br />
Copyright {DateTime.utc_now().year}. All rights reserved.<br />
</td>
</tr>
</table>
Expand Down
74 changes: 37 additions & 37 deletions lib/sentrypeer_web/components/core_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,18 @@ defmodule SentrypeerWeb.CoreComponents do
id={"#{@id}-title"}
class="text-lg font-medium leading-6 dark:text-white text-gray-900"
>
<%= render_slot(@title) %>
{render_slot(@title)}
</h3>
<p
:if={@subtitle != []}
id={"#{@id}-description"}
class="text-sm leading-6 text-zinc-600 dark:text-slate-400"
>
<%= render_slot(@subtitle) %>
{render_slot(@subtitle)}
</p>
<div class="mt-2">
<p class="text-sm dark:text-slate-400 text-gray-500">
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</p>
</div>
</div>
Expand All @@ -140,14 +140,14 @@ defmodule SentrypeerWeb.CoreComponents do
phx-disable-with
class="inline-flex w-full justify-center rounded-md border border-transparent bg-red-600 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm"
>
<%= render_slot(confirm) %>
{render_slot(confirm)}
</.button>
<.link
:for={cancel <- @cancel}
phx-click={hide_modal(@on_cancel, @id)}
class="mt-3 inline-flex w-full justify-center rounded-md border border-gray-300 bg-white dark:hover:bg-slate-500 dark:bg-slate-400 px-4 py-2 text-base font-medium dark:text-slate-800 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
>
<%= render_slot(cancel) %>
{render_slot(cancel)}
</.link>
</div>
</div>
Expand Down Expand Up @@ -235,17 +235,17 @@ defmodule SentrypeerWeb.CoreComponents do
id={"#{@id}-title"}
class="text-lg font-semibold leading-8 text-zinc-800 dark:text-white"
>
<%= render_slot(@title) %>
{render_slot(@title)}
</h1>
<p
:if={@subtitle != []}
id={"#{@id}-description"}
class="mt-2 text-sm leading-6 text-zinc-600 dark:text-slate-400"
>
<%= render_slot(@subtitle) %>
{render_slot(@subtitle)}
</p>
</header>
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
<div :if={@confirm != [] or @cancel != []} class="ml-6 mb-4 flex items-center gap-5">
<.button
:for={confirm <- @confirm}
Expand All @@ -254,14 +254,14 @@ defmodule SentrypeerWeb.CoreComponents do
phx-disable-with
class="py-2 px-3"
>
<%= render_slot(confirm) %>
{render_slot(confirm)}
</.button>
<.link
:for={cancel <- @cancel}
phx-click={hide_modal(@on_cancel, @id)}
class="text-sm font-semibold leading-6 text-zinc-900 hover:text-zinc-700"
>
<%= render_slot(cancel) %>
{render_slot(cancel)}
</.link>
</div>
</div>
Expand Down Expand Up @@ -309,9 +309,9 @@ defmodule SentrypeerWeb.CoreComponents do
<p :if={@title} class="flex items-center gap-1.5 text-sm font-medium leading-6">
<.icon :if={@kind == :info} name="hero-information-circle" class="w-6 h-6" />
<.icon :if={@kind == :error} name="hero-exclamation-circle" class="w-6 h-6" />
<%= @title %>
{@title}
</p>
<p class="ml-3 mt-2 text-sm leading-5"><%= msg %></p>
<p class="ml-3 mt-2 text-sm leading-5">{msg}</p>
<button
:if={@close}
type="button"
Expand Down Expand Up @@ -378,9 +378,9 @@ defmodule SentrypeerWeb.CoreComponents do
~H"""
<.form :let={f} for={@for} as={@as} {@rest}>
<div class="space-y-8 bg-white dark:bg-slate-800 mt-10">
<%= render_slot(@inner_block, f) %>
{render_slot(@inner_block, f)}
<div :for={action <- @actions} class="mt-2 flex items-center justify-between gap-6">
<%= render_slot(action, f) %>
{render_slot(action, f)}
</div>
</div>
</.form>
Expand Down Expand Up @@ -412,7 +412,7 @@ defmodule SentrypeerWeb.CoreComponents do
]}
{@rest}
>
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</button>
"""
end
Expand Down Expand Up @@ -476,36 +476,36 @@ defmodule SentrypeerWeb.CoreComponents do
class="rounded border-zinc-300 text-zinc-900 dark:text-slate-400 focus:ring-zinc-900"
{@rest}
/>
<%= @label %>
{@label}
</label>
<.error :for={msg <- @errors}><%= msg %></.error>
<.error :for={msg <- @errors}>{msg}</.error>
</div>
"""
end

def input(%{type: "select"} = assigns) do
~H"""
<div phx-feedback-for={@name}>
<.label for={@id}><%= @label %></.label>
<.label for={@id}>{@label}</.label>
<select
id={@id}
name={@name}
class="mt-1 block w-full py-2 px-3 border border-gray-300 bg-white rounded-md shadow-sm focus:outline-none focus:ring-zinc-500 focus:border-zinc-500 sm:text-sm"
multiple={@multiple}
{@rest}
>
<option :if={@prompt} value=""><%= @prompt %></option>
<%= Phoenix.HTML.Form.options_for_select(@options, @value) %>
<option :if={@prompt} value="">{@prompt}</option>
{Phoenix.HTML.Form.options_for_select(@options, @value)}
</select>
<.error :for={msg <- @errors}><%= msg %></.error>
<.error :for={msg <- @errors}>{msg}</.error>
</div>
"""
end

def input(%{type: "textarea"} = assigns) do
~H"""
<div phx-feedback-for={@name}>
<.label for={@id}><%= @label %></.label>
<.label for={@id}>{@label}</.label>
<textarea
id={@id || @name}
name={@name}
Expand All @@ -518,15 +518,15 @@ defmodule SentrypeerWeb.CoreComponents do
]}
{@rest}
><%= Phoenix.HTML.Form.normalize_value("textarea", @value) %></textarea>
<.error :for={msg <- @errors}><%= msg %></.error>
<.error :for={msg <- @errors}>{msg}</.error>
</div>
"""
end

def input(assigns) do
~H"""
<div phx-feedback-for={@name}>
<.label for={@id}><%= @label %></.label>
<.label for={@id}>{@label}</.label>
<input
type={@type}
name={@name}
Expand All @@ -541,7 +541,7 @@ defmodule SentrypeerWeb.CoreComponents do
]}
{@rest}
/>
<.error :for={msg <- @errors}><%= msg %></.error>
<.error :for={msg <- @errors}>{msg}</.error>
</div>
"""
end
Expand All @@ -555,7 +555,7 @@ defmodule SentrypeerWeb.CoreComponents do
def label(assigns) do
~H"""
<label for={@for} class="block text-sm font-semibold leading-6 text-zinc-800 dark:text-slate-400">
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</label>
"""
end
Expand All @@ -569,7 +569,7 @@ defmodule SentrypeerWeb.CoreComponents do
~H"""
<p class="phx-no-feedback:hidden mt-3 flex gap-3 text-sm leading-6 text-rose-600">
<.icon name="hero-exclamation-circle-mini" class="mt-0.5 w-5 h-5 flex-none" />
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</p>
"""
end
Expand All @@ -588,13 +588,13 @@ defmodule SentrypeerWeb.CoreComponents do
<header class={[@actions != [] && "flex items-center justify-between gap-6", @class]}>
<div>
<h1 class="text-lg font-semibold leading-8 text-zinc-800 dark:text-white">
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</h1>
<p :if={@subtitle != []} class="mt-2 text-sm leading-6 text-zinc-600 dark:text-slate-400">
<%= render_slot(@subtitle) %>
{render_slot(@subtitle)}
</p>
</div>
<div class="flex-none"><%= render_slot(@actions) %></div>
<div class="flex-none">{render_slot(@actions)}</div>
</header>
"""
end
Expand Down Expand Up @@ -635,8 +635,8 @@ defmodule SentrypeerWeb.CoreComponents do
<table class="mt-11 w-[40rem] sm:w-full">
<thead class="text-left text-[0.8125rem] leading-6 text-zinc-500">
<tr>
<th :for={col <- @col} class="p-0 pb-4 pr-6 font-normal"><%= col[:label] %></th>
<th class="relative p-0 pb-4"><span class="sr-only"><%= gettext("Actions") %></span></th>
<th :for={col <- @col} class="p-0 pb-4 pr-6 font-normal">{col[:label]}</th>
<th class="relative p-0 pb-4"><span class="sr-only">{gettext("Actions")}</span></th>
</tr>
</thead>
<tbody
Expand All @@ -653,7 +653,7 @@ defmodule SentrypeerWeb.CoreComponents do
<div class="block py-4 pr-6">
<span class="absolute -inset-y-px right-0 -left-4 group-hover:bg-zinc-50 sm:rounded-l-xl" />
<span class={["relative", i == 0 && "font-semibold text-zinc-900"]}>
<%= render_slot(col, @row_item.(row)) %>
{render_slot(col, @row_item.(row))}
</span>
</div>
</td>
Expand All @@ -664,7 +664,7 @@ defmodule SentrypeerWeb.CoreComponents do
:for={action <- @action}
class="relative ml-4 font-semibold leading-6 text-zinc-900 hover:text-zinc-700"
>
<%= render_slot(action, @row_item.(row)) %>
{render_slot(action, @row_item.(row))}
</span>
</div>
</td>
Expand Down Expand Up @@ -694,8 +694,8 @@ defmodule SentrypeerWeb.CoreComponents do
<div class="mt-14">
<dl class="-my-4 divide-y divide-zinc-100">
<div :for={item <- @item} class="flex gap-4 py-4 sm:gap-8">
<dt class="w-1/4 flex-none text-[0.8125rem] leading-6 text-zinc-500"><%= item.title %></dt>
<dd class="text-sm leading-6 text-zinc-700"><%= render_slot(item) %></dd>
<dt class="w-1/4 flex-none text-[0.8125rem] leading-6 text-zinc-500">{item.title}</dt>
<dd class="text-sm leading-6 text-zinc-700">{render_slot(item)}</dd>
</div>
</dl>
</div>
Expand All @@ -720,7 +720,7 @@ defmodule SentrypeerWeb.CoreComponents do
class="text-sm font-semibold leading-6 text-zinc-900 hover:text-zinc-700"
>
<.icon name="hero-arrow-left-solid" class="w-3 h-3" />
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</.link>
</div>
"""
Expand Down
2 changes: 1 addition & 1 deletion lib/sentrypeer_web/components/home_page_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ defmodule SentrypeerWeb.HomePageComponents do
>
Ant Networks Ltd.
</a>
<%= DateTime.utc_now().year %>. SentryPeer is a trading name of
{DateTime.utc_now().year}. SentryPeer is a trading name of
<a
href="https://antnetworks.com/"
class="hover:text-brand"
Expand Down
2 changes: 1 addition & 1 deletion lib/sentrypeer_web/components/layouts/app.html.heex
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<.flash_group flash={@flash} />
<%= @inner_content %>
{@inner_content}
4 changes: 2 additions & 2 deletions lib/sentrypeer_web/components/layouts/liveview_root.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="robots" content="index,follow" />
<meta name="csrf-token" content={get_csrf_token()} />
<.live_title>
<%= assigns[:page_title] <> " · SentryPeer" %>
{assigns[:page_title] <> " · SentryPeer"}
</.live_title>
<!-- SPDX-License-Identifier: AGPL-3.0 -->
<!-- Copyright (c) 2023 - 2024 Gavin Henry <[email protected]> -->
Expand All @@ -29,7 +29,7 @@
</head>
<body class="bg-white antialiased h-full">
<!-- This is the start of the root component for the live view -->
<%= @inner_content %>
{@inner_content}
<!-- This is the end of the root component for the live view -->
<!-- Back to top button -->
<button
Expand Down
4 changes: 2 additions & 2 deletions lib/sentrypeer_web/components/layouts/root.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="robots" content="index,follow" />
<meta name="csrf-token" content={get_csrf_token()} />
<.live_title>
<%= assigns[:page_title] <> " · SentryPeer" %>
{assigns[:page_title] <> " · SentryPeer"}
</.live_title>
<!-- SPDX-License-Identifier: AGPL-3.0 -->
<!-- Copyright (c) 2023 - 2024 Gavin Henry <[email protected]> -->
Expand Down Expand Up @@ -51,7 +51,7 @@
</head>
<body class="bg-white antialiased h-full">
<!-- This is the start of the root component for the live view -->
<%= @inner_content %>
{@inner_content}
<!-- This is the end of the root component for the live view -->
</body>
</html>
4 changes: 2 additions & 2 deletions lib/sentrypeer_web/components/navigation_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ defmodule SentrypeerWeb.NavigationComponents do
title="SentryPeer Node"
class="hidden md:block truncate ml-4 text-sm font-medium dark:text-white hover:text-gray-700"
>
<%= @client.client_id %>
{@client.client_id}
</.link>
</div>
</li>
Expand Down Expand Up @@ -268,7 +268,7 @@ defmodule SentrypeerWeb.NavigationComponents do
title="SentryPeer Node"
class="hidden md:block truncate ml-4 text-sm font-medium dark:text-white hover:text-gray-700"
>
<%= @client.client_id %>
{@client.client_id}
</.link>
</div>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="copyright" content="Gavin Henry, Ant Networks Limited." />
<meta name="robots" content="index,follow" />
<meta name="csrf-token" content={get_csrf_token()} />
<title><%= @page_title %>></title>
<title>{@page_title}></title>
<!-- SPDX-License-Identifier: AGPL-3.0 -->
<!-- Copyright (c) 2023 - 2024 Gavin Henry <[email protected]> -->
<!-- _____ _ _____ -->
Expand Down Expand Up @@ -59,10 +59,10 @@
<div class="text-center">
<p class="text-base font-semibold text-indigo-600">400</p>
<h1 class="mt-4 text-3xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-5xl">
Token <%= @reason %>
Token {@reason}
</h1>
<p class="mt-6 text-base leading-7 text-gray-600 dark:text-white">
Sorry, your confirmation token is <%= @reason %>
Sorry, your confirmation token is {@reason}
</p>
<div class="mt-10 flex items-center justify-center gap-x-6">
<a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="copyright" content="Gavin Henry, Ant Networks Limited." />
<meta name="robots" content="index,follow" />
<meta name="csrf-token" content={get_csrf_token()} />
<title><%= @page_title %>></title>
<title>{@page_title}></title>
<!-- SPDX-License-Identifier: AGPL-3.0 -->
<!-- Copyright (c) 2023 - 2024 Gavin Henry <[email protected]> -->
<!-- _____ _ _____ -->
Expand Down
Loading

0 comments on commit abaa3f6

Please sign in to comment.