Skip to content
Merged
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
9 changes: 7 additions & 2 deletions src/app/dashboard/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ function SettingsPageContent() {
}
} catch (error) {
console.error("Error updating settings:", error);
toast.error("Failed to update public profile setting");
} finally {
setSaving(false);
}
Expand All @@ -299,6 +300,7 @@ function SettingsPageContent() {
}
} catch (error) {
console.error("Error updating leaderboard setting:", error);
toast.error("Failed to update leaderboard setting");
} finally {
setSaving(false);
}
Expand Down Expand Up @@ -338,7 +340,8 @@ function SettingsPageContent() {
setCopied(true);
toast.success("Link copied successfully!");
setTimeout(() => setCopied(false), 2000);
}).catch(() => {
}).catch((err) => {
console.error("Clipboard copy failed:", err);
toast.error("Failed to copy link");
});
};
Expand All @@ -361,8 +364,10 @@ function SettingsPageContent() {
setLinkedAccounts((current) =>
current.filter((account) => account.githubId !== githubId)
);
} catch {
} catch (error) {
console.error("Failed to remove account:", error);
setRemoveError("Failed to remove account");
toast.error("Failed to remove account");
} finally {
setRemovingAccountId(null);
}
Expand Down
9 changes: 6 additions & 3 deletions src/components/CommitTimeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ResponsiveContainer,
} from "recharts";
import { Sun, Cloud, Sunset, Moon } from "lucide-react";
import { toast } from "sonner";

interface TimeBlocks {
morning: number;
Expand Down Expand Up @@ -83,9 +84,11 @@ export default function CommitTimeChart() {
setData(chartData);
setPeakTime(peak.commits > 0 ? peak.name : null);
})
.catch(() =>
setError("We couldn't load your time-of-day data right now."),
)
.catch((err) => {
console.error("Failed to fetch commit time data:", err);
setError("We couldn't load your time-of-day data right now.");
toast.error("Failed to load time-of-day data");
})
.finally(() => setLoading(false));
}, [days]);

Expand Down
9 changes: 6 additions & 3 deletions src/components/CommunityMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { useCallback, useEffect, useState } from "react";
import { useAccount } from "@/components/AccountContext";
import { toast } from "sonner";

interface CommunityData {
discussionsStarted: number;
Expand Down Expand Up @@ -32,11 +33,13 @@ export default function CommunityMetrics() {
return response.json();
})
.then((data: CommunityData) => setMetrics(data))
.catch(() =>
.catch((err) => {
console.error("Failed to fetch community metrics:", err);
setError(
"We couldn't load your discussion analytics right now. Please try again in a moment."
)
)
);
toast.error("Failed to load community metrics");
})
.finally(() => setLoading(false));
}, [selectedAccount]);

Expand Down
18 changes: 13 additions & 5 deletions src/components/StreakTracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ export default function StreakTracker() {
setData(streakData);
setContributionData(contribData);
setFreezeDates(streakData.freezeDates || []);
} catch {
} catch (err) {
console.error("Failed to fetch streak data:", err);
setError("We couldn't load your streak data right now. Please try again in a moment.");
} finally {
setLoading(false);
Expand All @@ -116,7 +117,10 @@ export default function StreakTracker() {
fetch("/api/streak/freeze")
.then((r) => r.json())
.then((d: FreezeData) => setFreeze(d))
.catch(() => setFreeze(null))
.catch((err) => {
console.error("Failed to fetch freeze data:", err);
setFreeze(null);
})
.finally(() => setFreezeLoading(false));
};

Expand Down Expand Up @@ -186,7 +190,8 @@ export default function StreakTracker() {
setData(streakData);
setFreeze(freezeData);
toast.success("Streak freeze activated for today!");
} catch {
} catch (err) {
console.error("Failed to apply streak freeze:", err);
toast.error("Failed to activate streak freeze.");
fetchFreeze();
} finally {
Expand Down Expand Up @@ -221,7 +226,9 @@ export default function StreakTracker() {
]);
setData(streakData);
setFreeze(freezeData);
} catch {
} catch (err) {
console.error("Failed to cancel streak freeze:", err);
toast.error("Failed to cancel streak freeze.");
fetchFreeze();
} finally {
setCancelling(false);
Expand Down Expand Up @@ -370,7 +377,8 @@ export default function StreakTracker() {
toast.success("Streak stats copied to clipboard!");

setTimeout(() => setCopied(false), 2000);
} catch {
} catch (err) {
console.error("Failed to copy streak stats:", err);
toast.error("Failed to copy streak stats.");
}
};
Expand Down
7 changes: 6 additions & 1 deletion src/components/repo-analytics/RepoAnalyticsExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { useCallback, useEffect, useState } from "react";
import RepoCarousel from "./RepoCarousel";
import { ExplorerRepoCardData } from "@/lib/repoAnalytics";
import { toast } from "sonner";

export default function RepoAnalyticsExplorer() {
const [repos, setRepos] = useState<ExplorerRepoCardData[]>([]);
Expand All @@ -19,7 +20,11 @@ export default function RepoAnalyticsExplorer() {
return res.json();
})
.then((json: { repos: ExplorerRepoCardData[] }) => setRepos(json.repos ?? []))
.catch(() => setError("Could not load repo analytics right now."))
.catch((err) => {
console.error("Failed to fetch repo analytics:", err);
setError("Could not load repo analytics right now.");
toast.error("Failed to load repo analytics");
})
.finally(() => setLoading(false));
}, []);

Expand Down
Loading