- {Object.entries(grouppedSessions || {}).map(([timestamp, sessions]) => (
-
-
- {isToday(new Date(timestamp))
- ? "Сегодня"
- : format(new Date(timestamp), "d MMMM", { locale: ru })}
-
-
- {sessions.map((session) => (
-
- ))}
+ {grouppedSessions?.length ? (
+ grouppedSessions?.map(([timestamp, sessions]) => (
+
+
+ {isToday(new Date(timestamp))
+ ? "Сегодня"
+ : format(new Date(timestamp), "d MMMM", { locale: ru })}
+
+
+ {sessions.map((session) => (
+
+ ))}
+
+
+ ))
+ ) : (
+
+

+
+
Ничего не нашли
+
+ Попробуйте изменить параметры поиска
+
- ))}
+ )}
-
+ {!!count && (
+
+ )}
);
}
diff --git a/src/types/Comments.ts b/src/types/Comment.ts
similarity index 100%
rename from src/types/Comments.ts
rename to src/types/Comment.ts
diff --git a/src/types/Session.ts b/src/types/Session.ts
index 9e82ea5..6c8a420 100644
--- a/src/types/Session.ts
+++ b/src/types/Session.ts
@@ -1,5 +1,5 @@
import { IApp as App } from "./App";
-import { Comment } from "./Comments";
+import { Comment } from "./Comment";
import { IOwner as Owner } from "./Owner";
import { Server } from "./Server";
import { Client } from "./Client";
diff --git a/src/utils/groupByCreatedAt.ts b/src/utils/groupByCreatedAt.ts
index a36f652..a1e9caf 100644
--- a/src/utils/groupByCreatedAt.ts
+++ b/src/utils/groupByCreatedAt.ts
@@ -1,8 +1,10 @@
export function groupByCreatedAt
(items: T[]) {
- return items.reduce((acc, session) => {
- const date = session.createdAt.toString().split("T")[0];
- acc[date] = acc[date] || [];
- acc[date].push(session);
- return acc;
- }, {} as Record);
+ return Object.entries(
+ items.reduce((acc, session) => {
+ const date = session.createdAt.toString().split("T")[0];
+ acc[date] = acc[date] || [];
+ acc[date].push(session);
+ return acc;
+ }, {} as Record)
+ );
}