This commit is contained in:
ilya-bkv 2022-12-12 11:11:43 +03:00
parent 88cfb70683
commit 73335ec3ff
3 changed files with 22 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import DialogAvatar from './DialogAvatar'
import type { Message, ChatMember } from '../../graphql/types.gen'
import formattedTime from '../../utils/formatDateTime'
import { Icon } from '../_shared/Icon'
import { MessageActionsPopup } from './MessageActionsPopup'
type Props = {
content: Message
@ -35,14 +36,11 @@ const Message = (props: Props) => {
<div onClick={props.replyClick}>
<Icon name="chat-reply" class={styles.reply} />
</div>
<Icon name="menu" />
<MessageActionsPopup trigger={<Icon name="menu" />} />
</div>
<div innerHTML={md.render(props.content.body)} />
</div>
</div>
<Show when={props.content.replyTo}>
<small>Repl to {props.content.replyTo}</small>
</Show>
<div class={styles.time}>{formattedTime(props.content.createdAt)}</div>
</div>
)

View File

@ -0,0 +1,19 @@
import type { PopupProps } from '../_shared/Popup'
import { Popup } from '../_shared/Popup'
type MessageActionsPopup = Omit<PopupProps, 'children'>
export const MessageActionsPopup = (props: MessageActionsPopup) => {
return (
<Popup {...props}>
<ul class="nodash">
<li>Ответить</li>
<li>Скопировать</li>
<li>Закрепить</li>
<li>Переслать</li>
<li>Выбрать</li>
<li>Удалить</li>
</ul>
</Popup>
)
}

View File

@ -57,6 +57,7 @@ export const InboxView = () => {
changeSearchParam('chat', `${chat.id}`)
try {
const response = await loadMessages({ chat: chat.id })
console.log('!!! response:', response)
setMessages(response as unknown as MessageType[])
// TODO: one client recreating
} catch (error) {