From f4d70647a1988f3fcdf87fb90d49d16afd5c4f21 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Thu, 3 Nov 2022 14:50:36 -0300 Subject: [PATCH] Remove old code --- .../notes/converter-button/component.jsx | 45 ------------- .../notes/converter-button/container.jsx | 14 ----- .../notes/converter-button/service.js | 63 ------------------- .../notes/converter-button/styles.js | 31 --------- 4 files changed, 153 deletions(-) delete mode 100644 bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx delete mode 100644 bigbluebutton-html5/imports/ui/components/notes/converter-button/container.jsx delete mode 100644 bigbluebutton-html5/imports/ui/components/notes/converter-button/service.js delete mode 100644 bigbluebutton-html5/imports/ui/components/notes/converter-button/styles.js diff --git a/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx b/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx deleted file mode 100644 index 130c66d482..0000000000 --- a/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx +++ /dev/null @@ -1,45 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { defineMessages, injectIntl } from 'react-intl'; -import Service from './service'; -import Styled from './styles'; -import { useState } from 'react'; - -const DEBOUNCE_TIMEOUT = 15000; - -const intlMessages = defineMessages({ - convertAndUploadLabel: { - id: 'app.note.converter-button.convertAndUpload', - description: 'Export shared notes as a PDF and upload to the main room', - }, -}); - -const propTypes = { - intl: PropTypes.shape({ - formatMessage: PropTypes.func.isRequired, - }).isRequired, - amIPresenter: PropTypes.bool.isRequired, -}; - -const ConverterButtonComponent = ({ - intl, - amIPresenter, -}) => { - [converterButtonDisabled, setConverterButtonDisabled] = useState(false); - return (amIPresenter - ? ( - { - setConverterButtonDisabled(true); - setTimeout(() => setConverterButtonDisabled(false), DEBOUNCE_TIMEOUT); - return Service.convertAndUpload()}} - label={intl.formatMessage(intlMessages.convertAndUploadLabel)} - icon="upload" - /> - ) - : null)}; - -ConverterButtonComponent.propTypes = propTypes; - -export default injectIntl(ConverterButtonComponent); diff --git a/bigbluebutton-html5/imports/ui/components/notes/converter-button/container.jsx b/bigbluebutton-html5/imports/ui/components/notes/converter-button/container.jsx deleted file mode 100644 index 5693394b3a..0000000000 --- a/bigbluebutton-html5/imports/ui/components/notes/converter-button/container.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import React, { useContext } from 'react'; -import ConverterButton from './component'; -import { UsersContext } from '/imports/ui/components/components-data/users-context/context'; -import Auth from '/imports/ui/services/auth'; - -const ConverterButtonContainer = ({ ...props }) => { - const usingUsersContext = useContext(UsersContext); - const { users } = usingUsersContext; - const amIPresenter = users[Auth.meetingID][Auth.userID].presenter; - - return ; -}; - -export default ConverterButtonContainer; diff --git a/bigbluebutton-html5/imports/ui/components/notes/converter-button/service.js b/bigbluebutton-html5/imports/ui/components/notes/converter-button/service.js deleted file mode 100644 index b2cfc3f078..0000000000 --- a/bigbluebutton-html5/imports/ui/components/notes/converter-button/service.js +++ /dev/null @@ -1,63 +0,0 @@ -import Auth from '/imports/ui/services/auth'; -import PresentationUploaderService from '/imports/ui/components/presentation/presentation-uploader/service'; -import PadsService from '/imports/ui/components/pads/service'; -import NotesService from '/imports/ui/components/notes/service'; -import { UploadingPresentations } from '/imports/api/presentations'; -import _ from 'lodash'; - -const PADS_CONFIG = Meteor.settings.public.pads; -const PRESENTATION_CONFIG = Meteor.settings.public.presentation; - -async function convertAndUpload() { - - let filename = 'Shared_Notes'; - const presentations = PresentationUploaderService.getPresentations(); - const duplicates = presentations.filter((pres) => pres.filename?.startsWith(filename) || pres.name?.startsWith(filename)).length; - - if (duplicates !== 0) { filename = `${filename}(${duplicates})`; } - - const params = PadsService.getParams(); - const padId = await PadsService.getPadId(NotesService.ID); - const extension = 'pdf'; - filename = `${filename}.${extension}`; - - UploadingPresentations.insert({ - id: _.uniqueId(filename), - progress: 0, - filename, - lastModifiedUploader: false, - upload: { - done: false, - error: false - }, - uploadTimestamp: new Date() - }) - - const exportUrl = Auth.authenticateURL(`${PADS_CONFIG.url}/p/${padId}/export/${extension}?${params}`); - const sharedNotesAsFile = await fetch(exportUrl, { credentials: 'include' }); - - const data = await sharedNotesAsFile.blob(); - - const sharedNotesData = new File([data], filename, { - type: data.type, - }); - - PresentationUploaderService.handleSavePresentation([], isFromPresentationUploaderInterface = false, { - file: sharedNotesData, - isDownloadable: false, // by default new presentations are set not to be downloadable - isRemovable: true, - filename: sharedNotesData.name, - isCurrent: true, - conversion: { done: false, error: false }, - upload: { done: false, error: false, progress: 0 }, - exportation: { isRunning: false, error: false }, - onConversion: () => {}, - onUpload: () => {}, - onProgress: () => {}, - onDone: () => {}, - }) -} - -export default { - convertAndUpload, -}; diff --git a/bigbluebutton-html5/imports/ui/components/notes/converter-button/styles.js b/bigbluebutton-html5/imports/ui/components/notes/converter-button/styles.js deleted file mode 100644 index 71fa88eb65..0000000000 --- a/bigbluebutton-html5/imports/ui/components/notes/converter-button/styles.js +++ /dev/null @@ -1,31 +0,0 @@ -import styled from 'styled-components'; -import { - colorWhite, - colorGrayDark, -} from '/imports/ui/stylesheets/styled-components/palette'; -import Button from '/imports/ui/components/common/button/component'; - -const ConvertAndUpload = styled(Button)` - position: relative; - background-color: ${colorWhite}; - display: block; - padding: 0; - & > i { - color: ${colorGrayDark}; - font-size: smaller; - [dir="rtl"] & { - -webkit-transform: scale(-1, 1); - -moz-transform: scale(-1, 1); - -ms-transform: scale(-1, 1); - -o-transform: scale(-1, 1); - transform: scale(-1, 1); - } - } - &:hover { - background-color: ${colorWhite}; - } -`; - -export default { - ConvertAndUpload, -};