Skip to content

Commit a61ccbe

Browse files
committed
Brave browser issue pop-up
1 parent 80dd151 commit a61ccbe

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

gitforme/src/components/gitformeUi.jsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ const GitformeUi = () => {
2626

2727
const [repoUrl, setRepoUrl] = useState('');
2828
const [isChatOpen, setIsChatOpen] = useState(false);
29+
// Added state for Brave browser detection
30+
const [isBraveBrowser, setIsBraveBrowser] = useState(false);
2931

3032
const apiServerUrl = import.meta.env.VITE_API_URL;
3133

@@ -35,6 +37,16 @@ const GitformeUi = () => {
3537
}
3638
}, [username, reponame]);
3739

40+
// Effect to check for Brave browser on component mount
41+
useEffect(() => {
42+
const checkForBrave = async () => {
43+
if (navigator.brave && await navigator.brave.isBrave()) {
44+
setIsBraveBrowser(true);
45+
}
46+
};
47+
checkForBrave();
48+
}, []);
49+
3850
const handleGitHubLogin = () => {
3951
window.location.href = `${apiServerUrl}/api/auth/github`;
4052
};
@@ -75,6 +87,15 @@ const GitformeUi = () => {
7587
oncook={handleCookRepoUrl}
7688
/>
7789

90+
{/* Brave Browser Warning Message */}
91+
{isBraveBrowser && !isAuthenticated && (
92+
<div className="container mx-auto mt-2 -mb-4">
93+
<div className="bg-yellow-100 border border-yellow-400 text-yellow-800 px-4 py-2 rounded-md text-center text-sm">
94+
For a better experience, please avoid using the Brave browser for login due to potential compatibility issues.
95+
</div>
96+
</div>
97+
)}
98+
7899
<AnimatePresence mode="wait">
79100
<motion.div
80101
key={username && reponame ? "repo-view-active" : "landing-view-active"}
@@ -139,4 +160,4 @@ const GitformeUi = () => {
139160
);
140161
};
141162

142-
export default GitformeUi;
163+
export default GitformeUi;

0 commit comments

Comments
 (0)