timgremore
commited on
Commit
•
c066ce6
1
Parent(s):
9372521
feat: Use user's timezone
Browse files- assets/js/app.js +3 -1
- config/config.exs +2 -0
- lib/medicode_web/components/components.ex +8 -1
- lib/medicode_web/live/transcriptions_live/show.ex +5 -1
- mix.exs +2 -1
- mix.lock +1 -0
assets/js/app.js
CHANGED
@@ -22,6 +22,8 @@ import { Socket } from "phoenix";
|
|
22 |
import { LiveSocket } from "phoenix_live_view";
|
23 |
import topbar from "../vendor/topbar";
|
24 |
|
|
|
|
|
25 |
let Hooks = {};
|
26 |
/**
|
27 |
* This hook is necessary because we're watching for a blur event on a `p` tag with `contenteditable`.
|
@@ -55,7 +57,7 @@ let csrfToken = document
|
|
55 |
.getAttribute("content");
|
56 |
let liveSocket = new LiveSocket("/live", Socket, {
|
57 |
hooks: Hooks,
|
58 |
-
params: { _csrf_token: csrfToken },
|
59 |
});
|
60 |
|
61 |
// Show progress bar on live navigation and form submits
|
|
|
22 |
import { LiveSocket } from "phoenix_live_view";
|
23 |
import topbar from "../vendor/topbar";
|
24 |
|
25 |
+
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
26 |
+
|
27 |
let Hooks = {};
|
28 |
/**
|
29 |
* This hook is necessary because we're watching for a blur event on a `p` tag with `contenteditable`.
|
|
|
57 |
.getAttribute("content");
|
58 |
let liveSocket = new LiveSocket("/live", Socket, {
|
59 |
hooks: Hooks,
|
60 |
+
params: { _csrf_token: csrfToken, timezone },
|
61 |
});
|
62 |
|
63 |
// Show progress bar on live navigation and form submits
|
config/config.exs
CHANGED
@@ -37,6 +37,8 @@ config :medicode, :generators,
|
|
37 |
# at the `config/runtime.exs`.
|
38 |
config :medicode, Medicode.Mailer, adapter: Swoosh.Adapters.Local
|
39 |
|
|
|
|
|
40 |
# Configure esbuild (the version is required)
|
41 |
config :esbuild,
|
42 |
version: "0.17.11",
|
|
|
37 |
# at the `config/runtime.exs`.
|
38 |
config :medicode, Medicode.Mailer, adapter: Swoosh.Adapters.Local
|
39 |
|
40 |
+
config :elixir, :time_zone_database, Tzdata.TimeZoneDatabase
|
41 |
+
|
42 |
# Configure esbuild (the version is required)
|
43 |
config :esbuild,
|
44 |
version: "0.17.11",
|
lib/medicode_web/components/components.ex
CHANGED
@@ -78,6 +78,13 @@ defmodule MedicodeWeb.Components do
|
|
78 |
Shows the status and keywords for the current session.
|
79 |
"""
|
80 |
def result_heading(assigns) do
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
~H"""
|
82 |
<div class="flex justify-between">
|
83 |
<div class="flex items-center">
|
@@ -117,7 +124,7 @@ defmodule MedicodeWeb.Components do
|
|
117 |
<img src={~p"/images/calendar.svg"} width="16" />
|
118 |
|
119 |
<span class="text-sm leading-normal font-bold text-type-black-tertiary uppercase">
|
120 |
-
<%=
|
121 |
</span>
|
122 |
</div>
|
123 |
<div class="px-4 pt-2 pb-10 flex flex-col gap-2">
|
|
|
78 |
Shows the status and keywords for the current session.
|
79 |
"""
|
80 |
def result_heading(assigns) do
|
81 |
+
assigns =
|
82 |
+
assign_new(assigns, :transcript_inserted_at, fn _ ->
|
83 |
+
assigns.transcription.inserted_at
|
84 |
+
|> DateTime.shift_zone!(assigns.timezone)
|
85 |
+
|> Calendar.strftime("%a, %b %d, %Y, %I:%M %p")
|
86 |
+
end)
|
87 |
+
|
88 |
~H"""
|
89 |
<div class="flex justify-between">
|
90 |
<div class="flex items-center">
|
|
|
124 |
<img src={~p"/images/calendar.svg"} width="16" />
|
125 |
|
126 |
<span class="text-sm leading-normal font-bold text-type-black-tertiary uppercase">
|
127 |
+
<%= @transcript_inserted_at %>
|
128 |
</span>
|
129 |
</div>
|
130 |
<div class="px-4 pt-2 pb-10 flex flex-col gap-2">
|
lib/medicode_web/live/transcriptions_live/show.ex
CHANGED
@@ -10,6 +10,8 @@ defmodule MedicodeWeb.TranscriptionsLive.Show do
|
|
10 |
def mount(params, session, socket) do
|
11 |
transcription = get_transcription(params["id"])
|
12 |
|
|
|
|
|
13 |
if is_nil(transcription), do: raise(Medicode.Fallback)
|
14 |
|
15 |
if connected?(socket) do
|
@@ -30,7 +32,8 @@ defmodule MedicodeWeb.TranscriptionsLive.Show do
|
|
30 |
summary_keywords: summary_keywords,
|
31 |
transcription: transcription,
|
32 |
transcriptions: list_transcriptions(session["current_user"]),
|
33 |
-
finalized_codes: finalized_codes
|
|
|
34 |
}
|
35 |
|
36 |
socket =
|
@@ -59,6 +62,7 @@ defmodule MedicodeWeb.TranscriptionsLive.Show do
|
|
59 |
transcription={@transcription}
|
60 |
summary_keywords={@summary_keywords}
|
61 |
finalized_codes={@finalized_codes}
|
|
|
62 |
/>
|
63 |
|
64 |
<img
|
|
|
10 |
def mount(params, session, socket) do
|
11 |
transcription = get_transcription(params["id"])
|
12 |
|
13 |
+
timezone = get_connect_params(socket)["timezone"] || "Etc/UTC"
|
14 |
+
|
15 |
if is_nil(transcription), do: raise(Medicode.Fallback)
|
16 |
|
17 |
if connected?(socket) do
|
|
|
32 |
summary_keywords: summary_keywords,
|
33 |
transcription: transcription,
|
34 |
transcriptions: list_transcriptions(session["current_user"]),
|
35 |
+
finalized_codes: finalized_codes,
|
36 |
+
timezone: timezone
|
37 |
}
|
38 |
|
39 |
socket =
|
|
|
62 |
transcription={@transcription}
|
63 |
summary_keywords={@summary_keywords}
|
64 |
finalized_codes={@finalized_codes}
|
65 |
+
timezone={@timezone}
|
66 |
/>
|
67 |
|
68 |
<img
|
mix.exs
CHANGED
@@ -72,7 +72,8 @@ defmodule Medicode.MixProject do
|
|
72 |
{:hackney, "~> 1.8"},
|
73 |
{:sentry, "~> 8.0"},
|
74 |
{:ecto_psql_extras, "~> 0.6"},
|
75 |
-
{:circular_buffer, "~> 0.4.0"}
|
|
|
76 |
# {:membrane_portaudio_plugin, "~> 0.18.0"}
|
77 |
]
|
78 |
end
|
|
|
72 |
{:hackney, "~> 1.8"},
|
73 |
{:sentry, "~> 8.0"},
|
74 |
{:ecto_psql_extras, "~> 0.6"},
|
75 |
+
{:circular_buffer, "~> 0.4.0"},
|
76 |
+
{:tzdata, "~> 1.1"}
|
77 |
# {:membrane_portaudio_plugin, "~> 0.18.0"}
|
78 |
]
|
79 |
end
|
mix.lock
CHANGED
@@ -103,6 +103,7 @@
|
|
103 |
"telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"},
|
104 |
"thousand_island": {:hex, :thousand_island, "1.3.5", "6022b6338f1635b3d32406ff98d68b843ba73b3aa95cfc27154223244f3a6ca5", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "2be6954916fdfe4756af3239fb6b6d75d0b8063b5df03ba76fd8a4c87849e180"},
|
105 |
"tokenizers": {:hex, :tokenizers, "0.4.0", "140283ca74a971391ddbd83cd8cbdb9bd03736f37a1b6989b82d245a95e1eb97", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.6", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "ef1a9824f5a893cd3b831c0e5b3d72caa250d2ec462035cc6afef6933b13a82e"},
|
|
|
106 |
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
|
107 |
"unifex": {:hex, :unifex, "1.1.0", "26b1bcb6c3b3454e1ea15f85b2e570aaa5b5c609566aa9f5c2e0a8b213379d6b", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:bundlex, "~> 1.0", [hex: :bundlex, repo: "hexpm", optional: false]}, {:shmex, "~> 0.5.0", [hex: :shmex, repo: "hexpm", optional: false]}], "hexpm", "d8f47e9e3240301f5b20eec5792d1d4341e1a3a268d94f7204703b48da4aaa06"},
|
108 |
"unpickler": {:hex, :unpickler, "0.1.0", "c2262c0819e6985b761e7107546cef96a485f401816be5304a65fdd200d5bd6a", [:mix], [], "hexpm", "e2b3f61e62406187ac52afead8a63bfb4e49394028993f3c4c42712743cab79e"},
|
|
|
103 |
"telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"},
|
104 |
"thousand_island": {:hex, :thousand_island, "1.3.5", "6022b6338f1635b3d32406ff98d68b843ba73b3aa95cfc27154223244f3a6ca5", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "2be6954916fdfe4756af3239fb6b6d75d0b8063b5df03ba76fd8a4c87849e180"},
|
105 |
"tokenizers": {:hex, :tokenizers, "0.4.0", "140283ca74a971391ddbd83cd8cbdb9bd03736f37a1b6989b82d245a95e1eb97", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.6", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "ef1a9824f5a893cd3b831c0e5b3d72caa250d2ec462035cc6afef6933b13a82e"},
|
106 |
+
"tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"},
|
107 |
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
|
108 |
"unifex": {:hex, :unifex, "1.1.0", "26b1bcb6c3b3454e1ea15f85b2e570aaa5b5c609566aa9f5c2e0a8b213379d6b", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:bundlex, "~> 1.0", [hex: :bundlex, repo: "hexpm", optional: false]}, {:shmex, "~> 0.5.0", [hex: :shmex, repo: "hexpm", optional: false]}], "hexpm", "d8f47e9e3240301f5b20eec5792d1d4341e1a3a268d94f7204703b48da4aaa06"},
|
109 |
"unpickler": {:hex, :unpickler, "0.1.0", "c2262c0819e6985b761e7107546cef96a485f401816be5304a65fdd200d5bd6a", [:mix], [], "hexpm", "e2b3f61e62406187ac52afead8a63bfb4e49394028993f3c4c42712743cab79e"},
|