Skip to content

Commit 658298f

Browse files
committed
feat: add offer section on job page
1 parent 57d6d2c commit 658298f

File tree

2 files changed

+23
-78
lines changed

2 files changed

+23
-78
lines changed

lib/algora/cloud.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ defmodule Algora.Cloud do
3737
call(AlgoraCloud, :get_contribution_score, [job, user, contributions_map])
3838
end
3939

40+
def get_job_offer(assigns) do
41+
call(AlgoraCloud.JobLive, :offer, [assigns])
42+
end
43+
4044
def start do
4145
call(AlgoraCloud, :start, [])
4246
end
@@ -56,7 +60,7 @@ defmodule Algora.Cloud do
5660
defp call(module, function, args) do
5761
if :code.which(module) == :non_existing do
5862
# TODO: call algora API
59-
:ok
63+
nil
6064
else
6165
apply(module, function, args)
6266
end

lib/algora_web/live/org/job_live.ex

Lines changed: 18 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,12 @@ defmodule AlgoraWeb.Org.JobLive do
101101
def handle_params(%{"tab" => "activate"}, uri, socket) do
102102
Algora.Activities.alert("Activate clicked #{uri}", :warning)
103103

104-
socket =
105-
if socket.assigns.current_org.subscription_price,
106-
do: assign(socket, :show_payment_drawer, true),
107-
else: redirect(socket, external: AlgoraWeb.Constants.get(:calendar_url))
104+
socket = redirect(socket, external: AlgoraWeb.Constants.get(:calendar_url))
105+
106+
# socket =
107+
# if socket.assigns.current_org.subscription_price,
108+
# do: assign(socket, :show_payment_drawer, true),
109+
# else: redirect(socket, external: AlgoraWeb.Constants.get(:calendar_url))
108110

109111
{:noreply, assign_new(socket, :current_tab, fn -> default_tab() end)}
110112
end
@@ -339,79 +341,11 @@ defmodule AlgoraWeb.Org.JobLive do
339341
<% end %>
340342
</div>
341343
342-
<.section :if={@current_org.hiring_subscription != :active}>
343-
<div class="border ring-1 ring-transparent rounded-xl overflow-hidden">
344-
<div class="bg-card/75 flex flex-col h-full p-4 rounded-xl border-t-4 sm:border-t-0 sm:border-l-4 border-emerald-400">
345-
<div class="grid md:grid-cols-2 gap-8 p-4 sm:p-6">
346-
<div>
347-
<h3 class="text-3xl font-semibold text-foreground">
348-
<span class="text-success-300 drop-shadow-[0_1px_5px_#34d39980]">Activate</span>
349-
Annual Subscription
350-
</h3>
351-
<ul class="mt-4 text-base grid grid-cols-1 gap-3">
352-
<li class="flex items-center gap-4 md:gap-3">
353-
<div class="shrink-0 flex items-center justify-center rounded-full bg-success-300/10 size-12 md:size-10 border border-success-300/20">
354-
<.icon name="tabler-speakerphone" class="size-8 md:size-6 text-success-300" />
355-
</div>
356-
<span>
357-
<span class="font-semibold text-success-300">Reach 50K+ devs</span>
358-
<br class="md:hidden" /> with unlimited job postings
359-
</span>
360-
</li>
361-
<li class="flex items-center gap-4 md:gap-3">
362-
<div class="shrink-0 flex items-center justify-center rounded-full bg-success-300/10 size-12 md:size-10 border border-success-300/20">
363-
<.icon name="tabler-lock-open" class="size-8 md:size-6 text-success-300" />
364-
</div>
365-
<span>
366-
<span class="font-semibold text-success-300">Access top 1% users</span>
367-
<br class="md:hidden" /> matching your preferences
368-
</span>
369-
</li>
370-
<li class="flex items-center gap-4 md:gap-3">
371-
<div class="shrink-0 flex items-center justify-center rounded-full bg-success-300/10 size-12 md:size-10 border border-success-300/20">
372-
<.icon name="tabler-wand" class="size-8 md:size-6 text-success-300" />
373-
</div>
374-
<span>
375-
<span class="font-semibold text-success-300">Auto-rank applicants</span>
376-
<br class="md:hidden" /> for OSS contribution history
377-
</span>
378-
</li>
379-
<li class="flex items-center gap-4 md:gap-3">
380-
<div class="shrink-0 flex items-center justify-center rounded-full bg-success-300/10 size-12 md:size-10 border border-success-300/20">
381-
<.icon name="tabler-currency-dollar" class="size-8 md:size-6 text-success-300" />
382-
</div>
383-
<span>
384-
<span class="font-semibold text-success-300">Trial top candidates</span>
385-
<br class="md:hidden" /> using contracts and bounties
386-
</span>
387-
</li>
388-
<li class="flex items-center gap-4 md:gap-3">
389-
<div class="shrink-0 flex items-center justify-center rounded-full bg-success-300/10 size-12 md:size-10 border border-success-300/20">
390-
<.icon name="tabler-moneybag" class="size-8 md:size-6 text-success-300" />
391-
</div>
392-
<span>
393-
<span class="font-semibold text-success-300">0% placement fee</span>
394-
<br class="md:hidden" /> for successful hires
395-
</span>
396-
</li>
397-
</ul>
398-
</div>
399-
<div class="flex flex-col justify-center items-center text-center">
400-
<.button
401-
phx-click="show_payment_drawer"
402-
variant="none"
403-
class="group bg-emerald-900/10 text-emerald-300 transition-colors duration-75 hover:bg-emerald-800/10 hover:text-emerald-300 hover:drop-shadow-[0_1px_5px_#34d39980] focus:bg-emerald-800/10 focus:text-emerald-300 focus:outline-none focus:drop-shadow-[0_1px_5px_#34d39980] border border-emerald-400/40 hover:border-emerald-400/50 focus:border-emerald-400/50 h-[8rem]"
404-
size="xl"
405-
>
406-
<div class="flex flex-col items-center gap-1 font-semibold">
407-
<span>Activate subscription</span>
408-
</div>
409-
</.button>
410-
</div>
411-
</div>
412-
</div>
413-
</div>
414-
</.section>
344+
<.offer
345+
:if={@current_org.hiring_subscription != :active}
346+
user={@current_org}
347+
handle={@current_org.handle}
348+
/>
415349
</div>
416350
417351
{share_drawer(assigns)}
@@ -420,6 +354,13 @@ defmodule AlgoraWeb.Org.JobLive do
420354
"""
421355
end
422356

357+
defp offer(assigns) do
358+
case Algora.Cloud.get_job_offer(assigns) do
359+
nil -> ~H""
360+
offer -> offer
361+
end
362+
end
363+
423364
@impl true
424365
def handle_event("show_payment_drawer", _, socket) do
425366
{:noreply, push_patch(socket, to: ~p"/#{socket.assigns.job.user.handle}/jobs/#{socket.assigns.job.id}/activate")}

0 commit comments

Comments
 (0)