2019-06-25 07:47:43 +00:00
|
|
|
import React from 'react';
|
2022-12-24 02:41:34 +00:00
|
|
|
import { createRoot } from 'react-dom/client';
|
2019-06-25 07:47:43 +00:00
|
|
|
import FileView from './components/history-trash-file-view/file-view';
|
|
|
|
import FileViewTip from './components/history-trash-file-view/file-view-tip';
|
|
|
|
import Image from './components/file-content-view/image';
|
|
|
|
import SVG from './components/file-content-view/svg';
|
|
|
|
import PDF from './components/file-content-view/pdf';
|
|
|
|
import Text from './components/file-content-view/text';
|
|
|
|
import Markdown from './components/file-content-view/markdown';
|
|
|
|
import Video from './components/file-content-view/video';
|
|
|
|
import Audio from './components/file-content-view/audio';
|
|
|
|
|
|
|
|
const {
|
|
|
|
fileType, err
|
|
|
|
} = window.app.pageOptions;
|
|
|
|
|
|
|
|
class HistoryTrashFileView extends React.Component {
|
|
|
|
|
|
|
|
render() {
|
|
|
|
if (err) {
|
|
|
|
return (
|
|
|
|
<FileView content={<FileViewTip />} />
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
let content;
|
|
|
|
switch (fileType) {
|
|
|
|
case 'Image':
|
2019-07-10 07:04:00 +00:00
|
|
|
content = <Image tip={<FileViewTip />} />;
|
2019-06-25 07:47:43 +00:00
|
|
|
break;
|
2020-11-02 05:56:35 +00:00
|
|
|
case 'SVG':
|
2019-06-25 07:47:43 +00:00
|
|
|
content = <SVG />;
|
|
|
|
break;
|
2020-11-02 05:56:35 +00:00
|
|
|
case 'PDF':
|
2019-06-25 07:47:43 +00:00
|
|
|
content = <PDF />;
|
|
|
|
break;
|
2020-11-02 05:56:35 +00:00
|
|
|
case 'Text':
|
2019-06-25 07:47:43 +00:00
|
|
|
content = <Text />;
|
|
|
|
break;
|
2020-11-02 05:56:35 +00:00
|
|
|
case 'Markdown':
|
2019-06-25 07:47:43 +00:00
|
|
|
content = <Markdown />;
|
|
|
|
break;
|
2020-11-02 05:56:35 +00:00
|
|
|
case 'Video':
|
2019-06-25 07:47:43 +00:00
|
|
|
content = <Video />;
|
|
|
|
break;
|
2020-11-02 05:56:35 +00:00
|
|
|
case 'Audio':
|
2019-06-25 07:47:43 +00:00
|
|
|
content = <Audio />;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
content = <FileViewTip err='File preview unsupported' />;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<FileView content={content} />
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-24 02:41:34 +00:00
|
|
|
const root = createRoot(document.getElementById('wrapper'));
|
|
|
|
root.render(<HistoryTrashFileView />);
|
|
|
|
|