Noah Settersten commited on
Commit ·
9da0664
1
Parent(s): e24c965
chore: Create separate component for basic display of a code
Browse files
lib/medical_transcription_web/components/code_select.ex
CHANGED
|
@@ -5,7 +5,7 @@ defmodule MedicalTranscriptionWeb.Components.CodeSelect do
|
|
| 5 |
|
| 6 |
alias MedicalTranscription.Feedback
|
| 7 |
use MedicalTranscriptionWeb, :live_component
|
| 8 |
-
import MedicalTranscriptionWeb.Components, only: [
|
| 9 |
|
| 10 |
@impl Phoenix.LiveComponent
|
| 11 |
def mount(socket) do
|
|
@@ -54,23 +54,18 @@ defmodule MedicalTranscriptionWeb.Components.CodeSelect do
|
|
| 54 |
</div>
|
| 55 |
<% end %>
|
| 56 |
<% else %>
|
| 57 |
-
<div class="
|
| 58 |
-
<
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
<
|
| 63 |
-
|
| 64 |
-
|
|
|
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
text=""
|
| 69 |
-
score={1.0}
|
| 70 |
-
weighting={[]}
|
| 71 |
-
code={@selected_code.code}
|
| 72 |
-
label={@selected_code.description}
|
| 73 |
-
/>
|
| 74 |
<% end %>
|
| 75 |
</div>
|
| 76 |
"""
|
|
|
|
| 5 |
|
| 6 |
alias MedicalTranscription.Feedback
|
| 7 |
use MedicalTranscriptionWeb, :live_component
|
| 8 |
+
import MedicalTranscriptionWeb.Components, only: [code_display: 1]
|
| 9 |
|
| 10 |
@impl Phoenix.LiveComponent
|
| 11 |
def mount(socket) do
|
|
|
|
| 54 |
</div>
|
| 55 |
<% end %>
|
| 56 |
<% else %>
|
| 57 |
+
<div class="px-[14px]">
|
| 58 |
+
<div class="flex justify-between pb-1 border-b border-zinc-300">
|
| 59 |
+
<p class="leading-normal font-bold text-type-black-primary uppercase">
|
| 60 |
+
User-selected code
|
| 61 |
+
</p>
|
| 62 |
+
<button type="button" phx-click="clear-code" phx-target={@myself}>
|
| 63 |
+
<.icon name="hero-x-circle" />
|
| 64 |
+
</button>
|
| 65 |
+
</div>
|
| 66 |
|
| 67 |
+
<.code_display code={@selected_code.code} label={@selected_code.description} />
|
| 68 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
<% end %>
|
| 70 |
</div>
|
| 71 |
"""
|
lib/medical_transcription_web/components/components.ex
CHANGED
|
@@ -175,6 +175,15 @@ defmodule MedicalTranscriptionWeb.Components do
|
|
| 175 |
"""
|
| 176 |
end
|
| 177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
def code_color(weighting) do
|
| 179 |
cond do
|
| 180 |
:positive in weighting and :negative in weighting -> "bg-orange-200/40"
|
|
|
|
| 175 |
"""
|
| 176 |
end
|
| 177 |
|
| 178 |
+
def code_display(assigns) do
|
| 179 |
+
~H"""
|
| 180 |
+
<div class="py-4 text-sm flex flex-col gap-1 font-secondary text-type-black-primary rounded">
|
| 181 |
+
<p class="text-lg font-bold leading-[22.97px]"><%= @code %></p>
|
| 182 |
+
<p class="text-base leading-[20.42px]"><%= @label %></p>
|
| 183 |
+
</div>
|
| 184 |
+
"""
|
| 185 |
+
end
|
| 186 |
+
|
| 187 |
def code_color(weighting) do
|
| 188 |
cond do
|
| 189 |
:positive in weighting and :negative in weighting -> "bg-orange-200/40"
|