mirror of
https://github.com/m1ngsama/FUJI.git
synced 2025-12-25 02:56:38 +00:00
fix: ensure eventid is removed from URL when drawer closes
- Replace onCloseEventDetail with handleDrawerOpenChange - Handle all drawer close scenarios: button click, outside click, ESC key - Remove eventid from URL whenever drawer is closed via any method - Fixes issue where eventid remained in URL after closing drawer
This commit is contained in:
parent
8720a56c7d
commit
dda92f5664
1 changed files with 10 additions and 8 deletions
|
|
@ -411,15 +411,17 @@ export default function App() {
|
||||||
window.history.replaceState({}, '', newUrl)
|
window.history.replaceState({}, '', newUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onCloseEventDetail = () => {
|
const handleDrawerOpenChange = (isOpen: boolean) => {
|
||||||
onOpenChange()
|
onOpenChange()
|
||||||
|
|
||||||
// Remove eventid from URL
|
// Remove eventid from URL when drawer is closed
|
||||||
|
if (!isOpen) {
|
||||||
const params = new URLSearchParams(window.location.search)
|
const params = new URLSearchParams(window.location.search)
|
||||||
params.delete('eventid')
|
params.delete('eventid')
|
||||||
const newUrl = `${window.location.pathname}?${params.toString()}`
|
const newUrl = `${window.location.pathname}?${params.toString()}`
|
||||||
window.history.replaceState({}, '', newUrl)
|
window.history.replaceState({}, '', newUrl)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const MobileEventCard = ({ event }: { event: PublicEvent }) => (
|
const MobileEventCard = ({ event }: { event: PublicEvent }) => (
|
||||||
<button className="bg-white border border-gray-200 rounded-lg p-4 shadow-sm" onClick={() => onOpenEventDetail(event)}>
|
<button className="bg-white border border-gray-200 rounded-lg p-4 shadow-sm" onClick={() => onOpenEventDetail(event)}>
|
||||||
|
|
@ -617,8 +619,8 @@ export default function App() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
onOpenChange={onOpenChange}
|
onOpenChange={handleDrawerOpenChange}
|
||||||
onClose={onCloseEventDetail}
|
onClose={() => handleDrawerOpenChange(false)}
|
||||||
onDelete={() => {}}
|
onDelete={() => {}}
|
||||||
onEdit={() => {}}
|
onEdit={() => {}}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue