Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stock clubs #16

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@ npm-debug.log

# Ignore generated CSS file for components
assets/css/_components.css

# JS Interop
/assets/js/_hooks/

# Editor config
.vscode/

# Ignore generated js hook files for components
assets/js/_hooks/
4 changes: 3 additions & 1 deletion assets/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ module.exports = {
content: [
"./js/**/*.js",
"../lib/basket_web.ex",
"../lib/basket_web/**/*.*ex"
"../lib/basket_web/**/*.*ex",
"../lib/basket_web/**/*.sface",
"../priv/catalogue/**/*.{ex,sface}"
],
darkMode: "class",
theme: {
Expand Down
1 change: 1 addition & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ config :logger, :console,
config :phoenix, :json_library, Jason

config :basket, :pow,
web_module: BasketWeb,
web_mailer_module: BasketWeb,
user: Basket.Users.User,
repo: Basket.Repo,
Expand Down
4 changes: 3 additions & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ config :basket, BasketWeb.Endpoint,
secret_key_base: "gRiKl5rvtc1Mgj3hhDzBzjHgmPE+PiG47uS8Pxk8KwjZhaaR3WxJ/I6czbmXr0j9",
watchers: [
esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]},
tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]}
tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]},
esbuild: {Esbuild, :install_and_run, [:catalogue, ~w(--sourcemap=inline --watch)]}
]

# ## SSL Support
Expand Down Expand Up @@ -60,6 +61,7 @@ config :basket, BasketWeb.Endpoint,
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/basket_web/(controllers|live|components)/.*(ex|heex|sface|js)$",
~r"lib/my_app_web/live/.*(sface)$",
~r"priv/catalogue/.*(ex)$"
]
]
Expand Down
23 changes: 3 additions & 20 deletions lib/basket_web/components/layouts/app.html.heex
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
<header class="px-4 sm:px-6 lg:px-8">
<div class="flex items-center justify-between border-b border-zinc-100 py-3 text-sm">
<div class="flex items-center justify-start border-b border-zinc-100 py-3 text-sm">
<div class="flex items-center gap-4">
<a href="/">
<img src={~p"/images/logo.svg"} width="36" />
</a>
<p class="bg-brand/5 text-primary rounded-full px-2 font-medium leading-6">
v<%= Application.spec(:phoenix, :vsn) %>
</p>
</div>
<div class="flex items-center gap-4 font-semibold leading-6 text-zinc-900">
<a href="https://twitter.com/elixirphoenix" class="hover:text-zinc-700">
@elixirphoenix
</a>
<a href="https://github.com/phoenixframework/phoenix" class="hover:text-zinc-700">
GitHub
</a>
<a
href="https://hexdocs.pm/phoenix/overview.html"
class="rounded-lg bg-zinc-100 px-2 py-1 hover:bg-zinc-200/80"
>
Get Started <span aria-hidden="true">&rarr;</span>
<a href="https://halyard.systems">
<img src={~p"/images/halyard-systems-logo.svg"} width="36" />
</a>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions lib/basket_web/components/nav_row.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ defmodule BasketWeb.Components.NavRow do
def render(assigns) do
~F"""
<div class="flex flex-row gap-4 items-center justify-end">
<.link to="/settings">Settings</.link>
<.link href="/session" method="delete">Sign out</.link>
</div>
"""
Expand Down
5 changes: 5 additions & 0 deletions lib/basket_web/controllers/pow/registration_html.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule BasketWeb.Pow.RegistrationHTML do
use BasketWeb, :html

embed_templates "registration_html/*"
end
39 changes: 39 additions & 0 deletions lib/basket_web/controllers/pow/registration_html/edit.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<div class="mx-auto max-w-sm">
<.header class="text-center">
Edit Account
</.header>

