solrengine-ui 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -3
- data/app/components/solrengine/ui/address_component.html.erb +2 -2
- data/app/components/solrengine/ui/send_transaction_form_component.html.erb +16 -5
- data/app/components/solrengine/ui/send_transaction_form_component.rb +22 -4
- data/lib/generators/solrengine/ui/install_generator.rb +1 -1
- data/lib/solrengine/ui/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f581b398d242514e6c5d1d6ff9fe3b3fc55e90c2d26e403010418ec14896b13
|
|
4
|
+
data.tar.gz: 49039f57c9bb07e2a671e7657ead45116e8444ac86a8edd2d9ca2f5cf32b751f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 29a2a90fcd48d82aab8694d09ecf1b09a4e77a4bf9b776a5278a19390526a99a3c89ed9603bd1717c1f99b17cb76139985666fb0efcec0c53564f1e1eb09bb7b
|
|
7
|
+
data.tar.gz: 4104e55638cdfab3659969782b8d29e85f177195494fd5ef666daf08c40d65aecf312c56a71defd180132fbd704cf6a358e76d9a15f278a6a3db9986e2755ce8
|
data/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# SolRengine UI
|
|
2
2
|
|
|
3
|
-
A ViewComponent library for Solana dApps built with Ruby on Rails and [SolRengine](https://github.com/solrengine). Ships
|
|
3
|
+
A ViewComponent library for Solana dApps built with Ruby on Rails and [SolRengine](https://github.com/solrengine). Ships 20 ready-to-use components styled with Tailwind CSS, with built-in dark/light mode support and Lookbook previews for every component.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
Add the gem to your Gemfile:
|
|
8
8
|
|
|
9
9
|
```ruby
|
|
10
|
-
gem "solrengine-ui"
|
|
10
|
+
gem "solrengine-ui"
|
|
11
11
|
|
|
12
12
|
group :development do
|
|
13
13
|
gem "lookbook", ">= 2.0"
|
|
@@ -60,6 +60,17 @@ yarn add @solrengine/ui
|
|
|
60
60
|
| `NotificationComponent` | `message:`, `type: :info`, `dismissible: true`, `explorer_url: nil` | Flash-style notification with icon and optional explorer link |
|
|
61
61
|
| `ThemeToggleComponent` | _(none)_ | Dark/light mode toggle button |
|
|
62
62
|
| `WalletButtonComponent` | `current_user: nil`, `login_path: "/auth/login"`, `logout_path: "/auth/logout"` | Connect/disconnect wallet button with truncated address |
|
|
63
|
+
| `CardComponent` | `padding: true`, slots: `header`, `body`, `footer` | Container card with optional header/footer |
|
|
64
|
+
| `ModalComponent` | `title: nil`, `size: :md`, slots: `body`, `actions` | Modal dialog with backdrop and close button |
|
|
65
|
+
| `DropdownComponent` | `align: :right`, slots: `trigger`, `items` | Dropdown menu with click-outside close |
|
|
66
|
+
| `CollapseComponent` | `expanded: false`, slots: `collapse_header`, `collapse_body` | Collapsible content section |
|
|
67
|
+
| `FooterComponent` | slots: `links`, `powered_by` | Page footer with links and branding |
|
|
68
|
+
| `TokenListComponent` | `tokens:` (array) | List of token rows with empty state |
|
|
69
|
+
| `TokenRowComponent` | `token:` (hash with symbol, name, balance, icon_uri, usd_value) | Single token row with icon and balance |
|
|
70
|
+
| `TokenIconComponent` | `symbol:`, `uri: nil`, `size: :md` | Token icon image or fallback letter |
|
|
71
|
+
| `TransactionStatusComponent` | `status:`, `signature: nil`, `network:` | Status badge (pending/confirmed/failed/processing) with explorer link |
|
|
72
|
+
| `SendTransactionFormComponent` | `wallet_address: nil`, `network:`, `action_url:` | SOL transfer form with recipient and amount |
|
|
73
|
+
| `AirdropButtonComponent` | `address:`, `network:`, `action_url:` | Airdrop button (devnet/testnet only) |
|
|
63
74
|
|
|
64
75
|
## Usage Examples
|
|
65
76
|
|
|
@@ -175,7 +186,7 @@ All components include `dark:` Tailwind variants out of the box. Add the `dark`
|
|
|
175
186
|
|
|
176
187
|
## Lookbook
|
|
177
188
|
|
|
178
|
-
After running the install generator, visit `/lookbook` in development to browse every component with live previews. The gem ships Lookbook preview classes for all
|
|
189
|
+
After running the install generator, visit `/lookbook` in development to browse every component with live previews. The gem ships Lookbook preview classes for all 20 components.
|
|
179
190
|
|
|
180
191
|
To add Lookbook manually (without the generator):
|
|
181
192
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<span class="inline-flex items-center gap-1.5">
|
|
2
2
|
<% if copyable %>
|
|
3
|
-
<button data-controller="sui-clipboard" data-sui-clipboard-text-value="<%= address %>" class="text-gray-400 dark:text-gray-400 text-xs font-mono bg-gray-100 dark:bg-gray-800 px-2.5 py-1.5 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors cursor-pointer">
|
|
4
|
-
|
|
3
|
+
<button data-controller="sui-clipboard" data-sui-clipboard-text-value="<%= address %>" data-action="click->sui-clipboard#copy" class="text-gray-400 dark:text-gray-400 text-xs font-mono bg-gray-100 dark:bg-gray-800 px-2.5 py-1.5 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors cursor-pointer">
|
|
4
|
+
<span data-sui-clipboard-target="label"><%= truncated_address %></span>
|
|
5
5
|
</button>
|
|
6
6
|
<% else %>
|
|
7
7
|
<span class="text-gray-400 dark:text-gray-400 text-xs font-mono bg-gray-100 dark:bg-gray-800 px-2.5 py-1.5 rounded-lg">
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
<div class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-xl p-5">
|
|
2
2
|
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Send SOL</h3>
|
|
3
3
|
<% if connected? %>
|
|
4
|
-
<form
|
|
4
|
+
<form class="space-y-4"
|
|
5
|
+
data-controller="send-transaction"
|
|
6
|
+
data-send-transaction-wallet-address-value="<%= wallet_address %>"
|
|
7
|
+
data-send-transaction-rpc-url-value="<%= rpc_url %>"
|
|
8
|
+
data-send-transaction-chain-value="<%= chain %>"
|
|
9
|
+
data-action="submit->send-transaction#send">
|
|
5
10
|
<div>
|
|
6
11
|
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">From</label>
|
|
7
12
|
<div class="text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 px-3 py-2 rounded-lg">
|
|
@@ -10,16 +15,22 @@
|
|
|
10
15
|
</div>
|
|
11
16
|
<div>
|
|
12
17
|
<label for="sui-send-recipient" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Recipient</label>
|
|
13
|
-
<input type="text" name="recipient" id="sui-send-recipient" placeholder="Solana address"
|
|
18
|
+
<input type="text" name="recipient" id="sui-send-recipient" placeholder="Solana address" required
|
|
19
|
+
data-send-transaction-target="recipient"
|
|
20
|
+
class="w-full px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-white text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" />
|
|
14
21
|
</div>
|
|
15
22
|
<div>
|
|
16
23
|
<label for="sui-send-amount" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Amount (SOL)</label>
|
|
17
|
-
<input type="number" name="amount" id="sui-send-amount" step="0.000000001" min="0" placeholder="0.0"
|
|
24
|
+
<input type="number" name="amount" id="sui-send-amount" step="0.000000001" min="0" placeholder="0.0" required
|
|
25
|
+
data-send-transaction-target="amount"
|
|
26
|
+
class="w-full px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-white text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" />
|
|
18
27
|
</div>
|
|
19
|
-
<
|
|
20
|
-
|
|
28
|
+
<button type="submit"
|
|
29
|
+
data-send-transaction-target="submit"
|
|
30
|
+
class="w-full py-2.5 px-4 bg-purple-600 hover:bg-purple-700 text-white font-medium rounded-lg text-sm transition-colors cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed">
|
|
21
31
|
Send Transaction
|
|
22
32
|
</button>
|
|
33
|
+
<div data-send-transaction-target="status" class="hidden"></div>
|
|
23
34
|
</form>
|
|
24
35
|
<% else %>
|
|
25
36
|
<p class="text-sm text-gray-500 dark:text-gray-400 text-center py-4">Connect your wallet to send SOL</p>
|
|
@@ -3,17 +3,35 @@
|
|
|
3
3
|
module Solrengine
|
|
4
4
|
module Ui
|
|
5
5
|
class SendTransactionFormComponent < ViewComponent::Base
|
|
6
|
-
|
|
6
|
+
PUBLIC_RPC_URLS = {
|
|
7
|
+
"mainnet-beta" => "https://api.mainnet-beta.solana.com",
|
|
8
|
+
"mainnet" => "https://api.mainnet-beta.solana.com",
|
|
9
|
+
"devnet" => "https://api.devnet.solana.com",
|
|
10
|
+
"testnet" => "https://api.testnet.solana.com"
|
|
11
|
+
}.freeze
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
CHAIN_IDS = {
|
|
14
|
+
"mainnet-beta" => "solana:mainnet",
|
|
15
|
+
"mainnet" => "solana:mainnet",
|
|
16
|
+
"devnet" => "solana:devnet",
|
|
17
|
+
"testnet" => "solana:testnet"
|
|
18
|
+
}.freeze
|
|
19
|
+
|
|
20
|
+
attr_reader :wallet_address, :network, :rpc_url
|
|
21
|
+
|
|
22
|
+
def initialize(wallet_address: nil, network: "devnet", rpc_url: nil, **)
|
|
9
23
|
@wallet_address = wallet_address
|
|
10
|
-
@network = network
|
|
11
|
-
@
|
|
24
|
+
@network = network.to_s
|
|
25
|
+
@rpc_url = rpc_url || PUBLIC_RPC_URLS.fetch(@network, PUBLIC_RPC_URLS["devnet"])
|
|
12
26
|
end
|
|
13
27
|
|
|
14
28
|
def connected?
|
|
15
29
|
wallet_address.present?
|
|
16
30
|
end
|
|
31
|
+
|
|
32
|
+
def chain
|
|
33
|
+
CHAIN_IDS.fetch(network, "solana:devnet")
|
|
34
|
+
end
|
|
17
35
|
end
|
|
18
36
|
end
|
|
19
37
|
end
|
|
@@ -56,7 +56,7 @@ module Solrengine
|
|
|
56
56
|
layout_path = "app/views/layouts/lookbook_preview.html.erb"
|
|
57
57
|
return if File.exist?(layout_path)
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
template "lookbook_preview.html.erb", layout_path
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
def configure_lookbook_preview_layout
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solrengine-ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jose Ferrer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: view_component
|