Skip to content

Conversation

Saksham-Sirohi
Copy link
Contributor

@Saksham-Sirohi Saksham-Sirohi commented Oct 1, 2025

Fixes #386 of eventyay-talk high number of locales seemed to be the breaking factor if locales are high a dropdown approach is now used

Screenshot 2025-10-01 at 11 53 07 PM Screenshot 2025-10-01 at 11 54 24 PM

Summary by Sourcery

Prevent header layout break when there are many locales by introducing a conditional locale selection dropdown, updating CSS layout rules, and adding dropdown behavior via JavaScript.

Bug Fixes:

  • Prevent header overflow caused by a high number of locale links by switching to a dropdown for events with more than three locales

Enhancements:

  • Update header CSS to use nowrap flex layout and keep-all word breaking for consistent alignment
  • Add dropdown styling for locale selection and conditional template logic to render inline links for up to three locales or a dropdown for more
  • Hide user-logs panel on viewports under 1200px for improved responsiveness
  • Include a dropdown.js script to close open dropdowns when clicking outside

Copy link
Contributor

sourcery-ai bot commented Oct 1, 2025

Reviewer's Guide

To prevent header wrapping when an event has many locales, this PR refactors CSS to enforce flex-nowrap and adds dedicated styling for inline and dropdown locale links (plus user-logs), updates the base template to render locales as an inline list when ≤3 or a

dropdown when >3 (including a new script reference), and introduces a small JS module that closes open dropdowns on outside clicks.

Class diagram for dropdown JS module

classDiagram
    class DropdownManager {
        +initDropdowns()
    }
    class "document" {
    }
    DropdownManager -- "document" : interacts with
    DropdownManager : +initDropdowns()
    DropdownManager : +eventListener('click')
    DropdownManager : +eventListener('DOMContentLoaded')
Loading

File-Level Changes

Change Details Files
Refine header and locale styling in CSS
  • Changed header and tab containers from flex-wrap: wrap to nowrap and added flex-shrink rules
  • Replaced word-break: break-word with keep-all
  • Introduced .locale-link, .locales-inline, .dropdown-content and hover/active states
  • Added .user-logs positioning and responsive hide rules
app/eventyay/static/cfp/css/_layout.css
Conditional locale selector dropdown in base template
  • Wrapped locale links in
    dropdown when event.locales > 3; used for the current locale label
  • Fell back to inline links for 3 or fewer locales with .locale-link class
  • Updated querystring handling for locale set URLs
  • Added <script defer> include for dropdown.js
app/eventyay/common/templates/common/base.html
Implement dropdown close behavior via JS
  • Created dropdown.js to close any open <details.dropdown> on outside clicks
  • Initialized listeners on DOMContentLoaded or when ready
app/eventyay/static/common/js/dropdown.js

Assessment against linked issues

Issue Objective Addressed Explanation
#386 Add a button on the event page that redirects to the video system with admin permissions. The PR does not add any button related to video system access or admin permissions. The changes are focused on locale selection UI and dropdown logic.
#386 Improve access logic by implementing a VideoAccessAuthenticator class to manage permissions and token generation. There is no implementation or modification related to access logic or a VideoAccessAuthenticator class in the PR. The PR only modifies frontend locale selection and dropdown behavior.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Consider extracting the hardcoded >3 threshold for switching between inline locale links and the dropdown into a configurable constant or template variable so it can be adjusted without editing code.
  • Improve dropdown accessibility by adding keyboard support (e.g. Escape to close, arrow navigation, focus management) and appropriate ARIA attributes on the <summary> and menu items.
  • Instead of manually inserting %3F when building the next query parameter, use Django’s urlencode or request.get_full_path to compose the full URL and avoid potential encoding issues.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider extracting the hardcoded `>3` threshold for switching between inline locale links and the dropdown into a configurable constant or template variable so it can be adjusted without editing code.
- Improve dropdown accessibility by adding keyboard support (e.g. Escape to close, arrow navigation, focus management) and appropriate ARIA attributes on the `<summary>` and menu items.
- Instead of manually inserting `%3F` when building the `next` query parameter, use Django’s `urlencode` or `request.get_full_path` to compose the full URL and avoid potential encoding issues.

## Individual Comments

### Comment 1
<location> `app/eventyay/static/cfp/css/_layout.css:49` </location>
<code_context>
     align-items: flex-end;
