2022-11-10 15:06:02 +00:00
|
|
|
import styles from './DialogCard.module.scss'
|
|
|
|
import DialogAvatar from './DialogAvatar'
|
2022-11-27 18:36:45 +00:00
|
|
|
import type { Author, ChatMember, User } from '../../graphql/types.gen'
|
2022-11-25 23:34:46 +00:00
|
|
|
import { t } from '../../utils/intl'
|
2022-12-02 11:11:45 +00:00
|
|
|
import { Show } from 'solid-js'
|
|
|
|
import { useSession } from '../../context/session'
|
2022-11-10 15:06:02 +00:00
|
|
|
|
2022-11-15 12:15:07 +00:00
|
|
|
type DialogProps = {
|
2022-11-10 15:06:02 +00:00
|
|
|
online?: boolean
|
|
|
|
message?: string
|
|
|
|
counter?: number
|
2022-11-27 18:36:45 +00:00
|
|
|
members: ChatMember[]
|
2022-11-15 09:45:55 +00:00
|
|
|
}
|
|
|
|
|
2022-11-15 12:15:07 +00:00
|
|
|
const DialogCard = (props: DialogProps) => {
|
2022-12-02 11:11:45 +00:00
|
|
|
const { session } = useSession()
|
|
|
|
const participants = props.members?.filter((m) => m?.id !== session().user.id) || []
|
2022-11-27 07:10:04 +00:00
|
|
|
console.log('!!! participants:', participants)
|
2022-11-10 15:06:02 +00:00
|
|
|
return (
|
2022-11-24 15:39:31 +00:00
|
|
|
//DialogCardView - подумать
|
2022-12-02 11:11:45 +00:00
|
|
|
<Show when={participants?.length > 0}>
|
|
|
|
<div class={styles.DialogCard}>
|
|
|
|
<div class={styles.avatar}>
|
|
|
|
<DialogAvatar name={participants[0].name} online={props.online} />
|
2022-11-10 15:06:02 +00:00
|
|
|
</div>
|
2022-12-02 11:11:45 +00:00
|
|
|
<div class={styles.row}>
|
|
|
|
<div class={styles.name}>{participants[0].name}</div>
|
|
|
|
<div class={styles.message}>{t('You can announce your languages in profile')}</div>
|
|
|
|
</div>
|
|
|
|
<div class={styles.activity}>
|
|
|
|
<div class={styles.time}>22:22</div>
|
|
|
|
<div class={styles.counter}>
|
|
|
|
<span>12</span>
|
|
|
|
</div>
|
2022-11-10 15:06:02 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-12-02 11:11:45 +00:00
|
|
|
</Show>
|
2022-11-10 15:06:02 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default DialogCard
|