<.simple_form :let={f} for={@changeset} as={:user} action={@action} phx-update="ignore">
<.error :if={
Pow.Plug.extension_enabled?(@conn, PowResetPassword) && @changeset.data.unconfirmed_email
}>
<span>
Click the link in the confirmation email to change your email to <span class="font-semibold"><%= @changeset.data.unconfirmed_email %></span>.
</span>
</.error>
<.error :if={@changeset.action}>
Oops, something went wrong! Please check the errors below.
</.error>
<.input
field={f[:current_password]}
type="password"
label="Current password"
value={nil}
required
/>
<.input
field={f[Pow.Ecto.Schema.user_id_field(@changeset)]}
type={(Pow.Ecto.Schema.user_id_field(@changeset) == :email && "email") || "text"}
label={Phoenix.Naming.humanize(Pow.Ecto.Schema.user_id_field(@changeset))}
required
/>
<.input field={f[:password]} type="password" label="New password" />
<.input field={f[:password_confirmation]} type="password" label="Confirm new password" />

<:actions>
<.button phx-disable-with="Updating..." class="w-full">
Update <span aria-hidden="true">→</span>
</.button>
</:actions>
</.simple_form>
</div>
35 changes: 35 additions & 0 deletions lib/basket_web/controllers/pow/registration_html/new.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<div class="mx-auto max-w-sm">
<.header class="text-center">
Register
<:subtitle>
Already have an account?
<.link
navigate={Pow.Phoenix.Routes.path_for(@conn, Pow.Phoenix.SessionController, :new)}
class="font-semibold text-brand hover:underline"
>
Sign in
</.link>
now.
</:subtitle>
</.header>

<.simple_form :let={f} for={@changeset} as={:user} action={@action} phx-update="ignore">
<.error :if={@changeset.action}>
Oops, something went wrong! Please check the errors below.
</.error>
<.input
field={f[Pow.Ecto.Schema.user_id_field(@changeset)]}
type={(Pow.Ecto.Schema.user_id_field(@changeset) == :email && "email") || "text"}
label={Phoenix.Naming.humanize(Pow.Ecto.Schema.user_id_field(@changeset))}
required
/>
<.input field={f[:password]} type="password" label="Password" required />
<.input field={f[:password_confirmation]} type="password" label="Confirm password" required />

<:actions>
<.button phx-disable-with="Registering..." class="w-full">
Register <span aria-hidden="true">→</span>
</.button>
</:actions>
</.simple_form>
</div>
5 changes: 5 additions & 0 deletions lib/basket_web/controllers/pow/session_html.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule BasketWeb.Pow.SessionHTML do
use BasketWeb, :html

embed_templates "session_html/*"
end
57 changes: 57 additions & 0 deletions lib/basket_web/controllers/pow/session_html/new.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<div class="mx-auto max-w-sm">
<.header class="text-center mb-3">
Welcome to Basket!
</.header>

<img src={~p"/images/stock_basket.webp"} width="216" class="mx-auto block" />

<.simple_form :let={f} for={@changeset} as={:user} action={@action} phx-update="ignore">
<.error :if={@changeset.action}>
Oops, something went wrong! Please check the errors below.
</.error>
<.input
field={f[Pow.Ecto.Schema.user_id_field(@changeset)]}
type={(Pow.Ecto.Schema.user_id_field(@changeset) == :email && "email") || "text"}
label={Phoenix.Naming.humanize(Pow.Ecto.Schema.user_id_field(@changeset))}
required
/>
<.input field={f[:password]} type="password" label="Password" value={nil} required />

<:actions
:let={f}
:if={
Pow.Plug.extension_enabled?(@conn, PowPersistentSession) ||
Pow.Plug.extension_enabled?(@conn, PowResetPassword)
}
>
<.input
:if={Pow.Plug.extension_enabled?(@conn, PowPersistentSession)}
field={f[:persistent_session]}
type="checkbox"
label="Keep me logged in"
/>
<.link
:if={Pow.Plug.extension_enabled?(@conn, PowResetPassword)}
href={
Pow.Phoenix.Routes.path_for(
@conn,
PowResetPassword.Phoenix.ResetPasswordController,
:new
)
}
class="text-sm font-semibold"
>
Forgot your password?
</.link>
</:actions>

