Skip to content

Update: Refactor UI/UX styles, enhance JS code consistency, and improve documentation formatting#22

Merged
hoangsonww merged 3 commits into
masterfrom
fix/fix-ui-ux
Dec 10, 2025
Merged

Update: Refactor UI/UX styles, enhance JS code consistency, and improve documentation formatting#22
hoangsonww merged 3 commits into
masterfrom
fix/fix-ui-ux

Conversation

@hoangsonww

Copy link
Copy Markdown
Owner

This pull request focuses on standardizing the use of double quotes in the JavaScript codebase and updating the .prettierignore file. The main changes ensure consistent code style and improve maintainability, but do not introduce new features or alter application behavior.

Code style consistency:

  • Replaced all single quotes with double quotes for strings, selectors, and attributes throughout packages/script.js to enforce a uniform quoting style. This affects DOM queries, event listener names, class and ID selectors, and string literals in all functions. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]

Configuration updates:

  • Added a rule to ignore all Markdown files (*.md) in the .prettierignore file, preventing Prettier from formatting documentation or markdown files.

@hoangsonww hoangsonww self-assigned this Dec 10, 2025
@hoangsonww hoangsonww added bug Something isn't working documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers labels Dec 10, 2025
@vercel

vercel Bot commented Dec 10, 2025

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
learning-management-system-fullstack Ignored Ignored Dec 10, 2025 3:31am

@hoangsonww
hoangsonww merged commit bfeb206 into master Dec 10, 2025
3 checks passed
@netlify

netlify Bot commented Dec 10, 2025

Copy link
Copy Markdown

Deploy Preview for fullstack-learning-management-system canceled.

Name Link
🔨 Latest commit 56ff7c4
🔍 Latest deploy log https://app.netlify.com/projects/fullstack-learning-management-system/deploys/6938e9870304e200088100a9

@hoangsonww
hoangsonww deleted the fix/fix-ui-ux branch December 10, 2025 03:31
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @hoangsonww, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing code consistency and maintainability across the project. It primarily standardizes JavaScript string literals to use double quotes, updates the Prettier configuration to ignore Markdown files, and includes minor CSS formatting improvements. These changes are purely stylistic and do not introduce new features or alter existing application behavior.

Highlights

  • JavaScript Code Consistency: Standardized string literals in packages/script.js to consistently use double quotes instead of single quotes across all functions, DOM queries, event listeners, and attribute manipulations. This improves code uniformity and adheres to common style guides.
  • Prettier Configuration Update: Modified the .prettierignore file to include *.md, preventing Prettier from formatting Markdown files and ensuring documentation formatting is not automatically altered.
  • Copyright Year Update: The copyright year in the LICENSE file has been updated from 2024 to 2025.
  • CSS Formatting Improvements: Applied minor formatting adjustments to packages/styles.css, primarily by adding newlines within complex CSS properties like linear-gradient and @keyframes definitions, enhancing readability.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request primarily focuses on code formatting and minor refactoring across packages/script.js and packages/styles.css. In script.js, changes include converting single quotes to double quotes, reformatting array definitions, and improving readability of console.log statements. In styles.css, the changes involve reformatting CSS properties and linear-gradient declarations for better readability, and adjusting the padding of .tab-btn. The LICENSE file was updated to reflect a 2025 copyright, and *.md files were added to .prettierignore. The review comments highlight two key areas for improvement in script.js: the initSearch function has a logical flaw where it incorrectly hides parent containers based on individual child elements not matching, and a refactor is suggested to correctly filter based on the container's overall text content; additionally, the initCopyButtons function directly manipulates button.style.background, and the reviewer suggests using CSS classes (.copied, .error) for managing button visual states to improve maintainability and separation of concerns.

Comment thread packages/script.js
Comment on lines +390 to 408
const searchableElements = document.querySelectorAll(
"section, .card, h2, h3, p",
);

