Skip to content

Commit 04c2fd3

Browse files
authored
fix(support link): auto-fill organization when on org page (supabase#40108)
* fix(support link): auto-fill organization when on org page If user clicks the Support Link from an org page (not a project page), pass along the organization slug in the query params to auto-fill the Support Form. * fix(date picker test) The new UI for range picking is a little different, and requires double-clicking to start a new range.
1 parent e3d021e commit 04c2fd3

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

apps/studio/components/layouts/ProjectLayout/LayoutHeader/HelpPopover.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import { useState } from 'react'
55
import SVG from 'react-inlinesvg'
66

77
import { IS_PLATFORM } from 'common'
8+
import type { SupportFormUrlKeys } from 'components/interfaces/Support/SupportForm.utils'
89
import { SupportLink } from 'components/interfaces/Support/SupportLink'
10+
import { SIDEBAR_KEYS } from 'components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider'
911
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
1012
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
1113
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
@@ -20,11 +22,10 @@ import {
2022
ButtonGroupItem,
2123
cn,
2224
Popover,
25+
Popover_Shadcn_,
2326
PopoverContent_Shadcn_,
2427
PopoverTrigger_Shadcn_,
25-
Popover_Shadcn_,
2628
} from 'ui'
27-
import { SIDEBAR_KEYS } from 'components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider'
2829

2930
export const HelpPopover = () => {
3031
const router = useRouter()
@@ -36,6 +37,12 @@ export const HelpPopover = () => {
3637
const [isOpen, setIsOpen] = useState(false)
3738

3839
const projectRef = project?.parent_project_ref ?? (router.query.ref as string | undefined)
40+
let supportLinkQueryParams: Partial<SupportFormUrlKeys> | undefined = undefined
41+
if (projectRef) {
42+
supportLinkQueryParams = { projectRef }
43+
} else if (org?.slug) {
44+
supportLinkQueryParams = { orgSlug: org.slug }
45+
}
3946

4047
return (
4148
<Popover_Shadcn_ open={isOpen} onOpenChange={setIsOpen}>
@@ -137,7 +144,7 @@ export const HelpPopover = () => {
137144
</ButtonGroupItem>
138145

139146
<ButtonGroupItem size="tiny" icon={<Mail strokeWidth={1.5} size={14} />}>
140-
<SupportLink queryParams={{ projectRef }}>Contact support</SupportLink>
147+
<SupportLink queryParams={supportLinkQueryParams}>Contact support</SupportLink>
141148
</ButtonGroupItem>
142149
</>
143150
)}

apps/studio/tests/features/logs/Logs.Datepickers.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ test('datepicker onSubmit will return ISO string of selected dates', async () =>
9999

100100
// Find and click on first date
101101
const day15Element = await screen.findByText(day15.format('D'))
102-
userEvent.click(day15Element)
102+
userEvent.dblClick(day15Element)
103103

104104
// Find and click on second date
105105
const day16Element = await screen.findByText(day16.format('D'))

0 commit comments

Comments
 (0)