feat: default Presentation

eslint cleanup
pull/207/head
Specht, David 2022-05-25 00:00:27 +02:00
parent e0bc1a2332
commit 76bd1e16ab
1 changed files with 30 additions and 31 deletions

View File

@ -1,6 +1,5 @@
import React from "react"; import React from 'react';
import { useState } from "react"; import { Room } from '../Common/Api';
import { Room } from "../Common/Api";
type Props = { type Props = {
id: string id: string
@ -11,38 +10,38 @@ type Props = {
const SharedPresentationInput: React.FC<Props> = ({ room, updateRoom, id }) => { const SharedPresentationInput: React.FC<Props> = ({ room, updateRoom, id }) => {
function filepicker() { function filepicker() {
OC.dialogs.filepicker(t('bbb', 'Default Presentation'), file => { OC.dialogs.filepicker(t('bbb', 'Default Presentation'), file => {
updateRoom({...room, presentationUserId: '', presentationPath: file}); updateRoom({...room, presentationUserId: '', presentationPath: file});
}, },
); );
} }
function removeFile() { function removeFile() {
updateRoom({...room, presentationUserId: '', presentationPath: ''}); updateRoom({...room, presentationUserId: '', presentationPath: ''});
} }
function getAvatarUrl(userId) { function getAvatarUrl() {
if (room.presentationUserId === null || room.presentationUserId === undefined) { if (room.presentationUserId === null || room.presentationUserId === undefined) {
return ; return ;
} }
return (OC.generateUrl('/avatar/' + encodeURIComponent(room.presentationUserId) + '/' + 24, { return (OC.generateUrl('/avatar/' + encodeURIComponent(room.presentationUserId) + '/' + 24, {
user: room.presentationUserId, user: room.presentationUserId,
size: 24, size: 24,
requesttoken: OC.requestToken, requesttoken: OC.requestToken,
})) }));
} }
return( return(
<div className="bbb-presentation-input"> <div className="bbb-presentation-input">
<input id={id} type="button" value={t('bbb', 'Choose a File')} onClick={filepicker} /> <input id={id} type="button" value={t('bbb', 'Choose a File')} onClick={filepicker} />
<p className={ room.presentationPath === '' ? 'hidden' : ''}> <p className={ room.presentationPath === '' ? 'hidden' : ''}>
<img src={getAvatarUrl(room.presentationUserId)} alt={room.presentationUserId} className="bbb-avatar" height="100%" /> <img src={getAvatarUrl()} alt={room.presentationUserId} className="bbb-avatar" height="100%" />
<em>{room.presentationPath}</em> <em>{room.presentationPath}</em>
<button onClick={removeFile}><span className="icon icon-close icon-visible"></span></button> <button onClick={removeFile}><span className="icon icon-close icon-visible"></span></button>
</p> </p>
</div> </div>
); );
}; };
export default SharedPresentationInput; export default SharedPresentationInput;