diff --git a/lib/music_library_web/components/notes_component.ex b/lib/music_library_web/components/notes_component.ex index afbe15d4..61fc3b39 100644 --- a/lib/music_library_web/components/notes_component.ex +++ b/lib/music_library_web/components/notes_component.ex @@ -24,29 +24,43 @@ defmodule MusicLibraryWeb.NotesComponent do <.sheet id={@sheet_id} placement="right" - class="min-w-xs sm:min-w-lg lg:min-w-2xl" + class="min-w-xs max-w-lg sm:min-w-lg lg:min-w-2xl py-16" > - <.simple_form - for={@form} - id="record-notes-form" - phx-target={@myself} - phx-change="validate" - phx-auto-recover="recover_form" - phx-submit="save" - > - <.textarea class="w-full h-96 font-mono" field={@form[:notes]} label={gettext("Notes")} /> - <:actions> -
- <.button - variant="solid" - class="w-full md:w-auto" - phx-disable-with={gettext("Saving...")} - > - {gettext("Save")} - + <.tabs> + <.tabs_list variant="segmented"> + <:tab name="read">{gettext("Read")} + <:tab name="edit">{gettext("Edit")} + + <.tabs_panel active name="read"> +
+ {Earmark.as_html!(@form[:notes].value || "", %Earmark.Options{gfm: true}) |> raw()}
- - + + <.tabs_panel name="edit"> + <.simple_form + for={@form} + id="record-notes-form" + phx-target={@myself} + phx-change="validate" + phx-auto-recover="recover_form" + phx-submit="save" + > + <.textarea class="w-full h-96 font-mono text-sm/8" field={@form[:notes]} /> + + <:actions> +
+ <.button + variant="solid" + class="w-full md:w-auto" + phx-disable-with={gettext("Saving...")} + > + {gettext("Save")} + +
+ + + +
""" diff --git a/mix.exs b/mix.exs index b8a257da..d356edaf 100644 --- a/mix.exs +++ b/mix.exs @@ -92,6 +92,9 @@ defmodule MusicLibrary.MixProject do # Image manipulation {:vix, "~> 0.35.0"}, + # Notes + {:earmark, "~> 1.4"}, + # Time-zone support - requires mint and castore {:time_zone_info, "~> 0.7.8"}, diff --git a/mix.lock b/mix.lock index ad5e9d07..82fca60e 100644 --- a/mix.lock +++ b/mix.lock @@ -9,6 +9,7 @@ "db_connection": {:hex, :db_connection, "2.8.0", "64fd82cfa6d8e25ec6660cea73e92a4cbc6a18b31343910427b702838c4b33b2", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "008399dae5eee1bf5caa6e86d204dcb44242c82b1ed5e22c881f2c34da201b15"}, "decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"}, "dns_cluster": {:hex, :dns_cluster, "0.2.0", "aa8eb46e3bd0326bd67b84790c561733b25c5ba2fe3c7e36f28e88f384ebcb33", [:mix], [], "hexpm", "ba6f1893411c69c01b9e8e8f772062535a4cf70f3f35bcc964a324078d8c8240"}, + "earmark": {:hex, :earmark, "1.4.48", "5f41e579d85ef812351211842b6e005f6e0cef111216dea7d4b9d58af4608434", [:mix], [], "hexpm", "a461a0ddfdc5432381c876af1c86c411fd78a25790c75023c7a4c035fdc858f9"}, "ecto": {:hex, :ecto, "3.13.2", "7d0c0863f3fc8d71d17fc3ad3b9424beae13f02712ad84191a826c7169484f01", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "669d9291370513ff56e7b7e7081b7af3283d02e046cf3d403053c557894a0b3e"}, "ecto_sql": {:hex, :ecto_sql, "3.13.2", "a07d2461d84107b3d037097c822ffdd36ed69d1cf7c0f70e12a3d1decf04e2e1", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.13.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "539274ab0ecf1a0078a6a72ef3465629e4d6018a3028095dc90f60a19c371717"}, "ecto_sqlite3": {:hex, :ecto_sqlite3, "0.21.0", "8531f5044fb08289b3aacd21e383a9fb187e5a78981b9ed6d0929a78a25c2341", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.13.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.13.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:exqlite, "~> 0.22", [hex: :exqlite, repo: "hexpm", optional: false]}], "hexpm", "9c3e90ea33099ca0ddd160c8d9eaf80d7d4a9b110d325fa6ed0409858a714606"}, diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 8a76ec67..0fa7ed5f 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -43,6 +43,7 @@ msgstr "" msgid "Delete" msgstr "" +#: lib/music_library_web/components/notes_component.ex #: lib/music_library_web/components/record_components.ex #: lib/music_library_web/live/artist_live/show.ex #: lib/music_library_web/live/artist_live/show.html.heex @@ -1314,12 +1315,12 @@ msgstr "" msgid "No records released on this day." msgstr "" -#: lib/music_library_web/components/notes_component.ex -#, elixir-autogen, elixir-format -msgid "Notes" -msgstr "" - #: lib/music_library_web/live/collection_live/show.html.heex #, elixir-autogen, elixir-format msgid "Open Notes" msgstr "" + +#: lib/music_library_web/components/notes_component.ex +#, elixir-autogen, elixir-format +msgid "Read" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index bac31085..64f4dc59 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -43,6 +43,7 @@ msgstr "" msgid "Delete" msgstr "" +#: lib/music_library_web/components/notes_component.ex #: lib/music_library_web/components/record_components.ex #: lib/music_library_web/live/artist_live/show.ex #: lib/music_library_web/live/artist_live/show.html.heex @@ -1314,12 +1315,12 @@ msgstr "" msgid "No records released on this day." msgstr "" -#: lib/music_library_web/components/notes_component.ex -#, elixir-autogen, elixir-format -msgid "Notes" -msgstr "" - #: lib/music_library_web/live/collection_live/show.html.heex #, elixir-autogen, elixir-format msgid "Open Notes" msgstr "" + +#: lib/music_library_web/components/notes_component.ex +#, elixir-autogen, elixir-format, fuzzy +msgid "Read" +msgstr ""