Skip to content

Conversation

@michal-duszak
Copy link

No description provided.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Summary of Changes

Hello @michal-duszak, 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 significantly upgrades the application's notification system by replacing the default, blocking browser alerts with a custom-built, aesthetically pleasing, and non-blocking alternative. This change ensures a more consistent and modern user interface for displaying feedback, errors, and important information, thereby enhancing the overall user experience and application responsiveness.

Highlights

  • Custom Alert System: Introduced a new custom, user-friendly alert system using Nunjucks, JavaScript, and Tailwind CSS, replacing the browser's native alert() function.
  • Improved User Experience: The new alert system provides visually distinct notifications for success, error, warning, and info messages, with smooth transitions, dismissibility, and configurable durations.
  • Code Modernization: All instances of native alert() calls in script.js have been replaced with calls to the new custom alert functions (showSuccess, showError, showWarning), standardizing the notification mechanism.
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.

@deepsource-io
Copy link

deepsource-io bot commented Sep 17, 2025

Here's the code health analysis summary for commits 04e766c..4069961. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Python LogoPython✅ SuccessView Check ↗
DeepSource Secrets LogoSecrets✅ SuccessView Check ↗
DeepSource Shell LogoShell✅ SuccessView Check ↗
DeepSource Docker LogoDocker✅ SuccessView Check ↗
DeepSource JavaScript LogoJavaScript✅ Success
🎯 6 occurences resolved
View Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Copy link
Contributor

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

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 does a great job of replacing native alert() calls with a much more user-friendly custom alert system. The implementation is solid, providing different alert types and animations.

I've identified a few areas for improvement. Most importantly, there's a critical security vulnerability (XSS) due to unescaped messages from API responses being rendered as HTML. I've also found a bug where alerts have an extremely long default duration, effectively making them permanent. Additionally, I've included some suggestions to improve code maintainability and consistency, such as refactoring an inline event handler and simplifying a confusing function implementation.

Addressing these points will make the new alert system more secure, robust, and easier to maintain.

@jbampton jbampton self-assigned this Sep 17, 2025
@jbampton jbampton marked this pull request as draft September 17, 2025 09:34
@jbampton jbampton added this to Chess Sep 17, 2025
@michal-duszak
Copy link
Author

@jbampton I see you've self-assigned this PR. Should I stop working on resolving issues?

@jbampton jbampton assigned michal-duszak and unassigned jbampton Sep 17, 2025
@jbampton jbampton moved this to In Progress in Chess Sep 17, 2025
@jbampton
Copy link
Member

I just reassigned you now @michal-duszak thanks

Sorry for the confusion.

@michal-duszak
Copy link
Author

@jbampton can we move on no matter failing checks?
image

@michal-duszak michal-duszak marked this pull request as ready for review September 22, 2025 13:25
@jbampton jbampton requested a review from BaseMax September 22, 2025 13:43
@jbampton
Copy link
Member

/gemini review

Copy link
Contributor

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

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 does a great job of replacing the native alert() calls with a custom, user-friendly alert system. The new alert component is well-structured and provides different styles for success, error, warning, and info messages. The implementation correctly handles message formatting, HTML escaping to prevent XSS, and animations for showing and dismissing alerts.

I've added a few suggestions to improve the new alert system further, focusing on accessibility, robustness, and JavaScript best practices. Specifically, I've recommended using a proper <button> element for the close control to improve accessibility, using crypto.randomUUID() for more reliable unique ID generation, and encapsulating the script in an IIFE to avoid polluting the global namespace.

The changes in script.js to adopt the new alert functions are clean and correct. Overall, this is a solid improvement to the user experience.

@michal-duszak
Copy link
Author

/gemini review

Copy link
Contributor

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

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 does a great job of replacing the native alert() with a custom and user-friendly alert system. The new AlertSystem is well-structured, handles different message types, and includes nice animations. The code is clean and the implementation is robust, including protection against XSS vulnerabilities. I have a few minor suggestions to improve accessibility, fix a small CSS class issue, and enhance code documentation. Overall, this is a solid improvement.

const alertId = 'alert-' + crypto.randomUUID();
const alertHTML = `
<div id="${alertId}" class="w-lg w-full ${config.bg} border ${config.border} ${config.text} px-4 py-3 rounded relative shadow-lg transform transition-all duration-300 ease-in-out translate-x-full opacity-0" role="alert">
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The CSS class w-lg is not a standard Tailwind CSS class and will have no effect. It seems you intended to set a maximum width for the alert. I suggest changing it to max-w-lg to constrain the alert's width on larger screens, which improves readability.

				<div id="${alertId}" class="max-w-lg w-full ${config.bg} border ${config.border} ${config.text} px-4 py-3 rounded relative shadow-lg transform transition-all duration-300 ease-in-out translate-x-full opacity-0" role="alert">

<div id="${alertId}" class="w-lg w-full ${config.bg} border ${config.border} ${config.text} px-4 py-3 rounded relative shadow-lg transform transition-all duration-300 ease-in-out translate-x-full opacity-0" role="alert">
<span class="block pr-2">${message}</span>
${dismissible ? `
<button class="absolute top-2 right-2 cursor-pointer alert-dismiss-button">
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For better accessibility and to follow best practices, the dismiss button should have an aria-label attribute to describe its function to screen readers. The <title> element inside an SVG is not consistently supported by all screen reader/browser combinations. Also, adding type="button" prevents it from unintentionally submitting a form if it were ever placed inside one.

						<button type="button" aria-label="Close" class="absolute top-2 right-2 cursor-pointer alert-dismiss-button">

* Displays an alert message with a list of validation errors.
* @param {string[]} errors - The list of error messages.
* Displays a warning alert message.
* @param {string|string[]} message - The list of error messages.
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The JSDoc for the message parameter is a bit confusing. Since the function is named showWarning, the documentation should refer to "warning messages" instead of "error messages" to maintain consistency and clarity.

Suggested change
* @param {string|string[]} message - The list of error messages.
* @param {string|string[]} message - The warning message or an array of messages.

@BaseMax
Copy link
Member

BaseMax commented Sep 28, 2025

Tests:

image

@BaseMax
Copy link
Member

BaseMax commented Sep 28, 2025

Hey, it was a key feature. @michal-duszak

Many thanks for your help. I will try to pull and test it locally. Also it can be nice if you can share a screenshot of the custom modal.

@jbampton
Copy link
Member

@BaseMax please don't reference those tests on PRs. See the issue list and please keep up mate.

We are not building the universe in one pr.

@michal-duszak is not responsible for fixing those

@michal-duszak
Copy link
Author

michal-duszak commented Sep 28, 2025

@BaseMax custom modal screenshots.

Warning:
image

Error:
image

EDIT: It's not a modal, it's an alert

@jbampton jbampton added javascript Pull requests that update javascript code medium-priority nunjucks labels Oct 3, 2025
@jbampton jbampton modified the milestones: September, Hacktoberfest Oct 3, 2025
@jbampton jbampton requested a review from prio101 October 4, 2025 21:13
@jbampton jbampton marked this pull request as draft October 8, 2025 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend javascript Pull requests that update javascript code medium-priority nunjucks

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Remove all alert() in script.js and create a custom and nice user-friendly alert by css/js

3 participants