diff --git a/.formatter.exs b/.formatter.exs index 11181c6..287dfce 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -11,5 +11,5 @@ "priv/*/seeds.exs" ], &Path.wildcard(&1, match_dot: true) - ) -- [".scratch.ex", ".notes.ex"] + ) -- [".scratch.ex", ".notes.ex", "lib/bike_shop_web/components/core_components.ex"] ] diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e6e91ce..8406a6a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -117,26 +117,7 @@ jobs: mix deps.get mix ecto.create - name: Check Test Coverage - # run: mix coveralls.html - run: mix coveralls.github - run_tests: - - uses: actions/checkout@v3 - - name: Set up Elixir - uses: erlef/setup-beam@61e01a43a562a89bfc54c7f9a378ff67b03e4a21 # v1.16.0 - strategy: - matrix: - elixir: [1.14] - otp: [26.0] # [Required] Define the Erlang/OTP version - - name: Restore dependencies cache - uses: actions/cache@v3 - with: - path: deps - key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} - restore-keys: ${{ runner.os }}-mix- - - name: Install dependencies - run: mix deps.get - - name: Run tests - run: mix test + run: mix coveralls.html services: pg: image: postgres:12 diff --git a/README.md b/README.md index 7bdbfae..eb6d3e0 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ # BikesOfBurningMan BikeShop __Demo BikeShop Built with Phoenix LiveView__ -![dialyxir check](https://github.com/marka2g/bike_shop/actions/workflows/dialyxir.yml/badge.svg) -![tests passing](https://github.com/marka2g/bike_shop/actions/workflows/tests.yml/badge.svg) -![security check](https://github.com/marka2g/bike_shop/actions/workflows/security.yml/badge.svg) - +![build status](https://github.com/marka2g/bike_shop/actions/workflows/main.yml/badge.svg) ## Notable Dependencies >1. [credo](https://github.com/rrrene/credo) - static code analysis tool for Elixir diff --git a/coveralls.json b/coveralls.json index 919221c..d755d56 100644 --- a/coveralls.json +++ b/coveralls.json @@ -9,7 +9,8 @@ "lib/bike_shop_web/components/core_components.ex", "lib/bike_shop_web/components/layouts.ex", "lib/bike_shop/repo.ex", - "lib/bike_shop_web/controllers/error_html" + "lib/bike_shop_web/controllers/error_html", + "lib/bike_shop_web/components/layouts/top_nav_component.ex" ], "coverage_options": { "treat_no_relevant_lines_as_covered": true, diff --git a/lib/bike_shop_web/components/core_components.ex b/lib/bike_shop_web/components/core_components.ex index df5bd2c..27ce44f 100644 --- a/lib/bike_shop_web/components/core_components.ex +++ b/lib/bike_shop_web/components/core_components.ex @@ -16,9 +16,11 @@ defmodule BikeShopWeb.CoreComponents do """ use Phoenix.Component - alias Phoenix.LiveView.JS import BikeShopWeb.Gettext + alias Phoenix.HTML.Form + alias Phoenix.LiveView.JS + @doc """ Renders a modal. @@ -50,7 +52,7 @@ defmodule BikeShopWeb.CoreComponents do data-cancel={JS.exec(@on_cancel, "phx-remove")} class="relative z-50 hidden" > -
+- <.icon :if={@kind == :info} name="hero-information-circle-mini" class="h-4 w-4" /> - <.icon :if={@kind == :error} name="hero-exclamation-circle-mini" class="h-4 w-4" /> + <.icon :if={@kind == :info} name="hero-information-circle-mini" class="w-4 h-4" /> + <.icon :if={@kind == :error} name="hero-exclamation-circle-mini" class="w-4 h-4" /> <%= @title %>
<%= msg %>
-+
<.icon name="hero-exclamation-circle-mini" class="mt-0.5 h-5 w-5 flex-none" /> <%= render_slot(@inner_block) %>
@@ -466,18 +468,18 @@ defmodule BikeShopWeb.CoreComponents do end ~H""" -<%= col[:label] %> | +<%= col[:label] %> | <%= gettext("Actions") %> |
---|---|---|
-
+
<%= render_slot(col, @row_item.(row)) %>
|
-
-
-
+
+ |
+
@@ -577,7 +579,7 @@ defmodule BikeShopWeb.CoreComponents do
## Examples
<.icon name="hero-x-mark-solid" />
- <.icon name="hero-arrow-path" class="ml-1 w-3 h-3 animate-spin" />
+ <.icon name="hero-arrow-path" class="w-3 h-3 ml-1 animate-spin" />
"""
attr :name, :string, required: true
attr :class, :string, default: nil
diff --git a/lib/bike_shop_web/components/layouts/root.html.heex b/lib/bike_shop_web/components/layouts/root.html.heex
index aa8fb7d..ec7a328 100644
--- a/lib/bike_shop_web/components/layouts/root.html.heex
+++ b/lib/bike_shop_web/components/layouts/root.html.heex
@@ -13,6 +13,7 @@
-
+
diff --git a/lib/bike_shop_web/components/layouts/top_nav_component.ex b/lib/bike_shop_web/components/layouts/top_nav_component.ex
new file mode 100644
index 0000000..b2cba51
--- /dev/null
+++ b/lib/bike_shop_web/components/layouts/top_nav_component.ex
@@ -0,0 +1,40 @@
+defmodule BikeShopWeb.TopNavComponent do
+ use BikeShopWeb, :html
+
+ def menu(assigns) do
+ ~H"""
+
+ """
+ end
+end
diff --git a/lib/bike_shop_web/controllers/page_controller.ex b/lib/bike_shop_web/controllers/page_controller.ex
deleted file mode 100644
index 81188d0..0000000
--- a/lib/bike_shop_web/controllers/page_controller.ex
+++ /dev/null
@@ -1,9 +0,0 @@
-defmodule BikeShopWeb.PageController do
- use BikeShopWeb, :controller
-
- def home(conn, _params) do
- # The home page is often custom made,
- # so skip the default app layout.
- render(conn, :home, layout: false)
- end
-end
diff --git a/lib/bike_shop_web/controllers/page_html.ex b/lib/bike_shop_web/controllers/page_html.ex
deleted file mode 100644
index f764a5a..0000000
--- a/lib/bike_shop_web/controllers/page_html.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule BikeShopWeb.PageHTML do
- use BikeShopWeb, :html
-
- embed_templates "page_html/*"
-end
diff --git a/lib/bike_shop_web/controllers/page_html/home.html.heex b/lib/bike_shop_web/controllers/page_html/home.html.heex
deleted file mode 100644
index e9fc48d..0000000
--- a/lib/bike_shop_web/controllers/page_html/home.html.heex
+++ /dev/null
@@ -1,222 +0,0 @@
-<.flash_group flash={@flash} />
-
-
-
diff --git a/lib/bike_shop_web/shop/shop_live.ex b/lib/bike_shop_web/shop/shop_live.ex
index aca2977..fed4be0 100644
--- a/lib/bike_shop_web/shop/shop_live.ex
+++ b/lib/bike_shop_web/shop/shop_live.ex
@@ -7,7 +7,16 @@ defmodule BikeShopWeb.ShopLive do
def render(assigns) do
~H"""
-
-
-
-- Phoenix Framework - - v<%= Application.spec(:phoenix, :vsn) %> - --- Peace of mind from prototype to production. - -- Build rich, interactive web applications quickly, with less code and fewer moving parts. Join our growing community of developers using Phoenix to craft APIs, HTML5 apps and more, for fun or at scale. - -
-
-
- Bikes Of Burning Man
+
+
"""
end
end
diff --git a/priv/static/images/logo.png b/priv/static/images/logo.png
new file mode 100644
index 0000000..2790f48
Binary files /dev/null and b/priv/static/images/logo.png differ
diff --git a/priv/static/images/logo.svg b/priv/static/images/logo.svg
deleted file mode 100644
index 9f26bab..0000000
--- a/priv/static/images/logo.svg
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/test/bike_shop_web/controllers/page_controller_test.exs b/test/bike_shop_web/controllers/page_controller_test.exs
deleted file mode 100644
index 566b93c..0000000
--- a/test/bike_shop_web/controllers/page_controller_test.exs
+++ /dev/null
@@ -1,8 +0,0 @@
-defmodule BikeShopWeb.PageControllerTest do
- use BikeShopWeb.ConnCase
-
- test "GET /", %{conn: conn} do
- conn = get(conn, ~p"/")
- assert html_response(conn, 200) =~ "Peace of mind from prototype to production"
- end
-end
diff --git a/test/bike_shop_web/live/shop_live_test.exs b/test/bike_shop_web/live/shop_live_test.exs
new file mode 100644
index 0000000..d1db795
--- /dev/null
+++ b/test/bike_shop_web/live/shop_live_test.exs
@@ -0,0 +1,10 @@
+defmodule BikeShopWeb.ShopLiveTest do
+ use BikeShopWeb.ConnCase
+ import Phoenix.LiveViewTest
+
+ test "load all bikes section", %{conn: conn} do
+ {:ok, view, _html} = live(conn, ~p"/")
+
+ assert has_element?(view, "[data-role=all-bikes-section]")
+ end
+end
diff --git a/test/support/data_case.ex b/test/support/data_case.ex
index 12c764e..94a6210 100644
--- a/test/support/data_case.ex
+++ b/test/support/data_case.ex
@@ -15,6 +15,8 @@ defmodule BikeShop.DataCase do
"""
use ExUnit.CaseTemplate
+ alias BikeShop.DataCase
+ alias Ecto.Adapters.SQL.Sandbox
using do
quote do
@@ -28,7 +30,7 @@ defmodule BikeShop.DataCase do
end
setup tags do
- BikeShop.DataCase.setup_sandbox(tags)
+ DataCase.setup_sandbox(tags)
:ok
end
@@ -36,8 +38,8 @@ defmodule BikeShop.DataCase do
Sets up the sandbox based on the test tags.
"""
def setup_sandbox(tags) do
- pid = Ecto.Adapters.SQL.Sandbox.start_owner!(BikeShop.Repo, shared: not tags[:async])
- on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end)
+ pid = Sandbox.start_owner!(BikeShop.Repo, shared: not tags[:async])
+ on_exit(fn -> Sandbox.stop_owner(pid) end)
end
@doc """
All Bikes+
+
+ |