mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 11:26:25 -05:00
Adding my public gpg key.
Moving upload destination input out of drop Segment. Disabling uploads when downloads are disabled. Inverting labels for checkboxes in inverted modal. Deleting file_groups which no longer contain the exclusive primary path. Adding debug logging for all API errors. Checking that upload output is not a directory. Expanding nginx request size. Adding docs to upload endpoint. Using dot-circle icon for more image mimetypes. Using Form.Field to make upload destination required. Adding border to inverted Segments. Many files can be uploaded in chunks. Files can be uploaded, progress is displayed. Showing white border around share QR code. Displaying WROLPi colors for download icons. Creating button to clear DirectorySearch. Excluding channel/domain directories so other directories can be returned. Ordering search results. Ignoring when no channel is found only if we have a destination. Limiting directory search results. Displaying categories when searching destination directories. Handling when live_chat.json file exists. Allowing refresh of directory directly. Logging which download was successful. Removing timeout. Creating index for directory names. Sleeping to catch cancel. Arbitrary files can be downloaded using the new FileDownloader.
This commit is contained in:
parent
83f9f6f085
commit
387282b445
45 changed files with 1665 additions and 356 deletions
|
|
@ -9,7 +9,6 @@ import {
|
|||
Dropdown,
|
||||
Image,
|
||||
Input,
|
||||
Modal,
|
||||
PlaceholderHeader,
|
||||
PlaceholderLine,
|
||||
TableCell,
|
||||
|
|
@ -19,7 +18,6 @@ import {
|
|||
BackButton,
|
||||
CardLink,
|
||||
cardTitleWrapper,
|
||||
defaultSearchOrder,
|
||||
encodeMediaPath,
|
||||
ExternalCardLink,
|
||||
FileIcon,
|
||||
|
|
@ -39,7 +37,7 @@ import {
|
|||
import {addTag, deleteArchives, postDownload, removeTag} from "../api";
|
||||
import {Link, Route, Routes, useNavigate, useParams} from "react-router-dom";
|
||||
import Message from "semantic-ui-react/dist/commonjs/collections/Message";
|
||||
import {useArchive, useDomains, useQuery, useSearchArchives, useSearchDomain} from "../hooks/customHooks";
|
||||
import {useArchive, useDomains, useSearchArchives, useSearchDomain} from "../hooks/customHooks";
|
||||
import {FileCards, FileRowTagIcon, FilesView} from "./Files";
|
||||
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
|
||||
import _ from "lodash";
|
||||
|
|
@ -304,21 +302,6 @@ export function DomainsPage() {
|
|||
export function SearchDomain() {
|
||||
// A Dropdown which allows the user to filter by Archive domains.
|
||||
const {domain, domains, setDomain} = useSearchDomain();
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
const handleOpen = (e) => {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
setOpen(true);
|
||||
}
|
||||
|
||||
const handleClose = (e) => {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
setOpen(false);
|
||||
}
|
||||
|
||||
const handleChange = (e, {value}) => {
|
||||
setDomain(value);
|
||||
|
|
@ -329,15 +312,6 @@ export function SearchDomain() {
|
|||
return {key: i['domain'], value: i['domain'], text: i['domain']}
|
||||
});
|
||||
return <>
|
||||
<Modal closeIcon
|
||||
open={open}
|
||||
onOpen={() => handleOpen()}
|
||||
onClose={() => handleClose()}
|
||||
>
|
||||
<Modal.Content>
|
||||
domains
|
||||
</Modal.Content>
|
||||
</Modal>
|
||||
<Dropdown selection search clearable fluid
|
||||
placeholder='Domains'
|
||||
options={domainOptions}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,36 @@
|
|||
import React, {useContext, useEffect, useState} from "react";
|
||||
import {Button as SButton, ButtonGroup, Card, Container, IconGroup, Input, Modal, Pagination} from 'semantic-ui-react';
|
||||
import {Button as SButton, ButtonGroup, Card, Container, IconGroup, Input, Pagination, Search} from 'semantic-ui-react';
|
||||
import {Link, NavLink, useNavigate} from "react-router-dom";
|
||||
import Message from "semantic-ui-react/dist/commonjs/collections/Message";
|
||||
import {useDirectories, useHotspot, useSearchOrder, useSettings, useThrottle} from "../hooks/customHooks";
|
||||
import {
|
||||
useDirectories,
|
||||
useHotspot,
|
||||
useSearchDirectories,
|
||||
useSearchOrder,
|
||||
useSettings,
|
||||
useThrottle
|
||||
} from "../hooks/customHooks";
|
||||
import {Media, StatusContext, ThemeContext} from "../contexts/contexts";
|
||||
import {Button, CardIcon, darkTheme, Form, Header, Icon, lightTheme, Menu, Popup, Statistic} from "./Theme";
|
||||
import {
|
||||
Button,
|
||||
CardIcon,
|
||||
darkTheme,
|
||||
Form,
|
||||
Header,
|
||||
Icon,
|
||||
lightTheme,
|
||||
Menu,
|
||||
Modal,
|
||||
ModalActions,
|
||||
ModalContent,
|
||||
ModalDescription, ModalHeader,
|
||||
Popup,
|
||||
Statistic
|
||||
} from "./Theme";
|
||||
import {FilePreviewContext} from "./FilePreview";
|
||||
import _ from "lodash";
|
||||
import {killDownloads, startDownloads} from "../api";
|
||||
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
|
||||
|
||||
export const API_URI = process.env && process.env.REACT_APP_API_URI ? process.env.REACT_APP_API_URI : `${window.location.protocol}//${window.location.host}/api`;
|
||||
export const VIDEOS_API = `${API_URI}/videos`;
|
||||
|
|
@ -697,54 +720,65 @@ export function isZipMimetype(mimetype) {
|
|||
return mimetype.startsWith('application/zip') || mimetype.startsWith('application/zlib') || mimetype.startsWith('application/x-7z-compressed') || mimetype.startsWith('application/x-bzip2') || mimetype.startsWith('application/x-xz') || mimetype.startsWith('application/gzip') || mimetype.startsWith('application/x-rar');
|
||||
}
|
||||
|
||||
export function mimetypeIconName(mimetype, lowerPath = '') {
|
||||
if (mimetype) {
|
||||
if (mimetype.startsWith('text/html') || mimetype.startsWith('application/json') || mimetype.startsWith('text/yaml') || mimetype.startsWith('text/xml')) {
|
||||
return 'file code';
|
||||
} else if (mimetype.startsWith('application/pdf')) {
|
||||
return 'file pdf';
|
||||
} else if (mimetype.startsWith('text/plain')) {
|
||||
return 'file text';
|
||||
} else if (mimetype.startsWith('image/')) {
|
||||
return 'image';
|
||||
} else if (mimetype.startsWith('video/')) {
|
||||
return 'film';
|
||||
} else if (mimetype.startsWith('message/rfc822')) {
|
||||
return 'mail';
|
||||
} else if (isZipMimetype(mimetype)) {
|
||||
return 'file archive';
|
||||
} else if (mimetype.startsWith('application/x-iso9660-image') || mimetype.startsWith('application/x-raw-disk-image') || mimetype.startsWith('application/x-cd-image')) {
|
||||
return 'dot circle';
|
||||
} else if (mimetype.startsWith('application/epub') || mimetype.startsWith('application/x-mobipocket-ebook') || mimetype.startsWith('application/vnd.amazon.mobi8-ebook')) {
|
||||
return 'book';
|
||||
} else if (mimetype.startsWith('text/vtt') || mimetype.startsWith('text/srt')) {
|
||||
return 'closed captioning';
|
||||
} else if (mimetype.startsWith('application/x-openscad') || mimetype.startsWith('model/stl')) {
|
||||
return 'cube';
|
||||
} else if (mimetype.startsWith('application/x-dosexec') || mimetype.startsWith('application/x-msi')) {
|
||||
return 'microsoft';
|
||||
} else if (mimetype.startsWith('audio/')) {
|
||||
return 'file audio';
|
||||
} else if (mimetype.startsWith('application/vnd.openxmlformats-officedocument.wordprocessingml.document')) {
|
||||
return 'file word';
|
||||
} else if (mimetype.startsWith('application/x-x509-ca-cert')) {
|
||||
return 'certificate';
|
||||
} else if (mimetype.startsWith('application/octet-stream')) {
|
||||
if (lowerPath.endsWith('.mp3')) {
|
||||
return 'file audio';
|
||||
} else if (lowerPath.endsWith('.stl')) {
|
||||
return 'cube';
|
||||
} else if (lowerPath.endsWith('.blend')) {
|
||||
return 'cube';
|
||||
} else if (lowerPath.endsWith('.dmg')) {
|
||||
return 'apple';
|
||||
} else if (lowerPath.endsWith('.azw3')) {
|
||||
return 'book';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lowerPath.endsWith('.pem')) {
|
||||
return 'certificate';
|
||||
}
|
||||
return 'file';
|
||||
}
|
||||
|
||||
export function FileIcon({file, disabled = true, size = 'huge', ...props}) {
|
||||
// Default to a grey file icon.
|
||||
const {mimetype, path, primary_path} = file;
|
||||
// `file` may be a file_group or a file.
|
||||
const lowerPath = primary_path ? primary_path.toLocaleString() : path.toLowerCase();
|
||||
props['name'] = 'file';
|
||||
props['name'] = mimetypeIconName(mimetype, lowerPath);
|
||||
props['color'] = mimetypeColor(mimetype);
|
||||
if (mimetype) {
|
||||
if (mimetype.startsWith('text/html') || mimetype.startsWith('application/json') || mimetype.startsWith('text/yaml') || mimetype.startsWith('text/xml')) {
|
||||
props['name'] = 'file code';
|
||||
} else if (mimetype.startsWith('application/pdf')) {
|
||||
props['name'] = 'file pdf';
|
||||
} else if (mimetype.startsWith('text/plain')) {
|
||||
props['name'] = 'file text';
|
||||
} else if (mimetype.startsWith('image/')) {
|
||||
props['name'] = 'image';
|
||||
} else if (mimetype.startsWith('video/')) {
|
||||
props['name'] = 'film';
|
||||
} else if (mimetype.startsWith('message/rfc822')) {
|
||||
props['name'] = 'mail';
|
||||
} else if (isZipMimetype(mimetype)) {
|
||||
props['name'] = 'file archive';
|
||||
} else if (mimetype.startsWith('application/x-iso9660-image')) {
|
||||
props['name'] = 'dot circle';
|
||||
} else if (mimetype.startsWith('application/epub') || mimetype.startsWith('application/x-mobipocket-ebook') || mimetype.startsWith('application/vnd.amazon.mobi8-ebook')) {
|
||||
props['name'] = 'book';
|
||||
} else if (mimetype.startsWith('text/vtt') || mimetype.startsWith('text/srt')) {
|
||||
props['name'] = 'closed captioning';
|
||||
} else if (mimetype.startsWith('application/x-openscad') || mimetype.startsWith('model/stl')) {
|
||||
props['name'] = 'cube';
|
||||
} else if (mimetype.startsWith('application/x-dosexec') || mimetype.startsWith('application/x-msi')) {
|
||||
props['name'] = 'microsoft';
|
||||
} else if (mimetype.startsWith('audio/')) {
|
||||
props['name'] = 'file audio';
|
||||
} else if (mimetype.startsWith('application/octet-stream')) {
|
||||
if (lowerPath.endsWith('.mp3')) {
|
||||
props['name'] = 'file audio';
|
||||
} else if (lowerPath.endsWith('.stl')) {
|
||||
props['name'] = 'cube';
|
||||
} else if (lowerPath.endsWith('.blend')) {
|
||||
props['name'] = 'cube';
|
||||
} else if (lowerPath.endsWith('.dmg')) {
|
||||
props['name'] = 'apple';
|
||||
} else if (lowerPath.endsWith('.azw3')) {
|
||||
props['name'] = 'book';
|
||||
}
|
||||
}
|
||||
}
|
||||
return <Icon disabled={disabled} size={size} {...props}/>
|
||||
}
|
||||
|
||||
|
|
@ -792,14 +826,14 @@ export function UnsupportedModal(header, message, icon) {
|
|||
<Icon name={icon || 'exclamation triangle'}/>
|
||||
{header || 'Unsupported'}
|
||||
</Header>
|
||||
<Modal.Content>
|
||||
<Modal.Description>
|
||||
<ModalContent>
|
||||
<ModalDescription>
|
||||
{message}
|
||||
</Modal.Description>
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
</ModalDescription>
|
||||
</ModalContent>
|
||||
<ModalActions>
|
||||
<Button basic inverted onClick={onClose}>Ok</Button>
|
||||
</Modal.Actions>
|
||||
</ModalActions>
|
||||
</Modal>;
|
||||
|
||||
return {modal, doClose: onClose, doOpen: onOpen};
|
||||
|
|
@ -851,6 +885,99 @@ export function useTitle(title) {
|
|||
}, [title]);
|
||||
}
|
||||
|
||||
export function DirectorySearch({onSelect, value, ...props}) {
|
||||
const {
|
||||
directoryName,
|
||||
setDirectoryName,
|
||||
directories,
|
||||
channelDirectories,
|
||||
domainDirectories,
|
||||
loading,
|
||||
} = useSearchDirectories(value);
|
||||
const [results, setResults] = useState();
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
(directories && directories.length >= 0)
|
||||
|| (channelDirectories && channelDirectories.length >= 0)
|
||||
|| (domainDirectories && domainDirectories.length >= 0)) {
|
||||
setResults({
|
||||
directories: {
|
||||
name: 'Directories',
|
||||
results: directories.map(i => {
|
||||
return {title: i['path']}
|
||||
}),
|
||||
},
|
||||
channel_directories: {
|
||||
name: 'Channels',
|
||||
results: channelDirectories.map(i => {
|
||||
return {title: i['path'], description: i['name']};
|
||||
}),
|
||||
},
|
||||
domain_directories: {
|
||||
name: 'Domains',
|
||||
results: domainDirectories.map(i => {
|
||||
return {title: i['path'], description: i['domain']};
|
||||
}),
|
||||
}
|
||||
});
|
||||
}
|
||||
}, [
|
||||
JSON.stringify(directories),
|
||||
JSON.stringify(channelDirectories),
|
||||
JSON.stringify(domainDirectories),
|
||||
loading,
|
||||
]);
|
||||
|
||||
const handleSearchChange = (e, data) => {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
if (onSelect) {
|
||||
onSelect('');
|
||||
}
|
||||
setDirectoryName(data.value);
|
||||
}
|
||||
|
||||
const handleResultSelect = (e, data) => {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
// title is the relative path.
|
||||
if (onSelect) {
|
||||
onSelect(data.result.title);
|
||||
}
|
||||
setDirectoryName(data.result.title);
|
||||
}
|
||||
|
||||
const handleClear = (e) => {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
onSelect('');
|
||||
setDirectoryName('');
|
||||
}
|
||||
|
||||
return <Grid>
|
||||
<Grid.Row>
|
||||
<Grid.Column mobile={13} tablet={14} computer={15}>
|
||||
<Search category
|
||||
placeholder='Search directory names...'
|
||||
onSearchChange={handleSearchChange}
|
||||
onResultSelect={handleResultSelect}
|
||||
loading={loading}
|
||||
value={directoryName}
|
||||
results={results}
|
||||
{...props}
|
||||
/>
|
||||
</Grid.Column>
|
||||
<Grid.Column mobile={3} tablet={2} computer={1}>
|
||||
<Button secondary icon='close' onClick={handleClear}/>
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
</Grid>
|
||||
}
|
||||
|
||||
export function DirectoryInput({disabled, error, placeholder, setInput, value, required, isDirectory}) {
|
||||
const {directory, directories, setDirectory, isDir} = useDirectories(value);
|
||||
const {settings} = useSettings();
|
||||
|
|
@ -1009,7 +1136,7 @@ export function SortButton({sorts = []}) {
|
|||
let sortFields;
|
||||
if (sorts && sorts.length) {
|
||||
sortFields = sorts.map((i) => {
|
||||
return <SButton key={i['value']} onClick={() => handleSortButton(i['value'])}>{i['text']}</SButton>
|
||||
return <Button key={i['value']} onClick={() => handleSortButton(i['value'])}>{i['text']}</Button>
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -1018,10 +1145,10 @@ export function SortButton({sorts = []}) {
|
|||
open={open}
|
||||
onClose={() => setOpen(false)}
|
||||
>
|
||||
<Modal.Header>Sort By</Modal.Header>
|
||||
<Modal.Content>
|
||||
<ModalHeader>Sort By</ModalHeader>
|
||||
<ModalContent>
|
||||
{sortFields}
|
||||
</Modal.Content>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
<ButtonGroup icon>
|
||||
<Button icon={desc ? 'sort down' : 'sort up'} onClick={() => toggleDesc()}/>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React, {useState} from "react";
|
||||
import {PageContainer, useTitle} from "./Common";
|
||||
import {Button, Header, Segment, Table} from "./Theme";
|
||||
import {Icon, Modal, TableBody, TableCell, TableRow} from "semantic-ui-react";
|
||||
import {Button, Header, Modal, ModalContent, ModalHeader, Segment, Table} from "./Theme";
|
||||
import {Icon, TableBody, TableCell, TableRow} from "semantic-ui-react";
|
||||
import QRCode from "react-qr-code";
|
||||
|
||||
const bitcoinAddress = '1mi1ddLSd6LmkuwJd1ttZsKuED724vYjS';
|
||||
|
|
@ -26,10 +26,12 @@ function CoinQRButton({qrCodeValue, header, buttonColor}) {
|
|||
onClose={() => setOpen(false)}
|
||||
onOpen={() => setOpen(true)}
|
||||
>
|
||||
<Modal.Header>{header}</Modal.Header>
|
||||
<Modal.Content>
|
||||
<QRCode value={qrCodeValue} size={300}/>
|
||||
</Modal.Content>
|
||||
<ModalHeader>{header}</ModalHeader>
|
||||
<ModalContent>
|
||||
<div style={{backgroundColor: '#FFFFFF', display: 'inline-block', padding: '1em'}}>
|
||||
<QRCode value={qrCodeValue} size={300}/>
|
||||
</div>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
</>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
import React, {useContext, useState} from "react";
|
||||
import {getDownloaders, postDownload} from "../api";
|
||||
import {DirectoryInput, frequencyOptions, HelpPopup, rssFrequencyOptions, WROLModeMessage} from "./Common";
|
||||
import {DirectorySearch, frequencyOptions, HelpPopup, rssFrequencyOptions, WROLModeMessage} from "./Common";
|
||||
import Icon from "semantic-ui-react/dist/commonjs/elements/Icon";
|
||||
import Message from "semantic-ui-react/dist/commonjs/collections/Message";
|
||||
import {ThemeContext} from "../contexts/contexts";
|
||||
import {Accordion, Button, Form, FormField, FormGroup, FormInput, Header, Loader, Segment, TextArea} from "./Theme";
|
||||
import {AccordionContent, AccordionTitle, FormDropdown} from "semantic-ui-react";
|
||||
import {Accordion, Button, Form, FormInput, Header, Loader, TextArea} from "./Theme";
|
||||
import {AccordionContent, AccordionTitle, Form as SForm, FormDropdown} from "semantic-ui-react";
|
||||
import {Link} from "react-router-dom";
|
||||
import {TagsSelector} from "../Tags";
|
||||
import {toast} from "react-semantic-toasts-2";
|
||||
|
||||
const validUrl = /^(http|https):\/\/[^ "]+$/;
|
||||
|
||||
|
|
@ -24,6 +25,7 @@ class Downloader extends React.Component {
|
|||
tagNames: [],
|
||||
urls: '',
|
||||
valid: true,
|
||||
destinationRequired: props.destinationRequired !== undefined ? props.destinationRequired : false,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -35,6 +37,8 @@ class Downloader extends React.Component {
|
|||
let response = await postDownload(urls, downloader, null, null, null, destination, tagNames);
|
||||
if (response.status === 204) {
|
||||
this.setState({urls: '', pending: false, submitted: true});
|
||||
} else {
|
||||
toast({type: 'error', title: 'Error', description: 'Failed to create download!'});
|
||||
}
|
||||
} finally {
|
||||
this.setState({pending: false});
|
||||
|
|
@ -46,10 +50,6 @@ class Downloader extends React.Component {
|
|||
this.setState({[name]: value}, this.validateUrls);
|
||||
}
|
||||
|
||||
handleDestinationChange = (value) => {
|
||||
this.setState({destination: value});
|
||||
}
|
||||
|
||||
validateUrls = async () => {
|
||||
// Validate that all URLs in state are valid.
|
||||
if (this.state.urls) {
|
||||
|
|
@ -84,23 +84,31 @@ class Downloader extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let disabled = !this.state.urls || !this.state.valid || this.state.pending || !this.state.downloader;
|
||||
const {advancedOpen, destination, submitted, tagNames} = this.state;
|
||||
const {header, withDestination, withTags} = this.props;
|
||||
const {
|
||||
advancedOpen,
|
||||
submitted,
|
||||
tagNames,
|
||||
urls,
|
||||
valid,
|
||||
pending,
|
||||
downloader,
|
||||
destination,
|
||||
destinationRequired
|
||||
} = this.state;
|
||||
let disabled = !urls || !valid || pending || !downloader;
|
||||
const {header, withTags, withSearchDirectory} = this.props;
|
||||
|
||||
let destinationField;
|
||||
if (withDestination) {
|
||||
destinationField = <FormGroup>
|
||||
<FormField width={16}>
|
||||
let directorySearch;
|
||||
if (withSearchDirectory) {
|
||||
directorySearch = <div style={{marginTop: '1em'}}>
|
||||
<SForm.Field required={destinationRequired}>
|
||||
<label>Destination</label>
|
||||
<DirectoryInput
|
||||
isDirectory={true}
|
||||
value={destination}
|
||||
setInput={this.handleDestinationChange}
|
||||
placeholder='download/into/custom/directory'
|
||||
/>
|
||||
</FormField>
|
||||
</FormGroup>;
|
||||
<DirectorySearch onSelect={i => this.setState({destination: i})}/>
|
||||
</SForm.Field>
|
||||
</div>;
|
||||
}
|
||||
if (destinationRequired) {
|
||||
disabled = !destination || disabled;
|
||||
}
|
||||
|
||||
let tagsSelector;
|
||||
|
|
@ -109,15 +117,12 @@ class Downloader extends React.Component {
|
|||
}
|
||||
|
||||
const advancedAccordion = <Accordion>
|
||||
<AccordionTitle onClick={() => this.setState({advancedOpen: !advancedOpen})}>
|
||||
<Icon name='dropdown'/>Advanced
|
||||
<AccordionTitle active={advancedOpen} onClick={() => this.setState({advancedOpen: !advancedOpen})}>
|
||||
<Icon name='dropdown'/>
|
||||
Advanced
|
||||
</AccordionTitle>
|
||||
<AccordionContent active={advancedOpen}>
|
||||
<Segment>
|
||||
{destinationField}
|
||||
{withDestination && withTags && <br/>}
|
||||
{tagsSelector}
|
||||
</Segment>
|
||||
{directorySearch}
|
||||
</AccordionContent>
|
||||
</Accordion>;
|
||||
|
||||
|
|
@ -132,8 +137,14 @@ class Downloader extends React.Component {
|
|||
name='urls'
|
||||
onChange={this.handleInputChange}
|
||||
value={this.state.urls}
|
||||
style={{marginBottom: '1em'}}
|
||||
/>
|
||||
{(withDestination || withTags) && advancedAccordion}
|
||||
{tagsSelector}
|
||||
{pending && <Loader active={pending}/>}
|
||||
|
||||
{/* Display DirectorySearch if its required, show it in an Accordion if it's not required */}
|
||||
{withSearchDirectory ? destinationRequired ? directorySearch : advancedAccordion : null}
|
||||
|
||||
<Button content='Cancel' onClick={this.props.clearSelected}/>
|
||||
<Button primary style={{marginTop: '1em'}} disabled={disabled}>Download</Button>
|
||||
{submitted && viewDownloads}
|
||||
|
|
@ -195,7 +206,7 @@ class ChannelDownload extends React.Component {
|
|||
|
||||
return <Form>
|
||||
<WROLModeMessage content='Downloading is disabled while WROL Mode is enabled'/>
|
||||
<Header as='h4'><Icon name='film'/> Channel / Playlist</Header>
|
||||
<Header as='h4'><Icon name='film' color='blue'/> Channel / Playlist</Header>
|
||||
<FormInput
|
||||
required
|
||||
label='URL'
|
||||
|
|
@ -225,7 +236,7 @@ class ChannelDownload extends React.Component {
|
|||
onClick={this.handleSubmit}
|
||||
disabled={buttonDisabled}
|
||||
/>
|
||||
<Loader active={pending}/>
|
||||
{pending && <Loader active={pending}/>}
|
||||
{success && <Icon name='check'/>}
|
||||
</Form>
|
||||
}
|
||||
|
|
@ -318,7 +329,7 @@ class RSSDownload extends ChannelDownload {
|
|||
|
||||
return <Form>
|
||||
<WROLModeMessage content='Downloading is disabled while WROL Mode is enabled'/>
|
||||
<Header as='h4'><Icon name='rss'/> RSS Feed</Header>
|
||||
<Header as='h4'><Icon name='rss' color='orange'/> RSS Feed</Header>
|
||||
<FormInput
|
||||
required
|
||||
label='URL'
|
||||
|
|
@ -373,7 +384,7 @@ class RSSDownload extends ChannelDownload {
|
|||
onClick={this.handleSubmit}
|
||||
disabled={buttonDisabled}
|
||||
/>
|
||||
<Loader active={pending}/>
|
||||
{pending && <Loader active={pending}/>}
|
||||
{success && <Icon name='check'/>}
|
||||
</Form>
|
||||
}
|
||||
|
|
@ -397,7 +408,7 @@ export function DownloadMenu({onOpen, disabled}) {
|
|||
/>
|
||||
<Button
|
||||
color='green'
|
||||
content='Archive'
|
||||
content='Archives'
|
||||
disabled={disabled}
|
||||
onClick={() => localOnOpen('archive')}
|
||||
style={{marginBottom: '1em'}}
|
||||
|
|
@ -415,6 +426,13 @@ export function DownloadMenu({onOpen, disabled}) {
|
|||
onClick={() => localOnOpen('rss')}
|
||||
style={{marginBottom: '1em'}}
|
||||
/>
|
||||
<Button
|
||||
color='black'
|
||||
content='File'
|
||||
disabled={disabled}
|
||||
onClick={() => localOnOpen('file')}
|
||||
style={{marginBottom: '1em'}}
|
||||
/>
|
||||
</>);
|
||||
|
||||
function clearSelected() {
|
||||
|
|
@ -425,25 +443,29 @@ export function DownloadMenu({onOpen, disabled}) {
|
|||
const downloaders = {
|
||||
archive: <Downloader
|
||||
clearSelected={clearSelected}
|
||||
header={<><Icon name='file alternate'/> Archive</>}
|
||||
header={<><Icon name='file alternate' color='green'/> Archives</>}
|
||||
downloader='archive'
|
||||
withTags={true}/>,
|
||||
video: <Downloader
|
||||
clearSelected={clearSelected}
|
||||
header={<><Icon name='film'/> Videos</>}
|
||||
header={<><Icon name='film' color='blue'/> Videos</>}
|
||||
downloader='video'
|
||||
withDestination={true}
|
||||
withSearchDirectory={true}
|
||||
withTags={true}/>,
|
||||
video_channel: <ChannelDownload clearSelected={clearSelected}/>,
|
||||
rss: <RSSDownload
|
||||
rss: <RSSDownload clearSelected={clearSelected}/>,
|
||||
file: <Downloader
|
||||
clearSelected={clearSelected}
|
||||
header={<><Icon name='rss square'/> RSS</>}/>,
|
||||
header={<><Icon name='file'/> Files</>}
|
||||
downloader='file'
|
||||
withSearchDirectory={true}
|
||||
destinationRequired={true}
|
||||
withTags={true}/>,
|
||||
};
|
||||
|
||||
body = downloader in downloaders ? downloaders[downloader] : body;
|
||||
|
||||
return <>
|
||||
<Header as='h2'>Download</Header>
|
||||
{body}
|
||||
</>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,16 @@
|
|||
import React from "react";
|
||||
import _ from "lodash";
|
||||
import {
|
||||
Button as SButton,
|
||||
Grid,
|
||||
Header as SHeader,
|
||||
Image,
|
||||
Modal,
|
||||
ModalActions,
|
||||
ModalContent,
|
||||
ModalHeader
|
||||
} from "semantic-ui-react";
|
||||
import {TagsSelector} from "../Tags";
|
||||
import {Media} from "../contexts/contexts";
|
||||
import {encodeMediaPath} from "./Common";
|
||||
import {addTag, fetchFile, removeTag} from "../api";
|
||||
import {StlViewer} from "react-stl-viewer";
|
||||
import {Button, Modal, ModalActions, ModalContent, ModalHeader} from "./Theme";
|
||||
|
||||
function getMediaPathURL(previewFile) {
|
||||
if (previewFile['primary_path']) {
|
||||
|
|
@ -47,6 +43,8 @@ function getIframeModal(previewFile) {
|
|||
<iframe title='textModal' src={url}
|
||||
style={{
|
||||
height: '100%', width: '100%', border: 'none', position: 'absolute', top: 0,
|
||||
// Use white to avoid iframe displaying with dark-theme.
|
||||
backgroundColor: '#ffffff',
|
||||
}}/>
|
||||
</div>
|
||||
</ModalContent>
|
||||
|
|
@ -201,16 +199,16 @@ export function FilePreviewWrapper({children}) {
|
|||
function setModalContent(content, url, downloadURL) {
|
||||
let openButton;
|
||||
if (url) {
|
||||
openButton = <SButton color='blue' as='a' href={url}>Open</SButton>;
|
||||
openButton = <Button color='blue' as='a' href={url}>Open</Button>;
|
||||
}
|
||||
const closeButton = <SButton onClick={handleClose}>Close</SButton>;
|
||||
const closeButton = <Button onClick={handleClose}>Close</Button>;
|
||||
const tagsDisplay = <TagsSelector selectedTagNames={previewFile['tags']} onAdd={localAddTag}
|
||||
onRemove={localRemoveTag}/>;
|
||||
let downloadButton;
|
||||
if (downloadURL) {
|
||||
downloadButton = <SButton color='yellow' as='a' href={downloadURL} floated='left'>
|
||||
downloadButton = <Button color='yellow' as='a' href={downloadURL} floated='left'>
|
||||
Download
|
||||
</SButton>;
|
||||
</Button>;
|
||||
}
|
||||
|
||||
setPreviewModal(<Modal closeIcon
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import React, {useContext, useState} from "react";
|
||||
import {
|
||||
Button as SButton,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
|
|
@ -11,7 +10,6 @@ import {
|
|||
Form,
|
||||
Image,
|
||||
Label,
|
||||
Modal,
|
||||
PlaceholderLine,
|
||||
TableCell,
|
||||
TableHeaderCell,
|
||||
|
|
@ -46,7 +44,19 @@ import {CardPlacholder} from "./Placeholder";
|
|||
import {ArchiveCard, ArchiveRowCells} from "./Archive";
|
||||
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
|
||||
import {Media, StatusContext, ThemeContext} from "../contexts/contexts";
|
||||
import {Button, Card, CardIcon, Icon, Placeholder, Progress, Segment} from "./Theme";
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
CardIcon,
|
||||
Icon,
|
||||
Modal,
|
||||
ModalActions,
|
||||
ModalContent,
|
||||
ModalHeader,
|
||||
Placeholder,
|
||||
Progress,
|
||||
Segment
|
||||
} from "./Theme";
|
||||
import {SelectableTable} from "./Tables";
|
||||
import {VideoCard, VideoRowCells} from "./Videos";
|
||||
import _ from 'lodash';
|
||||
|
|
@ -395,16 +405,16 @@ export function SearchFilter({filters = [], modalHeader}) {
|
|||
if (filters && filters.length > 0) {
|
||||
return <>
|
||||
<Modal open={open} onOpen={() => handleOpen()} onClose={() => setOpen(false)} closeIcon>
|
||||
{modalHeader || <Modal.Header>Filter</Modal.Header>}
|
||||
<Modal.Content>
|
||||
{modalHeader || <ModalHeader>Filter</ModalHeader>}
|
||||
<ModalContent>
|
||||
<Form>
|
||||
{filterFields}
|
||||
</Form>
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
<SButton onClick={handleClear} secondary>Clear</SButton>
|
||||
<SButton onClick={() => setOpen(false)}>Close</SButton>
|
||||
</Modal.Actions>
|
||||
</ModalContent>
|
||||
<ModalActions>
|
||||
<Button onClick={handleClear} secondary>Clear</Button>
|
||||
<Button onClick={() => setOpen(false)}>Close</Button>
|
||||
</ModalActions>
|
||||
</Modal>
|
||||
<Button
|
||||
icon='filter'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import {CardIcon, Header, Placeholder, Segment} from "./Theme";
|
||||
import {PlaceholderLine, Item, Image} from "semantic-ui-react";
|
||||
import {Placeholder, Segment} from "./Theme";
|
||||
import {Image, PlaceholderLine} from "semantic-ui-react";
|
||||
import React from "react";
|
||||
import {ThemeContext} from "../contexts/contexts";
|
||||
import {encodeMediaPath, FileIcon, findPosterPath, PreviewLink} from "./Common";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from "react";
|
||||
import {Icon} from "./Theme";
|
||||
import {Button as SButton, Header, IconGroup, Modal} from "semantic-ui-react";
|
||||
import {Button, Header, Icon, Modal, ModalActions, ModalContent, ModalHeader} from "./Theme";
|
||||
import {IconGroup} from "semantic-ui-react";
|
||||
import QRCode from "react-qr-code";
|
||||
import {sendNotification} from "../api";
|
||||
|
||||
|
|
@ -12,13 +12,13 @@ export const ShareEveryoneButton = ({url, size, onClick}) => {
|
|||
}
|
||||
}
|
||||
|
||||
return <SButton
|
||||
return <Button
|
||||
color='violet'
|
||||
size={size}
|
||||
onClick={handleShare}
|
||||
>
|
||||
Share with everyone
|
||||
</SButton>
|
||||
</Button>
|
||||
}
|
||||
|
||||
export const ShareButton = () => {
|
||||
|
|
@ -43,15 +43,17 @@ export const ShareButton = () => {
|
|||
open={open}
|
||||
onClose={handleClose}
|
||||
>
|
||||
<Modal.Header>Share this page</Modal.Header>
|
||||
<Modal.Content>
|
||||
<ModalHeader>Share this page</ModalHeader>
|
||||
<ModalContent>
|
||||
<Header as='h4'>Another user can scan this QR code to view this page</Header>
|
||||
<QRCode value={window.location.href}/>
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
<div style={{padding: '1em', backgroundColor: '#ffffff', display: "inline-block"}}>
|
||||
<QRCode value={window.location.href}/>
|
||||
</div>
|
||||
</ModalContent>
|
||||
<ModalActions>
|
||||
<ShareEveryoneButton url={window.location.href} onClick={handleClose}/>
|
||||
<SButton onClick={handleClose}>Close</SButton>
|
||||
</Modal.Actions>
|
||||
<Button onClick={handleClose}>Close</Button>
|
||||
</ModalActions>
|
||||
</Modal>
|
||||
<a href='#' onClick={handleOpen}>
|
||||
<IconGroup size='large'>
|
||||
|
|
|
|||
|
|
@ -1,27 +1,33 @@
|
|||
import React, {useContext, useEffect, useState} from 'react';
|
||||
import {ThemeContext} from "../contexts/contexts";
|
||||
import {
|
||||
Accordion as ACCORDION,
|
||||
Button as BUTTON,
|
||||
Card as CARD,
|
||||
Form as FORM,
|
||||
FormField as FORM_FIELD,
|
||||
FormGroup as FORM_GROUP,
|
||||
FormInput as FORM_INPUT,
|
||||
Header as HEADER,
|
||||
Icon as ICON,
|
||||
Loader as LOADER,
|
||||
Menu as MENU,
|
||||
Placeholder as PLACEHOLDER,
|
||||
Popup as POPUP,
|
||||
Progress as PROGRESS,
|
||||
Segment as SEGMENT,
|
||||
Statistic as STATISTIC,
|
||||
StatisticGroup as STATISTIC_GROUP,
|
||||
Tab as TAB,
|
||||
Table as TABLE,
|
||||
TabPane as TAB_PANE,
|
||||
TextArea as TEXTAREA
|
||||
Accordion as SAccordion,
|
||||
Button as SButton,
|
||||
Card as SCard,
|
||||
Divider as SDivider,
|
||||
Form as SForm,
|
||||
FormField as SFormField,
|
||||
FormGroup as SFormGroup,
|
||||
FormInput as SFormInput,
|
||||
Header as SHeader,
|
||||
Icon as SIcon,
|
||||
Loader as SLoader,
|
||||
Menu as SMenu,
|
||||
Modal as SModal,
|
||||
ModalActions as SModalActions,
|
||||
ModalContent as SModalContent,
|
||||
ModalDescription as SModalDescription,
|
||||
ModalHeader as SModalHeader,
|
||||
Placeholder as SPlaceholder,
|
||||
Popup as SPopup,
|
||||
Progress as SProgress,
|
||||
Segment as SSegment,
|
||||
Statistic as SStatistic,
|
||||
StatisticGroup as SStatisticGroup,
|
||||
Tab as STab,
|
||||
Table as STable,
|
||||
TabPane as STabPane,
|
||||
TextArea as STextArea
|
||||
} from "semantic-ui-react";
|
||||
import {ColorToSemanticHexColor} from "./Common";
|
||||
import _ from "lodash";
|
||||
|
|
@ -56,7 +62,7 @@ export function ThemeWrapper({children, ...props}) {
|
|||
console.debug('setDarkTheme');
|
||||
setI({inverted: true});
|
||||
setS({style: {backgroundColor: '#1B1C1D', color: '#dddddd'}});
|
||||
setT({style: {color: '#dddddd'}});
|
||||
setT({style: {color: '#eeeeee'}});
|
||||
setInverted('inverted');
|
||||
setTheme(darkTheme);
|
||||
document.body.style.background = '#171616';
|
||||
|
|
@ -161,125 +167,158 @@ const defaultGrey = (props, inverted) => {
|
|||
return props;
|
||||
}
|
||||
|
||||
export function Button(props) {
|
||||
const {i, inverted} = useContext(ThemeContext);
|
||||
props = defaultGrey({...i, ...props}, inverted);
|
||||
return <BUTTON {...props}/>
|
||||
}
|
||||
|
||||
export function Accordion(props) {
|
||||
const {i, inverted} = useContext(ThemeContext);
|
||||
props = defaultGrey({...i, ...props}, inverted);
|
||||
return <ACCORDION {...props}/>
|
||||
return <SAccordion {...props}/>
|
||||
}
|
||||
|
||||
export function Button(props) {
|
||||
const {i, inverted} = useContext(ThemeContext);
|
||||
props = defaultGrey({...i, ...props}, inverted);
|
||||
return <SButton {...props}/>
|
||||
}
|
||||
|
||||
export function Divider({...props}) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
return <SDivider {...props}/>
|
||||
}
|
||||
|
||||
export function Header(props) {
|
||||
const {i, inverted} = useContext(ThemeContext);
|
||||
props = defaultGrey({...i, ...props}, inverted);
|
||||
return <HEADER {...props}/>
|
||||
const {t, inverted} = useContext(ThemeContext);
|
||||
props = defaultGrey({...t, ...props}, inverted);
|
||||
return <SHeader {...props}/>
|
||||
}
|
||||
|
||||
export function Form(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
return <FORM {...props}/>
|
||||
return <SForm {...props}/>
|
||||
}
|
||||
|
||||
export function FormField(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = invertedNull({...i, ...props});
|
||||
return <FORM_FIELD {...props}/>
|
||||
return <SFormField {...props}/>
|
||||
}
|
||||
|
||||
export function FormGroup(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = invertedNull({...i, ...props});
|
||||
return <FORM_GROUP {...props}/>
|
||||
return <SFormGroup {...props}/>
|
||||
}
|
||||
|
||||
export function FormInput(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
return <FORM_INPUT {...props}/>
|
||||
return <SFormInput {...props}/>
|
||||
}
|
||||
|
||||
export function Icon(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
return <ICON {...props}/>
|
||||
return <SIcon {...props}/>
|
||||
}
|
||||
|
||||
export function Loader(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
return <LOADER {...props}/>
|
||||
return <SLoader {...props}/>
|
||||
}
|
||||
|
||||
export function Menu(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
return <MENU {...props}/>
|
||||
return <SMenu {...props}/>
|
||||
}
|
||||
|
||||
export function Modal({...props}) {
|
||||
const {inverted} = useContext(ThemeContext);
|
||||
return <SModal {...props} className={`${inverted}`}/>
|
||||
}
|
||||
|
||||
export function ModalActions({...props}) {
|
||||
const {inverted} = useContext(ThemeContext);
|
||||
return <SModalActions {...props} className={`${inverted}`}/>
|
||||
}
|
||||
|
||||
export function ModalContent({...props}) {
|
||||
const {inverted} = useContext(ThemeContext);
|
||||
return <SModalContent {...props} className={`${inverted}`}/>
|
||||
}
|
||||
|
||||
export function ModalDescription({...props}) {
|
||||
const {inverted} = useContext(ThemeContext);
|
||||
return <SModalDescription {...props} className={`${inverted}`}/>
|
||||
}
|
||||
|
||||
export function ModalHeader({...props}) {
|
||||
const {inverted} = useContext(ThemeContext);
|
||||
return <SModalHeader {...props} className={`${inverted}`}>
|
||||
{props.children}
|
||||
</SModalHeader>
|
||||
}
|
||||
|
||||
export function Placeholder(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
return <PLACEHOLDER {...props}/>
|
||||
return <SPlaceholder {...props}/>
|
||||
}
|
||||
|
||||
export function Popup(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
return <POPUP {...props}/>
|
||||
return <SPopup {...props}/>
|
||||
}
|
||||
|
||||
export function Progress(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
return <PROGRESS {...props}/>
|
||||
return <SProgress {...props}/>
|
||||
}
|
||||
|
||||
export function Segment(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
return <SEGMENT {...props}/>
|
||||
return <SSegment {...props}/>
|
||||
}
|
||||
|
||||
export function Statistic(props) {
|
||||
const {i, inverted} = useContext(ThemeContext);
|
||||
props = defaultGrey({...i, ...props}, inverted);
|
||||
return <STATISTIC {...props}/>
|
||||
return <SStatistic {...props}/>
|
||||
}
|
||||
|
||||
export function StatisticGroup(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
props['style'] = {...props['style'], marginLeft: 0, marginRight: 0};
|
||||
return <STATISTIC_GROUP {...props}/>
|
||||
return <SStatisticGroup {...props}/>
|
||||
}
|
||||
|
||||
export function Tab(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = invertedNull({...i, ...props});
|
||||
return <TAB {...props}/>
|
||||
return <STab {...props}/>
|
||||
}
|
||||
|
||||
export function TabPane(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
return <TAB_PANE {...props}/>
|
||||
return <STabPane {...props}/>
|
||||
}
|
||||
|
||||
export function Table(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = {...i, ...props};
|
||||
return <TABLE {...props}/>
|
||||
return <STable {...props}/>
|
||||
}
|
||||
|
||||
export function TextArea(props) {
|
||||
const {i} = useContext(ThemeContext);
|
||||
props = invertedNull({...i, ...props});
|
||||
return <TEXTAREA {...props}/>
|
||||
return <STextArea {...props}/>
|
||||
}
|
||||
|
||||
export function CardIcon({onClick, ...props}) {
|
||||
|
|
@ -304,5 +343,5 @@ export function Card({color, ...props}) {
|
|||
const borderColor = inverted ? '#888' : '#ddd';
|
||||
props['style']['boxShadow'] = `0 0 0 2px ${borderColor}, 0 5px 0 0 ${emphasisColor}, 0 0px 3px 0 #d4d4d5`;
|
||||
}
|
||||
return <CARD {...props}/>
|
||||
return <SCard {...props}/>
|
||||
}
|
||||
|
|
|
|||
110
app/src/components/Upload.js
Normal file
110
app/src/components/Upload.js
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
import React from "react";
|
||||
import {useDropzone} from "react-dropzone";
|
||||
import {Form, Header, Icon, Progress, Segment} from "./Theme";
|
||||
import {DirectorySearch, mimetypeIconName} from "./Common";
|
||||
import {useUploadFile} from "../hooks/customHooks";
|
||||
import _ from "lodash";
|
||||
import {ThemeContext} from "../contexts/contexts";
|
||||
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
|
||||
import {Form as SForm} from "semantic-ui-react";
|
||||
|
||||
export function Upload({disabled}) {
|
||||
const {setFiles, progresses, destination, setDestination, doClear} = useUploadFile();
|
||||
const {t} = React.useContext(ThemeContext);
|
||||
|
||||
const onDrop = React.useCallback(async (acceptedFiles) => {
|
||||
if (acceptedFiles && acceptedFiles.length > 0) {
|
||||
setFiles(acceptedFiles);
|
||||
}
|
||||
}, [destination]);
|
||||
|
||||
const {getRootProps, getInputProps} = useDropzone({onDrop});
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!destination) {
|
||||
// Destination was cleared, clear progresses.
|
||||
doClear();
|
||||
}
|
||||
}, [destination]);
|
||||
|
||||
const handleDestination = (value) => {
|
||||
setDestination(value);
|
||||
}
|
||||
|
||||
let progressBars;
|
||||
if (!_.isEmpty(progresses)) {
|
||||
progressBars = Object.entries(progresses).map(([name, value]) => {
|
||||
const {percent, status, type} = value;
|
||||
let color = 'grey';
|
||||
let statusString;
|
||||
if (status === 'complete') {
|
||||
color = 'green';
|
||||
statusString = 'Complete:';
|
||||
} else if (status === 'pending') {
|
||||
statusString = 'Pending:';
|
||||
} else if (status === 'failed') {
|
||||
color = 'red';
|
||||
statusString = 'Failed:';
|
||||
} else if (status === 'conflicting') {
|
||||
color = 'orange';
|
||||
statusString = 'Already Exists:';
|
||||
}
|
||||
// Only indicating when upload is pending.
|
||||
let indicating = status === 'pending';
|
||||
|
||||
return <Grid.Row key={name}>
|
||||
<Grid.Column mobile={3} tablet={2} computer={1}>
|
||||
<Icon name={mimetypeIconName(type, name.toLowerCase())} size='big'/>
|
||||
</Grid.Column>
|
||||
<Grid.Column mobile={13} tablet={14} computer={15}>
|
||||
<Progress progress indicating={indicating} percent={percent} color={color}>
|
||||
<p {...t}>{statusString} {name}</p>
|
||||
</Progress>
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
})
|
||||
}
|
||||
|
||||
return <>
|
||||
<Form>
|
||||
<SForm.Field required>
|
||||
<label>Destination</label>
|
||||
<DirectorySearch onSelect={handleDestination} disabled={disabled}/>
|
||||
</SForm.Field>
|
||||
</Form>
|
||||
|
||||
{destination ?
|
||||
<Segment>
|
||||
<Grid columns={1}>
|
||||
<Grid.Row>
|
||||
<Grid.Column style={{padding: '1em'}}>
|
||||
<Form onSubmit={() => {
|
||||
}}>
|
||||
<div {...getRootProps()}>
|
||||
<input {...getInputProps()}/>
|
||||
<Grid textAlign='center'>
|
||||
<Grid.Row>
|
||||
<Grid.Column>
|
||||
<Header icon>
|
||||
<Icon name='file text'/>
|
||||
Click here, or drop files here to upload
|
||||
</Header>
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
</Grid>
|
||||
</div>
|
||||
</Form>
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
</Grid>
|
||||
</Segment>
|
||||
: <Header as='h3'>You must search for a directory to place your files</Header>
|
||||
}
|
||||
|
||||
<br/>
|
||||
|
||||
<Grid columns={2}>
|
||||
{progressBars}
|
||||
</Grid>
|
||||
</>
|
||||
}
|
||||
|
|
@ -13,7 +13,6 @@ import {
|
|||
Button as SButton,
|
||||
Confirm,
|
||||
Loader,
|
||||
Modal,
|
||||
PlaceholderLine,
|
||||
TableBody,
|
||||
TableCell,
|
||||
|
|
@ -21,7 +20,7 @@ import {
|
|||
TableHeaderCell,
|
||||
TableRow
|
||||
} from "semantic-ui-react";
|
||||
import {Button, Header, Placeholder, Segment, Table} from "../Theme";
|
||||
import {Button, Header, Modal, ModalActions, ModalContent, ModalHeader, Placeholder, Segment, Table} from "../Theme";
|
||||
import {useDownloads} from "../../hooks/customHooks";
|
||||
import _ from "lodash";
|
||||
|
||||
|
|
@ -135,13 +134,13 @@ class DownloadRow extends React.Component {
|
|||
open={errorModalOpen}
|
||||
trigger={<Button icon='exclamation circle' color='orange'/>}
|
||||
>
|
||||
<Modal.Header>Download Error</Modal.Header>
|
||||
<Modal.Content>
|
||||
<ModalHeader>Download Error</ModalHeader>
|
||||
<ModalContent>
|
||||
<pre style={{overflowX: 'scroll'}}>{error}</pre>
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
</ModalContent>
|
||||
<ModalActions>
|
||||
<SButton onClick={() => this.setState({errorModalOpen: false})}>Close</SButton>
|
||||
</Modal.Actions>
|
||||
</ModalActions>
|
||||
</Modal>;
|
||||
|
||||
const deleteButton = <>
|
||||
|
|
@ -242,7 +241,8 @@ class StoppableRow extends React.Component {
|
|||
let {url, last_successful_download, status, location, error} = this.props;
|
||||
let {stopOpen, startOpen, errorModalOpen, deleteOpen} = this.state;
|
||||
|
||||
const link = location ?
|
||||
// Open downloads (/download), or external links in an anchor.
|
||||
const link = location && !location.startsWith('/download') ?
|
||||
(text) => <Link to={location}>{text}</Link> :
|
||||
(text) => <a href={url} target='_blank' rel='noopener noreferrer'>{text}</a>;
|
||||
|
||||
|
|
@ -301,13 +301,13 @@ class StoppableRow extends React.Component {
|
|||
open={errorModalOpen}
|
||||
trigger={<Button icon='exclamation circle' color='red'/>}
|
||||
>
|
||||
<Modal.Header>Download Error</Modal.Header>
|
||||
<Modal.Content>
|
||||
<ModalHeader>Download Error</ModalHeader>
|
||||
<ModalContent>
|
||||
<pre style={{overflowX: 'scroll'}}>{error}</pre>
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
</ModalContent>
|
||||
<ModalActions>
|
||||
<SButton onClick={() => this.setState({errorModalOpen: false})}>Close</SButton>
|
||||
</Modal.Actions>
|
||||
</ModalActions>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from "react";
|
||||
import {getSettings, saveSettings} from "../../api";
|
||||
import {Button, Form, FormGroup, FormInput, Header, Loader, Segment} from "../Theme";
|
||||
import {Container, Dimmer, Icon, Modal} from "semantic-ui-react";
|
||||
import {Button, Form, FormGroup, FormInput, Header, Loader, Modal, ModalContent, ModalHeader, Segment} from "../Theme";
|
||||
import {Container, Dimmer, Icon} from "semantic-ui-react";
|
||||
import {ThemeContext} from "../../contexts/contexts";
|
||||
import {HelpPopup, HotspotToggle, ThrottleToggle, Toggle, WROLModeMessage} from "../Common";
|
||||
import QRCode from "react-qr-code";
|
||||
|
|
@ -203,12 +203,14 @@ export class Settings extends React.Component {
|
|||
open={this.state.qrOpen}
|
||||
trigger={qrButton}
|
||||
>
|
||||
<Modal.Header>
|
||||
<ModalHeader>
|
||||
Scan this code to join the hotspot
|
||||
</Modal.Header>
|
||||
<Modal.Content>
|
||||
<QRCode value={qrCodeValue} size={300}/>
|
||||
</Modal.Content>
|
||||
</ModalHeader>
|
||||
<ModalContent>
|
||||
<div style={{display: 'inline-block', backgroundColor: '#ffffff', padding: '1em'}}>
|
||||
<QRCode value={qrCodeValue} size={300}/>
|
||||
</div>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
|
||||
<br/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue