Skip to content

Commit d62e8d4

Browse files
committed
refactor: improve conditional rendering for contractor details in contract view
- Updated the rendering logic for contractor location and timezone to use conditional attributes for better clarity and performance. - Ensured that the location and timezone elements are only displayed when relevant data is present, enhancing the user interface.
1 parent a85b900 commit d62e8d4

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

lib/algora_web/live/contract/view_live.ex

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -301,16 +301,20 @@ defmodule AlgoraWeb.Contract.ViewLive do
301301
<% end %>
302302
</div>
303303
<div class="space-y-2 pt-6">
304-
<div class="flex items-center gap-2 text-sm text-muted-foreground">
304+
<div
305+
:if={@contract.contractor.location}
306+
class="flex items-center gap-2 text-sm text-muted-foreground"
307+
>
305308
<.icon name="tabler-map-pin" class="h-4 w-4" />
306309
{@contract.contractor.location}
307310
</div>
308-
<%= if @contract.contractor.timezone do %>
309-
<div class="flex items-center gap-2 text-sm text-muted-foreground">
310-
<.icon name="tabler-clock" class="h-4 w-4" />
311-
{Algora.Time.friendly_timezone(@contract.contractor.timezone)}
312-
</div>
313-
<% end %>
311+
<div
312+
:if={@contract.contractor.timezone}
313+
class="flex items-center gap-2 text-sm text-muted-foreground"
314+
>
315+
<.icon name="tabler-clock" class="h-4 w-4" />
316+
{Algora.Time.friendly_timezone(@contract.contractor.timezone)}
317+
</div>
314318
</div>
315319
</.card_content>
316320
</.card>

0 commit comments

Comments
 (0)