Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Google and Github authentication. #211

Open
wants to merge 74 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
b25327a
feat: Add auth modal ui and show it next to onboarding.
zouhir96 Jan 27, 2025
71cd2e6
feat: Add google auth.
zouhir96 Jan 27, 2025
6d26d06
feat: Show user info in setting.
zouhir96 Jan 27, 2025
19a3dee
feat: Fix imports.
zouhir96 Jan 30, 2025
b612a46
feat: Add github auth
zouhir96 Jan 30, 2025
49f5683
feat: Add logout and observe current user.
zouhir96 Jan 30, 2025
7c15152
feat: Moved firebase config variable to .env file.
zouhir96 Feb 9, 2025
da9cf87
feat: Create CurrentUser type.
zouhir96 Feb 10, 2025
885dc3d
feat: Create useAuth hook.
zouhir96 Feb 10, 2025
7a7a22e
feat: Add profile button to header and create profile page.
zouhir96 Feb 10, 2025
c7b0bae
feat: Separate useAuth and AuthStore.
zouhir96 Feb 11, 2025
005b348
feat: Move auth modal state handle to AuthStore.
zouhir96 Feb 12, 2025
9cd9297
feat: Create AuthModalStore without persist.
zouhir96 Feb 16, 2025
f563614
feat: Rebame config file to firebase config.
zouhir96 Feb 16, 2025
fa616c4
fix: Code reviews.
zouhir96 Feb 16, 2025
240e15b
fix modal not showing in other pages
medyo Feb 16, 2025
827f2cf
feat: Create separated file for authModalStore.
zouhir96 Feb 16, 2025
4a0c08e
fix: Code reviews.
zouhir96 Feb 16, 2025
217c9a9
feat: New AuthModal ui.
zouhir96 Feb 17, 2025
dfcd2b0
feat: Add authorization token to request interceptor
medyo Feb 19, 2025
5b44bc8
feat: Add user connection and disconnection tracking to analytics
medyo Feb 19, 2025
18f5ac4
refactor the button component
medyo Feb 22, 2025
005cfad
refactor: Simplify signIn function by removing providerName parameter
medyo Feb 22, 2025
4511c82
style: Adjust button padding for small and medium sizes
medyo Feb 22, 2025
2a23308
style: Update button component in AuthModal for consistent size and s…
medyo Feb 22, 2025
a42a312
refactor the Modal component and improve Auth Modal
medyo Feb 22, 2025
eb3b6db
style: Adjust authModal width for responsive design
medyo Feb 22, 2025
fe41293
refactor: Remove bookmark import/export functionality from ProfileSet…
medyo Feb 23, 2025
c7d52a1
feat: Add CircleButton component with customizable sizes and variants
medyo Feb 23, 2025
359269c
refactor: Replace button elements with CircleButton and Button compon…
medyo Feb 23, 2025
b2338b3
refactor: Simplify Button usage in BookmarkSettings component
medyo Feb 23, 2025
0914b6c
refactor: Update button styles and layout in App.css for improved fle…
medyo Feb 23, 2025
c4d7f33
refactor: Rename round-icon-button class to circle-button for consist…
medyo Feb 23, 2025
31d70b3
fix: Add validation for Firebase configuration to prevent initializat…
medyo Feb 23, 2025
b20b44a
refactor: Move input styles to App.css and replace button with Button…
medyo Feb 23, 2025
d22b911
feat: Remove unused idToken and email
zouhir96 Feb 24, 2025
9fb260b
feat: Remove Profile page + Moved userInfo to General settings.
zouhir96 Feb 24, 2025
6c89c50
feat: Replace button elements with Button component for consistency
medyo Feb 24, 2025
f9bf089
feat: Update logout button size and adjust user info layout for bette…
medyo Feb 24, 2025
f62c62e
refactor: Simplify Header component by removing back navigation for home
medyo Feb 24, 2025
03367d5
feat: Update user info display to show provider name instead of provi…
medyo Feb 24, 2025
d67a39c
feat: Adjust user image size and enhance layout for user information …
medyo Feb 24, 2025
e4010d4
feat: Show auth provider icon in user info.
zouhir96 Feb 24, 2025
1b5fd18
feat: Create ConfirmModal component.
zouhir96 Feb 25, 2025
0bc49d4
feat: Add logout confirm modal.
zouhir96 Feb 25, 2025
e22c85c
feat: Logout firebase user.
zouhir96 Feb 25, 2025
9a8b8ba
fix: Merge conflicts.
zouhir96 Feb 25, 2025
8c91828
feat: Implement logout functionality using Firebase signOut
medyo Feb 25, 2025
822890b
feat: Enhance user settings UI with improved logout button and layout…
medyo Feb 25, 2025
e802001
refactor: Remove unused searchEngine prop from GeneralSettings component
medyo Feb 25, 2025
329c02c
feat: Update manifest files to version 3 and adjust permissions
medyo Mar 9, 2025
698d5f5
feat: Add message listener for token reception in auth.js
medyo Mar 9, 2025
72c2948
refactor: Clean up background.js by removing commented-out code
medyo Mar 9, 2025
2eebb3d
feat: Add content script to handle token reception and messaging
medyo Mar 9, 2025
9211342
refactor: Update return types for environment utility functions
medyo Mar 9, 2025
2d4d638
feat: Simplify Firebase configuration by removing unused keys and add…
medyo Mar 9, 2025
bde2db3
feat: Add host permission checks for Firefox sign-in functionality
medyo Mar 9, 2025
5b4ff4a
feat: Refactor auth modal store to include error handling and simplif…
medyo Mar 9, 2025
c62fecf
feat: Add dangerToast style for error notifications and adjust modal …
medyo Mar 9, 2025
d60f3c4
feat: Wrap AppLayout component with AuthProvider for improved authent…
medyo Mar 9, 2025
074b1f9
feat: Implement getOauthLink API and custom hook for OAuth authentica…
medyo Mar 9, 2025
6c9ade3
feat: Enhance AuthModal with OAuth link handling and error management
medyo Mar 9, 2025
d30a6d8
feat: Add AuthProvider component for handling user authentication via…
medyo Mar 9, 2025
8bc9d3e
feat: Add error styling to AuthModal for improved user feedback
medyo Mar 9, 2025
90de2ba
feat: Change script injection to document.documentElement for improve…
medyo Mar 9, 2025
2a55970
feat: Remove unused GitHub and Google auth providers from Firebase setup
medyo Mar 9, 2025
b0f2c7d
feat: Add Spinner component for loading indicators with customizable …
medyo Mar 9, 2025
b8bd09a
feat: Add loading state to Button component with spinner indicator
medyo Mar 9, 2025
8972fc3
feat: Add CSS styles for Spinner component with customizable sizes
medyo Mar 9, 2025
0d596f2
feat: Update AuthModal to include Google and GitHub auth providers wi…
medyo Mar 9, 2025
827b755
feat: Add success toast notification for user login with dynamic welc…
medyo Mar 9, 2025
1d7de16
feat: Refactor OAuth link retrieval to accept dynamic provider strings
medyo Mar 22, 2025
8c7c972
feat: Update API endpoint for OAuth link retrieval
medyo Mar 22, 2025
9d2932d
feat: Simplify content script matches in base manifest
medyo Mar 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"axios-cache-adapter": "^2.7.3",
"country-emoji": "^1.5.4",
"dompurify": "^2.2.7",
"firebase": "^11.2.0",
"htmlparser2": "^8.0.1",
"jsonpath": "^1.1.1",
"normalize.css": "^8.0.1",
Expand Down
6 changes: 6 additions & 0 deletions public/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
window.addEventListener('message', (event) => {
if (event.data.type === 'TOKEN_RECEIVED') {
// Forward to content script
window.postMessage(event.data, '*')
}
})
7 changes: 1 addition & 6 deletions public/background.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/*chrome.browserAction.onClicked.addListener(function (tab) {
chrome.tabs.create({ url: "chrome://newtab" });
}
);*/

const uninstallUrl = `https://hackertab.dev/uninstall.html`
if (chrome.runtime.setUninstallURL) {
chrome.runtime.setUninstallURL(uninstallUrl)
}
}
9 changes: 9 additions & 0 deletions public/base.manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
{
"manifest_version": 3,
"name": "Hackertab.dev - developer news",
"description": "All developer news in one tab",
"version": "1.20.1",
"chrome_url_overrides": {
"newtab": "index.html"
},
"host_permissions": ["https://*.hackertab.dev/*"],
"content_scripts": [
{
"matches": ["http://127.0.0.1:5173/*", "http://localhost:5173/*", "https://hackertab.dev/*"],
"run_at": "document_start",
"js": ["content.js"]
}
],
"icons": {
"16": "/logos/logo16.png",
"32": "/logos/logo32.png",
Expand Down
4 changes: 1 addition & 3 deletions public/chrome.manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"manifest_version": 3,
"background": {
"service_worker": "background.js"
},
"host_permissions": ["https://*.hackertab.dev/*"]
}
}
12 changes: 12 additions & 0 deletions public/content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const script = document.createElement('script')
script.src = chrome.runtime.getURL('auth.js')
document.documentElement.appendChild(script)

// Listen for messages from the injected script
window.addEventListener('message', (event) => {
if (event.source !== window || !event.data || event.data.type !== 'TOKEN_RECEIVED') {
return
}

chrome.runtime.sendMessage({ ...event.data })
})
20 changes: 4 additions & 16 deletions public/firefox.manifest.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
{
"manifest_version": 2,
"background": {
"scripts": [
"background.js"
]
},
"permissions": [
"https://*.hackertab.dev/*"
],
"content_security_policy": "script-src 'self' object-src 'self'",
"applications": {
"gecko": {
"id": "{f8793186-e9da-4332-aa1e-dc3d9f7bb04c}"
}
}
}
"background": {
"scripts": ["background.js"]
}
}
172 changes: 139 additions & 33 deletions src/assets/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,44 +122,25 @@ a {
}

