Skip to content

Commit 5e45b07

Browse files
committed
refactor: improve notes section layout and responsiveness in admin live view
- Simplified the rendering logic for the notes section, removing fullscreen toggle and enhancing the layout for better usability. - Adjusted the height settings for the notes container and input fields to improve responsiveness across different screen sizes. - Updated the button placement for saving notes to enhance user experience and clarity.
1 parent fec630d commit 5e45b07

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

lib/algora_web/live/admin/admin_live.ex

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ defmodule AlgoraWeb.Admin.AdminLive do
3535
def render(assigns) do
3636
~H"""
3737
<div class="space-y-8 p-8">
38-
<section id="notes" class={["transition-all duration-300", @notes_full_screen && "h-screen"]}>
38+
<section id="notes">
3939
<div class="mb-4 flex items-center justify-between">
4040
<h1 class="text-2xl font-bold">Notes</h1>
4141
<div class="flex gap-2">
@@ -56,30 +56,35 @@ defmodule AlgoraWeb.Admin.AdminLive do
5656
id="notes-container"
5757
class={[
5858
"overflow-hidden transition-all duration-300",
59-
if(@notes_full_screen, do: "max-h-none", else: "max-h-[500px]")
59+
if(@notes_full_screen,
60+
do: "max-h-none",
61+
else: "max-h-[60svh] overflow-y-auto scrollbar-thin"
62+
)
6063
]}
6164
>
6265
<div id="notes-edit" class={["hidden", @notes_edit_mode && "!block"]}>
6366
<.simple_form for={@notes_form} phx-change="validate_notes" phx-submit="save_notes">
64-
<div class="flex flex-col gap-2 h-full">
65-
<h3 class="font-medium text-sm">Content</h3>
66-
<div class="flex-1 [&>div]:h-full">
67-
<.input
68-
field={@notes_form[:content]}
69-
type="textarea"
70-
class="h-full scrollbar-thin"
71-
phx-debounce="300"
72-
rows={10}
73-
/>
74-
</div>
67+
<div class={[
68+
if(@notes_full_screen, do: "[&>div]:h-full", else: "[&>div]:h-[60svh]")
69+
]}>
70+
<.input
71+
field={@notes_form[:content]}
72+
type="textarea"
73+
class="h-full scrollbar-thin"
74+
phx-debounce="300"
75+
rows={10}
76+
/>
7577
</div>
76-
<:actions>
78+
<div class="flex justify-end">
7779
<.button type="submit">Save Notes</.button>
78-
</:actions>
80+
</div>
7981
</.simple_form>
8082
</div>
8183
82-
<div id="notes-preview" class={["h-full", !@notes_edit_mode && "!block"]}>
84+
<div
85+
id="notes-preview"
86+
class={["h-full", if(@notes_edit_mode, do: "hidden", else: "block")]}
87+
>
8388
<div class="h-full rounded-lg border bg-muted/40 p-4 overflow-y-auto">
8489
<div class="prose prose-sm max-w-none dark:prose-invert">
8590
{raw(@notes_preview)}

0 commit comments

Comments
 (0)