Skip to content

Commit

Permalink
improvement: add upcoming events
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Jan 23, 2025
1 parent 4c4d1df commit 6fcd59a
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 1 deletion.
83 changes: 83 additions & 0 deletions lib/ash_hq/events.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
defmodule AshHq.Events do
@events [
%{
cta: "Tickets On Sale Now!",
title: "Ash Training @ CodeBeam US",
description: """
<p class="font-bold" >
Supercharge Your Elixir Apps with Ash
</p>
<p>
Level up on Ash and hang out with the Ash team at CodeBeam US in San Francisco CA!
</p>
""",
date: ~D[2025-03-05],
date_in_english: "March 5th, 2025",
href: "https://codebeamamerica.com/trainings/supercharge-your-elixir-apps-with-ash/"
},
%{
title: "Ash Training @ AlchemyConf",
description: """
<p class="font-bold">
Supercharge Your Elixir Apps with Ash
</p>
<p>
Level up on Ash and hang out with the Ash team at AlchemyConf in Braga Portugal!
</p>
""",
date: ~D[2025-04-01],
date_in_english: "April 1st, 2025",
href: "https://codebeamamerica.com/trainings/supercharge-your-elixir-apps-with-ash/"
},
%{
title: "Talk @ GigCityElixir 2025",
description: """
<p class="font-bold">
Ash, Igniter and the Middle Way
</p>
<p>
Zach gives a talk on the future of Ash and Igniter, and a first foray into new concepts.
</p>
""",
date: ~D[2025-05-05],
date_in_english: "May 5th, 2025",
href: "https://www.gigcityelixir.com"
},
%{
title: "Talk @ ElixirConf EU",
description: """
<p class="font-bold">
The Next Dimension of Developer Experience
</p>
<p>
Zach gives a talk on Igniter and the massive improvement it can make to the Elixir DX!
</p>
""",
date: ~D[2025-05-15],
date_in_english: "May 15th, 2025",
href: "https://www.elixirconf.eu"
},
%{
title: "Talk @ GOATMIRE",
description: """
<p class="font-bold">
Talk title is a secret ;)
</p>
<p>
Hang out with Zach in Varberg, Sweden
</p>
""",
date: ~D[2025-09-10],
date_in_english: "September 10th, 2025",
href: "https://goatmire.com"
}
]
|> Enum.sort_by(& &1.date, Date)

def events do
today = Date.utc_today()

@events
|> Enum.reject(&(Date.compare(today, &1.date) == :gt))
end
end
18 changes: 18 additions & 0 deletions lib/ash_hq_web/controllers/home_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ defmodule AshHqWeb.HomeController do
contributors = AshHq.Github.Contributor.in_order!()

conn
|> assign_events()
|> assign(:contributor_count, Enum.count(contributors))
|> assign(:contributors, contributors)
|> render("community.html")
end

def media(conn, _) do
conn
|> assign_events()
|> render("media.html")
end

Expand All @@ -23,10 +25,26 @@ defmodule AshHqWeb.HomeController do
conn
|> assign(:url_base, @url_base)
|> assign(:app_name, app_name)
|> assign_events()
|> assign(:safe_app_name, safe(app_name))
|> render("home.html")
end

def events(conn, _) do
conn
|> assign_events()
|> render("events.html")
end

defp assign_events(conn) do
events = AshHq.Events.events()

conn
|> assign(:events_count, Enum.count(events))
|> assign(:next_event, Enum.at(events, 0))
|> assign(:events, events)
end

defp safe(name) do
name
|> String.downcase()
Expand Down
20 changes: 20 additions & 0 deletions lib/ash_hq_web/templates/home/home.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,24 @@
</div>
</div>
</div>

