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/dashboard/components/DashboardLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,18 @@ export function DashboardLayout() {
const { currentUser } = useAuth();

const handleSignOut = async () => {
await signOut(auth);
navigate("/");
try {
await signOut(auth);
navigate("/");
} catch (error) {
console.error("Sign out failed:", error);
}
};

const initials = currentUser?.displayName
? currentUser.displayName
.split(" ")
.filter((n) => n.length > 0)
.map((n) => n[0])
.join("")
.toUpperCase()
Expand Down
18 changes: 12 additions & 6 deletions src/dashboard/pages/DashboardOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,18 @@ export function DashboardOverview() {
);
}

const overallProgress = Math.round(
Object.values(project.stages).reduce(
(sum, s) => sum + s.completionPercent,
0,
) / Object.keys(project.stages).length,
);
const stageValues = Object.values(project.stages ?? {});
const overallProgress =
stageValues.length > 0
? Math.round(
stageValues.reduce(
(sum, s) =>
sum +
(Number.isFinite(s.completionPercent) ? s.completionPercent : 0),
0,
) / stageValues.length,
)
: 0;

const completedStages = Object.values(project.stages).filter(
(s) => s.status === "completed",
Expand Down
Loading