From 2d162c781d1e6751785986d7605d5a3727bae745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lobo?= Date: Sun, 2 Feb 2025 20:42:39 +0000 Subject: [PATCH 1/3] feat: landing ui improvements --- lib/safira/activities.ex | 2 +- lib/safira/activities/speaker.ex | 7 ++---- .../components/layouts/landing.html.heex | 11 ++++++++- .../controllers/error_html/404.html.heex | 12 ++++++---- .../controllers/error_html/500.html.heex | 19 +++++++++++---- .../live/landing/challenges_live/index.ex | 2 +- .../live/landing/components/footer.ex | 19 +++++++++++++-- .../live/landing/components/schedule.ex | 24 +++++++------------ .../live/landing/faqs_live/index.ex | 1 + .../live/landing/home_live/index.ex | 1 + .../live/landing/home_live/index.html.heex | 2 +- .../live/landing/schedule_live/index.ex | 1 + .../speakers_live/components/speakers.ex | 3 ++- .../live/landing/speakers_live/index.ex | 3 ++- 14 files changed, 71 insertions(+), 36 deletions(-) diff --git a/lib/safira/activities.ex b/lib/safira/activities.ex index 881aa5e9c..ed4ae6868 100644 --- a/lib/safira/activities.ex +++ b/lib/safira/activities.ex @@ -68,7 +68,7 @@ defmodule Safira.Activities do def list_daily_activities(day) do Activity |> where([a], a.date == ^day) - |> order_by([a], a.time_start) + |> order_by([a], asc: a.time_start) |> preload([:speakers, :category]) |> Repo.all() end diff --git a/lib/safira/activities/speaker.ex b/lib/safira/activities/speaker.ex index 67bdb8e27..a3717bb14 100644 --- a/lib/safira/activities/speaker.ex +++ b/lib/safira/activities/speaker.ex @@ -80,11 +80,8 @@ defmodule Safira.Activities.Speaker.Socials do def validate_linkedin(changeset) do changeset - |> validate_format( - :linkedin, - ~r/^[a-zA-Z0-9]{3,100}$/, - message: "not a valid linkedin handle" - ) + |> validate_length(:linkedin, min: 3, max: 100, message: "not a valid linkedin handle") + |> validate_format(:linkedin, ~r/^\S+$/, message: "cannot contain spaces") end def validate_x(changeset) do diff --git a/lib/safira_web/components/layouts/landing.html.heex b/lib/safira_web/components/layouts/landing.html.heex index a66518966..73777c6f8 100644 --- a/lib/safira_web/components/layouts/landing.html.heex +++ b/lib/safira_web/components/layouts/landing.html.heex @@ -9,5 +9,14 @@ <.flash_group flash={@flash} /> <%= @inner_content %> - <.footer /> + <.footer> + <:tip :if={ + Safira.Event.get_feature_flag!("challenges_enabled") and + Map.get(assigns, :current_page, nil) != :challenges + }> + Have you checked out the + <.link class="underline" navigate={~p"/challenges"}>challenges + yet? 🏆 + + diff --git a/lib/safira_web/controllers/error_html/404.html.heex b/lib/safira_web/controllers/error_html/404.html.heex index 066e52519..7adb511c0 100644 --- a/lib/safira_web/controllers/error_html/404.html.heex +++ b/lib/safira_web/controllers/error_html/404.html.heex @@ -1,11 +1,11 @@ - +
<.sparkles /> <.navbar pages={SafiraWeb.Config.landing_pages()} registrations_open?={Safira.Event.registrations_open?()} />
- + <.sparkles />
404
@@ -15,5 +15,9 @@
- <.footer /> - + <.footer> + <:tip> + Okay, let's get you back on track. <.link class="underline" navigate={~p"/"}>Go home? + + +
diff --git a/lib/safira_web/controllers/error_html/500.html.heex b/lib/safira_web/controllers/error_html/500.html.heex index 3cf14d766..950da0b8d 100644 --- a/lib/safira_web/controllers/error_html/500.html.heex +++ b/lib/safira_web/controllers/error_html/500.html.heex @@ -1,11 +1,11 @@ - +
<.sparkles /> <.navbar pages={SafiraWeb.Config.landing_pages()} registrations_open?={Safira.Event.registrations_open?()} />
- + <.sparkles />
500
@@ -15,5 +15,16 @@
- <.footer /> - + <.footer> + <:tip> + <.link + class="underline" + target="_blank" + href="https://github.com/cesium/safira/graphs/contributors" + > + Their + + fault. + + +
diff --git a/lib/safira_web/live/landing/challenges_live/index.ex b/lib/safira_web/live/landing/challenges_live/index.ex index 98732db2b..6173ab2fd 100644 --- a/lib/safira_web/live/landing/challenges_live/index.ex +++ b/lib/safira_web/live/landing/challenges_live/index.ex @@ -10,7 +10,7 @@ defmodule SafiraWeb.Landing.ChallengesLive.Index do @impl true def mount(_params, _session, socket) do - {:ok, socket} + {:ok, assign(socket, :current_page, :challenges)} end @impl true diff --git a/lib/safira_web/live/landing/components/footer.ex b/lib/safira_web/live/landing/components/footer.ex index 79c413843..29af4a17b 100644 --- a/lib/safira_web/live/landing/components/footer.ex +++ b/lib/safira_web/live/landing/components/footer.ex @@ -7,17 +7,18 @@ defmodule SafiraWeb.Landing.Components.Footer do alias Safira.Event + slot :tip, required: false + def footer(assigns) do ~H""" """ end diff --git a/lib/safira_web/live/landing/components/schedule.ex b/lib/safira_web/live/landing/components/schedule.ex index 16fec8857..889634b42 100644 --- a/lib/safira_web/live/landing/components/schedule.ex +++ b/lib/safira_web/live/landing/components/schedule.ex @@ -62,7 +62,7 @@ defmodule SafiraWeb.Landing.Components.Schedule do ", else: "text-md m-1 items-center rounded-full border-2 px-12 py-2 text-center font-bold text-white shadow-sm - hover:border-accent hover:text-accent px-8 + hover:bg-white/20 px-8 transition-colors " } patch={filter_url(@url, @current_day, @filters, category.id)} @@ -95,10 +95,7 @@ defmodule SafiraWeb.Landing.Components.Schedule do defp schedule_activity(assigns) do ~H""" -
+

@@ -114,17 +111,17 @@ defmodule SafiraWeb.Landing.Components.Schedule do

-
    +
    • {el, i} end)} - class="list-none sm:float-left" + class="list-none xl:float-left" > <%= if index == length(@activity.speakers) - 1 and length(@activity.speakers) != 1 do %> -