<div class="mt-6 z-10" id="upcoming-events">
<div class="max-w-5xl mx-auto text-center">
<h1 class="text-3xl sm:text-4xl font-bold mb-6 bg-gradient-to-r from-primary-light-400 via-primary-dark-500 to-primary-light-600 bg-clip-text text-transparent drop-shadow-[0_0_10px_rgba(255,87,87,0.3)]">
Upcoming
<span class="bg-gradient-to-r from-primary-dark-500 to-primary-light-500 bg-clip-text text-transparent">
events
</span>
</h1>
<ul class="text-left mx-auto max-w-3xl">
<li :for={event <- @events} class="mb-4 border-b">
<a href={event.href} class="text-xl font-bold">{event.title}</a>
<p class="text-sm text-gray-400">Date: {event.date_in_english}</p>
<p class="text-md">
{{:safe, event.description}}
</p>
</li>
</ul>
</div>
</div>
</div>
4 changes: 4 additions & 0 deletions lib/ash_hq_web/templates/layout/app.html.heex
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<nav class="fixed top-0 w-full z-50 backdrop-blur-lg bg-slate-950/50 border-b border-slate-500/20">
<div :if={@next_event} class="bg-fuchsia-900 w-full py-1 text-center">
<a class="font-bold mr-2" href={@next_event.href}>{@next_event[:cta]}&nbsp{@next_event.title}</a>{@next_event.date_in_english}
<a class="font-extralight" href="/#upcoming-events">&nbsp&nbsp|&nbsp&nbsp See all upcoming events</a>
</div>
<div class="py-2 leading-loose px-4 sm:px-6 lg:px-8">
<div class="hidden md:block relative">
<a href="/" title="Home" class="absolute top-0 left-0">
Expand Down
3 changes: 3 additions & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule AshHq.MixProject do
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(),
start_permanent: Mix.env() == :prod,
consolidate_protocols: Mix.env() != :dev,
aliases: aliases(),
deps: deps(),
dialyzer: [
Expand Down Expand Up @@ -39,6 +40,8 @@ defmodule AshHq.MixProject do
# Type `mix help deps` for examples and options.
defp deps do
[
{:timex, "~> 3.0"},
{:igniter, "~> 0.5", only: [:dev, :test]},
{:ash, "~> 3.3"},
{:ash_postgres, "~> 2.2"},
{:ash_admin, "~> 0.11"},
Expand Down
5 changes: 4 additions & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"certifi": {:hex, :certifi, "2.13.0", "e52be248590050b2dd33b0bb274b56678f9068e67805dca8aa8b1ccdb016bbf6", [:rebar3], [], "hexpm", "8f3d9533a0f06070afdfd5d596b32e21c6580667a492891851b0e2737bc507a1"},
"chacha20": {:hex, :chacha20, "1.0.4", "0359d8f9a32269271044c1b471d5cf69660c362a7c61a98f73a05ef0b5d9eb9e", [:mix], [], "hexpm", "2027f5d321ae9903f1f0da7f51b0635ad6b8819bc7fe397837930a2011bc2349"},
"cloak": {:hex, :cloak, "1.1.4", "aba387b22ea4d80d92d38ab1890cc528b06e0e7ef2a4581d71c3fdad59e997e7", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "92b20527b9aba3d939fab0dd32ce592ff86361547cfdc87d74edce6f980eb3d7"},
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"},
"comeonin": {:hex, :comeonin, "5.5.0", "364d00df52545c44a139bad919d7eacb55abf39e86565878e17cebb787977368", [:mix], [], "hexpm", "6287fc3ba0aad34883cbe3f7949fc1d1e738e5ccdce77165bc99490aa69f47fb"},
"conv_case": {:hex, :conv_case, "0.2.3", "c1455c27d3c1ffcdd5f17f1e91f40b8a0bc0a337805a6e8302f441af17118ed8", [:mix], [], "hexpm", "88f29a3d97d1742f9865f7e394ed3da011abb7c5e8cc104e676fdef6270d4b4a"},
"cowlib": {:hex, :remedy_cowlib, "2.11.1", "7abb4d0779a7d1c655f7642dc0bd0af754951e95005dfa01b500c68fe35a5961", [:rebar3], [], "hexpm", "0b613dc308e080cb6134285f1b1b55c3873e101652e70c70010fc6651c91b130"},
Expand Down Expand Up @@ -62,7 +63,7 @@
"hpax": {:hex, :hpax, "1.0.2", "762df951b0c399ff67cc57c3995ec3cf46d696e41f0bba17da0518d94acd4aac", [:mix], [], "hexpm", "2f09b4c1074e0abd846747329eaa26d535be0eb3d189fa69d812bfb8bfefd32f"},
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"igniter": {:hex, :igniter, "0.5.0", "00984e515c4bcd0aa0cffec83612e19041295f834392c4426e9cb0a67de16eb1", [:mix], [{:glob_ex, "~> 0.1.7", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:rewrite, ">= 1.1.1 and < 2.0.0-0", [hex: :rewrite, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.4", [hex: :sourceror, repo: "hexpm", optional: false]}, {:spitfire, ">= 0.1.3 and < 1.0.0-0", [hex: :spitfire, repo: "hexpm", optional: false]}], "hexpm", "4cbb8acc908343bf79d90697d593b9d1bbce49ae72a0d755664d4cfe897dba53"},
"igniter": {:hex, :igniter, "0.5.16", "3a6cc46f2ac93c8772038d513df5da6ab37aa06538ab96feb9d84b631fbbc073", [:mix], [{:glob_ex, "~> 0.1.7", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:inflex, "~> 2.0", [hex: :inflex, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:owl, "~> 0.11", [hex: :owl, repo: "hexpm", optional: false]}, {:phx_new, "~> 1.7", [hex: :phx_new, repo: "hexpm", optional: true]}, {:req, "~> 0.5", [hex: :req, repo: "hexpm", optional: false]}, {:rewrite, ">= 1.1.1 and < 2.0.0-0", [hex: :rewrite, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.4", [hex: :sourceror, repo: "hexpm", optional: false]}, {:spitfire, ">= 0.1.3 and < 1.0.0-0", [hex: :spitfire, repo: "hexpm", optional: false]}], "hexpm", "b6b5c74ac01541e0cdb296a93f7cc76a783d2020c152c9bc1f314ba0e83e1421"},
"inflex": {:hex, :inflex, "2.1.0", "a365cf0821a9dacb65067abd95008ca1b0bb7dcdd85ae59965deef2aa062924c", [:mix], [], "hexpm", "14c17d05db4ee9b6d319b0bff1bdf22aa389a25398d1952c7a0b5f3d93162dd8"},
"iterex": {:hex, :iterex, "0.1.2", "58f9b9b9a22a55cbfc7b5234a9c9c63eaac26d276b3db80936c0e1c60355a5a6", [:mix], [], "hexpm", "2e103b8bcc81757a9af121f6dc0df312c9a17220f302b1193ef720460d03029d"},
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
Expand Down Expand Up @@ -128,6 +129,8 @@
"telemetry_poller": {:hex, :telemetry_poller, "1.1.0", "58fa7c216257291caaf8d05678c8d01bd45f4bdbc1286838a28c4bb62ef32999", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "9eb9d9cbfd81cbd7cdd24682f8711b6e2b691289a0de6826e58452f28c103c8f"},
"text_diff": {:hex, :text_diff, "0.1.0", "1caf3175e11a53a9a139bc9339bd607c47b9e376b073d4571c031913317fecaa", [:mix], [], "hexpm", "d1ffaaecab338e49357b6daa82e435f877e0649041ace7755583a0ea3362dbd7"},
"thousand_island": {:hex, :thousand_island, "1.3.7", "1da7598c0f4f5f50562c097a3f8af308ded48cd35139f0e6f17d9443e4d0c9c5", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "0139335079953de41d381a6134d8b618d53d084f558c734f2662d1a72818dd12"},
"timex": {:hex, :timex, "3.7.11", "bb95cb4eb1d06e27346325de506bcc6c30f9c6dea40d1ebe390b262fad1862d1", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.20", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "8b9024f7efbabaf9bd7aa04f65cf8dcd7c9818ca5737677c7b76acbc6a94d1aa"},
"tzdata": {:hex, :tzdata, "1.1.2", "45e5f1fcf8729525ec27c65e163be5b3d247ab1702581a94674e008413eef50b", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "cec7b286e608371602318c414f344941d5eb0375e14cfdab605cca2fe66cba8b"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
"websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},
"websock_adapter": {:hex, :websock_adapter, "0.5.8", "3b97dc94e407e2d1fc666b2fb9acf6be81a1798a2602294aac000260a7c4a47d", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "315b9a1865552212b5f35140ad194e67ce31af45bcee443d4ecb96b5fd3f3782"},
Expand Down

0 comments on commit 6fcd59a

Please sign in to comment.