feat(table): introduce recent active markers
fix: https://github.com/Lundalogik/crm-feature/issues/1294
Summary by CodeRabbit
-
New Features
- Recently active table rows are now visually indicated, allowing users to see not only the currently selected row but also the previous one.
-
Style
- Enhanced table row styling with a consistent left border indicator for selected and recently active rows.
Review:
- [ ] Commits are atomic
- [ ] Commits have the correct type for the changes made
- [ ] Commits with breaking changes are marked as such
Browsers tested:
(Check any that applies, it's ok to leave boxes unchecked if testing something didn't seem relevant.)
Windows:
- [ ] Chrome
- [ ] Edge
- [ ] Firefox
Linux:
- [ ] Chrome
- [ ] Firefox
macOS:
- [ ] Chrome
- [ ] Firefox
- [ ] Safari
Mobile:
- [ ] Chrome on Android
- [ ] iOS
📝 Walkthrough
Walkthrough
The changes introduce a new SCSS mixin for a selected row indicator and a .recent-active class for table rows. In the Table component, logic is added to track and style the two most recently active rows, updating their classes to reflect their status. Minor code formatting adjustments are also made.
Changes
| File(s) | Change Summary |
|---|---|
| src/components/table/partial-styles/tabulator-custom-styles.scss | Added table-row-selected-indicator SCSS mixin; replaced manual row indicator styling with mixin; added .recent-active class for recently active rows; imported theme color variables. |
| src/components/table/table.tsx | Added activeRowHistory property to track most recent rows; updated row click and formatting logic to apply .recent-active class; minor formatting changes. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant TableComponent
participant TabulatorRow
User->>TableComponent: Clicks on a row
TableComponent->>TabulatorRow: Activates clicked row
TableComponent->>TableComponent: Push row to activeRowHistory
TableComponent->>TableComponent: If >2, remove oldest from history
TableComponent->>TabulatorRow: Add 'active' class to current row
TableComponent->>TabulatorRow: Add 'recent-active' class to previous row (if any)
TableComponent->>TabulatorRow: Remove 'recent-active' class from other rows
[!TIP]
⚡️ Faster reviews with caching
- CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure
Review - Disable Cacheat either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off theData Retentionsetting under your Organization Settings.Enjoy the performance boost—your workflow just got faster.
📜 Recent review details
Configuration used: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 67850a00af3739022687b7dec4b00991eab4e61f and f3d65f7dc0667731442381ff39195be20d392dce.
📒 Files selected for processing (2)
-
src/components/table/partial-styles/tabulator-custom-styles.scss(3 hunks) -
src/components/table/table.tsx(7 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`**/*.{tsx,scss}`: Almost all our components use shadow-DOM. Therefore, we have no need of BEM-style class names in our CSS.
**/*.{tsx,scss}: Almost all our components use shadow-DOM. Therefore, we have no need of BEM-style class names in our CSS.
-
src/components/table/partial-styles/tabulator-custom-styles.scss -
src/components/table/table.tsx
`**/*.tsx`: Our `.tsx` files are typically using StencilJS, not React. When a developer wants to return multiple top-level JSX elements from the `render` method, they will sometime...
**/*.tsx: Our.tsxfiles are typically using StencilJS, not React. When a developer wants to return multiple top-level JSX elements from therendermethod, they will sometimes wrap them in an array literal. In these cases, rather than recommending they addkeyproperties to the elements, recommend removing the hardcoded array literal. Recommend wrapping the elements in StencilJS's special<Host>element.
-
src/components/table/table.tsx
`**/*.{ts,tsx}`: Imports from other files in the same module (lime-elements) must use relative paths. Using absolute paths for imports will cause the production build to fail.
**/*.{ts,tsx}: Imports from other files in the same module (lime-elements) must use relative paths. Using absolute paths for imports will cause the production build to fail.
-
src/components/table/table.tsx
🪛 ESLint
src/components/table/table.tsx
[error] 110-110: No magic number: 2.
(no-magic-numbers)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Docs / Publish Docs
- GitHub Check: Build
- GitHub Check: Test
- GitHub Check: Lint
🔇 Additional comments (2)
src/components/table/table.tsx (2)
711-718: LGTM - Good implementation of the active row trackingThe active row history is properly maintained, keeping track of the current and previous active rows.
761-769: LGTM - Clean implementation of the recent-active classThe code properly distinguishes between the active row and the previously active row, applying the appropriate styling classes.
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
‼️ IMPORTANT Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai explain this code block. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and explain its main purpose. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
The recent marker is for now only active in selectable rows and not in lists at all, for continuity the recent marker should only be where there is an active marker, which is not in lists at the moment.
Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-3516/
two things I can think of:
- Since we are upgrading Tabulator here https://github.com/Lundalogik/lime-elements/pull/3478 we should revisit this issue after the upgrade
- We should also have a more global approach here. We have other views, such as List view, Kanban view, etc… All of these should have some sort of support for indicating the "previously selected item". We can't only implement this in the table view. How would we do this best? 🤔
two things I can think of:
- Since we are upgrading Tabulator here chore(table): update tabulator to 6 #3478 we should revisit this issue after the upgrade
- We should also have a more global approach here. We have other views, such as List view, Kanban view, etc… All of these should have some sort of support for indicating the "previously selected item". We can't only implement this in the table view. How would we do this best? 🤔
Is this a blocker to getting this PR in? Should we create issues for those other views?
Is this a blocker to getting this PR in? Should we create issues for those other views?
I think it's just hard to remember to check and verify it in the https://github.com/Lundalogik/lime-elements/pull/3478 I'd at least wait for that PR to be merged first.
And I think we can make an umbrella issue for all views, and connect this as a sub-task to that one. We will have many different implementations in various repos, to address the issue of:
- Hey, which item did I select before this one?
- Oh, which item was selected, just before I deselected it?