<:actions>
<.button
phx-disable-with="Signing in..."
class="w-full text-black bg-gray-300 hover:bg-gray-400"
>
Sign in <span aria-hidden="true">→</span>
</.button>
</:actions>
</.simple_form>
</div>
57 changes: 29 additions & 28 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -46,41 +46,41 @@ defmodule Basket.MixProject do
# Type `mix help deps` for examples and options.
defp deps do
[
{:phoenix, "~> 1.7.9"},
{:phoenix_ecto, "~> 4.4"},
{:ecto_sql, "~> 3.10"},
{:phoenix, "~> 1.7.14"},
{:phoenix_ecto, "~> 4.6"},
{:ecto_sql, "~> 3.11"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 3.3"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 0.19.5"},
{:floki, ">= 0.30.0", only: :test},
{:phoenix_live_dashboard, "~> 0.8.2"},
{:esbuild, "~> 0.7", runtime: Mix.env() == :dev},
{:tailwind, "~> 0.2.1", runtime: Mix.env() == :dev},
{:swoosh, "~> 1.3"},
{:finch, "~> 0.13"},
{:telemetry_metrics, "~> 0.6"},
{:telemetry_poller, "~> 1.0"},
{:gettext, "~> 0.20"},
{:jason, "~> 1.2"},
{:dns_cluster, "~> 0.1.1"},
{:plug_cowboy, "~> 2.5"},
{:surface, "~> 0.11.1"},
{:phoenix_html, "~> 3.3.1"},
{:phoenix_live_reload, "~> 1.5", only: :dev},
{:phoenix_live_view, "~> 0.20.17"},
{:floki, ">= 0.36.2", only: :test},
{:phoenix_live_dashboard, "~> 0.8.4"},
{:esbuild, "~> 0.8", runtime: Mix.env() == :dev},
{:tailwind, "~> 0.2.3", runtime: Mix.env() == :dev},
{:swoosh, "~> 1.16"},
{:finch, "~> 0.18"},
{:telemetry_metrics, "~> 1.0"},
{:telemetry_poller, "~> 1.1"},
{:gettext, "~> 0.24"},
{:jason, "~> 1.4.1"},
{:dns_cluster, "~> 0.1.3"},
{:plug_cowboy, "~> 2.7"},
{:surface, "~> 0.11.0"},
# for surface.init; possible to remove.
{:sourceror, "~> 0.12.0"},
{:surface_catalogue, "~> 0.6.1"},
{:sourceror, "~> 1.0.0"},
{:surface_catalogue, "~> 0.6.2"},
{:excoveralls, "~> 0.18", only: :test},
{:sobelow, "~> 0.13.0", only: [:dev, :test], runtime: false},
{:credo, "~> 1.7.1", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4.2", runtime: false},
{:mix_audit, "~> 2.1.1", runtime: false},
{:pow, "~> 1.0.34"},
{:credo, "~> 1.7.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4.3", runtime: false},
{:mix_audit, "~> 2.1.3", runtime: false},
{:pow, "~> 1.0.38"},
{:websockex, "~> 0.4.3"},
{:httpoison, "~> 2.1.0"},
{:httpoison, "~> 2.2.1"},
{:cachex, "~> 3.6"},
{:mox, "1.1.0", only: :test},
{:test_server, "~> 0.1", only: :test},
{:ex_machina, "~> 2.7.0", only: :test}
{:ex_machina, "~> 2.8.0", only: :test}
]
end

Expand All @@ -104,7 +104,8 @@ defmodule Basket.MixProject do

def catalogues do
[
"priv/catalogue"
"priv/catalogue",
"deps/surface/priv/catalogue"
]
end
end
Loading
Loading