Skip to content

Commit 62c951c

Browse files
medyozouhir96
andauthored
New version #minor
* improve the import/export bookmarks UI * change the import/export icons * feat: Add auth modal ui and show it next to onboarding. * feat: Add google auth. * feat: Show user info in setting. * feat: Fix imports. * feat: Add github auth * feat: Add logout and observe current user. * feat: Moved firebase config variable to .env file. * feat: Create CurrentUser type. * feat: Create useAuth hook. * feat: Add profile button to header and create profile page. * feat: Separate useAuth and AuthStore. * feat: Move auth modal state handle to AuthStore. * feat: Create AuthModalStore without persist. * feat: Rebame config file to firebase config. * fix: Code reviews. * fix modal not showing in other pages * feat: Create separated file for authModalStore. * fix: Code reviews. * feat: New AuthModal ui. * feat: Add authorization token to request interceptor * feat: Add user connection and disconnection tracking to analytics * refactor the button component * refactor: Simplify signIn function by removing providerName parameter * style: Adjust button padding for small and medium sizes * style: Update button component in AuthModal for consistent size and styling * refactor the Modal component and improve Auth Modal * style: Adjust authModal width for responsive design * refactor: Remove bookmark import/export functionality from ProfileSettings component * feat: Add CircleButton component with customizable sizes and variants * refactor: Replace button elements with CircleButton and Button components in Header and BookmarkSettings * refactor: Simplify Button usage in BookmarkSettings component * refactor: Update button styles and layout in App.css for improved flexibility and alignment * refactor: Rename round-icon-button class to circle-button for consistency and clarity * fix: Add validation for Firebase configuration to prevent initialization errors * refactor: Move input styles to App.css and replace button with Button component in ShareModal * feat: Add profile image container with streak indicator in Header component * feat: Implement hit tracking and update user streak in AuthStore * feat: Remove unused idToken and email * feat: Remove Profile page + Moved userInfo to General settings. * feat: Replace button elements with Button component for consistency * feat: Update logout button size and adjust user info layout for better responsiveness * refactor: Simplify Header component by removing back navigation for home * feat: Update user info display to show provider name instead of provider ID * feat: Adjust user image size and enhance layout for user information in General Settings * feat: Show auth provider icon in user info. * feat: Create ConfirmModal component. * feat: Add logout confirm modal. * feat: Logout firebase user. * fix: Merge conflicts. * feat: Implement logout functionality using Firebase signOut * feat: Enhance user settings UI with improved logout button and layout adjustments * refactor: Remove unused searchEngine prop from GeneralSettings component * feat: Add user streak display to GeneralSettings component * feat: Refactor streak display in GeneralSettings component for improved styling and structure * feat: Update manifest files to version 3 and adjust permissions * feat: Add message listener for token reception in auth.js * refactor: Clean up background.js by removing commented-out code * feat: Add content script to handle token reception and messaging * refactor: Update return types for environment utility functions * feat: Simplify Firebase configuration by removing unused keys and adding build target * feat: Add host permission checks for Firefox sign-in functionality * feat: Refactor auth modal store to include error handling and simplify usage in hooks * feat: Add dangerToast style for error notifications and adjust modal overflow behavior * feat: Wrap AppLayout component with AuthProvider for improved authentication context * feat: Implement getOauthLink API and custom hook for OAuth authentication * feat: Enhance AuthModal with OAuth link handling and error management * feat: Add AuthProvider component for handling user authentication via OAuth tokens * feat: Add error styling to AuthModal for improved user feedback * feat: Change script injection to document.documentElement for improved compatibility * feat: Remove unused GitHub and Google auth providers from Firebase setup * feat: Add Spinner component for loading indicators with customizable sizes * feat: Add loading state to Button component with spinner indicator * feat: Add CSS styles for Spinner component with customizable sizes * feat: Update AuthModal to include Google and GitHub auth providers with dynamic links * feat: Add success toast notification for user login with dynamic welcome message * refactor: replace react-device-detect with responsive breakpoints and update media queries * feat: Refactor OAuth link retrieval to accept dynamic provider strings * feat: Update API endpoint for OAuth link retrieval * feat: Simplify content script matches in base manifest * feat: Refactor isConnected function to use direct user check * feat: Update isConnected check to use direct reference * feat: Add pluralization utility and update streak display in user info * Add ad verification * rename vite config to mjs * chore: update dependencies and set Node.js engine version * fix: update request interceptor to use InternalAxiosRequestConfig * chore: update Node.js version in GitHub Actions workflow to 18 * fix: add unique keys to list items in UserInfo component * fix: update logout modal title and description for clarity * fix: improve auth error handling and update modal styles for better user experience * fix: restrict content script matches to production URL only * feat: enhance streak display with new icon and styling adjustments * fix: update background style for content section with gradient * fix: update content background color and adjust border styling for consistency * feat: add new avatar icon and define accent color variables for styling * fix: correct capitalization of terms in AuthModal component * feat: refactor user information display into separate UserInfo component * feat: add user ID to User type and initialize user state in AuthProvider * feat: implement account deletion functionality and integrate into GeneralSettings * fix: improve error message for account connection in AuthProvider * feat: enhance UserInfo component with account connection prompt and styling adjustments * fix: remove redundant text from UserInfo component * feat: add avatar placeholder styling and improve layout in GeneralSettings * feat: add loading state to profile image button and apply overflow hidden styling * feat: add user delete tracking to analytics and update DeleteAccount component * improve the displaying when the button is disabled * add isConnecting status to Auth * chore: update GitHub Actions to use latest versions of checkout, cache, and setup-node * feat: add Firebase API key to deployment workflows * fix: update chrome runtime message listener to handle optional chaining correctly * chore: update dependencies to latest versions in package.json * refactor: migrate to React 18's createRoot for rendering * fix: remove console log for user not logged in in getUserToken function * refactor: update SVG imports to use new syntax for React components * fix: ensure chrome runtime message listener is added and removed safely * fix: disable CSS code splitting in Vite configuration --------- Co-authored-by: zouhir <rajdaouizouhir.pro@gmail.com>
1 parent 61b17e5 commit 62c951c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2939
-589
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@ env:
1010
VITE_AMPLITUDE_KEY: ${{ secrets.REACT_APP_AMPLITUDE_KEY }}
1111
VITE_AMPLITUDE_URL: ${{ secrets.REACT_APP_AMPLITUDE_URL }}
1212
VITE_API_URL: ${{ secrets.API_URL }}
13+
VITE_FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
1314

