From 8a570ce724c233cba19337e8a9c9648c3f9e22dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A2u=20Cao?=
Date: Tue, 27 Jun 2023 19:18:05 +0200
Subject: [PATCH] Use modal component for LndHub setup code
---
.../services/lightning_controller.rb | 17 +--------
app/views/services/lightning/index.html.erb | 35 +++----------------
2 files changed, 5 insertions(+), 47 deletions(-)
diff --git a/app/controllers/services/lightning_controller.rb b/app/controllers/services/lightning_controller.rb
index 94aed24..1253ab0 100644
--- a/app/controllers/services/lightning_controller.rb
+++ b/app/controllers/services/lightning_controller.rb
@@ -8,8 +8,7 @@ class Services::LightningController < ApplicationController
before_action :fetch_balance
def index
- @wallet_url = "lndhub://#{current_user.ln_account}:#{current_user.ln_password}@#{ENV['LNDHUB_PUBLIC_URL']}"
- initialize_lndhub_qr_code
+ @wallet_setup_url = "lndhub://#{current_user.ln_account}:#{current_user.ln_password}@#{ENV['LNDHUB_PUBLIC_URL']}"
end
def transactions
@@ -56,20 +55,6 @@ class Services::LightningController < ApplicationController
private
- def initialize_lndhub_qr_code
- qr_code = RQRCode::QRCode.new(@wallet_url)
- @lndhub_qr_svg = qr_code.as_svg(
- color: "000",
- shape_rendering: "crispEdges",
- module_size: 6,
- standalone: true,
- use_path: true,
- svg_attributes: {
- class: 'inline-block'
- }
- )
- end
-
def authenticate_with_lndhub(options={})
if session[:ln_auth_token].present? && !options[:force_reauth]
@ln_auth_token = session[:ln_auth_token]
diff --git a/app/views/services/lightning/index.html.erb b/app/views/services/lightning/index.html.erb
index 6d18379..58a7c12 100644
--- a/app/views/services/lightning/index.html.erb
+++ b/app/views/services/lightning/index.html.erb
@@ -29,7 +29,7 @@
-
+
Wallet Apps
You can connect various wallet apps to your Kosmos account. This allows
@@ -40,19 +40,16 @@
+ value="<%= @wallet_setup_url %>" data-clipboard-target="source" />
or
-
-
-
-
- <%= raw @lndhub_qr_svg %>
+
+ <%= render QrCodeModalComponent.new(qr_content: @wallet_setup_url) %>
<% end %>
-
-