diff --git a/src/components/Inbox/DialogCard.tsx b/src/components/Inbox/DialogCard.tsx index a9a4dcd3..5d19919e 100644 --- a/src/components/Inbox/DialogCard.tsx +++ b/src/components/Inbox/DialogCard.tsx @@ -1,6 +1,6 @@ import styles from './DialogCard.module.scss' import DialogAvatar from './DialogAvatar' -import type { Author } from '../../graphql/types.gen' +import type { Author, User } from '../../graphql/types.gen' import { apiClient } from '../../utils/apiClient' import { t } from '../../utils/intl' import { useInbox } from '../../context/inbox' @@ -9,19 +9,21 @@ type DialogProps = { online?: boolean message?: string counter?: number - author?: Author - ownSlug: Author['slug'] + users: User[] + ownSlug: User['slug'] } const DialogCard = (props: DialogProps) => { + // @ts-ignore + const participants = props.users.filter((user) => user !== props.ownSlug) + console.log('!!! participants:', participants) + // @ts-ignore return ( //DialogCardView - подумать
-
- -
+
{/**/}
-
{props.author.name}
+ {/*
{participants[0]}
*/}
Указать предпочтительные языки для результатов поиска можно в разделе
diff --git a/src/components/Views/Inbox.tsx b/src/components/Views/Inbox.tsx index ca076a1b..f339cc84 100644 --- a/src/components/Views/Inbox.tsx +++ b/src/components/Views/Inbox.tsx @@ -1,5 +1,5 @@ import { For, createSignal, Show, onMount, createEffect, createMemo } from 'solid-js' -import type { Author } from '../../graphql/types.gen' +import type { Author, Chat } from '../../graphql/types.gen' import { AuthorCard } from '../Author/Card' import { Icon } from '../_shared/Icon' import { Loading } from '../Loading' @@ -58,18 +58,10 @@ const postMessage = async (msg: string) => { return response.data.createComment } -const handleGetChats = async () => { - try { - const response = await loadChats() - console.log('!!! handleGetChats:', response) - } catch (error) { - console.log(error) - } -} - export const InboxView = () => { const [messages, setMessages] = createSignal([]) const [recipients, setRecipients] = createSignal([]) + const [chats, setChats] = createSignal([]) const [cashedRecipients, setCashedRecipients] = createSignal([]) const [postMessageText, setPostMessageText] = createSignal('') const [loading, setLoading] = createSignal(false) @@ -116,6 +108,13 @@ export const InboxView = () => { } catch (error) { console.log(error) } + + try { + const response = await loadChats() + setChats(response as unknown as Chat[]) + } catch (error) { + console.log(error) + } }) const handleSubmit = async () => { @@ -129,18 +128,19 @@ export const InboxView = () => { } } - let formParent // autoresize ghost element + let textareaParent // textarea autoresize ghost element const handleChangeMessage = (event) => { setPostMessageText(event.target.value) } createEffect(() => { - formParent.dataset.replicatedValue = postMessageText() + textareaParent.dataset.replicatedValue = postMessageText() }) const handleOpenInviteModal = (event: Event) => { event.preventDefault() showModal('inviteToChat') } + return (
@@ -160,14 +160,14 @@ export const InboxView = () => {
  • {t('All')}
  • -
  • {t('Personal')}
  • +
  • {t('Personal')}
  • {t('Groups')}
  • - - {(author) => } + + {(chat) => }
    @@ -198,7 +198,7 @@ export const InboxView = () => {
    -
    +