Packages

What if GitHub gists, AWS Lambdas and Elixir Plugs had a baby?

Current section

Files

Jump to
vik lib vik_web live home_live.ex
Raw

lib/vik_web/live/home_live.ex

defmodule VikWeb.HomeLive do
@moduledoc false
use VikWeb, :live_view
on_mount VikWeb.Auth
on_mount {VikWeb.SystemHandler, :static}
@impl true
def mount(_params, _session, socket) do
{:ok, socket, if socket.assigns.authenticated? do [] else [layout: false] end}
end
@impl true
def render(assigns) when assigns.authenticated? do
~H"{live_render @socket, VikWeb.DashboardLive, id: :list}"
end
@impl true
def render(assigns) do
~H"""
<div class="max-w-[600px] mt-[3em] mx-auto flex flex-col items-center">
<.logo width="100px" />
<h1 class="mt-4 text-4xl">is it just smoke and mirrors</h1>
<p class="mt-6 flex gap-2 items-center">
<a class="bg-black text-white hover:opacity-90 px-2 py-1" href={~p"/login"}>login</a>
<a class="hover:opacity-90"href={~p"/api/hello"}>demo</a>
</p>
</div>
"""
end
# Logo created with: (in Firefox on MacOS)
# <p style="font-family:monospace;font-size:50px;display:flex;align-items:center;margin-left:1em;">\/||<span style="font-size:1.65em;font-weight:300;margin-left:-6px;">&lt;</span></p>
attr :width, :string, default: "200px"
attr :color, :string, default: "currentColor"
defp logo(assigns) do
~H"""
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width={@width} viewBox="0 0 1438 614">
<g transform="translate(0, 614) scale(0.1,-0.1)" fill={@color} stroke="none">
<path d="M13628 5642 c-1 -4 -109 -100 -238 -213 -129 -113 -242 -212 -250
-220 -8 -8 -46 -41 -85 -74 -38 -33 -72 -62 -75 -65 -3 -3 -61 -55 -130 -115
-69 -60 -127 -112 -130 -115 -3 -3 -36 -32 -75 -65 -38 -33 -72 -62 -75 -65
-3 -3 -61 -55 -130 -115 -69 -60 -127 -112 -130 -115 -3 -3 -36 -32 -75 -65
-38 -33 -90 -78 -115 -101 -25 -23 -106 -94 -180 -159 -153 -133 -258 -225
-274 -240 -28 -26 -255 -224 -291 -254 -22 -18 -60 -52 -85 -75 -25 -23 -135
-120 -245 -216 -110 -96 -202 -177 -205 -180 -3 -3 -33 -30 -67 -59 -35 -30
-63 -60 -63 -66 0 -12 55 -64 245 -230 50 -44 92 -82 95 -85 3 -3 37 -32 75
-65 39 -33 90 -78 115 -101 25 -23 63 -57 85 -75 50 -42 264 -229 325 -285 25
-23 63 -57 85 -75 22 -19 78 -68 125 -109 180 -158 234 -205 244 -215 31 -29
256 -225 291 -254 22 -18 60 -52 85 -75 25 -23 77 -68 115 -101 39 -33 72 -62
75 -65 3 -3 61 -55 130 -115 69 -60 127 -112 130 -115 3 -3 36 -32 75 -65 38
-33 90 -78 115 -101 25 -23 106 -94 180 -158 74 -65 167 -146 205 -180 124
-111 142 -126 153 -126 15 0 196 198 200 219 2 11 -58 70 -184 181 -103 91
-192 170 -198 175 -10 9 -207 182 -291 256 -16 14 -73 64 -125 110 -52 46
-131 116 -175 154 -44 38 -82 72 -85 75 -3 3 -61 54 -130 115 -69 60 -127 112
-130 115 -3 3 -95 84 -205 180 -110 96 -202 177 -205 180 -3 3 -77 68 -165
145 -88 77 -180 159 -205 181 -25 23 -65 59 -90 79 -25 20 -65 56 -90 79 -25
22 -77 68 -115 101 -39 33 -72 62 -75 65 -3 3 -47 43 -97 89 -51 46 -93 89
-93 96 0 8 35 44 78 81 42 36 97 85 122 108 25 22 77 68 115 101 39 33 90 78
115 101 25 23 65 59 90 79 25 20 65 56 90 79 25 23 77 68 115 101 39 33 72 62
75 65 3 3 46 41 95 85 50 43 122 106 160 140 39 35 135 120 215 190 80 70 159
139 175 154 17 14 86 76 155 136 69 60 127 112 130 115 3 3 77 68 165 145 88
77 162 142 165 145 3 4 100 89 215 190 315 276 385 341 385 357 0 9 -31 48
-69 87 -38 39 -80 83 -93 99 -24 25 -62 36 -70 19z"/>
<path d="M390 5622 c0 -11 53 -161 130 -367 28 -77 76 -205 105 -285 29 -80
85 -232 124 -337 39 -106 103 -280 142 -385 39 -106 95 -258 124 -338 29 -80
85 -233 125 -340 40 -107 96 -262 127 -345 30 -82 60 -166 68 -185 8 -19 38
-102 68 -185 31 -82 87 -238 127 -345 40 -107 96 -260 125 -340 51 -140 112
-304 265 -720 40 -107 96 -260 125 -340 29 -80 85 -233 125 -340 39 -107 79
-214 87 -237 l16 -43 188 0 188 0 19 53 c28 74 79 212 162 437 73 200 124 338
250 680 40 107 96 260 125 340 29 80 85 231 123 335 39 105 103 278 142 385
75 205 96 261 235 640 48 129 111 300 140 380 29 80 85 233 125 340 40 107 96
263 127 345 30 83 60 166 68 185 8 19 38 103 68 185 71 192 184 500 252 682
29 78 50 145 47 148 -3 3 -78 5 -167 5 l-163 0 -12 -32 c-6 -18 -18 -49 -25
-68 -8 -19 -38 -102 -68 -185 -31 -82 -87 -238 -127 -345 -157 -425 -214 -581
-267 -725 -30 -82 -86 -235 -125 -340 -134 -364 -211 -571 -273 -740 -35 -93
-95 -255 -133 -360 -39 -104 -103 -278 -142 -385 -84 -229 -181 -493 -389
-1057 -38 -104 -93 -252 -122 -331 -29 -78 -55 -142 -59 -142 -3 0 -12 17 -19
37 -7 21 -18 54 -26 73 -7 19 -38 103 -68 185 -31 83 -87 238 -127 345 -170
460 -215 583 -267 725 -30 83 -60 166 -68 185 -8 19 -38 103 -68 185 -56 153
-148 404 -263 715 -128 346 -184 498 -254 690 -40 107 -76 204 -80 215 -5 11
-33 88 -63 170 -30 83 -87 238 -127 345 -40 107 -103 278 -140 380 -38 102
-91 246 -118 320 l-50 135 -166 3 c-93 1 -166 -1 -166 -6z"/>
<path d="M6387 5624 c-4 -4 -7 -1161 -7 -2571 l0 -2563 165 0 165 0 -2 2567
-3 2568 -156 3 c-85 1 -158 -1 -162 -4z"/>
<path d="M9120 3060 l0 -2570 160 0 160 0 0 2570 0 2570 -160 0 -160 0 0
-2570z"/>
</g>
</svg>
"""
end
end