mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
displaying file id3 data
This commit is contained in:
parent
1d4c76f217
commit
13be0d67ab
4 changed files with 24 additions and 6 deletions
|
@ -75,6 +75,10 @@ const AudioPlayerUnconnected = ({
|
|||
};
|
||||
}, [file, current, setPlaying, onProgress]);
|
||||
|
||||
const title =
|
||||
file.metadata &&
|
||||
[file.metadata.id3artist, file.metadata.id3title].filter(el => !!el).join(' - ');
|
||||
|
||||
return (
|
||||
<div onClick={onPlay} className={classNames(styles.wrap, { playing })}>
|
||||
<div className={styles.playpause}>
|
||||
|
@ -84,7 +88,7 @@ const AudioPlayerUnconnected = ({
|
|||
<div className={styles.progress} onClick={onSeek}>
|
||||
<div className={styles.bar} style={{ width: `${progress.progress}%` }} />
|
||||
</div>
|
||||
<div className={styles.title}>{file.url}</div>
|
||||
<div className={styles.title}>{title || 'Unknown'}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -11,7 +11,7 @@ import * as NODE_ACTIONS from '~/redux/node/actions';
|
|||
import { selectNode } from '~/redux/node/selectors';
|
||||
import { LoaderCircle } from '~/components/input/LoaderCircle';
|
||||
import { Group } from '~/components/containers/Group';
|
||||
import { UPLOAD_SUBJECTS, UPLOAD_TARGETS } from '~/redux/uploads/constants';
|
||||
import { UPLOAD_SUBJECTS, UPLOAD_TARGETS, UPLOAD_TYPES } from '~/redux/uploads/constants';
|
||||
import uuid from 'uuid4';
|
||||
import * as UPLOAD_ACTIONS from '~/redux/uploads/actions';
|
||||
import { selectUploads } from '~/redux/uploads/selectors';
|
||||
|
@ -20,6 +20,7 @@ import { getFileType } from '~/utils/uploader';
|
|||
import { selectUser } from '~/redux/auth/selectors';
|
||||
import { getURL } from '~/utils/dom';
|
||||
import { ButtonGroup } from '~/components/input/ButtonGroup';
|
||||
import { AudioPlayer } from '~/components/media/AudioPlayer';
|
||||
|
||||
const mapStateToProps = (state: IState) => ({
|
||||
node: selectNode(state),
|
||||
|
@ -162,7 +163,13 @@ const CommentFormUnconnected: FC<IProps> = ({
|
|||
)
|
||||
)}
|
||||
|
||||
{comment.files.map(file => file.name && <div key={file.id}>{file.name}</div>)}
|
||||
{comment.files.map(file => {
|
||||
if (file.type === UPLOAD_TYPES.AUDIO) {
|
||||
return <AudioPlayer file={file} />;
|
||||
}
|
||||
|
||||
return <div>file.name</div>;
|
||||
})}
|
||||
</CommentWrapper>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue