Skip to content

Commit 1ab33ac

Browse files
committed
update favicon + open community cards in same tab
1 parent f99d28e commit 1ab33ac

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
5+
<link rel="icon" type="image/x-icon" href="/coderplex-light.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>coderplexDevCommunity()</title>
88
</head>

public/coderplex-dark.ico

15 KB
Binary file not shown.

public/coderplex-light.ico

15 KB
Binary file not shown.

src/components/Community.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ export function Community({ session }: { session: Session }) {
5858

5959
// Save scroll position before navigation
6060
const handleProfileClick = (profileId: string, event: React.MouseEvent) => {
61-
// Only save scroll position, don't prevent default navigation
61+
event.preventDefault();
6262
scrollPositions[location.pathname] = window.scrollY;
63+
navigate(profileId === session.user.id ? '/profile' : `/profile/${profile.user_id}`);
6364
};
6465

6566
// Restore scroll position
@@ -230,8 +231,6 @@ export function Community({ session }: { session: Session }) {
230231
key={profile.user_id}
231232
to={profile.user_id === session.user.id ? '/profile' : `/profile/${profile.user_id}`}
232233
onClick={(e) => handleProfileClick(profile.user_id, e)}
233-
target="_blank"
234-
rel="noopener noreferrer"
235234
className="block bg-white dark:bg-dark-800 rounded-lg p-4 md:p-6
236235
shadow-[0_2px_8px_rgba(0,0,0,0.08)] dark:shadow-[0_2px_8px_rgba(0,0,0,0.2)]
237236
hover:shadow-[0_8px_16px_rgba(0,0,0,0.08)] dark:hover:shadow-[0_8px_16px_rgba(0,0,0,0.3)]

src/context/ThemeContext.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ export function ThemeProvider({ children }: { children: React.ReactNode }) {
3131
localStorage.setItem('theme', theme);
3232
document.documentElement.classList.remove('light', 'dark');
3333
document.documentElement.classList.add(theme);
34+
35+
// Update favicon based on theme
36+
const favicon = document.querySelector('link[rel="icon"]');
37+
if (favicon) {
38+
favicon.setAttribute('href', theme === 'dark' ? '/coderplex-dark.ico' : '/coderplex-light.ico');
39+
}
3440
}, [theme]);
3541

3642
// Listen for system theme changes

0 commit comments

Comments
 (0)