diff --git a/assets/vendor/customicons/icon-game-icons-portal.svg b/assets/vendor/customicons/icon-game-icons-portal.svg new file mode 100644 index 00000000..07f71ace --- /dev/null +++ b/assets/vendor/customicons/icon-game-icons-portal.svg @@ -0,0 +1,3 @@ + + + diff --git a/lib/utils/formatters/time.ex b/lib/utils/formatters/time.ex index 964e4bca..1cf81435 100644 --- a/lib/utils/formatters/time.ex +++ b/lib/utils/formatters/time.ex @@ -11,7 +11,9 @@ defmodule Utils.Formatters.Time do %Utils.Formatters.TimeDisplay{formatted_time: "just now", original_datetime: datetime} """ - def friendly(datetime) when is_struct(datetime, NaiveDateTime), do: friendly(DateTime.from_naive!(datetime, "Etc/UTC")) + def friendly(datetime) when is_struct(datetime, NaiveDateTime), + do: friendly(DateTime.from_naive!(datetime, "Etc/UTC")) + def friendly(datetime) when is_struct(datetime, DateTime) do now = DateTime.utc_now() @@ -21,9 +23,9 @@ defmodule Utils.Formatters.Time do formatted_time = cond do seconds_diff < 60 -> "just now" - seconds_diff < 3600 -> "#{div(seconds_diff, 60)} minutes ago" - seconds_diff < 86400 -> "#{div(seconds_diff, 3600)} hours ago" - true -> "#{div(seconds_diff, 86400)} days ago" + seconds_diff < 3600 -> "#{div(seconds_diff, 60)}m ago" + seconds_diff < 86400 -> "#{div(seconds_diff, 3600)}h ago" + true -> "#{div(seconds_diff, 86400)}d ago" end %TimeDisplay{formatted_time: formatted_time, original_datetime: datetime} diff --git a/lib/vyasa_web/components/contexts/components.ex b/lib/vyasa_web/components/contexts/components.ex index 48a6d1cb..0d66f69e 100644 --- a/lib/vyasa_web/components/contexts/components.ex +++ b/lib/vyasa_web/components/contexts/components.ex @@ -13,23 +13,29 @@ defmodule VyasaWeb.Context.Components do attr :marks_target, :string attr :myself, :any, required: true + attr :is_composite_member, :boolean, + default: false, + doc: "When true, the collapsible marks display is a member of a larger component" + attr :id, :string, default: "", doc: "An optional id suffix, to differentate intentionally duplicate components." def collapsible_marks_display(assigns) do ~H""" - -
+
@id} - class="flex items-baseline justify-between p-2 bg-brand-extra-light rounded-lg shadow-sm transition-colors duration-200" + class="flex items-baseline justify-between p-4 bg-brand-extra-light transition-colors duration-200" >
""" @@ -168,7 +178,7 @@ defmodule VyasaWeb.Context.Components do class="flex items-center text-gray-600 hover:text-gray-800 ml-2" aria-label="Visit" > - <.icon name="custom-icon-material-symbols-select-jump-to-end" class="h-6 w-6 mr-1" /> + <.icon name="custom-icon-game-icons-portal" class="h-5 w-5" /> <% end %>
@@ -252,16 +262,35 @@ defmodule VyasaWeb.Context.Components do """ end - attr :sheaf, :any, required: true - def sheaf_display(assigns) do ~H""" - - SHEAF DISPLAY <%= @sheaf.body %> - <%= @sheaf.signature %> - +
+ <.sheaf_summary + id={"sheaf-summary-" <> @id} + level={@level} + is_reply_to={@is_reply_to} + is_composite_member={true} + sheaf={@sheaf} + sheaf_ui={@sheaf_ui} + children={@children} + on_signature_deadspace_click={@on_replies_click} + on_replies_click={@on_replies_click} + on_set_reply_to={@on_set_reply_to} + on_quick_reply={@on_quick_reply} + /> + + <%= if @sheaf.active do %> + <.collapsible_marks_display + is_composite_member={true} + marks_target={@events_target} + sheaf={@sheaf} + sheaf_ui={@sheaf_ui} + id={"marks-" <> @sheaf.id} + myself={@events_target} + /> + <% end %> +
""" end @@ -476,11 +505,16 @@ defmodule VyasaWeb.Context.Components do doc: "Defines a callback to invoke when the user clicks on the deadspace near the signature" ) + attr :is_composite_member, :boolean, + default: false, + doc: "When true, the sheaf summary is a member of a larger component" + attr :children, :list, default: [], doc: "The children of this sheaf" def sheaf_summary(assigns) do ~H""" -
+

to_string(@level) <> "-sheaf-top-row-" <> @id <> "-" <> @sheaf.id} class="flex justify-between items-center" > -
+
<.sheaf_signature_display sheaf={@sheaf} />
@@ -633,7 +667,7 @@ defmodule VyasaWeb.Context.Components do <% else %> Show <% end %> - <%= @replies_count %> replies + <%= @replies_count %> <%= Inflex.inflect("reply", @replies_count) %>
diff --git a/lib/vyasa_web/components/contexts/discuss.ex b/lib/vyasa_web/components/contexts/discuss.ex index 9a15298b..9b2bc365 100644 --- a/lib/vyasa_web/components/contexts/discuss.ex +++ b/lib/vyasa_web/components/contexts/discuss.ex @@ -898,9 +898,12 @@ defmodule VyasaWeb.Context.Discuss do


- <%= Enum.count(@root_sheaves || []) %> threads with a total of <%= Enum.count( - Map.keys(@sheaf_lattice || %{}) - ) %> comments + <% num_active_root_sheaves = Enum.count(@root_sheaves || []) %> + <% num_comments = Enum.count(Map.keys(@sheaf_lattice || %{})) %> + <%= num_active_root_sheaves %> <%= Inflex.inflect("thread", num_active_root_sheaves) %> with a total of <%= num_comments %> <%= Inflex.inflect( + "comment", + num_comments + ) %>
<.sheaf_creator_modal diff --git a/lib/vyasa_web/components/contexts/discuss/sheaf_tree.ex b/lib/vyasa_web/components/contexts/discuss/sheaf_tree.ex index 85b342a1..9cbdbc46 100644 --- a/lib/vyasa_web/components/contexts/discuss/sheaf_tree.ex +++ b/lib/vyasa_web/components/contexts/discuss/sheaf_tree.ex @@ -254,7 +254,7 @@ defmodule VyasaWeb.Context.Discuss.SheafTree do ~H"""
to_string(@level) <> "-sheaf-component_container-" <> @id} - class="flex flex-col" + class="flex flex-col my-2" > - <.sheaf_summary - id={"sheaf-tree-node-sheaf-summary-"<> @id} + <.sheaf_display + id={"sheaf-treenode-sheaf-display-" <> @id} level={@level} is_reply_to={@is_reply_to} sheaf={@sheaf} @@ -274,24 +274,17 @@ defmodule VyasaWeb.Context.Discuss.SheafTree do on_replies_click={@on_replies_click} on_set_reply_to={@on_set_reply_to} on_quick_reply={@on_quick_reply} + events_target={@events_target} + marks_target={@events_target} + myself={@events_target} /> - - <%= if @sheaf.active do %> - <.collapsible_marks_display - marks_target={@events_target} - sheaf={@sheaf} - sheaf_ui={@sheaf_ui} - id={"marks-" <> @sheaf.id} - myself={@events_target} - /> - <% end %> <%= if @level <= 2 && @sheaf_ui.is_expanded? do %> <.collapsible_sheaf_container id={"collapsible_sheaf_container-" <> @id} sheaf={@sheaf} reply_to={@reply_to} - container_class={"flex flex-col overflow-scroll pl-#{to_string((@level + 1) * 5)} ml-#{to_string((@level + 1) * 4)}"} + container_class={"flex flex-col #{if @level <= 1, do: "", else: "border-l border-gray-200"} overflow-scroll pl-#{to_string((@level + 1) * 5)}"} events_target={@events_target} sheafs={@children} sheaf_lattice={@sheaf_lattice} diff --git a/lib/vyasa_web/components/contexts/read/verse_matrix.ex b/lib/vyasa_web/components/contexts/read/verse_matrix.ex index 0d72deac..7ef150ad 100644 --- a/lib/vyasa_web/components/contexts/read/verse_matrix.ex +++ b/lib/vyasa_web/components/contexts/read/verse_matrix.ex @@ -179,7 +179,7 @@ defmodule VyasaWeb.Context.Read.VerseMatrix do sheaf={@draft_sheaf} sheaf_ui={@draft_sheaf_ui} /> - <.sheaf_display :for={sheaf <- @sheafs} sheaf={sheaf} /> +
""" end