diff --git a/src/Options/Options.tsx b/src/Options/Options.tsx new file mode 100644 index 0000000..9b4befc --- /dev/null +++ b/src/Options/Options.tsx @@ -0,0 +1,7 @@ +import React from 'react'; + +const Options = () => { + return
Hello World
; +}; + +export default Options; diff --git a/src/Options/index.tsx b/src/Options/index.tsx new file mode 100644 index 0000000..1d8bed4 --- /dev/null +++ b/src/Options/index.tsx @@ -0,0 +1,6 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; + +import Options from './Options'; + +ReactDOM.render(, document.getElementById('options-root')); diff --git a/src/Popup/Popup.tsx b/src/Popup/Popup.tsx new file mode 100644 index 0000000..2c0b34d --- /dev/null +++ b/src/Popup/Popup.tsx @@ -0,0 +1,7 @@ +import React from 'react'; + +const Popup = () => { + return
Hello world
; +}; + +export default Popup; diff --git a/src/Popup/index.tsx b/src/Popup/index.tsx new file mode 100644 index 0000000..17939b0 --- /dev/null +++ b/src/Popup/index.tsx @@ -0,0 +1,6 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; + +import Popup from './Popup'; + +ReactDOM.render(, document.getElementById('popup-root')); diff --git a/src/scripts/options.js b/src/scripts/options.js deleted file mode 100644 index 4e102cc..0000000 --- a/src/scripts/options.js +++ /dev/null @@ -1 +0,0 @@ -console.log('Hello World from options main file!'); diff --git a/src/scripts/popup.js b/src/scripts/popup.js deleted file mode 100644 index 3c43dfa..0000000 --- a/src/scripts/popup.js +++ /dev/null @@ -1,18 +0,0 @@ -import browser from 'webextension-polyfill'; - -document.addEventListener('DOMContentLoaded', async () => { - const tabs = await browser.tabs.query({ - active: true, - lastFocusedWindow: true, - }); - - const url = tabs.length && tabs[0].url; - - const response = await browser.runtime.sendMessage({ - msg: 'hello', - url, - }); - - // eslint-disable-next-line no-console - console.log(response); -}); diff --git a/webpack.config.js b/webpack.config.js index 7ea7019..9c07995 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -54,8 +54,8 @@ module.exports = { entry: { background: path.join(sourcePath, 'Background', 'index.ts'), contentScript: path.join(sourcePath, 'ContentScript', 'index.ts'), - popup: './src/scripts/popup.js', - options: './src/scripts/options.js', + popup: path.join(sourcePath, 'Popup', 'index.tsx'), + options: path.join(sourcePath, 'Options', 'index.tsx'), styles: [path.join(sourcePath, 'Popup', 'popup.scss'), path.join(sourcePath, 'Options', 'options.scss')], },