1415
jobs:
1516
build_and_deploy:
1617
runs-on: ubuntu-latest
1718

1819
steps:
1920
- name: Checkout code
20-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
2122

2223
- name: Set up Node.js
2324
uses: actions/setup-node@v4
2425
with:
25-
node-version: '16'
26+
node-version: 18
2627

2728
- name: Install dependencies
2829
run: yarn

.github/workflows/distribute.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ env:
2727
VITE_AMPLITUDE_KEY: ${{ secrets.REACT_APP_AMPLITUDE_KEY }}
2828
VITE_AMPLITUDE_URL: ${{ secrets.REACT_APP_AMPLITUDE_URL }}
2929
VITE_API_URL: ${{ secrets.API_URL }}
30+
VITE_FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
3031

3132
jobs:
3233
tag_version:
3334
runs-on: ubuntu-latest
3435
steps:
35-
- uses: actions/checkout@v3
36+
- uses: actions/checkout@v4
3637
with:
3738
fetch-depth: 0
3839

@@ -64,10 +65,10 @@ jobs:
6465
needs: tag_version
6566
runs-on: ubuntu-latest
6667
steps:
67-
- uses: actions/checkout@v2
68+
- uses: actions/checkout@v4
6869
with:
6970
ref: master
70-
- uses: actions/cache@v2
71+
- uses: actions/cache@v4
7172
with:
7273
path: '**/node_modules'
7374
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
@@ -91,13 +92,17 @@ jobs:
9192
needs: tag_version
9293
runs-on: ubuntu-latest
9394
steps:
94-
- uses: actions/checkout@v2
95+
- uses: actions/checkout@v4
9596
with:
9697
ref: master
97-
- uses: actions/cache@v2
98+
- uses: actions/cache@v4
9899
with:
99100
path: '**/node_modules'
100101
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
102+
- name: Set up Node.js
103+
uses: actions/setup-node@v4
104+
with:
105+
node-version: 18
101106
- name: Install yarn dependencies
102107
run: yarn
103108

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18.20.0

