- {companions.length > 1 ? (
-
{props.title}
- ) : (
-
{companions[0].name}
- )}
-
- Указать предпочтительные языки для результатов поиска можно в разделе
+
+
+
+ {companions.length > 2 ? (
+
+ ) : (
+
+ )}
+
+
+ {companions.length > 1 ? (
+
{props.title}
+ ) : (
+
{companions[0].name}
+ )}
+
+ Указать предпочтительные языки для результатов поиска можно в разделе
+
+
+
-
-
+
)
}
diff --git a/src/components/Views/Inbox.tsx b/src/components/Views/Inbox.tsx
index 93fb5cd6..497604c5 100644
--- a/src/components/Views/Inbox.tsx
+++ b/src/components/Views/Inbox.tsx
@@ -105,7 +105,6 @@ export const InboxView = () => {
} catch (error) {
console.log(error)
}
-
await loadChats()
console.log('!!! chats:', chats())
})
@@ -134,6 +133,16 @@ export const InboxView = () => {
showModal('inviteToChat')
}
+ const chatsToShow = () => {
+ if (sortByPerToPer()) {
+ return chats().filter((chat) => chat.title.trim().length === 0)
+ } else if (sortByGroup()) {
+ return chats().filter((chat) => chat.title.trim().length > 0)
+ } else {
+ return chats()
+ }
+ }
+
return (
@@ -181,15 +190,7 @@ export const InboxView = () => {
- chat.title.length === 0)
- : sortByGroup()
- ? chats().filter((chat) => chat.title.length > 0)
- : chats()
- }
- >
+
{(chat) => (
handleOpenChat(chat.id)}
diff --git a/src/context/inbox.tsx b/src/context/inbox.tsx
index e9969c6f..f502e24d 100644
--- a/src/context/inbox.tsx
+++ b/src/context/inbox.tsx
@@ -22,9 +22,9 @@ export const InboxProvider = (props: { children: JSX.Element }) => {
const [chats, setChats] = createSignal([])
const loadChats = async () => {
try {
- const chats = await apiClient.getChats({ limit: 50, offset: 0 })
+ const newChats = await apiClient.getChats({ limit: 50, offset: 0 })
setChats(
- chats.sort((x, y) => {
+ newChats.sort((x, y) => {
return x.updatedAt < y.updatedAt ? 1 : -1
})
)