diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 49c0764..3f9c14e 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -2,6 +2,6 @@ class DashboardController < ApplicationController before_action :require_user_signed_in def index - @current_section = :dashboard + @current_section = :services end end diff --git a/app/controllers/wallet_controller.rb b/app/controllers/services/lightning_controller.rb similarity index 93% rename from app/controllers/wallet_controller.rb rename to app/controllers/services/lightning_controller.rb index a7920d4..a6b7381 100644 --- a/app/controllers/wallet_controller.rb +++ b/app/controllers/services/lightning_controller.rb @@ -1,6 +1,6 @@ require "rqrcode" -class WalletController < ApplicationController +class Services::LightningController < ApplicationController before_action :require_user_signed_in before_action :authenticate_with_lndhub before_action :set_current_section @@ -42,7 +42,7 @@ class WalletController < ApplicationController end def set_current_section - @current_section = :wallet + @current_section = :services end def fetch_balance @@ -78,6 +78,7 @@ class WalletController < ApplicationController tx["received"] = true else tx["amount_sats"] = tx["value"] || tx["amt"] + tx["fee"] = tx["type"] == "paid_invoice" ? tx["fee"] : nil tx["datetime"] = Time.at(tx["timestamp"].to_i) tx["title"] = tx["type"] == "paid_invoice" ? "Sent" : "Received" tx["description"] = tx["memo"] || tx["description"] diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index 9e24f78..8b90fc0 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -43,9 +43,9 @@
- <%= link_to wallet_path, + <%= link_to services_lightning_index_path, class: "block h-full px-6 py-6 rounded-md" do %> -

Wallet

+

Lightning Network

Send and receive sats over the Bitcoin Lightning Network

diff --git a/app/views/notification_mailer/lightning_sats_received.text.erb b/app/views/notification_mailer/lightning_sats_received.text.erb index 1e122d4..22becf6 100644 --- a/app/views/notification_mailer/lightning_sats_received.text.erb +++ b/app/views/notification_mailer/lightning_sats_received.text.erb @@ -1,3 +1,3 @@ You just received <%= number_with_delimiter @amount_sats %> sats in your Lightning account (<%= @user.address %>). Check your wallet app, or open the account page for details: -<%= wallet_transactions_url %> +<%= transactions_lightning_index_url %> diff --git a/app/views/wallet/index.html.erb b/app/views/services/lightning/index.html.erb similarity index 97% rename from app/views/wallet/index.html.erb rename to app/views/services/lightning/index.html.erb index 4a4a37f..fda9558 100644 --- a/app/views/wallet/index.html.erb +++ b/app/views/services/lightning/index.html.erb @@ -1,9 +1,9 @@ -<%= render HeaderComponent.new(title: "Wallet") %> +<%= render HeaderComponent.new(title: "Lightning Network") %> <%= render MainSimpleComponent.new do %> <%= render WalletSummaryComponent.new(balance: @balance) %> - <%= render partial: "shared/tabnav_wallet" %> + <%= render partial: "shared/tabnav_lightning" %>

Lightning Address

diff --git a/app/views/wallet/transactions.html.erb b/app/views/services/lightning/transactions.html.erb similarity index 84% rename from app/views/wallet/transactions.html.erb rename to app/views/services/lightning/transactions.html.erb index 44859e3..0f11698 100644 --- a/app/views/wallet/transactions.html.erb +++ b/app/views/services/lightning/transactions.html.erb @@ -1,9 +1,9 @@ -<%= render HeaderComponent.new(title: "Wallet") %> +<%= render HeaderComponent.new(title: "Lightning Network") %> <%= render MainSimpleComponent.new do %> <%= render WalletSummaryComponent.new(balance: @balance) %> - <%= render partial: "shared/tabnav_wallet" %> + <%= render partial: "shared/tabnav_lightning" %>
@@ -27,7 +27,7 @@

"> <%= tx["received"] ? "+" : "" %><%= number_with_delimiter tx["amount_sats"] %> - + sats

@@ -35,7 +35,10 @@

- <%= tx["datetime"].strftime("%B %e, %H:%M") %> + <%= tx["datetime"].strftime("%B %e, %H:%M") -%> + <% if tx["fee"] && (tx["fee"] > 0) %> + ~ Fee: <%= pluralize tx["fee"], "sat" %> + <% end %>

diff --git a/app/views/shared/_main_nav.html.erb b/app/views/shared/_main_nav.html.erb index 7f5ee02..7fb011b 100644 --- a/app/views/shared/_main_nav.html.erb +++ b/app/views/shared/_main_nav.html.erb @@ -1,10 +1,8 @@ <%= link_to "Services", root_path, - class: main_nav_class(@current_section, :dashboard) %> -<%= link_to "Contributions", contributions_donations_path, - class: main_nav_class(@current_section, :contributions) %> + class: main_nav_class(@current_section, :services) %> <%= link_to "Invitations", invitations_path, class: main_nav_class(@current_section, :invitations) %> -<%= link_to "Wallet", wallet_path, - class: main_nav_class(@current_section, :wallet) %> +<%= link_to "Contributions", contributions_donations_path, + class: main_nav_class(@current_section, :contributions) %> <%= link_to "Settings", settings_path, class: main_nav_class(@current_section, :settings) %> diff --git a/app/views/shared/_tabnav_lightning.html.erb b/app/views/shared/_tabnav_lightning.html.erb new file mode 100644 index 0000000..b9f6f09 --- /dev/null +++ b/app/views/shared/_tabnav_lightning.html.erb @@ -0,0 +1,14 @@ +
+
+ +
+
diff --git a/app/views/shared/_tabnav_wallet.html.erb b/app/views/shared/_tabnav_wallet.html.erb deleted file mode 100644 index abdc5ad..0000000 --- a/app/views/shared/_tabnav_wallet.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -
-
- -
-
diff --git a/config/routes.rb b/config/routes.rb index fdc8454..c8dd8a4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,8 +18,13 @@ Rails.application.routes.draw do resources :invitations, only: ['index', 'show', 'create', 'destroy'] - get 'wallet', to: 'wallet#index' - get 'wallet/transactions', to: 'wallet#transactions' + namespace :services do + resources :lightning, only: [:index] do + collection do + get 'transactions' + end + end + end resources :settings, param: 'section', only: ['index', 'show', 'update'] do collection do