package.json

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,40 @@
77
"@tanstack/query-async-storage-persister": "^5.8.3",
88
"@tanstack/react-query": "^4.13.0",
99
"@tanstack/react-query-persist-client": "^5.8.4",
10-
"@types/dompurify": "^2.3.4",
11-
"@types/jspath": "^0.4.0",
12-
"axios": "^0.21.2",
10+
"axios": "^1.8.4",
1311
"axios-cache-adapter": "^2.7.3",
1412
"country-emoji": "^1.5.4",
15-
"dompurify": "^2.2.7",
13+
"dompurify": "^3.2.4",
14+
"firebase": "^11.2.0",
1615
"htmlparser2": "^8.0.1",
1716
"jsonpath": "^1.1.1",
1817
"normalize.css": "^8.0.1",
1918
"prop-types": "^15.0.0-0",
20-
"react": "^17.0.1",
19+
"react": "^19.1.0",
2120
"react-contexify": "^5.0.0",
22-
"react-device-detect": "^1.17.0",
23-
"react-dom": "^17.0.1",
21+
"react-dom": "^19.1.0",
2422
"react-easy-sort": "^1.5.1",
2523
"react-error-boundary": "^3.1.4",
2624
"react-icons": "^5.2.1",
2725
"react-markdown": "^7.0.1",
2826
"react-modal": "^3.12.1",
27+
"react-responsive": "^10.0.1",
2928
"react-router-dom": "^6.21.0",
3029
"react-select": "^5.0.1",
3130
"react-share": "^4.4.1",
32-
"react-simple-toasts": "^5.10.0",
31+
"react-simple-toasts": "^6.1.0",
3332
"react-spinners": "^0.10.4",
3433
"react-spring-bottom-sheet": "^3.4.1",
3534
"react-toggle": "^4.1.1",
3635
"react-tooltip": "^4.2.21",
3736
"timeago.js": "^4.0.2",
3837
"type-fest": "^1.2.0",
3938
"vite-plugin-ejs": "^1.6.4",
40-
"web-vitals": "^0.2.4",
4139
"zustand": "^4.3.3"
4240
},
41+
"engines": {
42+
"node": "18"
43+
},
4344
"scripts": {
4445
"start": "vite",
4546
"preview": "vite preview",
@@ -69,15 +70,16 @@
6970
"@types/chrome": "^0.0.241",
7071
"@types/jest": "^29.1.2",
7172
"@types/jsonpath": "^0.2.0",
73+
"@types/dompurify": "^2.3.4",
74+
"@types/jspath": "^0.4.0",
7275
"@types/node": "^20.4.2",
73-
"@types/react": "^18.0.21",
74-
"@types/react-dom": "^18.0.6",
76+
"@types/react": "^19.0.4",
77+
"@types/react-dom": "^19.0.4",
7578
"@types/react-modal": "^3.13.1",
7679
"@types/react-toggle": "^4.0.3",
7780
"@typescript-eslint/eslint-plugin": "^5.45.0",
7881
"@typescript-eslint/parser": "^5.40.1",
7982
"@vitejs/plugin-react": "^4.0.3",
80-
"eslint-config-airbnb": "19.0.4",
8183
"eslint-config-airbnb-typescript": "^17.0.0",
8284
"eslint-config-prettier": "^8.5.0",
8385
"eslint-config-react": "^1.1.7",
@@ -91,8 +93,8 @@
9193
"prettier": "^2.7.1",
9294
"terser": "^5.19.2",
9395
"typescript": "^5.1.6",
94-
"vite": "^4.4.5",
95-
"vite-plugin-svgr": "^3.2.0",
96+
"vite": "^6.2.3",
97+
"vite-plugin-svgr": "^4.3.0",
9698
"vite-tsconfig-paths": "^4.2.0"
9799
}
98100
}

public/auth.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
window.addEventListener('message', (event) => {
2+
if (event.data.type === 'TOKEN_RECEIVED') {
3+
// Forward to content script
4+
window.postMessage(event.data, '*')
5+
}
6+
})

public/background.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
/*chrome.browserAction.onClicked.addListener(function (tab) {
2-
chrome.tabs.create({ url: "chrome://newtab" });
3-
}
4-
);*/
5-
61
const uninstallUrl = `https://hackertab.dev/uninstall.html`
72
if (chrome.runtime.setUninstallURL) {
83
chrome.runtime.setUninstallURL(uninstallUrl)
9-
}
4+
}

public/base.manifest.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
{
2+
"manifest_version": 3,
23
"name": "Hackertab.dev - developer news",
34
"description": "All developer news in one tab",
45
"version": "1.20.1",
56
"chrome_url_overrides": {
67
"newtab": "index.html"
78
},
9+
"host_permissions": ["https://*.hackertab.dev/*"],
10+
"content_scripts": [
11+
{
12+
"matches": ["https://hackertab.dev/*"],
13+
"run_at": "document_start",
14+
"js": ["content.js"]
15+
}
16+
],
817
"icons": {
918
"16": "/logos/logo16.png",
1019
"32": "/logos/logo32.png",

public/chrome.manifest.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
2-
"manifest_version": 3,
32
"background": {
43
"service_worker": "background.js"
5-
},
6-
"host_permissions": ["https://*.hackertab.dev/*"]
4+
}
75
}

public/content.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const script = document.createElement('script')
2+
script.src = chrome.runtime.getURL('auth.js')
3+
document.documentElement.appendChild(script)
4+
5+
// Listen for messages from the injected script
6+
window.addEventListener('message', (event) => {
7+
if (event.source !== window || !event.data || event.data.type !== 'TOKEN_RECEIVED') {
8+
return
9+
}
10+
11+
chrome.runtime.sendMessage({ ...event.data })
12+
})

public/firefox.manifest.json

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
{
2-
"manifest_version": 2,
3-
"background": {
4-
"scripts": [
5-
"background.js"
6-
]
7-
},
8-
"permissions": [
9-
"https://*.hackertab.dev/*"
10-
],
11-
"content_security_policy": "script-src 'self' object-src 'self'",
12-
"applications": {
13-
"gecko": {
14-
"id": "{f8793186-e9da-4332-aa1e-dc3d9f7bb04c}"
15-
}
16-
}
17-
}
2+
"background": {
3+
"scripts": ["background.js"]
4+
}
5+
}

0 commit comments

Comments
 (0)