diff --git a/assets/js/hooks.js b/assets/js/hooks.js index 9cacc1f..1f20179 100644 --- a/assets/js/hooks.js +++ b/assets/js/hooks.js @@ -207,6 +207,7 @@ export const Hooks = { DateTimePicker: { mounted() { this.hiddenInput = this.el.querySelector("[data-datetime-value]") + this.unusedInput = this.el.querySelector("[data-datetime-unused]") this.dateInput = this.el.querySelector("[data-datetime-date]") this.timeInput = this.el.querySelector("[data-datetime-time]") this.timezoneLabel = this.el.querySelector("[data-datetime-timezone]") @@ -264,6 +265,11 @@ export const Hooks = { this.hiddenInput.dispatchEvent(new Event("input", {bubbles: true})) } + this.syncUserInput = () => { + if (this.unusedInput) this.unusedInput.disabled = true + this.syncHidden() + } + this.setQuickTime = event => { const minutes = Number(event.currentTarget.dataset.datetimeOffset) if (!Number.isFinite(minutes)) return @@ -271,11 +277,11 @@ export const Hooks = { const date = new Date(Date.now() + minutes * 60_000) date.setSeconds(0, 0) this.applyLocalDate(date) - this.syncHidden() + this.syncUserInput() } - this.dateInput.addEventListener("input", this.syncHidden) - this.timeInput.addEventListener("input", this.syncHidden) + this.dateInput.addEventListener("input", this.syncUserInput) + this.timeInput.addEventListener("input", this.syncUserInput) this.quickButtons.forEach(button => button.addEventListener("click", this.setQuickTime)) const initial = this.parseUtc(this.hiddenInput.value) @@ -288,8 +294,8 @@ export const Hooks = { } }, destroyed() { - this.dateInput?.removeEventListener("input", this.syncHidden) - this.timeInput?.removeEventListener("input", this.syncHidden) + this.dateInput?.removeEventListener("input", this.syncUserInput) + this.timeInput?.removeEventListener("input", this.syncUserInput) this.quickButtons?.forEach(button => button.removeEventListener("click", this.setQuickTime)) } }, diff --git a/lib/who_need_help_web/components/core_components.ex b/lib/who_need_help_web/components/core_components.ex index fcf520c..f5f19cf 100644 --- a/lib/who_need_help_web/components/core_components.ex +++ b/lib/who_need_help_web/components/core_components.ex @@ -394,6 +394,7 @@ defmodule WhoNeedHelpWeb.CoreComponents do assigns |> assign(:id, field.id) |> assign(:name, field.name) + |> assign(:unused_name, unused_input_name(field.name)) |> assign(:value, normalized_input_value("datetime-local", safe_form_value(field.value))) |> assign(:errors, Enum.map(errors, &translate_error(&1))) @@ -418,6 +419,7 @@ defmodule WhoNeedHelpWeb.CoreComponents do value={@value} data-datetime-value /> +
+
+ {gettext( + "This activity is closed. The group chat remains available as read-only history." + )} +
<.form :if={@activity.status == :open} for={@message_form} @@ -548,7 +556,9 @@ defmodule WhoNeedHelpWeb.ActivityLive.Show do phx-click="join" class="btn btn-info w-full" > - {gettext("Request to join")} + {if @viewer_participant, + do: gettext("Request to join again"), + else: gettext("Request to join")}
{gettext("Approval pending")} @@ -556,6 +566,28 @@ defmodule WhoNeedHelpWeb.ActivityLive.Show do {gettext("The organizer has not approved your request yet.")}

+
+

{gettext("You left this activity")}

+

+ {gettext( + "You are no longer a participant and cannot access the group chat or exact meeting point. You can request to join again while registration is open." + )} +

+
+
+

{gettext("Your join request was declined")}

+

+ {gettext( + "You are not a participant. You can send a new request while registration is open." + )} +

+