|
15 | 15 | </.header>
|
16 | 16 |
|
17 | 17 | <.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> |
19 | 22 | <: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> |
21 | 25 | </:col>
|
22 | 26 | <: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> |
24 | 31 | </:col>
|
25 | 32 | <: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}> |
27 | 35 | <%= truncate_elipsis(link.url, 50) %>
|
28 | 36 | </.link>
|
29 | 37 | </: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> |
31 | 44 | <: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"}"} /> |
33 | 47 | </:col>
|
34 | 48 | <:action :let={{_id, link}}>
|
| 49 | + <% publish_future = link.publish_at && DateTime.compare(link.publish_at, DateTime.utc_now()) == :gt %> |
35 | 50 | <.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"}"} /> |
37 | 52 | </.link>
|
38 | 53 | </:action>
|
39 | 54 | <:action :let={{_id, link}}>
|
| 55 | + <% publish_future = link.publish_at && DateTime.compare(link.publish_at, DateTime.utc_now()) == :gt %> |
40 | 56 | <.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"}"} /> |
42 | 58 | </.link>
|
43 | 59 | </:action>
|
44 | 60 | </.table>
|
|
0 commit comments