Merge pull request 'Show fees of Lightning transactions' (#122) from feature/lightning_fees into master
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #122 Reviewed-by: hueso <hueso@noreply.kosmos.org> Reviewed-by: bumi <bumi@noreply.kosmos.org>
This commit is contained in:
commit
cddc1e86f6
@ -2,6 +2,6 @@ class DashboardController < ApplicationController
|
||||
before_action :require_user_signed_in
|
||||
|
||||
def index
|
||||
@current_section = :dashboard
|
||||
@current_section = :services
|
||||
end
|
||||
end
|
||||
|
@ -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"]
|
@ -43,9 +43,9 @@
|
||||
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
||||
bg-cover bg-center sm:bg-[center_top_-140px] bg-no-repeat
|
||||
bg-[url(/img/logos/icon_lightning.svg)]">
|
||||
<%= link_to wallet_path,
|
||||
<%= link_to services_lightning_index_path,
|
||||
class: "block h-full px-6 py-6 rounded-md" do %>
|
||||
<h3 class="mb-3.5">Wallet</h3>
|
||||
<h3 class="mb-3.5">Lightning Network</h3>
|
||||
<p class="text-gray-600">
|
||||
Send and receive sats over the Bitcoin Lightning Network
|
||||
</p>
|
||||
|
@ -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 %>
|
||||
|
@ -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" %>
|
||||
|
||||
<section>
|
||||
<h3>Lightning Address</h3>
|
@ -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" %>
|
||||
|
||||
<section>
|
||||
<h3 class="hidden">Transactions</h3>
|
||||
@ -27,7 +27,7 @@
|
||||
<p class="col-span-2 md:col-span-1 mb-0 text-right">
|
||||
<span class="text-xl font-mono <%= tx["received"] ? "text-emerald-600" : "" %>">
|
||||
<%= tx["received"] ? "+" : "" %><%= number_with_delimiter tx["amount_sats"] %>
|
||||
<span class="hidden md:inline">sats</span>
|
||||
<span class="text-base md:text-lg">sats</span>
|
||||
</span>
|
||||
</p>
|
||||
<p class="col-span-4 md:col-span-3 mb-0 text-gray-500">
|
||||
@ -35,7 +35,10 @@
|
||||
</p>
|
||||
<p class="col-span-4 md:col-span-1 md:text-right mb-0">
|
||||
<span class="col-span-2 md:col-span-1 text-sm text-gray-500">
|
||||
<%= 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 %>
|
||||
</span>
|
||||
</p>
|
||||
</li>
|
@ -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) %>
|
||||
|
14
app/views/shared/_tabnav_lightning.html.erb
Normal file
14
app/views/shared/_tabnav_lightning.html.erb
Normal file
@ -0,0 +1,14 @@
|
||||
<section>
|
||||
<div class="border-b border-gray-200">
|
||||
<nav class="-mb-px flex" aria-label="Tabs">
|
||||
<%= render TabnavLinkComponent.new(
|
||||
name: "Info", path: services_lightning_index_path,
|
||||
active: current_page?(services_lightning_index_path)
|
||||
) %>
|
||||
<%= render TabnavLinkComponent.new(
|
||||
name: "Transactions", path: transactions_services_lightning_index_path,
|
||||
active: current_page?(transactions_services_lightning_index_path)
|
||||
) %>
|
||||
</nav>
|
||||
</div>
|
||||
</section>
|
@ -1,14 +0,0 @@
|
||||
<section>
|
||||
<div class="border-b border-gray-200">
|
||||
<nav class="-mb-px flex" aria-label="Tabs">
|
||||
<%= render TabnavLinkComponent.new(
|
||||
name: "Info", path: wallet_path,
|
||||
active: current_page?(wallet_path)
|
||||
) %>
|
||||
<%= render TabnavLinkComponent.new(
|
||||
name: "Transactions", path: wallet_transactions_path,
|
||||
active: current_page?(wallet_transactions_path)
|
||||
) %>
|
||||
</nav>
|
||||
</div>
|
||||
</section>
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user