-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggest Chrome Extension Installation Popup #1318
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { useEffect, useMemo, useState } from 'react'; | ||
|
||
import { IPC_MAIN_CHANNELS } from 'common/constants'; | ||
|
||
import Modal from '../Modal'; | ||
import Icon from '../../assets/img/logo.png'; | ||
import Button from '../Button'; | ||
|
||
export const ChromePopup = () => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
useEffect(() => { | ||
const usesChromeMs = window.electron.store.get('chromePopup.usesChrome'); | ||
if (usesChromeMs === undefined || usesChromeMs === true) { | ||
setIsOpen(true); | ||
} | ||
}, []); | ||
|
||
const onClose = () => { | ||
setIsOpen(false); | ||
}; | ||
|
||
return ( | ||
<Modal | ||
title={ | ||
<div className="flex flex-col items-center gap-2 border-b border-slate-500 pb-2"> | ||
<div className="flex w-full justify-center"> | ||
<img src={Icon} alt="Logo" width={64} /> | ||
</div> | ||
<div>Do you have our Chrome Extension?</div> | ||
</div> | ||
} | ||
isOpen={isOpen} | ||
onClose={onClose} | ||
> | ||
<div className="max-w-lg"> | ||
<p className="pb-4 text-center"> | ||
Responsively Helper on the Chrome Web Store | ||
<br /> | ||
<br /> | ||
Open your current Chrome browser page in the Responsively App | ||
seamlessly! | ||
</p> | ||
<div className="mt-4 flex justify-center"> | ||
<div className="flex gap-1"> | ||
<Button | ||
onClick={() => { | ||
window.electron.ipcRenderer.sendMessage( | ||
IPC_MAIN_CHANNELS.OPEN_EXTERNAL, | ||
{ | ||
url: `https://chromewebstore.google.com/detail/responsively-helper/jhphiidjkooiaollfiknkokgodbaddcj`, | ||
} | ||
); | ||
window.electron.store.set('chromePopup.usesChrome', true); | ||
onClose(); | ||
}} | ||
Comment on lines
+47
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is best practice to declare a new function outside of the onclick and then call it as in: If you declare a function inline in onClick={}, it will be recreated on every render. This can have performance implications |
||
isTextButton | ||
isPrimary | ||
> | ||
Download Extension | ||
</Button> | ||
<Button | ||
onClick={() => { | ||
window.electron.store.set('chromePopup.usesChrome', false); | ||
onClose(); | ||
}} | ||
isTextButton | ||
isPrimary | ||
> | ||
I do not use Chrome | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would change the text to "No, thank you", in order to cover more cases, like the person doesn't want it or they want to close the popup |
||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
</Modal> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usesChrome is a bit vague, I would name this something like
hasSeenChromeExtensionPopUp