Skip to content

Commit 15628fc

Browse files
committed
Trim Phoenix assets and boilerplate
1 parent 523b05e commit 15628fc

17 files changed

Lines changed: 49 additions & 281 deletions

File tree

assets/js/app.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,23 @@
1515
// import "some-package"
1616
//
1717

18-
// Include phoenix_html to handle method=PUT/DELETE in forms and buttons.
19-
import "phoenix_html"
2018
// Establish Phoenix Socket and LiveView configuration.
2119
import {Socket} from "phoenix"
2220
import {LiveSocket} from "phoenix_live_view"
23-
import topbar from "../vendor/topbar"
2421

2522
let Hooks = {}
2623

2724
const isInitialPageLoadEvent = (event) => event?.detail?.kind === "initial"
2825

26+
window.addEventListener("click", event => {
27+
const el = event.target instanceof Element ? event.target.closest("[data-confirm]") : null
28+
29+
if (el && !window.confirm(el.dataset.confirm)) {
30+
event.preventDefault()
31+
event.stopImmediatePropagation()
32+
}
33+
}, true)
34+
2935
Hooks.TimezoneHook = {
3036
mounted() {
3137
this.setTimezone();
@@ -178,17 +184,6 @@ let liveSocket = new LiveSocket(socketUrl, Socket, {
178184
hooks: Hooks
179185
})
180186

181-
// Show progress bar on live navigation and form submits
182-
topbar.config({barColors: {0: "#29d"}, shadowColor: "rgba(0, 0, 0, .3)"})
183-
window.addEventListener("phx:page-loading-start", event => {
184-
if (isInitialPageLoadEvent(event)) return
185-
topbar.show(300)
186-
})
187-
window.addEventListener("phx:page-loading-stop", event => {
188-
if (isInitialPageLoadEvent(event)) return
189-
topbar.hide()
190-
})
191-
192187
// connect if there are any LiveViews on the page
193188
liveSocket.connect()
194189

assets/vendor/topbar.js

Lines changed: 0 additions & 165 deletions
This file was deleted.

config/config.exs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,12 @@ config :reencodarr, ReencodarrWeb.Endpoint,
6666
pubsub_server: Reencodarr.PubSub,
6767
live_view: [signing_salt: "mUVP8kuz"]
6868

69-
# Configures the mailer
70-
#
71-
# By default it uses the "Local" adapter which stores the emails
72-
# locally. You can see the emails in your browser, at "/dev/mailbox".
73-
#
74-
# For production it's recommended to configure a different adapter
75-
# at the `config/runtime.exs`.
76-
config :reencodarr, Reencodarr.Mailer, adapter: Swoosh.Adapters.Local
77-
7869
# Configure esbuild (the version is required)
7970
config :esbuild,
8071
version: "0.17.11",
8172
reencodarr: [
8273
args:
83-
~w(js/app.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*),
74+
~w(js/app.js --bundle --target=es2020 --outdir=../priv/static/assets --external:/fonts/* --external:/images/* --legal-comments=none),
8475
cd: Path.expand("../assets", __DIR__),
8576
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
8677
]

config/dev.exs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ config :reencodarr, ReencodarrWeb.Endpoint,
7272
]
7373
]
7474

75-
# Enable dev routes for dashboard and mailbox
75+
# Enable dev routes for dashboards
7676
config :reencodarr, dev_routes: true
7777

7878
# Do not include metadata nor timestamps in development logs
@@ -102,8 +102,5 @@ config :phoenix_live_view,
102102
# Enable helpful, but potentially expensive runtime checks
103103
enable_expensive_runtime_checks: true
104104

105-
# Disable swoosh api client as it is only required for production adapters.
106-
config :swoosh, :api_client, false
107-
108105
# Load local overrides from dev.overrides.exs if exists
109106
if File.exists?("config/dev.overrides.exs"), do: import_config("dev.overrides.exs")

config/prod.exs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ import Config
88
config :reencodarr, ReencodarrWeb.Endpoint,
99
cache_static_manifest: "priv/static/cache_manifest.json"
1010

11-
# Configures Swoosh API Client
12-
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: Reencodarr.Finch
13-
14-
# Disable Swoosh Local Memory Storage
15-
config :swoosh, local: false
16-
1711
# Do not print debug messages in production
1812
config :logger, level: :info
1913

config/runtime.exs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,4 @@ if config_env() == :prod do
148148
# force_ssl: [hsts: true]
149149
#
150150
# Check `Plug.SSL` for all available options in `force_ssl`.
151-
152-
# ## Configuring the mailer
153-
#
154-
# In production you need to configure the mailer to use a different adapter.
155-
# Also, you may need to configure the Swoosh API client of your choice if you
156-
# are not using SMTP. Here is an example of the configuration:
157-
#
158-
# config :reencodarr, Reencodarr.Mailer,
159-
# adapter: Swoosh.Adapters.Mailgun,
160-
# api_key: System.get_env("MAILGUN_API_KEY"),
161-
# domain: System.get_env("MAILGUN_DOMAIN")
162-
#
163-
# For this example you need include a HTTP client required by Swoosh API client.
164-
# Swoosh supports Hackney and Finch out of the box:
165-
#
166-
# config :swoosh, :api_client, Swoosh.ApiClient.Hackney
167-
#
168-
# See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details.
169151
end

config/test.exs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,10 @@ config :reencodarr, ReencodarrWeb.Endpoint,
2323
secret_key_base: "A4oKjY781OHfIZq4JFru4uL2Z6REsXa7Y+0txG2z4wrWGsYYtMwXv/nFfqnqKTKo",
2424
server: false
2525

26-
# In test we don't send emails
27-
config :reencodarr, Reencodarr.Mailer, adapter: Swoosh.Adapters.Test
28-
29-
# Disable swoosh api client as it is only required for production adapters
30-
config :swoosh, :api_client, false
31-
3226
# Print only warnings and errors during test
3327
config :logger, level: :warning
3428

35-
# Disable dev routes (LiveDashboard, mailbox preview) during test
29+
# Disable dev routes during test
3630
config :reencodarr, dev_routes: false
3731

3832
# Initialize plugs at runtime for faster test compilation

lib/reencodarr/application.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ defmodule Reencodarr.Application do
107107
Reencodarr.DbWriter,
108108
{DNSCluster, query: Application.get_env(:reencodarr, :dns_cluster_query) || :ignore},
109109
{Phoenix.PubSub, name: Reencodarr.PubSub},
110-
# Start the Finch HTTP client for sending emails
110+
# Start the Finch HTTP client for outbound API requests.
111111
{Finch, name: Reencodarr.Finch},
112112
# Start to serve requests, typically the last entry
113113
ReencodarrWeb.Endpoint,

lib/reencodarr/mailer.ex

Lines changed: 0 additions & 3 deletions
This file was deleted.

lib/reencodarr_web/controllers/page_controller.ex

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)