Skip to content

Commit 59902d5

Browse files
authored
add upload progress to works and disable loading buttons (#803)
Also tossed a small css change in there
1 parent f540d8e commit 59902d5

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

assets/css/app.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
&.phx-keyup-loading,
3737
&.phx-keydown-loading,
3838
&.phx-loading {
39-
@apply loading;
39+
@apply loading btn-disabled;
4040
}
4141
}
4242

lib/banchan_web/live/work_live/components/work_uploads/work_uploads.css

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
}
44

55
.preview-item {
6-
@apply relative bg-base-100 mx-auto my-auto w-full h-full flex flex-col justify-center items-center cursor-pointer;
6+
@apply relative bg-base-100 mx-auto my-auto w-full h-full flex flex-col justify-center items-center cursor-pointer min-h-40;
77

88
&:first-child:nth-last-child(1) {
99
@apply md:col-span-6 w-full;
@@ -33,3 +33,7 @@
3333
.remove-upload {
3434
@apply absolute z-20 btn btn-sm btn-circle left-2 top-2;
3535
}
36+
37+
.upload-progress {
38+
@apply absolute z-10 radial-progress text-primary bg-primary-content opacity-80;
39+
}

lib/banchan_web/live/work_live/components/work_uploads/work_uploads.ex

+12
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ defmodule BanchanWeb.WorkLive.Components.WorkUploads do
116116
send(pid, {:canceled_upload, id, ref})
117117
end
118118

119+
defp get_upload_entry(entries, wupload) do
120+
Enum.find(entries, fn entry ->
121+
entry.ref == wupload.ref
122+
end)
123+
end
124+
119125
def render(assigns) do
120126
~F"""
121127
<bc-work-uploads id={@id} class={@class} :hook="SortableHook">
@@ -130,6 +136,12 @@ defmodule BanchanWeb.WorkLive.Components.WorkUploads do
130136
wupload.ref
131137
end}
132138
>
139+
{#if type == :live}
140+
<div
141+
class="upload-progress"
142+
style={"--value:#{get_upload_entry(@live_entries, wupload).progress}"}
143+
>{get_upload_entry(@live_entries, wupload).progress}%</div>
144+
{/if}
133145
{#if @editing}
134146
<button type="button" class="remove-upload" phx-value-idx={idx} :on-click="remove_upload">✕</button>
135147
{/if}

0 commit comments

Comments
 (0)