Skip to content

Commit

Permalink
Fix some things to work with ruby_ui main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
stephannv committed Nov 8, 2024
1 parent f01d070 commit 07ad36e
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 1,092 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@

/node_modules

.env*
.env*

.tool-versions

config/credentials/production.key

# Yarn
yarn-error.log
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.4
3.3.5
15 changes: 1 addition & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -340,20 +340,7 @@ GEM
zeitwerk (2.7.1)

PLATFORMS
aarch64-linux
aarch64-linux-gnu
aarch64-linux-musl
arm-linux
arm-linux-gnu
arm-linux-musl
arm64-darwin
x86-linux
x86-linux-gnu
x86-linux-musl
x86_64-darwin
x86_64-linux
x86_64-linux-gnu
x86_64-linux-musl
ruby

DEPENDENCIES
bootsnap
Expand Down
10 changes: 5 additions & 5 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ def component_references(component, code_example = nil, use_component_files = fa
calls = []
Prism.parse(code_example).value.accept(MethodCallFinder.new(calls))
calls_set = Set.new(calls.map(&:to_s))
descendants = Phlex::HTML.descendants.map { |d| d.to_s.gsub(/^RBUI::/, "") }
descendants = Phlex::HTML.descendants.map { |d| d.to_s.gsub(/^RubyUI::/, "") }
component_names = descendants.select { |d| calls_set.include?(d) }

# component_names = code_example.scan(/(?<=^|\s)#{component}\w*/).uniq

component_names.map do |name|
Docs::ComponentStruct.new(
name: name,
source: "lib/rbui/#{camel_to_snake(component)}/#{camel_to_snake(name)}.rb",
source: "lib/ruby_ui/#{camel_to_snake(component)}/#{camel_to_snake(name)}.rb",
built_using: :phlex
)
end
Expand All @@ -35,7 +35,7 @@ def component_files(component, gem_name = "ruby_ui")
return [] unless gem_spec

# Construct the path to the component files within the gem
component_dir = File.join(gem_spec.gem_dir, "lib", "rbui", camel_to_snake(component))
component_dir = File.join(gem_spec.gem_dir, "lib", "ruby_ui", camel_to_snake(component))

return [] unless Dir.exist?(component_dir)

Expand All @@ -49,8 +49,8 @@ def component_files(component, gem_name = "ruby_ui")
basename = File.basename(file, ext)

name = basename.camelize
# source = "https://github.com/PhlexUI/phlex_ui/blob/v1/lib/rbui/#{component.to_s.downcase}/#{File.basename(file)}"
source = "lib/rbui/#{camel_to_snake(component)}/#{File.basename(file)}"
# source = "https://github.com/PhlexUI/phlex_ui/blob/v1/lib/ruby_ui/#{component.to_s.downcase}/#{File.basename(file)}"
source = "lib/ruby_ui/#{camel_to_snake(component)}/#{File.basename(file)}"
built_using = if ext == ".rb"
:phlex
else # ".js"
Expand Down
10 changes: 5 additions & 5 deletions app/lib/deferred_render.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module DeferredRender
def before_template(&)
vanish(&)
super
end
module DeferredRender
def before_template(&)
vanish(&)
super
end
end
2 changes: 1 addition & 1 deletion app/views/application_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ApplicationView < ApplicationComponent
# can change that to `Phlex::HTML` if you want to keep views and
# components independent.

GITHUB_REPO_URL = "https://github.com/rbui-labs/rbui/"
GITHUB_REPO_URL = "https://github.com/ruby-ui/ruby_ui/"
GITHUB_FILE_URL = "#{GITHUB_REPO_URL}blob/main/"

def before_template
Expand Down
2 changes: 1 addition & 1 deletion app/views/component_view.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ComponentView < ApplicationComponent
include RBUI
include RubyUI
include ApplicationHelper
end
2 changes: 1 addition & 1 deletion app/views/components/application_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class ApplicationComponent < Phlex::HTML
include RBUI
include RubyUI
include Phlex::Rails::Helpers::Routes

if Rails.env.development?
Expand Down
2 changes: 1 addition & 1 deletion app/views/components/shared/navbar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def view_template
end

def dark_mode_toggle
RBUI.ThemeToggle do |toggle|
RubyUI.ThemeToggle do |toggle|
toggle.light_mode do
Button(variant: :ghost, icon: true) do
svg(
Expand Down
2 changes: 1 addition & 1 deletion app/views/components/test_view.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class TestView < Phlex::HTML
include RBUI
include RubyUI
include PhlexUI

def view_template(&)
Expand Down
Loading

0 comments on commit 07ad36e

Please sign in to comment.