Skip to content

UI Enhancements for Shared Index Table component#263

Open
pranavrao145 wants to merge 6 commits intomainfrom
pranav/shared-index-table-component-ui-overhaul
Open

UI Enhancements for Shared Index Table component#263
pranavrao145 wants to merge 6 commits intomainfrom
pranav/shared-index-table-component-ui-overhaul

Conversation

@pranavrao145
Copy link
Contributor

@pranavrao145 pranavrao145 commented Mar 24, 2026

TL;DR

  • Make rows clickable and add styling for hover:
image
  • Move actions to a separate menu (reduce visual repetition):
image
  • Add subtle animations to index table component.

Checklist

  • Changes have been top-hatted locally
  • Tests have been added or updated
  • Documentation has been updated (if applicable)
  • Linked related issues

@pranavrao145 pranavrao145 force-pushed the pranav/shared-index-table-component-ui-overhaul branch 2 times, most recently from f5d8c85 to 689592d Compare March 24, 2026 03:29
@pranavrao145 pranavrao145 changed the title Shared Index Table Component UI Overhaul UI Enhancements for Shared Index Table component Mar 24, 2026
@pranavrao145 pranavrao145 marked this pull request as ready for review March 24, 2026 03:30
Copilot AI review requested due to automatic review settings March 24, 2026 03:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances Shared::IndexTableComponent to support per-row action menus and clickable row navigation, updating multiple views and i18n keys to use the new capabilities.

Changes:

  • Extend Shared::IndexTableComponent with actions, clickable_rows, and optional Turbo Stream row navigation.
  • Introduce a Stimulus controller to handle row navigation and an actions dropdown menu UI.
  • Update translations and multiple pages to use the new actions dropdown API.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
config/locales/es/shared.es.yml Restructures index table “actions” translations and adds search placeholder (ES).
config/locales/en/shared.en.yml Restructures index table “actions” translations and adds search placeholder (EN).
config/i18n-tasks.yml.erb Adds an ignore rule for index table action keys in i18n-tasks.
app/views/users/show.html.erb Migrates log entries table to new actions: API + Turbo Stream row navigation.
app/views/users/index.html.erb Migrates users table to new actions: API.
app/views/subprojects/show.html.erb Migrates log/journal tables to new actions: API + Turbo Stream for log entries.
app/views/reports/edit.html.erb Disables clickable rows for the journal picker table.
app/views/regions/index.html.erb Migrates regions table to new actions: API and disables clickable rows.
app/views/projects/show.html.erb Migrates subprojects table to new actions: API and adds enter animation wrapper.
app/models/user.rb Adds to_polymorphic_path for row navigation.
app/models/subproject.rb Adds to_polymorphic_path for nested routing.
app/models/region.rb Adds to_polymorphic_path for row navigation.
app/models/log_entry.rb Adds to_polymorphic_path for nested routing.
app/models/journal.rb Adds to_polymorphic_path for nested routing.
app/javascript/controllers/table_actions_dropdown_controller.js New Stimulus controller for dropdown actions + row navigation (including Turbo Stream fetch).
app/components/shared/index_table_component.rb Adds actions/clickable row options and row path generation helper.
app/components/shared/index_table_component.html.erb Updates markup for searchable input, clickable rows, and dropdown action menus.
app/assets/images/icons/ellipsis-v.svg Adds an ellipsis icon used by the actions dropdown trigger.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pranavrao145 pranavrao145 force-pushed the pranav/shared-index-table-component-ui-overhaul branch from 689592d to 76b6e19 Compare March 24, 2026 03:59
Copilot AI review requested due to automatic review settings March 24, 2026 04:00
@pranavrao145 pranavrao145 force-pushed the pranav/shared-index-table-component-ui-overhaul branch from 76b6e19 to a175385 Compare March 24, 2026 04:00
@pranavrao145 pranavrao145 force-pushed the pranav/shared-index-table-component-ui-overhaul branch 3 times, most recently from b2c88e8 to da5800f Compare March 24, 2026 04:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pranavrao145 pranavrao145 force-pushed the pranav/shared-index-table-component-ui-overhaul branch from da5800f to 44d8aa9 Compare March 24, 2026 04:06
Copilot AI review requested due to automatic review settings March 24, 2026 04:07
@pranavrao145 pranavrao145 force-pushed the pranav/shared-index-table-component-ui-overhaul branch from 1c45a95 to e08105d Compare March 24, 2026 04:07
@pranavrao145 pranavrao145 force-pushed the pranav/shared-index-table-component-ui-overhaul branch from e08105d to dba8fef Compare March 24, 2026 04:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 24, 2026 04:20
@pranavrao145 pranavrao145 force-pushed the pranav/shared-index-table-component-ui-overhaul branch from bee6dd5 to 5a15d11 Compare March 24, 2026 04:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

