Skip to content

Commit d3f6b3d

Browse files
committed
fix: update contract status conditions and improve achievements display logic
- Modified contract status checks to include :paid status for active contracts in the organization dashboard. - Adjusted visibility conditions for achievements section in both organization and user dashboards to only display when there are multiple achievements. - Enhanced the layout of the achievements section for better user experience and clarity.
1 parent 9efbdf7 commit d3f6b3d

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

lib/algora_web/live/org/dashboard_live.ex

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,15 +1208,15 @@ defmodule AlgoraWeb.Org.DashboardLive do
12081208
</.button>
12091209
12101210
<.button
1211-
:if={@contract_for_user && @contract_for_user.status == :active}
1211+
:if={@contract_for_user && @contract_for_user.status in [:active, :paid]}
12121212
navigate={~p"/org/#{@current_org.handle}/contracts/#{@contract_for_user.id}"}
12131213
variant="none"
12141214
class="bg-emerald-800/10 text-emerald-300 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/50 focus:border-emerald-400/50"
12151215
>
12161216
<.icon name="tabler-contract" class="size-4 text-current mr-2 -ml-1" /> Contract
12171217
</.button>
12181218
<.button
1219-
:if={@contract_for_user && @contract_for_user.status in [:draft, :paid]}
1219+
:if={@contract_for_user && @contract_for_user.status in [:draft]}
12201220
navigate={~p"/org/#{@current_org.handle}/contracts/#{@contract_for_user.id}"}
12211221
variant="none"
12221222
class="bg-gray-800/10 text-gray-400 drop-shadow-[0_1px_5px_#94a3b880] focus:bg-gray-800/10 focus:text-gray-400 focus:outline-none focus:drop-shadow-[0_1px_5px_#94a3b880] border border-gray-400/50 focus:border-gray-400/50"
@@ -1362,26 +1362,26 @@ defmodule AlgoraWeb.Org.DashboardLive do
13621362
defp sidebar(assigns) do
13631363
~H"""
13641364
<aside class="scrollbar-thin fixed top-16 right-0 bottom-0 hidden w-96 h-full overflow-y-auto border-l border-border bg-background p-4 pt-6 sm:p-6 md:p-8 lg:flex lg:flex-col">
1365-
<div class="flex items-center justify-between">
1365+
<div :if={length(@achievements) > 1} class="pb-12">
13661366
<h2 class="text-xl font-semibold leading-none tracking-tight">Getting started</h2>
1367+
<nav class="pt-6">
1368+
<ol role="list" class="space-y-6">
1369+
<%= for achievement <- @achievements do %>
1370+
<li class="space-y-6">
1371+
<.achievement achievement={achievement} />
1372+
<.achievement_todo
1373+
achievement={achievement}
1374+
current_user={@current_user}
1375+
secret_code={@secret_code}
1376+
login_form={@login_form}
1377+
/>
1378+
</li>
1379+
<% end %>
1380+
</ol>
1381+
</nav>
13671382
</div>
1368-
<nav class="pt-6">
1369-
<ol role="list" class="space-y-6">
1370-
<%= for achievement <- @achievements do %>
1371-
<li class="space-y-6">
1372-
<.achievement achievement={achievement} />
1373-
<.achievement_todo
1374-
achievement={achievement}
1375-
current_user={@current_user}
1376-
secret_code={@secret_code}
1377-
login_form={@login_form}
1378-
/>
1379-
</li>
1380-
<% end %>
1381-
</ol>
1382-
</nav>
13831383
<%= if @current_org.handle do %>
1384-
<div :if={not incomplete?(@achievements, :create_bounty_status)} class="pt-12">
1384+
<div :if={not incomplete?(@achievements, :create_bounty_status)}>
13851385
<div class="flex items-center justify-between">
13861386
<h2 class="text-xl font-semibold leading-none tracking-tight">Share your bounty board</h2>
13871387
</div>

lib/algora_web/live/user/dashboard_live.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ defmodule AlgoraWeb.User.DashboardLive do
221221
</.error>
222222
</div>
223223
<!-- Achievements Section -->
224-
<div class="hidden lg:block mt-8">
224+
<div :if={length(@achievements) > 1} class="hidden lg:block mt-8">
225225
<h2 class="text-xl font-semibold leading-none tracking-tight">Achievements</h2>
226226
<nav class="pt-4">
227227
<ol role="list" class="space-y-6">

0 commit comments

Comments
 (0)