better code style

This commit is contained in:
2025-02-15 04:04:10 +00:00
parent 2a8a1d11b8
commit 3e686fa199
32 changed files with 225 additions and 186 deletions

View File

@ -37,7 +37,7 @@ defmodule MemexWeb.Components.ContextsTableComponent do
} = socket
) do
columns =
if actions == [] or current_user |> is_nil() do
if actions == [] or !current_user do
[]
else
[%{label: gettext("actions"), key: :actions, sortable: false}]

View File

@ -1,12 +1,13 @@
<div class="px-8 py-4 flex flex-col justify-center items-center space-y-4
bg-primary-900
border border-gray-400 rounded-lg shadow-lg hover:shadow-md
transition-all duration-300 ease-in-out">
<h1 class="title text-xl">
<div class="flex flex-col justify-center items-center px-8 py-4 space-y-4 rounded-lg border border-gray-400 shadow-lg transition-all duration-300 ease-in-out bg-primary-900 hover:shadow-md">
<h1 class="text-xl title">
<%= @invite.name %>
</h1>
<%= if @invite.disabled_at |> is_nil() do %>
<%= if @invite.disabled_at do %>
<h2 class="title text-md">
<%= gettext("invite disabled") %>
</h2>
<% else %>
<h2 class="title text-md">
<%= if @invite.uses_left do %>
<%= gettext(
@ -17,10 +18,6 @@
<%= gettext("uses left: unlimited") %>
<% end %>
</h2>
<% else %>
<h2 class="title text-md">
<%= gettext("invite disabled") %>
</h2>
<% end %>
<.qr_code
@ -35,14 +32,13 @@
<div class="flex flex-row flex-wrap justify-center items-center">
<code
id={"code-#{@invite.id}"}
class="mx-2 my-1 text-xs px-4 py-2 rounded-lg text-center break-all
text-primary-400 bg-primary-800"
class="px-4 py-2 mx-2 my-1 text-xs text-center break-all rounded-lg text-primary-400 bg-primary-800"
phx-no-format
><%= url(MemexWeb.Endpoint, ~p"/users/register?invite=#{@invite.token}") %></code>
<%= if @code_actions, do: render_slot(@code_actions) %>
</div>
<div :if={@inner_block} class="flex space-x-4 justify-center items-center">
<div :if={@inner_block} class="flex justify-center items-center space-x-4">
<%= render_slot(@inner_block) %>
</div>
</div>

View File

@ -37,7 +37,7 @@ defmodule MemexWeb.Components.NotesTableComponent do
} = socket
) do
columns =
if actions == [] or current_user |> is_nil() do
if actions == [] or !current_user do
[]
else
[%{label: gettext("actions"), key: :actions, sortable: false}]

View File

@ -37,7 +37,7 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
} = socket
) do
columns =
if actions == [] or current_user |> is_nil() do
if actions == [] or !current_user do
[]
else
[%{label: gettext("actions"), key: :actions, sortable: false}]
@ -101,7 +101,7 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
defp get_value_for_key(:description, %{description: description} = assigns, _additional_data) do
description_block = ~H"""
<div class="truncate max-w-sm">
<div class="max-w-sm truncate">
<%= @description %>
</div>
"""