Skip to content
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

feat/forward-search-params #676

Merged
merged 4 commits into from
Mar 20, 2025
Merged

feat/forward-search-params #676

merged 4 commits into from
Mar 20, 2025

Conversation

anyulled
Copy link
Member

include utm params in tickets link

@anyulled anyulled requested a review from icougil March 20, 2025 08:34
@anyulled anyulled self-assigned this Mar 20, 2025
@anyulled anyulled added the enhancement New feature or request label Mar 20, 2025
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.

Hello @anyulled, 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!

Summary of Changes

This pull request focuses on enhancing the ticket purchasing flow by including UTM parameters in the ticket links. It also refactors the logic for determining whether certain actions (like buying tickets, submitting CFP, or applying for sponsorship) are enabled based on date intervals, using a new useDateInterval hook. This hook centralizes the date comparison logic and provides boolean flags for disabling the respective buttons.

Highlights

  • UTM Parameter Forwarding: The ticket purchase links now include UTM parameters from the current URL, allowing for better tracking of marketing campaign effectiveness.
  • Date Interval Hook: Introduces a useDateInterval hook to encapsulate the logic for checking if tickets, CFP, and sponsorship applications are within their respective active date ranges. This hook returns boolean flags to disable/enable the corresponding buttons.
  • Component Refactoring: The ActionButtons components for the 2023, 2024, and 2025 home pages have been updated to use the useDateInterval hook and to pass the disabled prop to the Button component based on the hook's return values. The date comparison logic has been removed from the components themselves.

Changelog

Click here to see the changelog
  • src/2023/Home/components/ActionButtons/ActionButtons.tsx
    • Imported the useDateInterval hook.
    • Replaced the individual date calculations and isBetween function with the useDateInterval hook.
    • Modified the ticket link to include window.location.search to forward UTM parameters.
    • Added the disabled prop to the buttons, controlled by the useDateInterval hook.
  • src/2024/Home/components/ActionButtons.tsx
    • Imported the useDateInterval hook.
    • Replaced the individual date calculations and isBetween function with the useDateInterval hook.
    • Modified the ticket link to include window.location.search to forward UTM parameters.
    • Added the disabled prop to the buttons, controlled by the useDateInterval hook.
  • src/hooks/useDateInterval.ts
    • Created a new hook useDateInterval that takes a date and the edition data as input.
    • Calculates whether the current date is within the ticket, CFP, and sponsorship date ranges.
    • Returns an object with boolean flags isTicketsDisabled, isCfpDisabled, and isSponsorDisabled.
  • src/views/Home/components/ActionButtons/ActionButtons.tsx
    • Imported the useDateInterval hook.
    • Replaced the individual date calculations and isBetween function with the useDateInterval hook.
    • Modified the ticket link to include window.location.search to forward UTM parameters.
    • Added the disabled prop to the buttons, controlled by the useDateInterval hook.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.


A hook is born, a function's grace,
To check the dates in time and space.
Tickets, CFP, and sponsors too,
Their buttons wait, for me and you.
UTM's passed, a marketer's dream,
To track the source, it would seem.

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.

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 introduces a new hook useDateInterval to determine if certain dates are within a specified interval, and it also forwards search parameters to the ticket link. The changes look good overall, but there are a few areas that could be improved for clarity and maintainability.

Summary of Findings

  • Code Duplication: The logic for determining if dates are within an interval was previously duplicated across multiple components. The introduction of the useDateInterval hook addresses this, which is great.
  • Readability: The removal of the isBetween function and the date calculations within the ActionButtons components improves readability by extracting this logic into a custom hook.
  • Maintainability: Using window.location.search directly in the link prop might lead to issues if the search parameters are not properly encoded or if there are conflicts with existing parameters. Consider using a utility function to handle URL parameter manipulation.

Merge Readiness

The pull request is almost ready for merging. Addressing the maintainability concern regarding URL parameter manipulation would make the code more robust. I am unable to directly approve the pull request, and other reviewers should review and approve this code before merging.

Copy link

netlify bot commented Mar 20, 2025

Deploy Preview for dev-bcn ready!

Name Link
🔨 Latest commit 19bbab5
🔍 Latest deploy log https://app.netlify.com/sites/dev-bcn/deploys/67dbe2fdbefbd900082862c0
😎 Deploy Preview https://deploy-preview-676--dev-bcn.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
4.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@anyulled
Copy link
Member 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

The pull request introduces a new useUrlBuilder hook and useDateInterval hook to handle URL construction and date interval checks for the DevBcn website. The goal is to include UTM parameters in ticket links and manage the disabled state of action buttons based on date intervals. The changes involve refactoring the ActionButtons components for different years (2023, 2024, 2025) to use these new hooks.

Summary of Findings

  • Dependency Management: The pull request includes changes to package-lock.json and package.json, moving @faker-js/faker from dependencies to devDependencies and updating versions of testing libraries. This is good for keeping production dependencies lean.
  • Code Duplication: The ActionButtons components for different years (2023, 2024, 2025) are very similar. Consider creating a single, reusable component with props to handle the year-specific data and logic.
  • Testing: The useUrlBuilder hook is tested by mocking window.location. While this works, consider using a more robust testing strategy that doesn't rely on global mocks.

Merge Readiness

The pull request is almost ready for merging. The introduction of the useUrlBuilder and useDateInterval hooks improves the maintainability and testability of the code. However, addressing the code duplication in the ActionButtons components and improving the testing strategy for useUrlBuilder would make the pull request even better. I am unable to approve this pull request, and recommend that others review and approve this code before merging. Given the medium severity comment, I recommend that the author address it before merging.

@anyulled anyulled merged commit 3f2f467 into main Mar 20, 2025
13 of 14 checks passed
@anyulled anyulled deleted the feat/forward-search-params branch March 20, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant