Skip to content

Commit 5a1be77

Browse files
feat: opacity in schedul link
1 parent 426dc0f commit 5a1be77

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

lib/cesium_link_web/live/link_live/index.html.heex

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,46 @@
1515
</.header>
1616

1717
<.table id="links" rows={@streams.links} phx-hook="Sorting">
18-
<:col :let={{_id, _link}}><.icon name="hero-bars-3 cursor-pointer ml-4" class="handle w-5 h-5" /></:col>
18+
<:col :let={{_id, _link}}>
19+
<% publish_future = _link.publish_at && DateTime.compare(_link.publish_at, DateTime.utc_now()) == :gt %>
20+
<.icon name="hero-bars-3 cursor-pointer ml-4" class={"handle w-5 h-5 #{if publish_future, do: "opacity-50"}"} />
21+
</:col>
1922
<:col :let={{_id, link}} label="Name">
20-
<p class="font-semibold text-zinc-900"><%= link.name %></p>
23+
<% publish_future = link.publish_at && DateTime.compare(link.publish_at, DateTime.utc_now()) == :gt %>
24+
<p class={"font-semibold text-zinc-900 #{if publish_future, do: "opacity-50"}"}><%= link.name %></p>
2125
</:col>
2226
<:col :let={{_id, link}} label="Emoji">
23-
<.emoji code={link.emoji} />
27+
<% publish_future = link.publish_at && DateTime.compare(link.publish_at, DateTime.utc_now()) == :gt %>
28+
<span class={if publish_future, do: "opacity-50"}>
29+
<.emoji code={link.emoji} />
30+
</span>
2431
</:col>
2532
<:col :let={{_id, link}} label="URL">
26-
<.link target="_blank" class="hover:text-brand hover:underline" navigate={link.url}>
33+
<% publish_future = link.publish_at && DateTime.compare(link.publish_at, DateTime.utc_now()) == :gt %>
34+
<.link target="_blank" class={"hover:text-brand hover:underline #{if publish_future, do: "opacity-50"}"} navigate={link.url}>
2735
<%= truncate_elipsis(link.url, 50) %>
2836
</.link>
2937
</:col>
30-
<:col :let={{_id, link}} label="Clicks"><%= link.visits %></:col>
38+
<:col :let={{_id, link}} label="Clicks">
39+
<% publish_future = link.publish_at && DateTime.compare(link.publish_at, DateTime.utc_now()) == :gt %>
40+
<p class={if publish_future, do: "opacity-50"}>
41+
<%= link.visits %>
42+
</p>
43+
</:col>
3144
<:col :let={{_id, link}} label="Attention">
32-
<input type="checkbox" disabled={true} checked={link.attention} class="self-center block rounded-md text-gray-600" />
45+
<% publish_future = link.publish_at && DateTime.compare(link.publish_at, DateTime.utc_now()) == :gt %>
46+
<input type="checkbox" disabled={true} checked={link.attention} class={"self-center block rounded-md text-gray-600 #{if publish_future, do: "opacity-50"}"} />
3347
</:col>
3448
<:action :let={{_id, link}}>
49+
<% publish_future = link.publish_at && DateTime.compare(link.publish_at, DateTime.utc_now()) == :gt %>
3550
<.link patch={~p"/admin/links/#{link}/edit"}>
36-
<.icon name="hero-pencil" class="w-5 h-5" />
51+
<.icon name="hero-pencil" class={"w-5 h-5 #{if publish_future, do: "opacity-50"}"} />
3752
</.link>
3853
</:action>
3954
<:action :let={{_id, link}}>
55+
<% publish_future = link.publish_at && DateTime.compare(link.publish_at, DateTime.utc_now()) == :gt %>
4056
<.link patch={~p"/admin/links/#{link}/archive"}>
41-
<.icon name="hero-archive-box" class="w-5 h-5" />
57+
<.icon name="hero-archive-box" class={"w-5 h-5 #{if publish_future, do: "opacity-50"}"} />
4258
</.link>
4359
</:action>
4460
</.table>

0 commit comments

Comments
 (0)