Skip to content

Commit 5ec84aa

Browse files
committed
refactor: conditionally render share badge and image in dashboard layout for better organization
1 parent 882ec6f commit 5ec84aa

File tree

1 file changed

+36
-34
lines changed

1 file changed

+36
-34
lines changed

lib/algora_web/live/org/dashboard_live.ex

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,41 +1246,43 @@ defmodule AlgoraWeb.Org.DashboardLive do
12461246
<% end %>
12471247
</ol>
12481248
</nav>
1249-
<div class="pt-12 flex items-center justify-between">
1250-
<h2 class="text-xl font-semibold leading-none tracking-tight">Share your bounty board</h2>
1251-
</div>
1252-
<.badge
1253-
id="og-url"
1254-
phx-hook="CopyToClipboard"
1255-
data-value={url(~p"/org/#{@current_org.handle}/home")}
1256-
data-notice="Copied to clipboard!"
1257-
phx-click={
1258-
%JS{}
1259-
|> JS.hide(
1260-
to: "#og-url-copy-icon",
1261-
transition: {"transition-opacity", "opacity-100", "opacity-0"}
1262-
)
1263-
|> JS.show(
1264-
to: "#og-url-check-icon",
1265-
transition: {"transition-opacity", "opacity-0", "opacity-100"}
1266-
)
1267-
}
1268-
class="relative cursor-pointer mt-3 text-foreground/90 hover:text-foreground"
1269-
variant="outline"
1270-
>
1271-
<.icon id="og-url-copy-icon" name="tabler-copy" class="absolute left-1 my-auto size-4 mr-2" />
1272-
<.icon
1273-
id="og-url-check-icon"
1274-
name="tabler-check"
1275-
class="absolute left-1 my-auto hidden size-4 mr-2"
1249+
<%= if @current_org.handle do %>
1250+
<div class="pt-12 flex items-center justify-between">
1251+
<h2 class="text-xl font-semibold leading-none tracking-tight">Share your bounty board</h2>
1252+
</div>
1253+
<.badge
1254+
id="og-url"
1255+
phx-hook="CopyToClipboard"
1256+
data-value={url(~p"/org/#{@current_org.handle}/home")}
1257+
data-notice="Copied to clipboard!"
1258+
phx-click={
1259+
%JS{}
1260+
|> JS.hide(
1261+
to: "#og-url-copy-icon",
1262+
transition: {"transition-opacity", "opacity-100", "opacity-0"}
1263+
)
1264+
|> JS.show(
1265+
to: "#og-url-check-icon",
1266+
transition: {"transition-opacity", "opacity-0", "opacity-100"}
1267+
)
1268+
}
1269+
class="relative cursor-pointer mt-3 text-foreground/90 hover:text-foreground"
1270+
variant="outline"
1271+
>
1272+
<.icon id="og-url-copy-icon" name="tabler-copy" class="absolute left-1 my-auto size-4 mr-2" />
1273+
<.icon
1274+
id="og-url-check-icon"
1275+
name="tabler-check"
1276+
class="absolute left-1 my-auto hidden size-4 mr-2"
1277+
/>
1278+
<span class="pl-4">{AlgoraWeb.Endpoint.host()}{~p"/org/#{@current_org.handle}/home"}</span>
1279+
</.badge>
1280+
<img
1281+
src={~p"/og/org/#{@current_org.handle}/home"}
1282+
alt={@current_org.name}
1283+
class="mt-3 w-full aspect-[1200/630] rounded-lg ring-1 ring-input bg-black"
12761284
/>
1277-
<span class="pl-4">{AlgoraWeb.Endpoint.host()}{~p"/org/#{@current_org.handle}/home"}</span>
1278-
</.badge>
1279-
<img
1280-
src={~p"/og/org/#{@current_org.handle}/home"}
1281-
alt={@current_org.name}
1282-
class="mt-3 w-full aspect-[1200/630] rounded-lg ring-1 ring-input bg-black"
1283-
/>
1285+
<% end %>
12841286
<div class="fixed right-0 bottom-0 hidden w-96 p-4 pr-0 pt-6 sm:p-6 sm:pr-0 md:py-8 md:pr-0 lg:grid lg:grid-cols-2 gap-2 gap-x-4 text-sm">
12851287
<div class="flex items-center gap-2">
12861288
<div class="flex -space-x-2">

0 commit comments

Comments
 (0)