searchInput.addEventListener("input", (e) => {
const searchTerm = e.target.value.toLowerCase();
searchableElements.forEach(element => {

searchableElements.forEach((element) => {
const text = element.textContent.toLowerCase();
const parent = element.closest('.card, section');
if (text.includes(searchTerm) || searchTerm === '') {
if (parent) parent.style.display = '';
element.style.display = '';
const parent = element.closest(".card, section");

if (text.includes(searchTerm) || searchTerm === "") {
if (parent) parent.style.display = "";
element.style.display = "";
} else {
if (parent) parent.style.display = 'none';
if (parent) parent.style.display = "none";
}
});
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

The current search implementation has a logic flaw that can cause incorrect filtering. When a search term doesn't match an element (like a <p>), it hides the element's parent (.card or section). This can hide a parent container even if other child elements within it do match the search term, because the loop will continue and a non-matching child will hide the parent, leading to an incorrect final state.

To fix this, you should iterate through the main content blocks (e.g., section or .card) and decide whether to show or hide each block based on whether its text content contains the search term. This ensures that a block is visible if any part of it matches.

  const searchableContainers = document.querySelectorAll("section[id], .card");

  searchInput.addEventListener("input", (e) => {
    const searchTerm = e.target.value.toLowerCase();

    searchableContainers.forEach((container) => {
      const text = container.textContent.toLowerCase();
      const isMatch = text.includes(searchTerm) || searchTerm === "";
      container.style.display = isMatch ? "" : "none";
    });
  });

Comment thread packages/script.js
Comment on lines 232 to 251
try {
await navigator.clipboard.writeText(code);
const originalText = button.textContent;
button.textContent = '✓ Copied!';
button.style.background = '#10b981';
button.textContent = "✓ Copied!";
button.style.background = "#10b981";

setTimeout(() => {
button.textContent = originalText;
button.style.background = '';
button.style.background = "";
}, 2000);
} catch (err) {
console.error('Failed to copy code:', err);
button.textContent = '✗ Error';
button.style.background = '#ef4444';
console.error("Failed to copy code:", err);
button.textContent = "✗ Error";
button.style.background = "#ef4444";

setTimeout(() => {
button.textContent = 'Copy';
button.style.background = '';
button.textContent = "Copy";
button.style.background = "";
}, 2000);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Directly manipulating button.style.background mixes JavaScript logic with CSS styling. For better maintainability and separation of concerns, it's recommended to use CSS classes to handle visual states.

You can define .copied and .error classes in your stylesheet and simply add or remove them from the button in JavaScript.

Example CSS:

.copy-btn.copied {
  background-color: var(--success-color);
}
.copy-btn.error {
  background-color: var(--danger-color);
}
Suggested change
try {
await navigator.clipboard.writeText(code);
const originalText = button.textContent;
button.textContent = '✓ Copied!';
button.style.background = '#10b981';
button.textContent = "✓ Copied!";
button.style.background = "#10b981";
setTimeout(() => {
button.textContent = originalText;
button.style.background = '';
button.style.background = "";
}, 2000);
} catch (err) {
console.error('Failed to copy code:', err);
button.textContent = '✗ Error';
button.style.background = '#ef4444';
console.error("Failed to copy code:", err);
button.textContent = "✗ Error";
button.style.background = "#ef4444";
setTimeout(() => {
button.textContent = 'Copy';
button.style.background = '';
button.textContent = "Copy";
button.style.background = "";
}, 2000);
}
try {
await navigator.clipboard.writeText(code);
const originalText = button.textContent;
button.textContent = "✓ Copied!";
button.classList.add("copied");
setTimeout(() => {
button.textContent = originalText;
button.classList.remove("copied");
}, 2000);
} catch (err) {
console.error("Failed to copy code:", err);
button.textContent = "✗ Error";
button.classList.add("error");
setTimeout(() => {
button.textContent = "Copy";
button.classList.remove("error");
}, 2000);
}

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

Labels

bug Something isn't working documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

1 participant