solrengine-ui 0.1.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 +7 -0
- data/LICENSE +21 -0
- data/README.md +35 -0
- data/app/components/solrengine/ui/address_component.html.erb +19 -0
- data/app/components/solrengine/ui/address_component.rb +30 -0
- data/app/components/solrengine/ui/app_bar_component.html.erb +24 -0
- data/app/components/solrengine/ui/app_bar_component.rb +12 -0
- data/app/components/solrengine/ui/badge_component.html.erb +3 -0
- data/app/components/solrengine/ui/badge_component.rb +26 -0
- data/app/components/solrengine/ui/balance_component.html.erb +3 -0
- data/app/components/solrengine/ui/balance_component.rb +41 -0
- data/app/components/solrengine/ui/explorer_link_component.html.erb +3 -0
- data/app/components/solrengine/ui/explorer_link_component.rb +38 -0
- data/app/components/solrengine/ui/network_badge_component.html.erb +4 -0
- data/app/components/solrengine/ui/network_badge_component.rb +33 -0
- data/app/components/solrengine/ui/notification_component.html.erb +20 -0
- data/app/components/solrengine/ui/notification_component.rb +38 -0
- data/app/components/solrengine/ui/theme_toggle_component.html.erb +10 -0
- data/app/components/solrengine/ui/theme_toggle_component.rb +8 -0
- data/app/components/solrengine/ui/wallet_button_component.html.erb +15 -0
- data/app/components/solrengine/ui/wallet_button_component.rb +26 -0
- data/lib/solrengine/ui/engine.rb +15 -0
- data/lib/solrengine/ui/version.rb +7 -0
- data/lib/solrengine/ui.rb +10 -0
- metadata +113 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e2bc2bd3aeb36e1145142d929300a08d854a330cd65c71d68dfece9c1767e018
|
|
4
|
+
data.tar.gz: 80de3bf17e3233c33a9fded9bbc729862e04d0df498c7c4f112b7f2cc27e92de
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b2ff1de5ef92fcb51ff9f6fdaffb62c1537acb5d93807c6474fce68555213d0adab10559469477b11515a0cc65c27c41aec72f6ffe5b6b6986160630451bf469
|
|
7
|
+
data.tar.gz: 2961bafc62c4c0174dfa678f579de14276805a97d4607da9906caa343d6ff271bbc88c6c292ef91ce027c21f7edfc182dd32d9323c85b22ffc7c29fc62259d67
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Moviendome Limited
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Solrengine::Ui
|
|
2
|
+
|
|
3
|
+
TODO: Delete this and the text below, and describe your gem
|
|
4
|
+
|
|
5
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/solrengine/ui`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
|
10
|
+
|
|
11
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
TODO: Write usage instructions here
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
|
+
|
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/solrengine-ui.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<span class="inline-flex items-center gap-1.5">
|
|
2
|
+
<% if copyable %>
|
|
3
|
+
<button data-controller="clipboard" data-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
|
+
<%= truncated_address %>
|
|
5
|
+
</button>
|
|
6
|
+
<% else %>
|
|
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">
|
|
8
|
+
<%= truncated_address %>
|
|
9
|
+
</span>
|
|
10
|
+
<% end %>
|
|
11
|
+
|
|
12
|
+
<% if explorer %>
|
|
13
|
+
<a href="<%= explorer_url %>" target="_blank" rel="noopener noreferrer" class="text-purple-600 dark:text-purple-400 hover:text-purple-500 dark:hover:text-purple-300 transition-colors">
|
|
14
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
15
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
|
|
16
|
+
</svg>
|
|
17
|
+
</a>
|
|
18
|
+
<% end %>
|
|
19
|
+
</span>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solrengine
|
|
4
|
+
module Ui
|
|
5
|
+
class AddressComponent < ViewComponent::Base
|
|
6
|
+
attr_reader :address, :copyable, :explorer, :network
|
|
7
|
+
|
|
8
|
+
def initialize(address:, copyable: true, explorer: false, network: "mainnet-beta")
|
|
9
|
+
@address = address
|
|
10
|
+
@copyable = copyable
|
|
11
|
+
@explorer = explorer
|
|
12
|
+
@network = network
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def truncated_address
|
|
16
|
+
return "" if address.nil? || address.length < 8
|
|
17
|
+
|
|
18
|
+
"#{address[0..3]}...#{address[-4..]}"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def explorer_url
|
|
22
|
+
if network == "mainnet-beta"
|
|
23
|
+
"https://solscan.io/account/#{address}"
|
|
24
|
+
else
|
|
25
|
+
"https://explorer.solana.com/address/#{address}?cluster=#{network}"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<nav class="border-b border-gray-200 dark:border-gray-800 bg-white/80 dark:bg-gray-900/50 backdrop-blur sticky top-0 z-10">
|
|
2
|
+
<div class="max-w-6xl mx-auto px-4 py-4 flex items-center justify-between">
|
|
3
|
+
<div class="flex items-center gap-6">
|
|
4
|
+
<% if logo %>
|
|
5
|
+
<%= logo %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% if nav_links.any? %>
|
|
8
|
+
<div class="flex items-center gap-4">
|
|
9
|
+
<% nav_links.each do |nav_link| %>
|
|
10
|
+
<%= nav_link %>
|
|
11
|
+
<% end %>
|
|
12
|
+
</div>
|
|
13
|
+
<% end %>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="flex items-center gap-3">
|
|
16
|
+
<% if network_badge %>
|
|
17
|
+
<%= network_badge %>
|
|
18
|
+
<% end %>
|
|
19
|
+
<% if wallet_button %>
|
|
20
|
+
<%= wallet_button %>
|
|
21
|
+
<% end %>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</nav>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solrengine
|
|
4
|
+
module Ui
|
|
5
|
+
class BadgeComponent < ViewComponent::Base
|
|
6
|
+
VARIANTS = {
|
|
7
|
+
success: "bg-green-100 dark:bg-green-900/50 text-green-700 dark:text-green-400 border-green-200 dark:border-green-800",
|
|
8
|
+
warning: "bg-yellow-100 dark:bg-yellow-900/50 text-yellow-700 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800",
|
|
9
|
+
error: "bg-red-100 dark:bg-red-900/50 text-red-700 dark:text-red-400 border-red-200 dark:border-red-800",
|
|
10
|
+
info: "bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400 border-blue-200 dark:border-blue-800",
|
|
11
|
+
purple: "bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-400 border-purple-200 dark:border-purple-800"
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
14
|
+
attr_reader :text, :variant
|
|
15
|
+
|
|
16
|
+
def initialize(text:, variant: :info)
|
|
17
|
+
@text = text
|
|
18
|
+
@variant = variant
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def variant_classes
|
|
22
|
+
VARIANTS.fetch(variant, VARIANTS[:info])
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solrengine
|
|
4
|
+
module Ui
|
|
5
|
+
class BalanceComponent < ViewComponent::Base
|
|
6
|
+
LAMPORTS_PER_SOL = 1_000_000_000
|
|
7
|
+
SIZE_CLASSES = {
|
|
8
|
+
sm: "text-sm",
|
|
9
|
+
md: "text-xl",
|
|
10
|
+
lg: "text-3xl"
|
|
11
|
+
}.freeze
|
|
12
|
+
|
|
13
|
+
attr_reader :show_symbol, :size
|
|
14
|
+
|
|
15
|
+
def initialize(lamports: nil, sol: nil, show_symbol: true, size: :md)
|
|
16
|
+
@lamports = lamports
|
|
17
|
+
@sol = sol
|
|
18
|
+
@show_symbol = show_symbol
|
|
19
|
+
@size = size
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def sol_amount
|
|
23
|
+
if @lamports
|
|
24
|
+
@lamports.to_f / LAMPORTS_PER_SOL
|
|
25
|
+
elsif @sol
|
|
26
|
+
@sol.to_f
|
|
27
|
+
else
|
|
28
|
+
0.0
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def formatted_amount
|
|
33
|
+
format("%.9f", sol_amount).sub(/0+\z/, "").sub(/\.\z/, ".0")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def size_class
|
|
37
|
+
SIZE_CLASSES.fetch(size, SIZE_CLASSES[:md])
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solrengine
|
|
4
|
+
module Ui
|
|
5
|
+
class ExplorerLinkComponent < ViewComponent::Base
|
|
6
|
+
attr_reader :value, :type, :network, :truncate
|
|
7
|
+
|
|
8
|
+
def initialize(value:, type: :address, network: "mainnet-beta", truncate: true)
|
|
9
|
+
@value = value
|
|
10
|
+
@type = type
|
|
11
|
+
@network = network
|
|
12
|
+
@truncate = truncate
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def display_text
|
|
16
|
+
if truncate && value.length > 12
|
|
17
|
+
"#{value[0..7]}...#{value[-4..]}"
|
|
18
|
+
else
|
|
19
|
+
value
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def explorer_url
|
|
24
|
+
if network == "mainnet-beta"
|
|
25
|
+
case type
|
|
26
|
+
when :address
|
|
27
|
+
"https://solscan.io/account/#{value}"
|
|
28
|
+
when :tx
|
|
29
|
+
"https://solscan.io/tx/#{value}"
|
|
30
|
+
end
|
|
31
|
+
else
|
|
32
|
+
path = type == :tx ? "tx" : "address"
|
|
33
|
+
"https://explorer.solana.com/#{path}/#{value}?cluster=#{network}"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solrengine
|
|
4
|
+
module Ui
|
|
5
|
+
class NetworkBadgeComponent < ViewComponent::Base
|
|
6
|
+
NETWORKS = {
|
|
7
|
+
"mainnet-beta" => { label: "Mainnet", dot_color: "bg-green-500" },
|
|
8
|
+
"devnet" => { label: "Devnet", dot_color: "bg-yellow-500" },
|
|
9
|
+
"testnet" => { label: "Testnet", dot_color: "bg-blue-500" }
|
|
10
|
+
}.freeze
|
|
11
|
+
|
|
12
|
+
attr_reader :network
|
|
13
|
+
|
|
14
|
+
def initialize(network:)
|
|
15
|
+
@network = network
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def label
|
|
19
|
+
network_config[:label]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def dot_color
|
|
23
|
+
network_config[:dot_color]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def network_config
|
|
29
|
+
NETWORKS.fetch(network, NETWORKS["mainnet-beta"])
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<div data-controller="notification" class="p-4 rounded-xl border text-sm flex items-start gap-3 <%= variant_classes %>">
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 shrink-0 mt-0.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
3
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="<%= icon_path %>" />
|
|
4
|
+
</svg>
|
|
5
|
+
<div class="flex-1">
|
|
6
|
+
<p><%= message %></p>
|
|
7
|
+
<% if explorer_url %>
|
|
8
|
+
<a href="<%= explorer_url %>" target="_blank" rel="noopener noreferrer" class="underline font-medium mt-1 inline-block hover:opacity-80 transition-opacity">
|
|
9
|
+
View on Explorer
|
|
10
|
+
</a>
|
|
11
|
+
<% end %>
|
|
12
|
+
</div>
|
|
13
|
+
<% if dismissible %>
|
|
14
|
+
<button data-action="click->notification#dismiss" class="shrink-0 mt-0.5 hover:opacity-70 transition-opacity cursor-pointer">
|
|
15
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
16
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
|
17
|
+
</svg>
|
|
18
|
+
</button>
|
|
19
|
+
<% end %>
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solrengine
|
|
4
|
+
module Ui
|
|
5
|
+
class NotificationComponent < ViewComponent::Base
|
|
6
|
+
VARIANTS = {
|
|
7
|
+
success: "bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-300 border-green-200 dark:border-green-800",
|
|
8
|
+
error: "bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-300 border-red-200 dark:border-red-800",
|
|
9
|
+
warning: "bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800",
|
|
10
|
+
info: "bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-300 border-blue-200 dark:border-blue-800"
|
|
11
|
+
}.freeze
|
|
12
|
+
|
|
13
|
+
ICONS = {
|
|
14
|
+
success: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z",
|
|
15
|
+
error: "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z",
|
|
16
|
+
warning: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z",
|
|
17
|
+
info: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
18
|
+
}.freeze
|
|
19
|
+
|
|
20
|
+
attr_reader :type, :message, :dismissible, :explorer_url
|
|
21
|
+
|
|
22
|
+
def initialize(message:, type: :info, dismissible: true, explorer_url: nil)
|
|
23
|
+
@type = type
|
|
24
|
+
@message = message
|
|
25
|
+
@dismissible = dismissible
|
|
26
|
+
@explorer_url = explorer_url
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def variant_classes
|
|
30
|
+
VARIANTS.fetch(type, VARIANTS[:info])
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def icon_path
|
|
34
|
+
ICONS.fetch(type, ICONS[:info])
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<button data-controller="theme" data-action="click->theme#toggle" class="p-2 rounded-lg text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors cursor-pointer">
|
|
2
|
+
<%# Sun icon — visible in dark mode %>
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 hidden dark:block" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
4
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
|
|
5
|
+
</svg>
|
|
6
|
+
<%# Moon icon — visible in light mode %>
|
|
7
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 block dark:hidden" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
8
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" />
|
|
9
|
+
</svg>
|
|
10
|
+
</button>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<% if connected? %>
|
|
2
|
+
<span class="inline-flex items-center gap-2">
|
|
3
|
+
<span class="text-gray-600 dark:text-gray-400 text-xs font-mono bg-gray-100 dark:bg-gray-800 px-2.5 py-1.5 rounded-lg">
|
|
4
|
+
<%= truncated_address %>
|
|
5
|
+
</span>
|
|
6
|
+
<%= link_to "Disconnect", logout_path, data: { turbo_method: :delete }, class: "text-gray-500 dark:text-gray-400 text-xs hover:text-red-500 dark:hover:text-red-400 transition-colors" %>
|
|
7
|
+
</span>
|
|
8
|
+
<% else %>
|
|
9
|
+
<%= link_to login_path, class: "bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-500 hover:to-blue-500 text-white font-semibold py-2.5 px-5 rounded-xl transition-all duration-200 inline-flex items-center gap-2 text-sm" do %>
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
11
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M17 9V7a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2m2 4h10a2 2 0 002-2v-6a2 2 0 00-2-2H9a2 2 0 00-2 2v6a2 2 0 002 2zm7-5a2 2 0 11-4 0 2 2 0 014 0z" />
|
|
12
|
+
</svg>
|
|
13
|
+
Connect Wallet
|
|
14
|
+
<% end %>
|
|
15
|
+
<% end %>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solrengine
|
|
4
|
+
module Ui
|
|
5
|
+
class WalletButtonComponent < ViewComponent::Base
|
|
6
|
+
attr_reader :current_user, :login_path, :logout_path
|
|
7
|
+
|
|
8
|
+
def initialize(current_user: nil, login_path: "/auth/login", logout_path: "/auth/logout")
|
|
9
|
+
@current_user = current_user
|
|
10
|
+
@login_path = login_path
|
|
11
|
+
@logout_path = logout_path
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def connected?
|
|
15
|
+
current_user.present?
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def truncated_address
|
|
19
|
+
address = current_user.wallet_address
|
|
20
|
+
return "" if address.nil? || address.length < 8
|
|
21
|
+
|
|
22
|
+
"#{address[0..3]}...#{address[-4..]}"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solrengine
|
|
4
|
+
module Ui
|
|
5
|
+
class Engine < ::Rails::Engine
|
|
6
|
+
# Don't isolate namespace — components render in app context
|
|
7
|
+
|
|
8
|
+
initializer "solrengine-ui.view_component" do
|
|
9
|
+
ActiveSupport.on_load(:view_component) do
|
|
10
|
+
# Components are autoloaded from app/components
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: solrengine-ui
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jose Ferrer
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-04-13 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: view_component
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '3.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '3.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rails
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '7.1'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '7.1'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: lookbook
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '2.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '2.0'
|
|
55
|
+
description: 'Ready-to-use UI components for Solana dApps: wallet buttons, address
|
|
56
|
+
display, network badges, token lists, transaction status, and more. Built with ViewComponent,
|
|
57
|
+
styled with Tailwind CSS, with dark/light mode and Lookbook previews.'
|
|
58
|
+
email:
|
|
59
|
+
- estoy@moviendo.me
|
|
60
|
+
executables: []
|
|
61
|
+
extensions: []
|
|
62
|
+
extra_rdoc_files: []
|
|
63
|
+
files:
|
|
64
|
+
- LICENSE
|
|
65
|
+
- README.md
|
|
66
|
+
- app/components/solrengine/ui/address_component.html.erb
|
|
67
|
+
- app/components/solrengine/ui/address_component.rb
|
|
68
|
+
- app/components/solrengine/ui/app_bar_component.html.erb
|
|
69
|
+
- app/components/solrengine/ui/app_bar_component.rb
|
|
70
|
+
- app/components/solrengine/ui/badge_component.html.erb
|
|
71
|
+
- app/components/solrengine/ui/badge_component.rb
|
|
72
|
+
- app/components/solrengine/ui/balance_component.html.erb
|
|
73
|
+
- app/components/solrengine/ui/balance_component.rb
|
|
74
|
+
- app/components/solrengine/ui/explorer_link_component.html.erb
|
|
75
|
+
- app/components/solrengine/ui/explorer_link_component.rb
|
|
76
|
+
- app/components/solrengine/ui/network_badge_component.html.erb
|
|
77
|
+
- app/components/solrengine/ui/network_badge_component.rb
|
|
78
|
+
- app/components/solrengine/ui/notification_component.html.erb
|
|
79
|
+
- app/components/solrengine/ui/notification_component.rb
|
|
80
|
+
- app/components/solrengine/ui/theme_toggle_component.html.erb
|
|
81
|
+
- app/components/solrengine/ui/theme_toggle_component.rb
|
|
82
|
+
- app/components/solrengine/ui/wallet_button_component.html.erb
|
|
83
|
+
- app/components/solrengine/ui/wallet_button_component.rb
|
|
84
|
+
- lib/solrengine/ui.rb
|
|
85
|
+
- lib/solrengine/ui/engine.rb
|
|
86
|
+
- lib/solrengine/ui/version.rb
|
|
87
|
+
homepage: https://github.com/solrengine/ui
|
|
88
|
+
licenses:
|
|
89
|
+
- MIT
|
|
90
|
+
metadata:
|
|
91
|
+
homepage_uri: https://github.com/solrengine/ui
|
|
92
|
+
source_code_uri: https://github.com/solrengine/ui
|
|
93
|
+
changelog_uri: https://github.com/solrengine/ui/blob/main/CHANGELOG.md
|
|
94
|
+
post_install_message:
|
|
95
|
+
rdoc_options: []
|
|
96
|
+
require_paths:
|
|
97
|
+
- lib
|
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: 3.2.0
|
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
|
+
requirements:
|
|
105
|
+
- - ">="
|
|
106
|
+
- !ruby/object:Gem::Version
|
|
107
|
+
version: '0'
|
|
108
|
+
requirements: []
|
|
109
|
+
rubygems_version: 3.5.22
|
|
110
|
+
signing_key:
|
|
111
|
+
specification_version: 4
|
|
112
|
+
summary: ViewComponent UI library for Solana dApps built with Rails and SolRengine
|
|
113
|
+
test_files: []
|