Skip to content

feat: sort project cards lexicographically for better navigation#611

Merged
steam-bell-92 merged 1 commit into
steam-bell-92:mainfrom
nishtha-agarwal-211:fix/decorative-code-overlapping-474
May 22, 2026
Merged

feat: sort project cards lexicographically for better navigation#611
steam-bell-92 merged 1 commit into
steam-bell-92:mainfrom
nishtha-agarwal-211:fix/decorative-code-overlapping-474

Conversation

@nishtha-agarwal-211
Copy link
Copy Markdown
Contributor

Description

Fixes #603

This PR resolves the issue where project cards on the homepage were displayed in an inconsistent/random order. It ensures that all project cards are sorted lexicographically (alphabetically) by their title for better navigation and UX.

Proposed Changes

  • Dynamic Sorting in main.js: Reordered the project card DOM elements inside .projects-grid alphabetically using localeCompare on their <h3> text content right at the start of the DOMContentLoaded event handler.
  • Downstream Safety: Since the sorting runs before defining references like projectCards, all downstream interactions (filtering, search, favorites, category tabs) automatically operate on the sorted elements.
  • Automatic & Scalable: Avoids manually rearranging thousands of lines of static HTML files, and ensures any future cards added to the HTML will automatically be sorted lexicographically without developer intervention.

Benefits

  • Zero layout shift: Elements are reordered synchronously on DOMContentLoaded before rendering is complete.
  • Consistent sorting: Works consistently across the homepage (index.html) as well as all specific categories (games.html, math.html, utilities.html).

Verification & Testing

  • Ran all local Python unit tests via pytest to ensure zero regressions to the calculation modules:
    119 passed in 0.69s
  • Verified visual correctness: project cards are properly sorted starting from AP/GP/AGP/HP Recognizer, Armstrong Numbers through to Word Scramble / Whack-a-Mole.

Copilot AI review requested due to automatic review settings May 22, 2026 15:25
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

@nishtha-agarwal-211 is attempting to deploy a commit to the Anuj's projects Team on Vercel.

A member of the Team first needs to authorize it.

@nishtha-agarwal-211
Copy link
Copy Markdown
Contributor Author

Implemented the change by sorting all project cards lexicographically for improved navigation and easier project discovery.

The cards are now displayed in alphabetical order, making the UI more organised and user-friendly.

Screenshot 2026-05-22 at 8 55 27 PM

Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

Adds client-side sorting so project cards render alphabetically by their title when the page finishes loading.

Changes:

  • Collects .project-card elements and sorts them lexicographically by <h3> text.
  • Re-appends sorted cards into .projects-grid during DOMContentLoaded.

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

Comment thread web-app/js/main.js Outdated

// Sort project cards lexicographically (alphabetically) by title
var projectsGrid = document.querySelector('.projects-grid');
var rawCards = Array.from(document.querySelectorAll('.project-card'));
Comment thread web-app/js/main.js
Comment thread web-app/js/main.js
Comment on lines +53 to +60
rawCards.sort(function (a, b) {
var titleA = (a.querySelector('h3') || {}).textContent || '';
var titleB = (b.querySelector('h3') || {}).textContent || '';
return titleA.trim().localeCompare(titleB.trim());
});
rawCards.forEach(function (card) {
projectsGrid.appendChild(card);
});
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
python-mini-project Ready Ready Preview, Comment May 22, 2026 3:59pm

@steam-bell-92 steam-bell-92 merged commit 093b46b into steam-bell-92:main May 22, 2026
7 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🎉 Thank you for your contribution!

Your Pull Request has been merged successfully.

We appreciate the time and effort you put into improving this project. Contributions like yours help the repository grow and stay useful for everyone.

If you'd like to contribute again, please check the open issues and make sure you are assigned before opening another Pull Request.

Thanks again for your support! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sort Project Cards Lexicographically for Better Navigation

3 participants