-
Notifications
You must be signed in to change notification settings - Fork 3
Perchance Parser updates, Table View Search #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 introduces functionality to ignore inline comments in Perchance table definitions and adds a search input for filtering table entries. Key changes include:
- Adding a removeComments() function in PerchanceParser.ts to strip inline comments.
- Introducing a search box and passing search queries to TableEntryViewer in TableWindow.tsx.
- Updating UI styles in TableWindow.css for the new search box.
- Adjusting subtitle and search data handling in TableList.tsx and TableEntryViewer.tsx.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/shared/utils/PerchanceParser.ts | Adds a utility to remove inline comments from code lines |
| src/renderer/components/TableWindow.tsx | Implements a search box and updates subtitle generation logic |
| src/renderer/components/TableWindow.css | Adds styles for the new table search box |
| src/renderer/components/TableList.tsx | Updates subtitle text and passes an empty search query to the viewer |
| src/renderer/components/TableEntryViewer.tsx | Integrates search filtering for table sections and entries |
when rolling from section to section, the second roll has a ghost roll
There was a problem hiding this 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 introduces enhancements to the Perchance table functionality by ignoring inline comments in table definitions and adding a search feature for filtering table entries.
- Added a removeComments() helper to clean inline comments in table parsing.
- Integrated a search box in TableWindow to filter section entries based on user input.
- Updated UI styles and adjusted dependency handling in useEffect, along with some package upgrades.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/shared/utils/PerchanceParser.ts | Added comment removal logic and updated indent matching. |
| src/renderer/components/TableWindow.tsx | Integrated search input and modified useEffect dependencies. |
| src/renderer/components/TableWindow.css | Added styles for the search box. |
| src/renderer/components/TableList.tsx | Updated table subtitle to reflect sections and errors. |
| src/renderer/components/TableEntryViewer.tsx | Added filtering based on search query in section rendering. |
| src/renderer/components/TableEntryViewer.css | Adjusted section count styling to support responsive width. |
| src/renderer/App.tsx | Added a Refresh Vault button and removed duplicate refresh code. |
| src/renderer/App.css | Styled the disabled state for the refresh vault button. |
| package.json | Bumped dependency versions and updated author/license info. |
Comments suppressed due to low confidence (3)
src/renderer/components/TableWindow.tsx:242
- Consider adding an aria-label or associating a label element with the search input to improve accessibility for users relying on screen readers.
<input type="text" className="table-search-input" placeholder="Search table entries..." value={searchQuery} onChange={(e) => setSearchQuery(e.target.value)} />
src/renderer/App.tsx:1257
- [nitpick] Consider refactoring the nested try/catch structure in the refresh vault button handler for improved readability and maintainability. For example, you might sequentially await each operation in a flattened structure or extract the logic into a dedicated function.
<button onClick={async () => { try { await handleScanFiles(); try { await handleParseTables(); } catch (parseError) {...
src/renderer/components/TableWindow.tsx:197
- Review the removal of currentSection from the useEffect dependencies; ensure that the intended behavior is maintained in all scenarios where currentSection changes, or consider a more explicit mechanism to control when a roll should occur.
}, [table, allTables]); // Removed currentSection dependency to prevent double-rolling
found when rerolling coin amount in treasure
There was a problem hiding this 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 Perchance parsing by stripping inline comments and improves the Table View with a search/filter feature and related UI updates.
- Strip
//comments in Perchance table definitions viaremoveComments(). - Add a search box to filter tables and pass the query through to
TableEntryViewer. - Refactor subroll utilities and adjust UI styles for search and roll counts.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/shared/utils/PerchanceParser.ts | Added removeComments() and updated parsing logic |
| src/renderer/components/TableWindow.tsx | Introduced search state, UI for search box, and updated effect dependencies |
| src/renderer/components/TableEntryViewer.tsx | Wired searchQuery prop, filtering logic, and entry highlighting |
| src/renderer/components/TableWindow.css | Styles for search box and its focus handling |
| src/shared/utils/TableRoller.ts | Refactored subroll position adjustments and core logic |
| src/shared/utils/SubrollUtils.ts | Added shared subroll utility functions |
Comments suppressed due to low confidence (2)
src/renderer/components/TableEntryViewer.tsx:14
- You've added
searchQueryto this component’s props but may not have updated theTableEntryViewerPropsinterface. Make suresearchQuery?: stringis declared there to avoid type errors.
const TableEntryViewer: React.FC<TableEntryViewerProps> = ({ table, searchQuery = '',
src/shared/utils/PerchanceParser.ts:93
- The new
removeCommentslogic should be covered by unit tests, including lines with comments only, lines without comments, and lines containing//in data. Please add tests for these scenarios.
function removeComments(line: string): string {
| /* Override global focus styling within table window when search is active */ | ||
| .table-window-content:focus-within *:not(.table-search-input):focus-visible { | ||
| outline: none !important; | ||
| } |
Copilot
AI
May 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule suppresses focus outlines for all elements except the search input when the search is active, which can hinder keyboard navigation. Ensure focus indicators remain visible on interactive elements.
| /* Override global focus styling within table window when search is active */ | |
| .table-window-content:focus-within *:not(.table-search-input):focus-visible { | |
| outline: none !important; | |
| } | |
| /* Ensure focus indicators remain visible for all interactive elements */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
This PR introduces functionality to ignore inline comments in Perchance table definitions and adds a search input for filtering table entries. Key changes include:
Fixes #25