-    word-break: break-word;
+    word-break: keep-all;
+    flex-wrap: nowrap;
   }
   #header-tabs {
</code_context>

<issue_to_address>
**issue:** Using 'flex-wrap: nowrap' may cause layout overflow on smaller screens.

Please verify that the layout remains usable on small screens with many tabs or locale links, as nowrap may prevent content from wrapping and cause overflow.
</issue_to_address>

### Comment 2
<location> `app/eventyay/static/cfp/css/_layout.css:59` </location>
<code_context>
     border-radius: var(--size-border-radius) var(--size-border-radius) 0 0;
     margin-bottom: -4px;
     padding-bottom: 4px;
+    flex-shrink: 0;
     a.header-tab {
       padding: 8px 10px 4px 10px;
</code_context>

<issue_to_address>
**suggestion:** Adding 'flex-shrink: 0' may reduce flexibility for header elements.

This change may lead to header overflow on smaller screens. Consider applying 'flex-shrink: 0' only when necessary, based on screen size.

Suggested implementation:

```

```

```
  #header-tabs {
    display: flex;
    flex-wrap: nowrap;
    z-index: 400;
    background: var(--color-bg);
    border-radius: var(--size-border-radius) var(--size-border-radius) 0 0;
    margin-bottom: -4px;
    padding-bottom: 4px;
  }

  @media (min-width: 600px) {
    #header-tabs {
      flex-shrink: 0;
    }
  }

  #header-tabs a.header-tab {
    padding: 8px 10px 4px 10px;
    border-bottom: 2px solid transparent;
    color: white;
    margin-left: auto;
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;

```
</issue_to_address>

### Comment 3
<location> `app/eventyay/common/templates/common/base.html:109` </location>
<code_context>
+                                    </summary>
+                                    <div id="locale-dropdown" class="dropdown-content dropdown-content-s{% if rtl %}e{% else %}w{% endif %}">
+                                        {% for l, name in request.event.named_locales %}
+                                            <a href="{% url "cfp:locale.set" event=request.event.slug %}?locale={{ l }}&next={{ request.path }}%3F{{ request.META.QUERY_STRING|urlencode }}"
+                                               class="dropdown-item {% if l|lower == request.LANGUAGE_CODE|lower %}active{% endif %}" role="menuitem" tabindex="-1">{{ name }}</a>
+                                        {% endfor %}
</code_context>

<issue_to_address>
**issue:** URL encoding for 'next' parameter may be inconsistent between dropdown and inline links.

Please standardize the URL encoding logic for the 'next' parameter in both dropdown and inline links to prevent navigation errors with complex query strings.
</issue_to_address>

### Comment 4
<location> `app/eventyay/static/common/js/dropdown.js:4-15` </location>
<code_context>

</code_context>

<issue_to_address>
**issue (code-quality):** Use `const` or `let` instead of `var`. ([`avoid-using-var`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/JavaScript/Default-Rules/avoid-using-var))

<details><summary>Explanation</summary>`const` is preferred as it ensures you cannot reassign references (which can lead to buggy and confusing code).
`let` may be used if you need to reassign references - it's preferred to `var` because it is block- rather than
function-scoped.

From the [Airbnb JavaScript Style Guide](https://airbnb.io/javascript/#references--prefer-const)
</details>
</issue_to_address>

### Comment 5
<location> `app/eventyay/static/common/js/dropdown.js:6` </location>
<code_context>

</code_context>

<issue_to_address>
**issue (code-quality):** Use `const` or `let` instead of `var`. ([`avoid-using-var`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/JavaScript/Default-Rules/avoid-using-var))

<details><summary>Explanation</summary>`const` is preferred as it ensures you cannot reassign references (which can lead to buggy and confusing code).
`let` may be used if you need to reassign references - it's preferred to `var` because it is block- rather than
function-scoped.

From the [Airbnb JavaScript Style Guide](https://airbnb.io/javascript/#references--prefer-const)
</details>
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

align-items: flex-end;
word-break: break-word;
word-break: keep-all;
flex-wrap: nowrap;
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: Using 'flex-wrap: nowrap' may cause layout overflow on smaller screens.

Please verify that the layout remains usable on small screens with many tabs or locale links, as nowrap may prevent content from wrapping and cause overflow.

@mariobehling mariobehling changed the title fix:schedule imbalance fix fix: schedule imbalance fix Oct 2, 2025
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.

4 participants