.extras {
display: none;
flex-direction: row;
align-content: center;
order: 2;
}

.extraBtn {
background-color: var(--button-background-color);
color: var(--button-text-color);
margin-left: 8px;
height: 40px;
width: 40px;
line-height: 44px;
font-size: 18px;
text-align: center;
border: 0;
border-radius: 20px;
cursor: pointer;
position: relative;
.buttonsFlex {
display: inline-flex;
align-items: center;
justify-content: center;
}

.extraBtn:first-child {
margin-left: 0;
flex-direction: row;
align-content: center;
column-gap: 8px;
row-gap: 8px;
}

.extraTextBtn {
padding: 0 16px;
width: auto;
min-width: 40px;
.dndButton {
font-weight: bold;
}

.darkModeBtn {
background-color: var(--dark-mode-background-color);
color: var(--dark-mode-text-color);
.profileImage {
height: 40px;
width: 40px;
border-radius: 20px;
}

.badgeCount {
Expand Down Expand Up @@ -1198,10 +1179,6 @@ Producthunt item
position: relative;
}

.extras {
display: block;
}

.scrollButton {
align-items: center;
display: flex;
Expand Down Expand Up @@ -1349,6 +1326,135 @@ Producthunt item
color: var(--primary-text-color);
border-radius: 10px;
}

.dangerToast {
background-color: #ff4d4f;
color: white;
padding: 10px 20px;
border-radius: 10px;
}
.successToast {
background-color: #52c41a;
color: white;
padding: 10px 20px;
border-radius: 10px;
}
.capitalize {
text-transform: capitalize;
}

/**
Modal
**/

.Modal {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 650px;
background-color: var(--card-background-color);
padding: 24px;
border-radius: 10px;
box-shadow: 0 0 20px #00000052;
z-index: 3;
max-height: 80vh;
overflow-y: auto;
}

.Overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: var(--overlay-background-color);
backdrop-filter: blur(2px);
}

.modalHeader {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
margin-bottom: 16px;
position: relative;
}

.modalTitle {
margin: 0;
padding: 0;
color: var(--primary-text-color);
font-size: 1.3em;
display: inline-flex;
width: 100%;
column-gap: 8px;
align-items: center;
}
.modalCloseBtn {
align-items: center;
position: absolute;
background-color: transparent;
border-radius: 50%;
top: 0;
right: 0;
border: none;
color: var(--primary-text-color);
cursor: pointer;
display: flex;
justify-content: center;
margin: 0;
padding: 0;
text-align: center;
}
.modalCloseBtn:hover {
opacity: 0.7;
}
.settingContent .form {
display: flex;
flex-direction: row;
align-items: center;
gap: 12px;
}

.settingContent input[type='text'] {
flex: 1;
background-color: var(--settings-input-background-color);
border: 1px solid var(--settings-input-border-color);
border-radius: 50px;
padding: 6px 18px;
color: var(--settings-input-text-color);
font-size: 14px;
}

.settingContent input[type='text']::placeholder {
/* Chrome, Firefox, Opera, Safari 10.1+ */
color: var(--settings-input-placeholder-color);
opacity: 1;
font-size: 14px;
}

.settingContent input[type='text']:focus {
border-color: var(--settings-input-border-focus-color);
}
@media (max-width: 768px) {
.Modal {
left: 0;
top: 0;
margin: 0;
height: 100vh;
max-height: 100vh;
transform: translate(0, 0);
border-radius: 0;
position: relative;
box-shadow: none;
width: auto;
}
.settingContent {
margin-top: 6px;
}
.settingRow {
flex-direction: column;
align-items: flex-start;
}
}
4 changes: 4 additions & 0 deletions src/assets/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ html.dark {

/** Buttons **/
--button-background-color: #1c2026;
--button-hover-background-color: #181c21;
--button-text-color: #fff;
--button-hover-text-color: #d0d0d0;

/**Card **/
--card-background-color: #0d1116;
Expand Down Expand Up @@ -117,6 +119,8 @@ html.light {

--button-background-color: #d2deeb;
--button-text-color: #3c5065;
--button-hover-background-color: #b9cadc;
--button-hover-text-color: #3c5065;

/**Card **/
--card-background-color: #ffffff;
Expand Down
Loading