@@ -11,7 +30,7 @@
in USD
Public name
Date
-
+
@@ -23,11 +42,13 @@
<% if donation.amount_eur.present? %><%= number_to_currency donation.amount_eur / 100, unit: "" %><% end %>
<% if donation.amount_usd.present? %><%= number_to_currency donation.amount_usd / 100, unit: "" %><% end %>
<%= donation.public_name %>
- <%= donation.paid_at ? donation.paid_at.strftime("%Y-%m-%d") : "" %>
- <%= link_to 'Show', admin_donation_path(donation), class: 'btn btn-sm btn-gray' %>
- <%= link_to 'Edit', edit_admin_donation_path(donation), class: 'btn btn-sm btn-gray' %>
- <%= link_to 'Destroy', admin_donation_path(donation), class: 'btn btn-sm btn-red',
- data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' } %>
+ <%= donation.paid_at ? donation.paid_at.strftime("%Y-%m-%d (%H:%M UTC)") : "" %>
+
+ <%= link_to 'Show', admin_donation_path(donation), class: 'btn btn-sm btn-gray' %>
+ <%= link_to 'Edit', edit_admin_donation_path(donation), class: 'btn btn-sm btn-gray' %>
+ <%= link_to 'Destroy', admin_donation_path(donation), class: 'btn btn-sm btn-red',
+ data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' } %>
+
<% end %>
@@ -37,6 +58,7 @@
No donations yet.
<% end %>
+
<%= link_to 'Record an out-of-system donation', new_admin_donation_path, class: 'btn-md btn-gray' %>
diff --git a/app/views/admin/invitations/index.html.erb b/app/views/admin/invitations/index.html.erb
index 4bad1fb..1bc5517 100644
--- a/app/views/admin/invitations/index.html.erb
+++ b/app/views/admin/invitations/index.html.erb
@@ -2,16 +2,28 @@
<%= render MainSimpleComponent.new do %>
-
- There are currently <%= @invitations_unused_count %>
- unused invitations available to existing users.
- <%= @users_with_referrals_count %> users have successfully
- invited new users.
-
+ <%= render QuickstatsContainerComponent.new do %>
+ <%= render QuickstatsItemComponent.new(
+ type: :number,
+ title: 'Available',
+ value: @stats[:available],
+ ) %>
+ <%= render QuickstatsItemComponent.new(
+ type: :number,
+ title: 'Accepted',
+ value: @stats[:accepted],
+ ) %>
+ <%= render QuickstatsItemComponent.new(
+ type: :number,
+ title: 'Users with referrals',
+ value: @stats[:users_with_referrals],
+ meta: "/ #{User.count}"
+ ) %>
+ <% end %>
<% if @invitations_used.any? %>
- Accepted (<%= @invitations_used.length %>)
+ Recently Accepted
diff --git a/app/views/admin/lightning/index.html.erb b/app/views/admin/lightning/index.html.erb
new file mode 100644
index 0000000..902186c
--- /dev/null
+++ b/app/views/admin/lightning/index.html.erb
@@ -0,0 +1,48 @@
+<%= render HeaderComponent.new(title: "Lightning Network") %>
+
+<%= render MainSimpleComponent.new do %>
+
+ <%= render QuickstatsContainerComponent.new do %>
+ <%= render QuickstatsItemComponent.new(
+ type: :number,
+ title: 'Current user balance',
+ value: @ln[:current_balance],
+ unit: 'sats'
+ ) %>
+ <%= render QuickstatsItemComponent.new(
+ type: :number,
+ title: 'Users with sats',
+ value: @ln[:users_with_sats],
+ meta: "/ #{User.count}"
+ ) %>
+ <% end %>
+
+
+
+ Accounts
+
+
+
+ LN Account
+ User
+ Balance
+
+
+
+ <% @accounts.each do |account| %>
+
+
+ <%= account.login[0, 8] %>...<%= account.login[12, 19] %>
+
+
+ <% if user = @users.find{ |u| u[2] == account.login } %>
+ <%= "#{user[0]}@#{user[1]}" %>
+ <% end %>
+
+ <%= number_with_delimiter account.balance.to_i.to_s %>
+
+ <% end %>
+
+
+
+<% end %>
diff --git a/app/views/settings/account/index.html.erb b/app/views/settings/account/index.html.erb
index 708a174..279d37d 100644
--- a/app/views/settings/account/index.html.erb
+++ b/app/views/settings/account/index.html.erb
@@ -4,10 +4,10 @@
Password
Use the following button to request an email with a password reset link:
-
- <%= form_with(url: settings_reset_password_path, method: :post) do %>
+ <%= form_with(url: settings_reset_password_path, method: :post) do %>
+
<%= submit_tag("Send me a password reset link", class: 'btn-md btn-gray w-full sm:w-auto') %>
- <% end %>
-
+
+ <% end %>
<% end %>
diff --git a/app/views/shared/_admin_nav.html.erb b/app/views/shared/_admin_nav.html.erb
index 881cd93..b7ef06e 100644
--- a/app/views/shared/_admin_nav.html.erb
+++ b/app/views/shared/_admin_nav.html.erb
@@ -1,8 +1,10 @@
<%= link_to "Dashboard", admin_root_path,
class: main_nav_class(@current_section, :dashboard) %>
+<%= link_to "Users", admin_ldap_users_path,
+ class: main_nav_class(@current_section, :ldap_users) %>
<%= link_to "Invitations", admin_invitations_path,
class: main_nav_class(@current_section, :invitations) %>
<%= link_to "Donations", admin_donations_path,
class: main_nav_class(@current_section, :donations) %>
-<%= link_to "LDAP Users", admin_ldap_users_path,
- class: main_nav_class(@current_section, :ldap_users) %>
+<%= link_to "Lightning", admin_lightning_path,
+ class: main_nav_class(@current_section, :lightning) %>
diff --git a/config/database.yml b/config/database.yml
index 10df6c5..49b5c31 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -10,21 +10,40 @@ default: &default
timeout: 5000
development:
- <<: *default
- database: db/development.sqlite3
+ primary:
+ <<: *default
+ database: db/development.sqlite3
+ # lndhub:
+ # <<: *default
+ # database: db/lndhub.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
- <<: *default
- database: db/test.sqlite3
+ primary:
+ <<: *default
+ database: db/test.sqlite3
+ lndhub:
+ <<: *default
+ database_tasks: false
+ database: db/test.lndhub.sqlite3
production:
- <<: *default
- adapter: postgresql
- database: akkounts
- port: 5432
- host: <%= Rails.application.credentials.postgres[:host] rescue nil %>
- username: <%= Rails.application.credentials.postgres[:username] rescue nil %>
- password: <%= Rails.application.credentials.postgres[:password] rescue nil %>
+ primary:
+ <<: *default
+ adapter: postgresql
+ database: akkounts
+ port: 5432
+ host: <%= Rails.application.credentials.postgres[:host] rescue nil %>
+ username: <%= Rails.application.credentials.postgres[:username] rescue nil %>
+ password: <%= Rails.application.credentials.postgres[:password] rescue nil %>
+ lndhub:
+ <<: *default
+ adapter: postgresql
+ database_tasks: false
+ database: lndhub
+ port: 5432
+ host: <%= Rails.application.credentials.postgres[:host] rescue nil %>
+ username: <%= Rails.application.credentials.postgres[:username] rescue nil %>
+ password: <%= Rails.application.credentials.postgres[:password] rescue nil %>
diff --git a/config/routes.rb b/config/routes.rb
index 5ed99bd..00475c5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -39,9 +39,10 @@ Rails.application.routes.draw do
namespace :admin do
root to: 'dashboard#index'
- get 'invitations', to: 'invitations#index'
get 'ldap_users', to: 'ldap_users#index'
+ get 'invitations', to: 'invitations#index'
resources :donations
+ get 'lightning', to: 'lightning#index'
end
authenticate :user, ->(user) { user.is_admin? } do
diff --git a/public/img/illustrations/undraw_vault_re_s4my.svg b/public/img/illustrations/undraw_vault_re_s4my.svg
new file mode 100644
index 0000000..408326c
--- /dev/null
+++ b/public/img/illustrations/undraw_vault_re_s4my.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/spec/components/quickstats_container_component_spec.rb b/spec/components/quickstats_container_component_spec.rb
new file mode 100644
index 0000000..9ac0406
--- /dev/null
+++ b/spec/components/quickstats_container_component_spec.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+
+RSpec.describe QuickstatsContainerComponent, type: :component do
+ pending "add some examples to (or delete) #{__FILE__}"
+
+ # it "renders something useful" do
+ # expect(
+ # render_inline(described_class.new(attr: "value")) { "Hello, components!" }.css("p").to_html
+ # ).to include(
+ # "Hello, components!"
+ # )
+ # end
+end
diff --git a/spec/components/quickstats_item_component_spec.rb b/spec/components/quickstats_item_component_spec.rb
new file mode 100644
index 0000000..c886c37
--- /dev/null
+++ b/spec/components/quickstats_item_component_spec.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+
+RSpec.describe QuickstatsItemComponent, type: :component do
+ pending "add some examples to (or delete) #{__FILE__}"
+
+ # it "renders something useful" do
+ # expect(
+ # render_inline(described_class.new(attr: "value")) { "Hello, components!" }.css("p").to_html
+ # ).to include(
+ # "Hello, components!"
+ # )
+ # end
+end