Remove old code

This commit is contained in:
Joao Victor 2022-11-03 14:50:36 -03:00
parent 54f99ccf76
commit f4d70647a1
4 changed files with 0 additions and 153 deletions

View File

@ -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
? (
<Styled.ConvertAndUpload
disabled={converterButtonDisabled}
onClick={() => {
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);

View File

@ -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 <ConverterButton {...{ amIPresenter, ...props }} />;
};
export default ConverterButtonContainer;

View File

@ -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,
};

View File

@ -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,
};