Skip to content

Commit 4f12707

Browse files
committed
fix: ci
1 parent 99be5b8 commit 4f12707

File tree

11 files changed

+43
-33
lines changed

11 files changed

+43
-33
lines changed

lib/safira/activities.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ defmodule Safira.Activities do
5151
42
5252
5353
"""
54-
def get_activities_count() do
54+
def get_activities_count do
5555
Activity
5656
|> Repo.aggregate(:count, :id)
5757
end

lib/safira/companies.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ defmodule Safira.Companies do
5151
42
5252
5353
"""
54-
def get_companies_count() do
54+
def get_companies_count do
5555
Company
5656
|> Repo.aggregate(:count, :id)
5757
end

lib/safira_web/components/dropdown.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
defmodule SafiraWeb.Components.Dropdown do
2+
@moduledoc """
3+
A dropdown component.
4+
"""
25
use Phoenix.Component
36

47
alias Phoenix.LiveView.JS

lib/safira_web/components/link.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
defmodule SafiraWeb.Components.Link do
2+
@moduledoc """
3+
A component for rendering links.
4+
"""
25
use Phoenix.Component
36

47
attr :class, :any, default: nil, doc: "CSS class for link (either a string or list)"
@@ -24,7 +27,8 @@ defmodule SafiraWeb.Components.Link do
2427
"""
2528
end
2629

27-
# Since the <a> tag can't be disabled, we turn it into a disabled button (looks exactly the same and does nothing when clicked)
30+
# Since the <a> tag can't be disabled, we turn it into a disabled button.
31+
# (looks exactly the same and does nothing when clicked)
2832
def a(%{disabled: true, link_type: type} = assigns) when type != "button" do
2933
a(Map.put(assigns, :link_type, "button"))
3034
end

lib/safira_web/live/landing/components/navbar.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ defmodule SafiraWeb.Landing.Components.Navbar do
5151
/>
5252
</:trigger_element>
5353
<.dropdown_menu_item
54-
:if={is_user_type?(@current_user, :staff)}
54+
:if={user_type?(@current_user, :staff)}
5555
link_type="live_patch"
5656
to="/dashboard/attendees"
5757
label="Dashboard"
5858
/>
5959
<.dropdown_menu_item
60-
:if={is_user_type?(@current_user, :attendee)}
60+
:if={user_type?(@current_user, :attendee)}
6161
link_type="live_patch"
6262
to="/app"
6363
label="App"
@@ -104,14 +104,14 @@ defmodule SafiraWeb.Landing.Components.Navbar do
104104
<.join_us />
105105
</div>
106106
<.link
107-
:if={is_user_type?(@current_user, :staff)}
107+
:if={user_type?(@current_user, :staff)}
108108
patch={~p"/dashboard/attendees"}
109109
class="font-terminal uppercase text-3xl text-white transition-colors duration-75 ease-in hover:text-accent"
110110
>
111111
Dashboard
112112
</.link>
113113
<.link
114-
:if={is_user_type?(@current_user, :attendee)}
114+
:if={user_type?(@current_user, :attendee)}
115115
patch={~p"/app"}
116116
class="font-terminal uppercase text-3xl text-white transition-colors duration-75 ease-in hover:text-accent"
117117
>
@@ -160,7 +160,7 @@ defmodule SafiraWeb.Landing.Components.Navbar do
160160
|> JS.dispatch("js:call", to: "#show-mobile-navbar", detail: %{call: "focus", args: []})
161161
end
162162

163-
defp is_user_type?(user, type) do
163+
defp user_type?(user, type) do
164164
user && user.type == type
165165
end
166166
end

lib/safira_web/live/landing/components/schedule.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ defmodule SafiraWeb.Landing.Components.Schedule do
8888
<%= if index != 0, do: "," %>
8989
</span>
9090
<% end %>
91-
<.link navigate={~p"/speakers/#{speaker.id}"} class="my-[0.4em] hover:underline">
91+
<.link navigate={~p"/"} class="my-[0.4em] hover:underline">
9292
<%= speaker.name %>
9393
</.link>
9494
</li>

lib/safira_web/live/landing/faqs_live/index.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule SafiraWeb.Landing.FAQLive.Index do
22
use SafiraWeb, :landing_view
33

4-
alias Safira.{Companies, Event}
4+
alias Safira.Event
55
import SafiraWeb.Landing.FAQLive.Components.{Faq, FindUs}
66

77
@impl true

lib/safira_web/live/landing/home_live/components/speakers.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule SafiraWeb.Landing.HomeLive.Components.Speakers do
1515
Here's a selection of this year's speakers
1616
</h2>
1717
<div class="xs:w-70 w-60 sm:w-80">
18-
<.link navigate={~p"/speakers"}>
18+
<.link navigate={~p"/"}>
1919
<.action_button title="MEET THE SPEAKERS" title_class="!text-lg !font-iregular font-bold" />
2020
</.link>
2121
</div>

priv/repo/seeds/activities.exs

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ defmodule Safira.Repo.Seeds.Activities do
111111
break: Enum.find(category_list, fn category -> category.name == "Break" end)
112112
}
113113

114+
seed_first_day_activities(categories, speakers)
115+
seed_last_days_activities(categories, speakers)
116+
end
117+
118+
defp seed_first_day_activities(categories, speakers) do
114119
for activity <- first_day_seed_data() do
115120
type = activity.type
116121
changeset = Activities.change_activity(%Activity{},
@@ -120,18 +125,11 @@ defmodule Safira.Repo.Seeds.Activities do
120125
|> Map.put(:title, Map.get(activity, :title) || Faker.Company.bs() |> String.capitalize())
121126
|> Map.put(:location, Map.get(activity, :location) || "CP2 - B1"))
122127

123-
case Repo.insert(changeset) do
124-
{:ok, activity} ->
125-
speaker_ids = Enum.take_random(speakers, :rand.uniform(3))
126-
if type in [:talk, :pitch, :wokshop] do
127-
Activities.upsert_activity_speakers(Map.put(activity, :speakers, []), speaker_ids)
128-
end
129-
{:error, changeset} ->
130-
Mix.shell().error("Failed to insert activity: #{activity.title}")
131-
Mix.shell().error(Kernel.inspect(changeset.errors))
132-
end
128+
insert_activity(changeset, type, speakers)
133129
end
130+
end
134131

132+
defp seed_last_days_activities(categories, speakers) do
135133
for i <- 1..3 do
136134
for activity <- last_days_seed_data() do
137135
type = activity.type
@@ -142,20 +140,24 @@ defmodule Safira.Repo.Seeds.Activities do
142140
|> Map.put(:title, Map.get(activity, :title) || Faker.Company.bs() |> String.capitalize())
143141
|> Map.put(:location, Map.get(activity, :location) || "CP2 - B1"))
144142

145-
case Repo.insert(changeset) do
146-
{:ok, activity} ->
147-
speaker_ids = Enum.take_random(speakers, :rand.uniform(3))
148-
if type in [:talk, :pitch, :workshop] do
149-
Activities.upsert_activity_speakers(Map.put(activity, :speakers, []), speaker_ids)
150-
end
151-
{:error, changeset} ->
152-
Mix.shell().error("Failed to insert activity: #{activity.title}")
153-
Mix.shell().error(Kernel.inspect(changeset.errors))
154-
end
143+
insert_activity(changeset, type, speakers)
155144
end
156145
end
157146
end
158147

148+
defp insert_activity(changeset, type, speakers) do
149+
case Repo.insert(changeset) do
150+
{:ok, activity} ->
151+
speaker_ids = Enum.take_random(speakers, :rand.uniform(3))
152+
if type in [:talk, :pitch, :workshop] do
153+
Activities.upsert_activity_speakers(Map.put(activity, :speakers, []), speaker_ids)
154+
end
155+
{:error, changeset} ->
156+
Mix.shell().error("Failed to insert activity: #{changeset.title}")
157+
Mix.shell().error(Kernel.inspect(changeset.errors))
158+
end
159+
end
160+
159161
defp next_first_tuesday_of_february do
160162
today = Date.utc_today()
161163
{year, _, _} = Date.to_erl(today)

priv/repo/seeds/event.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ defmodule Safira.Repo.Seeds.Event do
1313
end
1414
end
1515

16-
defp seed_faqs() do
16+
defp seed_faqs do
1717
@faqs
1818
|> Enum.each(fn faq ->
1919
%{

0 commit comments

Comments
 (0)