diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..cf814b4
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,29 @@
+{
+ "env": {
+ "browser": true,
+ "es2021": true,
+ "webextensions": true
+ },
+ "extends": [
+ "eslint:recommended",
+ "plugin:react/recommended"
+ ],
+ "parserOptions": {
+ "ecmaFeatures": {
+ "jsx": true
+ },
+ "ecmaVersion": "latest",
+ "sourceType": "module"
+ },
+ "plugins": [
+ "react"
+ ],
+ "rules": {
+ "react/react-in-jsx-scope": "off",
+ "react/prop-types": "off",
+ "no-undef": "error"
+ },
+ "globals": {
+ "chrome": "readonly"
+ }
+}
\ No newline at end of file
diff --git a/public/background.js b/public/background.js
new file mode 100644
index 0000000..5d9fa12
--- /dev/null
+++ b/public/background.js
@@ -0,0 +1,8 @@
+chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
+ if (request.action === 'start') {
+ navigator.clipboard.writeText(request.text)
+ .then(() => sendResponse({success: true}))
+ .catch((err) => console.log(err));
+ return true;
+ }
+});
\ No newline at end of file
diff --git a/public/manifest.json b/public/manifest.json
index 11a0424..36068e2 100644
--- a/public/manifest.json
+++ b/public/manifest.json
@@ -1,19 +1,24 @@
-{
- "manifest_version": 3,
- "name": "React Router Chrome Extension",
- "version": "1.0",
- "description": "A Chrome Extension with React Router: User List + Actions Pages",
- "permissions": ["storage"],
- "icons": {
- "16": "favicon.ico",
+{
+ "manifest_version": 3,
+ "name": "React Router Chrome Extension",
+ "version": "1.0",
+ "description": "A Chrome Extension with React Router: User List + Actions Pages",
+ "permissions": [
+ "storage"
+ ],
+ "background": {
+ "service_worker": "background.js"
+ },
+ "icons": {
+ "16": "favicon.ico",
"48": "favicon.ico",
"128": "favicon.ico"
- },
- "action": {
- "default_popup": "index.html"
},
- "options_ui": {
- "page": "index.html",
- "open_in_tab": true
- }
+ "action": {
+ "default_popup": "index.html"
+ },
+ "options_ui": {
+ "page": "index.html",
+ "open_in_tab": true
+ }
}
\ No newline at end of file
diff --git a/src/App.css b/src/App.css
index 83d7b28..1d9e23d 100644
--- a/src/App.css
+++ b/src/App.css
@@ -1,65 +1,98 @@
.app {
- max-width: 800px;
- margin: 0 auto;
- padding: 20px;
- font-family: Arial, sans-serif;
- width: 300px;
- height: 100vh;
- box-shadow: #0b7dda 0 0 0 10px;
+ max-width: 800px;
+ margin: 0 auto;
+ padding: 20px;
+ font-family: Arial, sans-serif;
+ width: 300px;
+ height: 100vh;
}
.navbar {
- background: #2196f3;
- color: white;
- padding: 15px;
- border-radius: 4px;
- margin-bottom: 20px;
+ background: #2196f3;
+ color: white;
+ padding: 15px;
+ border-radius: 4px;
+ margin-bottom: 20px;
}
.page {
- padding: 20px;
- border: 1px solid #ddd;
- border-radius: 4px;
+ padding: 20px;
+ border: 1px solid #ddd;
+ border-radius: 4px;
}
.user-list {
- list-style: none;
- padding: 0;
+ list-style: none;
+ padding: 0;
}
.user-list li {
- padding: 8px;
- border-bottom: 1px solid #eee;
+ padding: 8px;
+ border-bottom: 1px solid #eee;
}
.btn {
- display: inline-block;
- margin-top: 20px;
- padding: 10px 20px;
- background: #2196f3;
- color: white;
- text-decoration: none;
- border-radius: 4px;
+ display: inline-block;
+ margin-top: 20px;
+ padding: 10px 20px;
+ background: #2196f3;
+ color: white;
+ text-decoration: none;
+ border-radius: 4px;
}
.btn:hover {
- background: #0b7dda;
+ background: #0b7dda;
}
.actions {
- margin: 20px 0;
+ margin: 20px 0;
}
.action-btn {
- margin-right: 10px;
- padding: 8px 16px;
- background: #4caf50;
- color: white;
- border: none;
- border-radius: 4px;
- cursor: pointer;
+ margin-right: 10px;
+ padding: 8px 16px;
+ background: #4caf50;
+ color: white;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
}
.action-btn:hover {
- background: #3d8b40;
+ background: #3d8b40;
+}
+
+.stop-btn {
+ margin-right: 10px;
+ padding: 8px 16px;
+ background: #f32152;
+ color: white;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+}
+
+.stop-btn:hover {
+ background: #ff0000;
+}
+
+input {
+ width: 100%;
+ padding: 10px;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+ margin-bottom: 20px;
+ box-sizing: border-box;
+ font-size: 14px;
+}
+
+select {
+ width: 100%;
+ padding: 10px;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+ margin-bottom: 20px;
+ box-sizing: border-box;
+ font-size: 14px;
}
diff --git a/src/App.js b/src/App.js
index 2708067..ade4a5e 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,5 +1,4 @@
-import { HashRouter as Router, Routes, Route } from 'react-router-dom';
-import UserListPage from './pages/UserListPage';
+import {HashRouter as Router, Routes, Route} from 'react-router-dom';
import ActionsPage from './pages/ActionsPage';
import TimestampPage from './pages/TimestampPage';
import './App.css';
@@ -8,14 +7,10 @@ function App() {
return (
@@ -47,63 +79,71 @@ const TimestampPage = () => {