From 3be2a16876bc8f4d0589e251b942a96dc531e42a Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 6 Apr 2025 22:26:46 +0100 Subject: [PATCH 01/15] refactor: streamline message handling in auth and content scripts --- public/auth.js | 6 ++++-- public/content.js | 9 ++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/public/auth.js b/public/auth.js index 80541101..a0c827ce 100644 --- a/public/auth.js +++ b/public/auth.js @@ -1,6 +1,8 @@ +const acceptedTypes = ['TOKEN_RECEIVED', 'ERROR_RECEIVED'] window.addEventListener('message', (event) => { - if (event.data.type === 'TOKEN_RECEIVED' || event.data.type === 'ERROR_RECEIVED') { - // Forward to content script + console.log('Received message from content script:', event.data) + if (acceptedTypes.includes(event.data.type)) { + // Forward to content scripte window.postMessage(event.data, '*') } }) diff --git a/public/content.js b/public/content.js index 3f188acb..661d199f 100644 --- a/public/content.js +++ b/public/content.js @@ -1,17 +1,12 @@ const script = document.createElement('script') script.src = chrome.runtime.getURL('auth.js') document.documentElement.appendChild(script) +const acceptedTypes = ['TOKEN_RECEIVED', 'ERROR_RECEIVED'] // Listen for messages from the injected script window.addEventListener('message', (event) => { - if ( - event.source !== window || - !event.data || - event.data.type !== 'TOKEN_RECEIVED' || - event.data.type !== 'ERROR_RECEIVED' - ) { + if (event.source !== window || !event.data || !acceptedTypes.includes(event.data.type)) { return } - chrome.runtime.sendMessage({ ...event.data }) }) From 88fcec2af1c756272d50611f3b1ff0b5b7564581 Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 7 Apr 2025 14:03:35 +0100 Subject: [PATCH 02/15] refactor: remove refresh_rate from RemoteConfig type --- src/features/remoteConfig/types/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/features/remoteConfig/types/index.ts b/src/features/remoteConfig/types/index.ts index c492ab00..1357aa78 100644 --- a/src/features/remoteConfig/types/index.ts +++ b/src/features/remoteConfig/types/index.ts @@ -21,7 +21,6 @@ export type TagValuesFieldType = export type RemoteConfig = { supportedTags: Tag[] - refresh_rate: number | false marketingBannerConfig?: any adsConfig: { rowPosition: number From 24381bab129a2aa89551ba127d0f8e0c3474a78c Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 7 Apr 2025 16:59:56 +0100 Subject: [PATCH 03/15] refactor: update import statement for ScrollCardsNavigator in AppContentLayout --- src/components/Layout/AppContentLayout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Layout/AppContentLayout.tsx b/src/components/Layout/AppContentLayout.tsx index 03ffbf12..71dda18a 100644 --- a/src/components/Layout/AppContentLayout.tsx +++ b/src/components/Layout/AppContentLayout.tsx @@ -3,9 +3,9 @@ import { DesktopBreakpoint } from 'src/providers/DesktopBreakpoint' import { MobileBreakpoint } from 'src/providers/MobileBreakpoint' import { useUserPreferences } from 'src/stores/preferences' import { BottomNavigation } from '../Elements' -import { ScrollCardsNavigator } from './' import { DesktopCards } from './DesktopCards' import { MobileCards } from './MobileCards' +import { ScrollCardsNavigator } from './ScrollCardsNavigator' export const AppContentLayout = () => { const { cards, userCustomCards } = useUserPreferences() From 49a38f9bdd19edc122ceb59c5deb4da1cfd27eda Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 7 Apr 2025 17:00:56 +0100 Subject: [PATCH 04/15] chore: update zustand to version 5.0.3 and remove old dependency from package.json --- package.json | 4 ++-- yarn.lock | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 786786b4..4fd1fde1 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "timeago.js": "^4.0.2", "type-fest": "^1.2.0", "vite-plugin-ejs": "^1.6.4", - "zustand": "^4.3.3" + "zustand": "^5.0.3" }, "engines": { "node": "18" @@ -65,9 +65,9 @@ }, "devDependencies": { "@types/chrome": "^0.0.241", + "@types/dompurify": "^2.3.4", "@types/jest": "^29.1.2", "@types/jsonpath": "^0.2.0", - "@types/dompurify": "^2.3.4", "@types/jspath": "^0.4.0", "@types/node": "^20.4.2", "@types/react": "^19.0.4", diff --git a/yarn.lock b/yarn.lock index 7596b8b3..e714bc55 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6085,7 +6085,7 @@ use-subscription@^1.3.0: dependencies: use-sync-external-store "^1.2.0" -use-sync-external-store@1.2.0, use-sync-external-store@^1.2.0: +use-sync-external-store@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== @@ -6287,9 +6287,7 @@ yargs@^17.7.2: y18n "^5.0.5" yargs-parser "^21.1.1" -zustand@^4.3.3: - version "4.4.7" - resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.4.7.tgz#355406be6b11ab335f59a66d2cf9815e8f24038c" - integrity sha512-QFJWJMdlETcI69paJwhSMJz7PPWjVP8Sjhclxmxmxv/RYI7ZOvR5BHX+ktH0we9gTWQMxcne8q1OY8xxz604gw== - dependencies: - use-sync-external-store "1.2.0" +zustand@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/zustand/-/zustand-5.0.3.tgz#b323435b73d06b2512e93c77239634374b0e407f" + integrity sha512-14fwWQtU3pH4dE0dOpdMiWjddcH+QzKIgk1cl8epwSE7yag43k/AD/m4L6+K7DytAOr9gGBe3/EXj9g7cdostg== From e9bec630766127620d6cdcaa73a908a408da0131 Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 7 Apr 2025 17:34:21 +0100 Subject: [PATCH 05/15] feat: add action listener to extension on toolbar icon click --- public/background.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/background.js b/public/background.js index df8301a7..0d69eab8 100644 --- a/public/background.js +++ b/public/background.js @@ -2,3 +2,7 @@ const uninstallUrl = `https://hackertab.dev/uninstall.html` if (chrome.runtime.setUninstallURL) { chrome.runtime.setUninstallURL(uninstallUrl) } + +chrome.action.onClicked.addListener(function () { + chrome.tabs.create({ url: 'index.html', selected: true }) +}) From 7c036e9ada717b5d0cbb4a6581543d1213d9251c Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 7 Apr 2025 17:35:22 +0100 Subject: [PATCH 06/15] feat: add action key to chrome manifest for extension functionality --- public/chrome.manifest.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/chrome.manifest.json b/public/chrome.manifest.json index fcb931e3..699397d3 100644 --- a/public/chrome.manifest.json +++ b/public/chrome.manifest.json @@ -1,5 +1,6 @@ { "background": { "service_worker": "background.js" - } + }, + "action": {} } From bb8a4aee2b3c855c7b47a1a7cf7fc5afbb868127 Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 7 Apr 2025 17:35:41 +0100 Subject: [PATCH 07/15] refactor: remove unused index --- src/features/onboarding/components/steps/HelloTab.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/onboarding/components/steps/HelloTab.tsx b/src/features/onboarding/components/steps/HelloTab.tsx index 1c88b744..b97b8f9e 100644 --- a/src/features/onboarding/components/steps/HelloTab.tsx +++ b/src/features/onboarding/components/steps/HelloTab.tsx @@ -93,7 +93,7 @@ export const HelloTab = ({

Let's customize your Hackertab experience!

- {OCCUPATIONS.map((occ, index) => { + {OCCUPATIONS.map((occ) => { return (