Skip to content

Add localStorage-based dismissal for donation dialog#709

Merged
ManAnRuck merged 4 commits intomasterfrom
copilot/add-hide-donation-dialog-functionality
Nov 4, 2025
Merged

Add localStorage-based dismissal for donation dialog#709
ManAnRuck merged 4 commits intomasterfrom
copilot/add-hide-donation-dialog-functionality

Conversation

Copy link
Contributor

Copilot AI commented Nov 4, 2025

The donation dialog "Wir brauchen Dich! 🫵🏼" was appearing on every page refresh. Implemented time-based dismissal with localStorage persistence.

Changes

  • New utility module (donateDialogStorage.ts)

    • shouldShowDonateDialog(): Checks localStorage for active dismissal period
    • setDonateDialogDismissTime(): Persists dismissal timestamp
    • Validates parsed timestamps, handles localStorage unavailability
    • Auto-cleans expired entries
  • Updated DonateDialog component

    • Checks dismissal state on mount via useEffect
    • "Jetzt Nicht" → 30 minute dismissal
    • "Spenden" → 1 day dismissal
    • Dialog completely skipped when dismissed (no render → no flicker)

Behavior

// localStorage key: 'donateDialogDismissUntil'
// Stores Unix timestamp (ms) when dismissal expires

DISMISS_DURATION = {
  NOT_NOW: 30 * 60 * 1000,    // 30 minutes
  DONATED: 24 * 60 * 60 * 1000 // 1 day
}

If localStorage is unavailable or throws, dialog shows normally (fail-open pattern).

Original prompt

Start implementation

User has selected text in file devbox.json from 2:17 to 2:21

[Chronological Review: The conversation began with the user requesting a functionality to hide a donation dialog for a specified duration based on user interaction. The user specified that the dialog should not be shown again for 30 minutes if the user clicks "jetzt nicht" (not now) and for one day if they click "spenden" (donate). The user then clarified that if the settings are set to hide, the popup should not be visible and should not trigger any flicker. They also mentioned that if there is no local storage, the dialog should always be shown. The user decided to use browser developer tools for testing instead of other methods. The conversation continued with the user requesting to skip showing the dialog when it should be hidden, and finally, they instructed to start the implementation.]

[Intent Mapping:

  1. "plane zu democracy/desktop eine funktionalität welche den spendendialog 'Wir brauchen Dich! 🫵🏼' nicht bei jeden refresh anzeigt." - User wants to implement a feature to hide the donation dialog for a specified time.
  2. "if the settings are on hide it's important that the popup is not visible and triggers no flickr" - User emphasizes the importance of the dialog being hidden without flickering.
  3. "ja if there is no local storage the dialog should be shown always" - User specifies behavior when local storage is absent.
  4. "no, i will use my browser dev tools for it" - User indicates their choice of testing method.
  5. "skip it when it should be hidden" - User requests to skip showing the dialog when it should be hidden.
  6. "Start implementation" - User instructs to begin the implementation of the requested feature.]

[Technical Inventory:

  • Local Storage: Used to track user interactions with the donation dialog.
  • Popup Dialog: The UI element that needs to be controlled based on user actions.
  • Browser Developer Tools: The tool chosen by the user for testing the implementation.]

[Code Archaeology: No specific files or code changes have been discussed yet, as the user has just initiated the implementation phase.]

[Progress Assessment:

  • Completed Tasks: User has outlined the requirements for the donation dialog functionality.
  • Partially Complete Work: Implementation has just been started, with no code changes made yet.]

[Context Validation: All critical information for continuation is captured, including user requirements for the donation dialog and the conditions under which it should be displayed or hidden.]

[Recent Commands Analysis:

  • Last Agent Commands: User requested to "Start implementation."
  • Tool Results Summary: No tool results were generated as the implementation phase has just begun.
  • Pre-Summary State: The agent was preparing to start the implementation of the donation dialog functionality when the token budget was exceeded.
  • Operation Context: The commands executed were directly related to the user's goal of implementing a feature to manage the visibility of the donation dialog based on user interactions.]
1. Conversation Overview: - Primary Objectives: User requested to implement functionality to hide the donation dialog for specific durations based on user interactions: "Wir brauchen Dich! 🫵🏼" should not be shown again for 30 minutes if "jetzt nicht" is clicked and for one day if "spenden" is clicked. - Session Context: The conversation flowed from outlining requirements to clarifying behavior under certain conditions, leading to the initiation of the implementation phase. - User Intent Evolution: The user clarified their requirements and testing methods, ultimately directing to start the implementation.
  1. Technical Foundation:
  • Local Storage: Used to store user preferences regarding the donation dialog visibility.
  • Popup Dialog: The UI element that needs to be controlled based on user actions.
  1. Codebase Status:
  • No specific files or code changes have been discussed yet, as the implementation has just been initiated.
  1. Problem Resolution:
  • Issues Encountered: None reported yet, as the implementation phase has just started.
  • Solutions Implemented: Not applicable at this stage.
  • Debugging Context: No ongoing troubleshooting efforts reported.
  • Lessons Learned: User has specific requirements for dialog visibility based on interactions.
  1. Progress Tracking:
  • Completed Tasks: User has defined the requirements for the donation dialog functionality.
  • Partially Complete Work: Implementation has just started, with no code changes made yet.
  1. Active Work State:
  • Current Focus: User is focused on starting the implementation of the donation dialog functionality.
  • Recent Context: The last few exchanges involved clarifying requirements and initiating the implementation.
  • Working Code: No specific code snippets have been discussed yet.
  • Immediate Context: User requested to start the implementation of the donation dialog functionality.
  1. Recent...

Created from VS Code via the GitHub Pull Request extension.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits November 4, 2025 19:36
Co-authored-by: ManAnRuck <2183135+ManAnRuck@users.noreply.github.com>
… parseInt

Co-authored-by: ManAnRuck <2183135+ManAnRuck@users.noreply.github.com>
Co-authored-by: ManAnRuck <2183135+ManAnRuck@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement functionality to hide donation dialog based on user interaction Add localStorage-based dismissal for donation dialog Nov 4, 2025
Copilot AI requested a review from ManAnRuck November 4, 2025 19:43
@ManAnRuck ManAnRuck marked this pull request as ready for review November 4, 2025 19:50
@ManAnRuck ManAnRuck requested a review from Copilot November 4, 2025 19:50
Copy link

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

This PR adds localStorage-based dismiss functionality to the DonateDialog component. The dialog will now remember when users dismiss it and respect configurable time periods before showing again (30 minutes for "Not Now", 1 day for "Donate").

Key Changes:

  • Created a new utility module (donateDialogStorage.ts) to manage dialog dismiss state using localStorage
  • Updated DonateDialog component to check localStorage before showing the dialog
  • Added dismiss time tracking when users interact with dialog buttons

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
democracy/desktop/src/utils/donateDialogStorage.ts New utility module providing functions to check and set dialog dismiss timestamps with error handling for localStorage operations
democracy/desktop/src/components/organisms/DonateDialog.tsx Updated to use localStorage utilities, changed from useMemo to useEffect, and added dismiss time tracking on button clicks

@ManAnRuck ManAnRuck merged commit deefbb1 into master Nov 4, 2025
19 checks passed
@ManAnRuck ManAnRuck deleted the copilot/add-hide-donation-dialog-functionality branch November 4, 2025 20:17
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.

3 participants