Skip to content

Conversation

@ptaranat
Copy link
Member

@ptaranat ptaranat commented May 27, 2025

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.

Fixes #25

@ptaranat ptaranat requested a review from Copilot May 27, 2025 14:06
Copy link

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 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

@ptaranat ptaranat changed the title table view search, ignore perchance comments Perchance Parser updates, Table View Search May 27, 2025
@ptaranat ptaranat changed the title Perchance Parser updates, Table View Search Perchance ignore comments, Table View Search May 27, 2025
@ptaranat ptaranat marked this pull request as ready for review May 27, 2025 18:39
@ptaranat ptaranat requested a review from Copilot May 27, 2025 18:39
@ptaranat ptaranat changed the title Perchance ignore comments, Table View Search Perchance Parser updates, Table View Search May 27, 2025
Copy link

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 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

@ptaranat ptaranat requested a review from Copilot May 27, 2025 20:52
Copy link

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 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 via removeComments().
  • 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 searchQuery to this component’s props but may not have updated the TableEntryViewerProps interface. Make sure searchQuery?: string is declared there to avoid type errors.
const TableEntryViewer: React.FC<TableEntryViewerProps> = ({ table, searchQuery = '',

src/shared/utils/PerchanceParser.ts:93

  • The new removeComments logic 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 {

Comment on lines 91 to 94
/* 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;
}
Copy link

Copilot AI May 27, 2025

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.

Suggested change
/* 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 */

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@ptaranat ptaranat merged commit 23d628c into main May 28, 2025
@ptaranat ptaranat deleted the parser branch May 28, 2025 17:13
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.

Perchance ignore comments

1 participant