Skip to content

Commit

Permalink
fix recent session activity
Browse files Browse the repository at this point in the history
  • Loading branch information
bosi95 committed Nov 13, 2024
1 parent f574354 commit af7d6c5
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/components/RecentSessions/RecentSessions.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from "react";
import React from "react";
import { Link } from "react-router-dom";
import "./RecentSessions.scss";
import RecentSessionsItem from "./RecentSessionsItem/RecentSessionsItem";
Expand All @@ -7,20 +7,6 @@ import { ROUTES, STAGES_MAP } from "../../utils/constants";

const RecentSessions: React.FC = () => {
const { recentSessions, talkActivity } = useGlobalState();
const [activity, setActivity] = useState<Map<string, number>>(
new Map<string, number>()
);

useEffect(() => {
const tmpActivity = new Map<string, number>();
for (let i = 0; i < recentSessions.length; i++) {
tmpActivity.set(
recentSessions[i].id,
talkActivity.get(recentSessions[i].id) || 0
);
}
setActivity(tmpActivity);
}, [talkActivity]);

return (
<div>
Expand All @@ -38,7 +24,7 @@ const RecentSessions: React.FC = () => {
id={session.id}
title={session.title}
stage={STAGES_MAP.get(session.slot_roomId || "") || ""}
activity={activity.get(session.id) || 0}
activity={talkActivity.get(session.id) || 0}
/>
);
})}
Expand Down

0 comments on commit af7d6c5

Please sign in to comment.