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/public/auth.js b/public/auth.js
index 80541101..eff5dcc5 100644
--- a/public/auth.js
+++ b/public/auth.js
@@ -1,6 +1,7 @@
+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
+ if (acceptedTypes.includes(event.data.type)) {
+ // Forward to content scripte
window.postMessage(event.data, '*')
}
})
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 })
+})
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": {}
}
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 })
})
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()
diff --git a/src/features/auth/index.ts b/src/features/auth/index.ts
index ab44d99e..a93cd5d3 100644
--- a/src/features/auth/index.ts
+++ b/src/features/auth/index.ts
@@ -3,4 +3,3 @@ export * from './hooks/useAuth'
export * from './stores/authModalStore'
export * from './stores/authStore'
export * from './types'
-export * from './utils/auth'
diff --git a/src/features/auth/utils/auth.ts b/src/features/auth/utils/auth.ts
deleted file mode 100644
index a0680ccf..00000000
--- a/src/features/auth/utils/auth.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { firebaseAuth } from 'src/lib/firebase'
-
-export const getUserToken = async () => {
- return new Promise((resolve, _) => {
- const unsub = firebaseAuth.onAuthStateChanged(async (user) => {
- if (user) {
- const token = await user.getIdToken()
- resolve(token)
- } else {
- resolve(null)
- }
- unsub()
- })
- })
-}
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 (