Skip to content

Commit 47860ce

Browse files
committed
feat: improve contract page
1 parent e605808 commit 47860ce

File tree

1 file changed

+33
-26
lines changed

1 file changed

+33
-26
lines changed

lib/algora_web/live/contract_live.ex

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -441,18 +441,18 @@ defmodule AlgoraWeb.ContractLive do
441441
</h1>
442442
<div class="text-sm text-muted-foreground space-x-2">
443443
<span>Created {Calendar.strftime(@bounty.inserted_at, "%b %d, %Y")}</span>
444-
<span
444+
<%!-- <span
445445
:if={@bounty.hours_per_week && @bounty.hours_per_week > 0}
446446
class="space-x-2"
447447
>
448448
<.icon name="tabler-clock" class="h-4 w-4" />
449449
{@bounty.hours_per_week} hours per week
450-
</span>
450+
</span> --%>
451451
</div>
452452
</div>
453453
</div>
454454
<%= if transaction = Enum.find(@transactions, fn tx -> tx.type == :charge and tx.status == :requires_capture end) do %>
455-
<%= if @current_user && @current_user.id == @contractor.id do %>
455+
<%= if @current_user && @current_user.is_admin do %>
456456
<.button
457457
phx-click="accept_contract"
458458
phx-disable-with="Accepting..."
@@ -475,26 +475,14 @@ defmodule AlgoraWeb.ContractLive do
475475
</div>
476476
<% end %>
477477
478-
<%= if @can_create_bounty && @transactions == [] do %>
478+
<%= if @can_create_bounty && @transactions == [] && @bounty.contract_type != :marketplace do %>
479479
<.button phx-click="reward" variant="secondary">
480480
Make payment
481481
</.button>
482482
<% end %>
483483
</div>
484484
</.card_content>
485485
</.card>
486-
<.card :if={@ticket_body_html}>
487-
<.card_header>
488-
<.card_title>
489-
Description
490-
</.card_title>
491-
</.card_header>
492-
<.card_content class="pt-0">
493-
<div class="prose prose-invert">
494-
{Phoenix.HTML.raw(@ticket_body_html)}
495-
</div>
496-
</.card_content>
497-
</.card>
498486
<.card :if={
499487
length(@transactions) == 0 and @can_create_bounty and
500488
@bounty.contract_type == :marketplace
@@ -507,27 +495,34 @@ defmodule AlgoraWeb.ContractLive do
507495
<.card_content class="pt-0">
508496
<div class="flex flex-col xl:flex-row xl:justify-between gap-4">
509497
<ul class="space-y-2">
510-
<li class="flex items-center">
511-
<.icon name="tabler-circle-number-1 mr-2" class="size-8 text-success-400" />
512-
Authorize the payment to share the contract offer with {@contractor.name}
498+
<li class="lg:flex">
499+
<.icon
500+
name="tabler-circle-number-1 mr-2"
501+
class="shrink-0 size-8 text-success-400"
502+
/> Authorize the payment to share the contract offer with {@contractor.name}
513503
</li>
514-
<li class="flex items-center">
515-
<.icon name="tabler-circle-number-2 mr-2" class="size-8 text-success-400" />
516-
When {@contractor.name} accepts, you will be charged
504+
<li class="lg:flex">
505+
<.icon
506+
name="tabler-circle-number-2 mr-2"
507+
class="shrink-0 size-8 text-success-400"
508+
/> When {@contractor.name} accepts, you will be charged
517509
<span class="font-semibold font-display px-1">
518510
{Money.to_string!(
519511
Bounties.final_contract_amount(@bounty.contract_type, @bounty.amount)
520512
)}
521513
</span>
522514
into escrow
523515
</li>
524-
<li class="flex items-center">
525-
<.icon name="tabler-circle-number-3 mr-2" class="size-8 text-success-400" />
516+
<li class="lg:flex">
517+
<.icon
518+
name="tabler-circle-number-3 mr-2"
519+
class="shrink-0 size-8 text-success-400"
520+
/>
526521
At the end of the week, release or withhold the funds based on {@contractor.name}'s performance
527522
</li>
528523
</ul>
529524
530-
<dl class="-mt-12 space-y-4">
525+
<dl class="lg:-mt-12 space-y-4">
531526
<dd class="font-display tabular-nums text-5xl text-success-400 font-bold">
532527
{Money.to_string!(
533528
Bounties.final_contract_amount(@bounty.contract_type, @bounty.amount)
@@ -549,6 +544,18 @@ defmodule AlgoraWeb.ContractLive do
549544
</div>
550545
</.card_content>
551546
</.card>
547+
<.card :if={@ticket_body_html}>
548+
<.card_header>
549+
<.card_title>
550+
Description
551+
</.card_title>
552+
</.card_header>
553+
<.card_content class="pt-0">
554+
<div class="prose prose-invert">
555+
{Phoenix.HTML.raw(@ticket_body_html)}
556+
</div>
557+
</.card_content>
558+
</.card>
552559
<.card :if={length(@transactions) > 0}>
553560
<.card_header>
554561
<.card_title>
@@ -1077,7 +1084,7 @@ defmodule AlgoraWeb.ContractLive do
10771084
tx.type == :charge or
10781085
(tx.type == :debit and tx.status in [:succeeded, :requires_release])
10791086

1080-
socket.assigns.current_user.id == socket.assigns.contractor.id ->
1087+
socket.assigns[:current_user] && socket.assigns.current_user.id == socket.assigns.contractor.id ->
10811088
tx.type == :credit and tx.status == :succeeded
10821089

10831090
true ->

0 commit comments

Comments
 (0)