Commit
•
a19d36e
1
Parent(s):
8f4c6f0
chore: Highlight feedback buttons when clicked, ...
Browse files
lib/medical_transcription_web/components/components.ex
CHANGED
@@ -4,6 +4,8 @@ defmodule MedicalTranscriptionWeb.Components do
|
|
4 |
"""
|
5 |
|
6 |
use Phoenix.Component
|
|
|
|
|
7 |
import MedicalTranscriptionWeb.CoreComponents
|
8 |
alias MedicalTranscriptionWeb.Components.TranscriptionTextComponent
|
9 |
use MedicalTranscriptionWeb, :verified_routes
|
@@ -154,10 +156,11 @@ defmodule MedicalTranscriptionWeb.Components do
|
|
154 |
<.feedback_button code_vector_id={@code_vector_id} text={@text} response="false" />
|
155 |
</div>
|
156 |
|
|
|
157 |
<div
|
158 |
-
class={"flex flex-col gap-1 font-secondary text-type-black-primary
|
159 |
-
|
160 |
-
|
161 |
"}
|
162 |
title={"Similarity score: #{trunc(@score * 100) / 100}"}
|
163 |
>
|
@@ -171,7 +174,10 @@ defmodule MedicalTranscriptionWeb.Components do
|
|
171 |
defp feedback_button(assigns) do
|
172 |
~H"""
|
173 |
<button
|
174 |
-
phx-click=
|
|
|
|
|
|
|
175 |
phx-value-code_vector_id={@code_vector_id}
|
176 |
phx-value-text={@text}
|
177 |
phx-value-response={@response}
|
|
|
4 |
"""
|
5 |
|
6 |
use Phoenix.Component
|
7 |
+
alias Phoenix.LiveView.JS
|
8 |
+
|
9 |
import MedicalTranscriptionWeb.CoreComponents
|
10 |
alias MedicalTranscriptionWeb.Components.TranscriptionTextComponent
|
11 |
use MedicalTranscriptionWeb, :verified_routes
|
|
|
156 |
<.feedback_button code_vector_id={@code_vector_id} text={@text} response="false" />
|
157 |
</div>
|
158 |
|
159 |
+
<div class="w-1 h-full border-l border-[#444444]/20"></div>
|
160 |
<div
|
161 |
+
class={"flex flex-col gap-1 font-secondary text-type-black-primary ml-4 p-1 rounded
|
162 |
+
#{if @response == true, do: "bg-emerald-200"}
|
163 |
+
#{if @response == false, do: "bg-red-200"}
|
164 |
"}
|
165 |
title={"Similarity score: #{trunc(@score * 100) / 100}"}
|
166 |
>
|
|
|
174 |
defp feedback_button(assigns) do
|
175 |
~H"""
|
176 |
<button
|
177 |
+
phx-click={
|
178 |
+
JS.push("add_feedback")
|
179 |
+
|> JS.add_class("ring-2 ring-orange-500/40")
|
180 |
+
}
|
181 |
phx-value-code_vector_id={@code_vector_id}
|
182 |
phx-value-text={@text}
|
183 |
phx-value-response={@response}
|