Skip to content

Commit a8cc681

Browse files
authored
Merge pull request #228 from medyo/fix-bugs
Fix Oauth bug and UserPreferences store and other minor issues
2 parents 309e1eb + 98eb724 commit a8cc681

File tree

17 files changed

+72
-71
lines changed

17 files changed

+72
-71
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"timeago.js": "^4.0.2",
3737
"type-fest": "^1.2.0",
3838
"vite-plugin-ejs": "^1.6.4",
39-
"zustand": "^4.3.3"
39+
"zustand": "^5.0.3"
4040
},
4141
"engines": {
4242
"node": "18"
@@ -65,9 +65,9 @@
6565
},
6666
"devDependencies": {
6767
"@types/chrome": "^0.0.241",
68+
"@types/dompurify": "^2.3.4",
6869
"@types/jest": "^29.1.2",
6970
"@types/jsonpath": "^0.2.0",
70-
"@types/dompurify": "^2.3.4",
7171
"@types/jspath": "^0.4.0",
7272
"@types/node": "^20.4.2",
7373
"@types/react": "^19.0.4",

public/auth.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
const acceptedTypes = ['TOKEN_RECEIVED', 'ERROR_RECEIVED']
12
window.addEventListener('message', (event) => {
2-
if (event.data.type === 'TOKEN_RECEIVED' || event.data.type === 'ERROR_RECEIVED') {
3-
// Forward to content script
3+
if (acceptedTypes.includes(event.data.type)) {
4+
// Forward to content scripte
45
window.postMessage(event.data, '*')
56
}
67
})

public/background.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ const uninstallUrl = `https://hackertab.dev/uninstall.html`
22
if (chrome.runtime.setUninstallURL) {
33
chrome.runtime.setUninstallURL(uninstallUrl)
44
}
5+
6+
chrome.action.onClicked.addListener(function () {
7+
chrome.tabs.create({ url: 'index.html', selected: true })
8+
})

public/chrome.manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"background": {
33
"service_worker": "background.js"
4-
}
4+
},
5+
"action": {}
56
}

public/content.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
const script = document.createElement('script')
22
script.src = chrome.runtime.getURL('auth.js')
33
document.documentElement.appendChild(script)
4+
const acceptedTypes = ['TOKEN_RECEIVED', 'ERROR_RECEIVED']
45

56
// Listen for messages from the injected script
67
window.addEventListener('message', (event) => {
7-
if (
8-
event.source !== window ||
9-
!event.data ||
10-
event.data.type !== 'TOKEN_RECEIVED' ||
11-
event.data.type !== 'ERROR_RECEIVED'
12-
) {
8+
if (event.source !== window || !event.data || !acceptedTypes.includes(event.data.type)) {
139
return
1410
}
15-
1611
chrome.runtime.sendMessage({ ...event.data })
1712
})

src/components/Layout/AppContentLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { DesktopBreakpoint } from 'src/providers/DesktopBreakpoint'
33
import { MobileBreakpoint } from 'src/providers/MobileBreakpoint'
44
import { useUserPreferences } from 'src/stores/preferences'
55
import { BottomNavigation } from '../Elements'
6-
import { ScrollCardsNavigator } from './'
76
import { DesktopCards } from './DesktopCards'
87
import { MobileCards } from './MobileCards'
8+
import { ScrollCardsNavigator } from './ScrollCardsNavigator'
99

1010
export const AppContentLayout = () => {
1111
const { cards, userCustomCards } = useUserPreferences()

src/features/auth/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ export * from './hooks/useAuth'
33
export * from './stores/authModalStore'
44
export * from './stores/authStore'
55
export * from './types'
6-
export * from './utils/auth'

src/features/auth/utils/auth.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/features/onboarding/components/steps/HelloTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const HelloTab = ({
9393
<p className="tabBody">Let's customize your Hackertab experience!</p>
9494
</div>
9595
<div className="occupations">
96-
{OCCUPATIONS.map((occ, index) => {
96+
{OCCUPATIONS.map((occ) => {
9797
return (
9898
<button
9999
key={occ.title}

src/features/onboarding/components/steps/SourcesTab.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ export const SourcesTab = ({
2929
options={sources}
3030
defaultValues={tabsData.sources}
3131
onChange={(_, selectedChips) => {
32-
console.log(
33-
'sources',
34-
selectedChips.map((chip) => chip.value)
35-
)
36-
3732
setTabsData({ ...tabsData, sources: selectedChips.map((chip) => chip.value) })
3833
}}
3934
/>

0 commit comments

Comments
 (0)