Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 12 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"next-auth": "^4.24.7",
"react": "^18",
"react-dom": "^18",
"recharts": "^2.12.7"
"recharts": "^2.12.7",
"sonner": "^2.0.7"
},
"devDependencies": {
"@playwright/test": "1.49.1",
Expand Down
16 changes: 13 additions & 3 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Footer from "@/components/Footer";
import Providers from "./providers";
import PWARegister from "@/components/pwa-register";
import "./globals.css";
import { Toaster } from "sonner";

const inter = Inter({ subsets: ["latin"] });

Expand Down Expand Up @@ -48,7 +49,9 @@ export default function RootLayout({
(function() {
try {
const stored = localStorage.getItem('theme');
const supportDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches === true;
const supportDarkMode =
window.matchMedia('(prefers-color-scheme: dark)').matches === true;

if (stored === 'dark' || (!stored && supportDarkMode)) {
document.documentElement.classList.add('dark');
document.documentElement.style.colorScheme = 'dark';
Expand All @@ -62,15 +65,22 @@ export default function RootLayout({
}}
/>
</head>
<body className={`${inter.className} min-h-screen bg-[var(--background)] text-[var(--foreground)]`}>

<body
className={`${inter.className} min-h-screen bg-[var(--background)] text-[var(--foreground)]`}
>
<PWARegister />

<div className="flex min-h-screen flex-col">
<div className="flex-1">
<Providers>{children}</Providers>
</div>

<Footer />

<Toaster richColors position="top-right" />
</div>
</body>
</html>
);
}
}
20 changes: 15 additions & 5 deletions src/components/StreakTracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useAccount } from "@/components/AccountContext";
import { useCountUp } from "@/hooks/useCountUp";
import StreakMilestoneBanner from "@/components/StreakMilestoneBanner";
import { useHeatmapTheme } from "@/hooks/useHeatmapTheme";
import { toast } from "sonner";

const STREAK_MILESTONES = [7, 30, 50, 100, 200, 365];

Expand Down Expand Up @@ -284,23 +285,32 @@ export default function StreakTracker() {
]
: [];

const handleCopy = () => {
const handleCopy = async () => {
if (!data) return;

const textToCopy = [
"🔥 DevTrack Stats",
`Current streak: ${data.current} days`,
`Longest streak: ${data.longest} days`,
`Active days: ${data.totalActiveDays}`
].join('\n');
`Active days: ${data.totalActiveDays}`,
].join("\n");

if (!navigator.clipboard) {
toast.error("Clipboard is not supported in this browser.");
return;
}

navigator.clipboard.writeText(textToCopy).then(() => {
try {
await navigator.clipboard.writeText(textToCopy);

setCopied(true);

toast.success("Streak stats copied to clipboard!");

setTimeout(() => setCopied(false), 2000);
}).catch(() => {});
} catch {
toast.error("Failed to copy streak stats.");
}
};

const currentMilestone =
Expand Down
Loading