Noah Settersten commited on
Commit ·
2719169
1
Parent(s): a6485ec
refactor: Fold `Recorder` functional component into upload_form
Browse files
lib/medical_transcription_web/components/components.ex
CHANGED
|
@@ -5,7 +5,7 @@ defmodule MedicalTranscriptionWeb.Components do
|
|
| 5 |
|
| 6 |
use Phoenix.Component
|
| 7 |
import MedicalTranscriptionWeb.CoreComponents
|
| 8 |
-
alias MedicalTranscriptionWeb.Components.
|
| 9 |
use MedicalTranscriptionWeb, :verified_routes
|
| 10 |
|
| 11 |
def upload_form(assigns) do
|
|
@@ -17,7 +17,13 @@ defmodule MedicalTranscriptionWeb.Components do
|
|
| 17 |
class="w-full flex flex-col items-center gap-[21px]"
|
| 18 |
>
|
| 19 |
<div class="w-full px-4 py-[19px] rounded-[10px] flex items-center bg-light-divider">
|
| 20 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
<label
|
| 23 |
for={@audio_upload.ref}
|
|
|
|
| 5 |
|
| 6 |
use Phoenix.Component
|
| 7 |
import MedicalTranscriptionWeb.CoreComponents
|
| 8 |
+
alias MedicalTranscriptionWeb.Components.TranscriptionTextComponent
|
| 9 |
use MedicalTranscriptionWeb, :verified_routes
|
| 10 |
|
| 11 |
def upload_form(assigns) do
|
|
|
|
| 17 |
class="w-full flex flex-col items-center gap-[21px]"
|
| 18 |
>
|
| 19 |
<div class="w-full px-4 py-[19px] rounded-[10px] flex items-center bg-light-divider">
|
| 20 |
+
<button
|
| 21 |
+
type="button"
|
| 22 |
+
phx-click="toggle_recording"
|
| 23 |
+
class="mr-2 h-full px-3 py-2.5 rounded-lg border border-emerald-300 bg-emerald-200"
|
| 24 |
+
>
|
| 25 |
+
<.icon name="hero-microphone" class="w-6 h-6" />
|
| 26 |
+
</button>
|
| 27 |
|
| 28 |
<label
|
| 29 |
for={@audio_upload.ref}
|
lib/medical_transcription_web/components/recorder.ex
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 1 |
-
defmodule MedicalTranscriptionWeb.Components.Recorder do
|
| 2 |
-
@moduledoc """
|
| 3 |
-
Phoenix component for displaying a recording button.
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
use Phoenix.Component
|
| 7 |
-
import MedicalTranscriptionWeb.CoreComponents
|
| 8 |
-
|
| 9 |
-
def recorder(assigns) do
|
| 10 |
-
~H"""
|
| 11 |
-
<button
|
| 12 |
-
type="button"
|
| 13 |
-
phx-click="toggle_recording"
|
| 14 |
-
class={"mr-2 h-full px-3 py-2.5 rounded-lg border border-slate-400 #{button_classes(false)}"}
|
| 15 |
-
>
|
| 16 |
-
<.icon name="hero-microphone" class="w-6 h-6" />
|
| 17 |
-
</button>
|
| 18 |
-
"""
|
| 19 |
-
end
|
| 20 |
-
|
| 21 |
-
defp button_classes(recording) do
|
| 22 |
-
if recording do
|
| 23 |
-
"border border-red-300 bg-red-200"
|
| 24 |
-
else
|
| 25 |
-
"border border-emerald-300 bg-emerald-200"
|
| 26 |
-
end
|
| 27 |
-
end
|
| 28 |
-
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|