mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-03 13:19:58 -05:00
Removing default download freqeuncy so channels will not be downloaded without a url and frequency. Adding channel unique url constraint. Handling when a Channel's directory may still be relative in DB. Adding TODOs to remove old favorites. Removing outdated favorites from config after favorites have been created. Testing that old-style favorited videos in the config are imported. Removing channels_by_link. Using list to store channels in config. Moving channel import function into lib. Supporting old channel import with links. Bumping version for channel.link removal. Removing all reference to Channel.link in app and api. Adding relative property to MediaPathType. Testing that a channel can be downloaded after it has a frequency added. All tests pass. Video and Channel tests pass without channel.link. Removing channel.link usage in channel api. Changing video Statistics page to About.
101 lines
3.5 KiB
JavaScript
101 lines
3.5 KiB
JavaScript
import React from 'react';
|
|
import './App.css';
|
|
import {NavBar} from "./components/Nav";
|
|
import {Route, Switch, useHistory} from "react-router-dom";
|
|
import {VideosPreview, VideosRoute, VideoWrapper} from "./components/Videos";
|
|
import Admin from "./components/Admin";
|
|
import {Container, Divider, Header} from "semantic-ui-react";
|
|
import 'semantic-ui-offline/semantic.min.css';
|
|
import {SemanticToastContainer} from 'react-semantic-toasts';
|
|
import 'react-semantic-toasts/styles/react-semantic-alert.css';
|
|
import {AppsRoute} from "./components/Apps";
|
|
import {InventoryRoute} from "./components/Inventory";
|
|
import {ArchiveRoute, ArchivesList} from "./components/Archive";
|
|
import {Saver} from "./components/Upload";
|
|
import {MoreButton, PageContainer, SearchInput} from "./components/Common";
|
|
import {FilesRoute} from "./components/Files";
|
|
import {useSearch, useVersion} from "./hooks/customHooks";
|
|
import {MapRoute} from "./components/Map";
|
|
|
|
function Welcome() {
|
|
const {searchStr, setSearchStr, archives, videos} = useSearch();
|
|
const history = useHistory();
|
|
|
|
let body = (
|
|
<>
|
|
<Header as='h2'>Save your media</Header>
|
|
<Saver/>
|
|
</>
|
|
);
|
|
|
|
if (searchStr) {
|
|
let archiveMore = () => {
|
|
history.push(`/archive?q=${searchStr}`);
|
|
};
|
|
let videosMore = () => {
|
|
history.push(`/videos?q=${searchStr}&o=rank`);
|
|
};
|
|
|
|
body = (<>
|
|
<Header as='h2'>Archives</Header>
|
|
<ArchivesList archives={archives} searchStr={searchStr}/>
|
|
<MoreButton onClick={archiveMore} disabled={!archives || archives.length === 0}/>
|
|
|
|
<Divider/>
|
|
|
|
<Header as='h2'>Videos</Header>
|
|
<VideosPreview videos={videos}/>
|
|
<MoreButton onClick={videosMore} disabled={!videos || videos.length === 0}/>
|
|
</>);
|
|
}
|
|
|
|
return (
|
|
<PageContainer>
|
|
<SearchInput initValue={searchStr} onSubmit={setSearchStr} size='big' placeholder='Search Everywhere...'/>
|
|
{body}
|
|
</PageContainer>
|
|
)
|
|
}
|
|
|
|
function PageNotFound() {
|
|
return (
|
|
<Container fluid>
|
|
<h1 className="display-4">Page Not Found!</h1>
|
|
<p>The page you requested cannot be found</p>
|
|
</Container>
|
|
)
|
|
}
|
|
|
|
function Footer() {
|
|
const version = useVersion();
|
|
return <Container textAlign='center' style={{marginTop: '1.5em', marginBottom: '1em'}}>
|
|
WROLPi v{version} <a href='https://github.com/lrnselfreliance/wrolpi'>GitHub</a>
|
|
</Container>
|
|
}
|
|
|
|
export default function App() {
|
|
return (
|
|
<>
|
|
<header>
|
|
<NavBar/>
|
|
</header>
|
|
<>
|
|
<Switch>
|
|
<Route path='/videos/video/:video_id' exact component={VideoWrapper}/>
|
|
<Route path='/videos/channel/:channel_id/video/:video_id' exact component={VideoWrapper}/>
|
|
<Route path="/" exact={true} component={Welcome}/>
|
|
<Route path="/videos" component={VideosRoute}/>
|
|
<Route path="/admin" component={Admin}/>
|
|
<Route path="/apps" component={AppsRoute}/>
|
|
<Route path="/inventory" component={InventoryRoute}/>
|
|
<Route path='/archive' component={ArchiveRoute}/>
|
|
<Route path='/map' component={MapRoute}/>
|
|
<Route path='/files' component={FilesRoute}/>
|
|
<Route component={PageNotFound}/>
|
|
</Switch>
|
|
</>
|
|
<SemanticToastContainer position="top-right"/>
|
|
<Footer/>
|
|
</>
|
|
);
|
|
}
|