From 052f48d114c6b07f5bcfd103c08f8d8fa00847fb Mon Sep 17 00:00:00 2001 From: Adrian Marin Date: Tue, 3 Sep 2024 10:09:52 +0300 Subject: [PATCH] wip --- app/components/avo/fields/common/badge_viewer_component.rb | 2 +- app/components/avo/filters_component.rb | 2 +- app/components/avo/index/grid_item_component.rb | 2 +- app/components/avo/index/resource_controls_component.rb | 2 +- app/components/avo/index/resource_grid_component.rb | 2 +- app/components/avo/index/resource_table_component.rb | 2 +- app/components/avo/index/table_row_component.rb | 2 +- app/components/avo/items/panel_component.rb | 2 +- app/components/avo/paginator_component.rb | 2 +- app/components/avo/panel_component.rb | 2 +- app/components/avo/panel_name_component.rb | 2 +- app/components/avo/views/resource_edit_component.rb | 2 +- app/components/avo/views/resource_index_component.rb | 2 +- app/components/avo/views/resource_show_component.rb | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/components/avo/fields/common/badge_viewer_component.rb b/app/components/avo/fields/common/badge_viewer_component.rb index c8d0380397..51940118a7 100644 --- a/app/components/avo/fields/common/badge_viewer_component.rb +++ b/app/components/avo/fields/common/badge_viewer_component.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class Avo::Fields::Common::BadgeViewerComponent < Avo::BaseComponent - prop :value, String + prop :value, prop :value, _Union(_String, _Symbol) prop :options, Hash def after_initialize diff --git a/app/components/avo/filters_component.rb b/app/components/avo/filters_component.rb index 16b5643495..d5fc5accfa 100644 --- a/app/components/avo/filters_component.rb +++ b/app/components/avo/filters_component.rb @@ -6,7 +6,7 @@ class Avo::FiltersComponent < Avo::BaseComponent prop :filters, _Array(Avo::Filters::BaseFilter), default: [].freeze prop :resource, _Nilable(Avo::BaseResource) prop :applied_filters, Hash, default: {}.freeze - prop :parent_record, _Nilable(ActiveRecord::Base) + prop :parent_record, _Nilable(_Any) def render? @filters.present? diff --git a/app/components/avo/index/grid_item_component.rb b/app/components/avo/index/grid_item_component.rb index 58abb8bd7f..a5ce6e086a 100644 --- a/app/components/avo/index/grid_item_component.rb +++ b/app/components/avo/index/grid_item_component.rb @@ -6,7 +6,7 @@ class Avo::Index::GridItemComponent < Avo::BaseComponent prop :resource, _Nilable(Avo::BaseResource) prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection) - prop :parent_record, _Nilable(ActiveRecord::Base) + prop :parent_record, _Nilable(_Any) prop :parent_resource, _Nilable(Avo::BaseResource) prop :actions, _Nilable(_Array(Avo::BaseAction)) diff --git a/app/components/avo/index/resource_controls_component.rb b/app/components/avo/index/resource_controls_component.rb index ceec5d9a9c..a59c997e9e 100644 --- a/app/components/avo/index/resource_controls_component.rb +++ b/app/components/avo/index/resource_controls_component.rb @@ -5,7 +5,7 @@ class Avo::Index::ResourceControlsComponent < Avo::ResourceComponent prop :resource, _Nilable(Avo::BaseResource) prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection) - prop :parent_record, _Nilable(ActiveRecord::Base) + prop :parent_record, _Nilable(_Any) prop :parent_resource, _Nilable(Avo::BaseResource) prop :view_type, Symbol, default: :table prop :actions, _Nilable(_Array(Avo::BaseAction)) diff --git a/app/components/avo/index/resource_grid_component.rb b/app/components/avo/index/resource_grid_component.rb index 00da185e7f..8955c77498 100644 --- a/app/components/avo/index/resource_grid_component.rb +++ b/app/components/avo/index/resource_grid_component.rb @@ -4,7 +4,7 @@ class Avo::Index::ResourceGridComponent < Avo::BaseComponent prop :resources, _Array(_Nilable(Avo::BaseResource)) prop :resource, _Nilable(Avo::BaseResource) prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection) - prop :parent_record, _Nilable(ActiveRecord::Base) + prop :parent_record, _Nilable(_Any) prop :parent_resource, _Nilable(Avo::BaseResource) prop :actions, _Nilable(_Array(Avo::BaseAction)), reader: :public end diff --git a/app/components/avo/index/resource_table_component.rb b/app/components/avo/index/resource_table_component.rb index 67ae873cf4..682c4097c7 100644 --- a/app/components/avo/index/resource_table_component.rb +++ b/app/components/avo/index/resource_table_component.rb @@ -11,7 +11,7 @@ def before_render prop :resources, _Nilable(_Array(Avo::BaseResource)) prop :resource, _Nilable(Avo::BaseResource) prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection) - prop :parent_record, _Nilable(ActiveRecord::Base) + prop :parent_record, _Nilable(_Any) prop :parent_resource, _Nilable(Avo::BaseResource) prop :pagy, _Nilable(Pagy) prop :query, _Nilable(ActiveRecord::Relation) diff --git a/app/components/avo/index/table_row_component.rb b/app/components/avo/index/table_row_component.rb index efa9f85d26..5924480626 100644 --- a/app/components/avo/index/table_row_component.rb +++ b/app/components/avo/index/table_row_component.rb @@ -7,7 +7,7 @@ class Avo::Index::TableRowComponent < Avo::BaseComponent prop :resource, _Nilable(Avo::BaseResource) prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection) - prop :parent_record, _Nilable(ActiveRecord::Base) + prop :parent_record, _Nilable(_Any) prop :parent_resource, _Nilable(Avo::BaseResource) prop :actions, _Nilable(_Array(Avo::BaseAction)) prop :fields, _Nilable(_Array(Avo::Fields::BaseField)) diff --git a/app/components/avo/items/panel_component.rb b/app/components/avo/items/panel_component.rb index c6be290d7d..aa6b0f8166 100644 --- a/app/components/avo/items/panel_component.rb +++ b/app/components/avo/items/panel_component.rb @@ -11,7 +11,7 @@ class Avo::Items::PanelComponent < Avo::ResourceComponent prop :actions, _Nilable(_Array(Avo::BaseAction)), reader: :public prop :index, _Nilable(Integer), reader: :public prop :parent_component, _Nilable(ViewComponent::Base) - prop :parent_record, _Nilable(ActiveRecord::Base) + prop :parent_record, _Nilable(_Any) prop :parent_resource, _Nilable(Avo::BaseResource) prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection) diff --git a/app/components/avo/paginator_component.rb b/app/components/avo/paginator_component.rb index 1f93db8035..ccde48c7d4 100644 --- a/app/components/avo/paginator_component.rb +++ b/app/components/avo/paginator_component.rb @@ -2,7 +2,7 @@ class Avo::PaginatorComponent < Avo::BaseComponent prop :resource, _Nilable(Avo::BaseResource) - prop :parent_record, _Nilable(ActiveRecord::Base) + prop :parent_record, _Nilable(_Any) prop :pagy, _Nilable(Pagy) prop :turbo_frame, _Nilable(_Union(String, Symbol)) do |frame| frame.present? ? CGI.escapeHTML(frame) : :_top diff --git a/app/components/avo/panel_component.rb b/app/components/avo/panel_component.rb index cbe1cf44f0..e8e24f54cb 100644 --- a/app/components/avo/panel_component.rb +++ b/app/components/avo/panel_component.rb @@ -24,7 +24,7 @@ class Avo::PanelComponent < Avo::BaseComponent prop :profile_photo, _Nilable(Avo::ProfilePhoto) prop :cover_photo, _Nilable(Avo::CoverPhoto) prop :args, Hash, :**, default: {}.freeze - prop :name, _Nilable(String) do |value| + prop :name, _Nilable(_Union(_String, _Integer)) do |value| value || @args&.dig(:title) end diff --git a/app/components/avo/panel_name_component.rb b/app/components/avo/panel_name_component.rb index 00e49a3667..73172fcabd 100644 --- a/app/components/avo/panel_name_component.rb +++ b/app/components/avo/panel_name_component.rb @@ -3,7 +3,7 @@ class Avo::PanelNameComponent < Avo::BaseComponent renders_one :body - prop :name, _Nilable(String) + prop :name, _Nilable(_Union(_String, _Integer)) prop :url, _Nilable(String) prop :target, Symbol, default: :self do |value| value&.to_sym diff --git a/app/components/avo/views/resource_edit_component.rb b/app/components/avo/views/resource_edit_component.rb index b4f103bfa1..5f5163e74b 100644 --- a/app/components/avo/views/resource_edit_component.rb +++ b/app/components/avo/views/resource_edit_component.rb @@ -4,7 +4,7 @@ class Avo::Views::ResourceEditComponent < Avo::ResourceComponent include Avo::ApplicationHelper prop :resource, _Nilable(Avo::BaseResource) - prop :record, _Nilable(ActiveRecord::Base) + prop :record, _Nilable(_Any) prop :actions, _Array(Avo::BaseAction), default: [].freeze prop :view, Avo::ViewInquirer, default: Avo::ViewInquirer.new(:edit).freeze prop :display_breadcrumbs, _Boolean, default: true, reader: :public diff --git a/app/components/avo/views/resource_index_component.rb b/app/components/avo/views/resource_index_component.rb index 118508624b..b34bcad748 100644 --- a/app/components/avo/views/resource_index_component.rb +++ b/app/components/avo/views/resource_index_component.rb @@ -14,7 +14,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent prop :actions, _Array(Avo::BaseAction), default: [].freeze prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection) prop :turbo_frame, _Nilable(String), default: "" - prop :parent_record, _Nilable(ActiveRecord::Base) + prop :parent_record, _Nilable(_Any) prop :parent_resource, _Nilable(Avo::BaseResource) prop :applied_filters, Hash, default: {}.freeze prop :query, _Nilable(ActiveRecord::Relation), reader: :public diff --git a/app/components/avo/views/resource_show_component.rb b/app/components/avo/views/resource_show_component.rb index 072618eab2..08560278cd 100644 --- a/app/components/avo/views/resource_show_component.rb +++ b/app/components/avo/views/resource_show_component.rb @@ -8,7 +8,7 @@ class Avo::Views::ResourceShowComponent < Avo::ResourceComponent prop :resource, _Nilable(Avo::BaseResource) prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection) prop :parent_resource, _Nilable(Avo::BaseResource) - prop :parent_record, _Nilable(ActiveRecord::Base) + prop :parent_record, _Nilable(_Any) prop :resource_panel, _Nilable(_Array(Avo::BaseAction)), reader: :public prop :actions, _Array(Avo::BaseAction), default: [].freeze, reader: :public