Skip to content

Commit

Permalink
Merge pull request #1 from thiagoesteves/thi/add-default-home-supervisor
Browse files Browse the repository at this point in the history
Adding home and supervisor pages
  • Loading branch information
thiagoesteves authored May 24, 2024
2 parents 0d42e83 + e807cc9 commit 0b07d96
Show file tree
Hide file tree
Showing 12 changed files with 175 additions and 34 deletions.
15 changes: 11 additions & 4 deletions lib/calori_web/components/core_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -678,21 +678,27 @@ defmodule CaloriWeb.CoreComponents do
@doc """
Copied/Modified from https://fullstackphoenix.com/tutorials/tailwind-navbar-new-liveview-0-18-components
"""
attr :name, :string, default: "Calori App"
attr :name, :string, default: "Calori Software"

def logo(assigns) do
~H"""
<svg
class="w-10 h-10 p-2 mr-3 text-white rounded-full bg-primary"
class="w-10 h-10 p-1 mr-3 text-black rounded-full bg-white"
xmlns="http://www.w3.org/2000/svg"
fill="none"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
viewBox="0 0 24 24"
viewBox="-8 -4 40 40"
>
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"></path>
<g transform="translate(-291.484 -256.287)">
<path d="M304.462,289.851a12.976,12.976,0,0,1-5.163-24.882l.789,1.838a11,11,0,1,0,7.782-.364l.613-1.9a12.971,12.971,0,0,1-4.021,25.312Z" />
<path d="M299.7,266.884a1,1,0,0,1-1-1v-9.6h10.486v9.2a1,1,0,0,1-2,0v-7.2H300.7v7.6A1,1,0,0,1,299.7,266.884Z" />
<path d="M293.753,280.571l-1.689-1.072c.159-.251,3.989-6.123,13.419-4.129,8.031,1.7,10.357.191,10.379.177l1.225,1.58c-.276.222-2.959,2.12-12.018.2C297.054,275.623,293.883,280.368,293.753,280.571Z" />
</g>
</svg>
<span class="self-center text-xl font-semibold whitespace-nowrap dark:text-white">
Expand All @@ -702,6 +708,7 @@ defmodule CaloriWeb.CoreComponents do
end

slot :logo

slot(:link, required: true) do
attr :to, :string
attr :label, :string
Expand Down
12 changes: 10 additions & 2 deletions lib/calori_web/components/layouts/app.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,25 @@
</.link>
</:logo>
<:link label="Home" to={~p"/home"} />
<:link label="About" to={~p"/home"} />
<:link label="Supervisor" to={~p"/supervisor"} />
</.navbar>
</header>

<main class="relative">
<div class="flex items-center justify-center">
<div class="w-2/12"></div>
<div class="w-8/12 mx-auto">
<div class="w-8/12 mx-auto ">
<.flash_group flash={@flash} />
<%= @inner_content %>
</div>
<div class="w-2/12"></div>
</div>

<footer class="bg-white">
<div class="w-full max-w-screen-xl mx-auto p-2 md:py-6">
<span class="block text-sm text-black sm:text-center">
© 2024 <a href="https://calori.com.br/" class="hover:underline">Calori Software</a>. All Rights Reserved.
</span>
</div>
</footer>
</main>
4 changes: 2 additions & 2 deletions lib/calori_web/components/layouts/root.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} />
<.live_title suffix=" · Beam">
<%= assigns[:page_title] || "Calori" %>
<.live_title suffix="">
<%= assigns[:page_title] || "Calori Software" %>
</.live_title>
<link phx-track-static rel="stylesheet" href={~p"/assets/app.css"} />
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
Expand Down
22 changes: 0 additions & 22 deletions lib/calori_web/live/about.ex

This file was deleted.

99 changes: 99 additions & 0 deletions lib/calori_web/live/home.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
defmodule CaloriWeb.HomeLive do
use CaloriWeb, :live_view

@impl true
def render(assigns) do
~H"""
<div class="relative bg-gray-200 px-6 pb-20 lg:px-8 lg:pt-24 lg:pb-28">
<div class="absolute inset-0">
<div class="h-1/3 bg-gray-100 sm:h-2/3"></div>
</div>
<div class="relative mx-auto max-w-7xl">
<div class="mx-auto grid max-w-lg gap-5 lg:max-w-none lg:grid-cols-3">
<div class="flex flex-col overflow-hidden rounded-lg shadow-lg">
<div class="flex-shrink-0">
<img class="h-48 w-full object-cover" src={~p"/images/blog.png"} alt="" />
</div>
<div class="flex flex-1 flex-col justify-between bg-white p-6">
<div class="flex-1">
<p class="text-sm font-medium text-indigo-600">
<a href="#" class="hover:underline">Blog</a>
</p>
<a href="#" class="mt-2 block">
<p class="text-xl font-semibold text-gray-900">Check out the new articles</p>
<p class="mt-3 text-base text-gray-500">Coming soon...</p>
</a>
</div>
</div>
</div>
<div class="flex flex-col overflow-hidden rounded-lg shadow-lg">
<div class="flex-shrink-0">
<img class="h-48 w-full object-cover" src={~p"/images/who_am_i.png"} alt="" />
</div>
<div class="flex flex-1 flex-col justify-between bg-white p-6">
<div class="flex-1">
<p class="text-sm font-medium text-indigo-600">
<a href={~p"/supervisor"} class="hover:underline">Supervisor</a>
</p>
<a href={~p"/supervisor"} class="mt-2 block">
<p class="text-xl font-semibold text-gray-900">
Who is supervising Calori Software?
</p>
<p class="mt-3 text-base text-gray-500">
If you know about the Erlang or Elixir then you are going to love this one.
</p>
</a>
</div>
</div>
</div>
<div class="flex flex-col overflow-hidden rounded-lg shadow-lg">
<div class="flex-shrink-0">
<img class="h-48 w-full object-cover" src={~p"/images/get_in_touch.png"} alt="" />
</div>
<div class="flex flex-1 flex-col justify-between bg-white p-6">
<div class="flex-1">
<p class="text-sm font-medium text-indigo-600">
<a
href="https://www.linkedin.com/in/thiago-cesar-calori-esteves-972368115/"
class="hover:underline"
>
Contact
</a>
</p>
<a
href="https://www.linkedin.com/in/thiago-cesar-calori-esteves-972368115/"
class="mt-2 block"
>
<p class="text-xl font-semibold text-gray-900">Get in touch!</p>
<button class="bg-blue-500 mt-10 p-2 font-semibold text-white inline-flex items-center space-x-2 rounded">
<svg
class="w-5 h-5 fill-current"
role="img"
viewBox="0 0 256 256"
xmlns="http://www.w3.org/2000/svg"
>
<g>
<path d="M218.123122,218.127392 L180.191928,218.127392 L180.191928,158.724263 C180.191928,144.559023 179.939053,126.323993 160.463756,126.323993 C140.707926,126.323993 137.685284,141.757585 137.685284,157.692986 L137.685284,218.123441 L99.7540894,218.123441 L99.7540894,95.9665207 L136.168036,95.9665207 L136.168036,112.660562 L136.677736,112.660562 C144.102746,99.9650027 157.908637,92.3824528 172.605689,92.9280076 C211.050535,92.9280076 218.138927,118.216023 218.138927,151.114151 L218.123122,218.127392 Z M56.9550587,79.2685282 C44.7981969,79.2707099 34.9413443,69.4171797 34.9391618,57.260052 C34.93698,45.1029244 44.7902948,35.2458562 56.9471566,35.2436736 C69.1040185,35.2414916 78.9608713,45.0950217 78.963054,57.2521493 C78.9641017,63.090208 76.6459976,68.6895714 72.5186979,72.8184433 C68.3913982,76.9473153 62.7929898,79.26748 56.9550587,79.2685282 M75.9206558,218.127392 L37.94995,218.127392 L37.94995,95.9665207 L75.9206558,95.9665207 L75.9206558,218.127392 Z M237.033403,0.0182577091 L18.8895249,0.0182577091 C8.57959469,-0.0980923971 0.124827038,8.16056231 -0.001,18.4706066 L-0.001,237.524091 C0.120519052,247.839103 8.57460631,256.105934 18.8895249,255.9977 L237.033403,255.9977 C247.368728,256.125818 255.855922,247.859464 255.999,237.524091 L255.999,18.4548016 C255.851624,8.12438979 247.363742,-0.133792868 237.033403,0.000790807055">
</path>
</g>
</svg>
<p class="mr-2">Linkedin</p>
</button>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
"""
end

@impl true
def mount(_params, _session, socket) do
{:ok, socket}
end
end
49 changes: 49 additions & 0 deletions lib/calori_web/live/supervisor.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
defmodule CaloriWeb.SupervisorLive do
use CaloriWeb, :live_view

@impl true
def render(assigns) do
~H"""
<%!-- <div class="min-h-screen bg-gray-700 flex flex-col items-center justify-center">
<h1 class="text-5xl text-white font-bold mb-8 animate-pulse">
Coming Soon
</h1>
<p class="text-white text-lg mb-8">
We're working hard to bring you something amazing. Stay tuned!
</p>
</div> --%>
<div class=" flex min-h-screen bg-gray-100 rounded-b-lg ">
<div class="container mt-5 mx-auto md:px-6 ">
<section class="mb-32">
<div class="flex flex-wrap">
<div class="w-full shrink-0 grow-0 basis-auto md:w-3/12 lg:w-4/12">
<img
src={~p"/images/supervisor.png"}
class="mb-6 w-full rounded-lg shadow-lg dark:shadow-black/20"
alt="Avatar"
/>
</div>
<div class="w-full shrink-0 grow-0 basis-auto text-center md:w-9/12 md:pl-6 md:text-left lg:w-8/12">
<h5 class="mb-6 text-xl font-semibold">Who supervises the application?</h5>
<p>
<u><a href="https://calori.com.br/">Calori Software</a></u>
webserver was created using the Erlang Beam VM and the <u><a href="https://www.phoenixframework.org/">Phoenix Liveview Framework</a></u>.
Its source code and all deployment configurations are available at this <u><a href="https://github.com/thiagoesteves/calori">repository</a></u>.
This webserver is also supervised by <u><a href="https://github.com/thiagoesteves/deployex">Deployex</a></u>,
another Phoenix LiveView application specifically designed for supervising Elixir applications. If you want to check real time deployments within calori webserver, just <u><a href="https://deployex.calori.com.br/">click here</a></u>.
</p>
</div>
</div>
</section>
</div>
</div>
"""
end

@impl true
def mount(_params, _session, socket) do
{:ok, socket}
end
end
6 changes: 3 additions & 3 deletions lib/calori_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ defmodule CaloriWeb.Router do
pipe_through :browser

live_session :default do
live "/", AboutLive, :index
live "/home", AboutLive, :index
live "/about", AboutLive, :index
live "/", HomeLive, :index
live "/home", HomeLive, :index
live "/supervisor", SupervisorLive, :index
end
end

Expand Down
Binary file added priv/static/images/blog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/images/get_in_touch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/images/supervisor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/images/who_am_i.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion test/calori_web/controllers/page_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ defmodule CaloriWeb.PageControllerTest do

test "GET /", %{conn: conn} do
conn = get(conn, ~p"/")
assert html_response(conn, 200) =~ "Peace of mind from prototype to production"
assert html_response(conn, 200) =~ "Get in touch!"
end
end

0 comments on commit 0b07d96

Please sign in to comment.