Skip to content

Commit 3df5310

Browse files
committed
fix: opening links in stub replace modal
1 parent 4ecf404 commit 3df5310

3 files changed

Lines changed: 37 additions & 11 deletions

File tree

‎packages/vscode/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"bugs": {
1111
"url": "https://github.com/codeque-co/codeque/issues"
1212
},
13-
"version": "0.34.0",
13+
"version": "0.34.1",
1414
"engines": {
1515
"vscode": "^1.68.0",
1616
"node": ">=14"

‎packages/vscode/src/extension.ts‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,18 +375,10 @@ export function activate(context: vscode.ExtensionContext) {
375375
})
376376

377377
eventBusInstance.addListener('pro-modal:subscribe_clicked', () => {
378-
vscode.env.openExternal(
379-
vscode.Uri.parse(
380-
'https://jayu.dev/newsletter?utm_source=vscode_proModal',
381-
),
382-
)
383-
384378
telemetryModule.reportStubReplaceModalSubscribeClick()
385379
})
386380

387381
eventBusInstance.addListener('pro-modal:twitter_handler_clicked', () => {
388-
vscode.env.openExternal(vscode.Uri.parse('https://twitter.com/jayu_dev'))
389-
390382
telemetryModule.reportStubReplaceModalNameClick()
391383
})
392384

‎packages/vscode/src/webviews/SearchResultsPanel/index.tsx‎

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ const Panel = () => {
500500
return [...(results?.errors ?? []), ...replacementErrors]
501501
}, [replacementErrors, results?.errors])
502502

503+
const subscribeLinkRef = useRef<any>()
504+
const nameLinkRef = useRef<any>()
505+
503506
return (
504507
<Providers>
505508
<Flex height="98vh" flexDir="column" maxWidth="100wv">
@@ -544,6 +547,23 @@ const Panel = () => {
544547
/>
545548
)}
546549
<Banners />
550+
{/* This link is hidden and we click it imperatively. For some reason clicking link inside modal does not work */}
551+
<Link
552+
ref={subscribeLinkRef}
553+
my="1"
554+
href="https://jayu.dev/newsletter?utm_source=vscode_proModal"
555+
display={'none'}
556+
>
557+
Subscribe to book 17€* early bird price 💸
558+
</Link>
559+
<Link
560+
ref={nameLinkRef}
561+
my="1"
562+
href="https://twitter.com/jayu_dev"
563+
display={'none'}
564+
>
565+
Jakub Twitter account
566+
</Link>
547567
<SearchResultsList
548568
isLoading={isSearching}
549569
matches={results?.matches ?? []}
@@ -559,6 +579,7 @@ const Panel = () => {
559579
isWorkspace={isWorkspace}
560580
/>
561581
</Flex>
582+
562583
<Flex>
563584
<Modal isOpen={proModalVisible} onClose={closeProModal}>
564585
<ModalOverlay />
@@ -573,7 +594,13 @@ const Panel = () => {
573594
<ModalBody display="flex" flexDirection="column" gap="6px">
574595
<Text>
575596
Hey 👋{' '}
576-
<Link onClick={nameClickProModal} textDecoration="underline">
597+
<Link
598+
onClick={() => {
599+
nameClickProModal()
600+
nameLinkRef.current?.click()
601+
}}
602+
textDecoration="underline"
603+
>
577604
Jakub
578605
</Link>{' '}
579606
here.
@@ -616,7 +643,14 @@ const Panel = () => {
616643
</ModalBody>
617644

618645
<ModalFooter>
619-
<Button colorScheme="purple" mr={3} onClick={ctaClickProModal}>
646+
<Button
647+
colorScheme="purple"
648+
mr={3}
649+
onClick={() => {
650+
ctaClickProModal()
651+
subscribeLinkRef.current?.click()
652+
}}
653+
>
620654
Subscribe to book 17€* early bird price 💸
621655
</Button>
622656
</ModalFooter>

0 commit comments

Comments
 (0)