mirror of
https://github.com/balzack/databag.git
synced 2025-04-23 18:15:19 +00:00
rendering thumbs for audio and binary
This commit is contained in:
parent
9ec55e39ca
commit
2e170f693f
BIN
app/client/web/src/images/audio.png
Normal file
BIN
app/client/web/src/images/audio.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
BIN
app/client/web/src/images/binary.png
Normal file
BIN
app/client/web/src/images/binary.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
app/client/web/src/images/failed.png
Normal file
BIN
app/client/web/src/images/failed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
@ -19,6 +19,15 @@
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.failed {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin-left: 72px;
|
||||
margin-right: 32px;
|
||||
margin-top: 8px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@ -53,6 +62,10 @@
|
||||
font-style: italic;
|
||||
color: var(--mantine-color-text-7);
|
||||
}
|
||||
|
||||
.unconfirmed {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
|
@ -1,18 +1,19 @@
|
||||
import { avatar } from '../constants/Icons'
|
||||
import { Topic, Card, Profile } from 'databag-client-sdk';
|
||||
import classes from './Message.module.css'
|
||||
import { Image } from '@mantine/core'
|
||||
import { Image, Skeleton } from '@mantine/core'
|
||||
import { ImageAsset } from './imageAsset/ImageAsset';
|
||||
import { AudioAsset } from './audioAsset/AudioAsset';
|
||||
import { VideoAsset } from './videoAsset/VideoAsset';
|
||||
import { BinaryAsset } from './binaryAsset/BinaryAsset';
|
||||
import type { MediaAsset } from '../conversation/Conversation';
|
||||
import { useMessage } from './useMessage.hook';
|
||||
import failed from '../images/failed.png'
|
||||
|
||||
export function Message({ topic, card, profile, host }: { topic: Topic, card: Card | null, profile: Profile | null, host: boolean }) {
|
||||
const { state, actions } = useMessage();
|
||||
|
||||
const { locked, data, created, topicId } = topic;
|
||||
const { locked, data, created, topicId, status, transform } = topic;
|
||||
const { name, handle, node } = profile || card || { name: null, handle: null, node: null }
|
||||
const { text, textColor, textSize, assets } = data || { text: null, textColor: null, textSize: null }
|
||||
const textStyle = textColor && textSize ? { color: textColor, fontSize: textSize } : textColor ? { color: textColor } : textSize ? { fontSize: textSize } : {}
|
||||
@ -53,21 +54,33 @@ export function Message({ topic, card, profile, host }: { topic: Topic, card: Ca
|
||||
</div>
|
||||
<div className={classes.options}>OPTIONS</div>
|
||||
</div>
|
||||
{ !locked && text && (
|
||||
{ !locked && status === 'confirmed' && text && (
|
||||
<div style={textStyle}>
|
||||
<span className={classes.text}>{ text }</span>
|
||||
</div>
|
||||
)}
|
||||
{ !locked && status !== 'confirmed' && (
|
||||
<div className={classes.unconfirmed}>
|
||||
<Skeleton height={8} mt={6} radius="xl" />
|
||||
<Skeleton height={8} mt={6} width="70%" radius="xl" />
|
||||
</div>
|
||||
)}
|
||||
{ locked && (
|
||||
<div className={classes.locked}>{ state.strings.encrypted }</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{ !locked && media.length > 0 && (
|
||||
{ !locked && media.length > 0 && transform === 'complete' && (
|
||||
<div className={classes.assets}>
|
||||
{ media }
|
||||
</div>
|
||||
)}
|
||||
{ !locked && media.length > 0 && transform === 'incomplete' && (
|
||||
<Skeleton height={64} circle mb="xl" />
|
||||
)}
|
||||
{ !locked && media.length > 0 && transform !== 'complete' && transform !== 'incomplete' && (
|
||||
<Image className={classes.failed} src={failed} fit="contain" />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
.asset {
|
||||
|
||||
.thumb {
|
||||
width: auto;
|
||||
height: 128px;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,16 @@
|
||||
import React from 'react';
|
||||
import { MediaAsset } from '../../conversation/Conversation';
|
||||
import { useAudioAsset } from './useAudioAsset.hook';
|
||||
import audio from '../../images/audio.png'
|
||||
import classes from './AudioAsset.module.css'
|
||||
import { Image } from '@mantine/core'
|
||||
|
||||
export function AudioAsset({ topicId, asset }: { topicId: string, asset: MediaAsset }) {
|
||||
const { state, actions } = useAudioAsset(topicId, asset);
|
||||
return <div>Audio</div>
|
||||
return (
|
||||
<div className={classes.asset}>
|
||||
<Image className={classes.thumb} src={audio} fit="contain" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
.asset {
|
||||
|
||||
.thumb {
|
||||
width: auto;
|
||||
height: 128px;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,16 @@
|
||||
import React from 'react';
|
||||
import { MediaAsset } from '../../conversation/Conversation';
|
||||
import { useBinaryAsset } from './useBinaryAsset.hook';
|
||||
import binary from '../../images/binary.png'
|
||||
import classes from './BinaryAsset.module.css'
|
||||
import { Image } from '@mantine/core'
|
||||
|
||||
export function BinaryAsset({ topicId, asset }: { topicId: string, asset: MediaAsset }) {
|
||||
const { state, actions } = useBinaryAsset(topicId, asset);
|
||||
return <div>Binary</div>
|
||||
return (
|
||||
<div className={classes.asset}>
|
||||
<Image className={classes.thumb} src={binary} fit="contain" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user