Skip to content

Commit 365ef8a

Browse files
committed
Update info page search param key
1 parent fb3f148 commit 365ef8a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

ui/src/components/info-dialog/info-dialog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ import { Button, ButtonTheme } from 'design-system/components/button/button'
33
import * as Dialog from 'design-system/components/dialog/dialog'
44
import { STRING, translate } from 'utils/language'
55
import styles from './info-dialog.module.scss'
6-
import { useActivePage } from './useActivePage'
6+
import { useActiveInfoPage } from './useActivePage'
77

88
export const InfoDialog = ({ name, slug }: { name: string; slug: string }) => {
9-
const { activePage, setActivePage } = useActivePage()
9+
const { activeInfoPage, setActiveInfoPage } = useActiveInfoPage()
1010
const { page, isLoading, error } = usePageDetails(slug)
1111

1212
return (
1313
<Dialog.Root
14-
open={activePage === slug}
15-
onOpenChange={(open) => setActivePage(open ? slug : undefined)}
14+
open={activeInfoPage === slug}
15+
onOpenChange={(open) => setActiveInfoPage(open ? slug : undefined)}
1616
>
1717
<Dialog.Trigger>
1818
<Button label={name} theme={ButtonTheme.Plain} />
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { useSearchParams } from 'react-router-dom'
22

3-
const SEARCH_PARAM_KEY = 'page'
3+
const SEARCH_PARAM_KEY = 'info-page'
44

5-
export const useActivePage = () => {
5+
export const useActiveInfoPage = () => {
66
const [searchParams, setSearchParams] = useSearchParams()
77

8-
const activePage = searchParams.get(SEARCH_PARAM_KEY) ?? undefined
8+
const activeInfoPage = searchParams.get(SEARCH_PARAM_KEY) ?? undefined
99

10-
const setActivePage = (pageSlug?: string) => {
10+
const setActiveInfoPage = (pageSlug?: string) => {
1111
searchParams.delete(SEARCH_PARAM_KEY)
1212
if (pageSlug?.length) {
1313
searchParams.set(SEARCH_PARAM_KEY, pageSlug)
1414
}
1515
setSearchParams(searchParams)
1616
}
1717

18-
return { activePage, setActivePage }
18+
return { activeInfoPage, setActiveInfoPage }
1919
}

0 commit comments

Comments
 (0)