app/views/users/show.html.erb:70

  • This table still renders in-row ActionButtonComponents (view/edit/delete), but Shared::IndexTableComponent now makes rows clickable by default. Click events on those buttons will bubble to the row and trigger navigateToRecord, which can override the intended edit/delete behavior. Consider setting clickable_rows: false for this table, or migrating it to the new actions: dropdown API so only the row background is clickable.
      <%= render Shared::IndexTableComponent.new(records: @user.journals) do |table| %>
        <% table.column :title do |journal| %>
          <%= journal.title %>
        <% end %>
        <% table.column :created_at do |journal_entry| %>
          <%= l(journal_entry.created_at) %>
        <% end %>
        <% table.column :updated_at do |journal_entry| %>
          <%= l(journal_entry.updated_at) %>
        <% end %>
        <% table.column :project do |journal_entry| %>
          <%= journal_entry.subproject.project.name %>
        <% end %>
        <% table.column :subproject do |journal_entry| %>
          <%= journal_entry.subproject.name %>
        <% end %>
        <% table.column :actions, header: t("shared.index_table_component.actions.label"), col_size: "90px" do |journal_entry| %>
          <div class="flex flex-row gap-2 items-center">
            <%= render ActionButtonComponent.new(to: project_subproject_journal_path(journal_entry.subproject.project, journal_entry.subproject, journal_entry), icon: "view", turbo_stream: true) %>
            <%= render ActionButtonComponent.new(to: edit_project_subproject_journal_path(journal_entry.subproject.project, journal_entry.subproject, journal_entry), icon: "edit", turbo_stream: true, colour: :info) %>
            <%= render ActionButtonComponent.new(to: project_subproject_journal_path(journal_entry.subproject.project, journal_entry.subproject, journal_entry), method: :delete, icon: "delete", colour: :error, confirm: t("projects.subprojects.journals.destroy.confirm")) %>
          </div>

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pranavrao145 pranavrao145 force-pushed the pranav/shared-index-table-component-ui-overhaul branch from 5a15d11 to 604c19d Compare March 24, 2026 04:34
Copilot AI review requested due to automatic review settings March 24, 2026 04:55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the clickable box logic can be simplied, there seems to be alot of code for what it achives. What do you think of the following?

Having to derrive the clickable row path within the component adds alot of cross model dependency. To properly use this table for any nested route, we must be sure to override the to_polymorphic_path method, which isn't ideal.

It seems very realistic to just have the caller provide the path, within the block.

table.clickable_path <path>, turbo_stream: ture

<div class="space-y-2">
<div class="space-y-2" data-controller="table-actions-dropdown" data-action="click@window->table-actions-dropdown#handleDocumentClick">
<% records.each_with_index do |record, index| %>
<div data-index-table-component-target="row" class="card bg-white rounded-lg shadow-sm">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a similar pattern as the render_method(&) in app/components/action_button_component.rb to conditionally have this as a button_to or a div depending on whether or not the row is clickable.

There really isn't a need for all this javascript.

app/components/action_button_component.rb

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

app/views/users/show.html.erb:69

  • These action buttons request Turbo Stream responses (turbo_stream: true), but the journals controller/actions don’t have show.turbo_stream.erb/edit.turbo_stream.erb templates (only HTML). This will raise MissingTemplate when clicked. Remove turbo_stream: true for these links or add the missing turbo_stream responses/templates.
            <%= render ActionButtonComponent.new(to: project_subproject_journal_path(journal_entry.subproject.project, journal_entry.subproject, journal_entry), icon: "view", turbo_stream: true) %>
            <%= render ActionButtonComponent.new(to: edit_project_subproject_journal_path(journal_entry.subproject.project, journal_entry.subproject, journal_entry), icon: "edit", turbo_stream: true, colour: :info) %>
            <%= render ActionButtonComponent.new(to: project_subproject_journal_path(journal_entry.subproject.project, journal_entry.subproject, journal_entry), method: :delete, icon: "delete", colour: :error, confirm: t("projects.subprojects.journals.destroy.confirm")) %>

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<%= render ActionButtonComponent.new(to: project_subproject_journal_path(@project, @subproject, journal), icon: "view", turbo_stream: true) %>
<% table.column :actions, header: t("shared.index_table_component.actions.label"), col_size: "90px" do |journal| %>
<div class="flex flex-row gap-2 items-center justify-center">
<%= render ActionButtonComponent.new(to: edit_project_subproject_journal_path(@project, @subproject, journal), icon: "edit", turbo_stream: true, colour: :info) %>
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edit_project_subproject_journal_path is requested with turbo_stream: true, but there is no edit.turbo_stream.erb for journals (only HTML), so this will raise MissingTemplate. Remove turbo_stream: true for the edit action or add a turbo_stream edit response/template.

Suggested change
<%= render ActionButtonComponent.new(to: edit_project_subproject_journal_path(@project, @subproject, journal), icon: "edit", turbo_stream: true, colour: :info) %>
<%= render ActionButtonComponent.new(to: edit_project_subproject_journal_path(@project, @subproject, journal), icon: "edit", colour: :info) %>

Copilot uses AI. Check for mistakes.
@pranavrao145 pranavrao145 force-pushed the pranav/shared-index-table-component-ui-overhaul branch from 794835d to c8c9fc8 Compare March 24, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants