Adding Donate page.

This commit is contained in:
Roland 2022-11-08 22:42:00 -07:00
parent 1e1c8f0b85
commit c148bb4d84
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
6 changed files with 99 additions and 16 deletions

View file

@ -1,7 +1,7 @@
import React, {useContext} from 'react';
import './App.css';
import {NavBar} from "./components/Nav";
import {Route, Routes} from "react-router-dom";
import {Link, Route, Routes} from "react-router-dom";
import {VideosRoute, VideoWrapper} from "./components/Videos";
import Admin from "./components/admin/Admin";
import {Container} from "semantic-ui-react";
@ -17,6 +17,7 @@ import {MapRoute} from "./components/Map";
import {StatusContext, ThemeContext} from "./contexts/contexts";
import {ThemeWrapper} from "./components/Theme";
import {Dashboard} from "./Dashboard";
import {Donate} from "./components/Donate";
function PageNotFound() {
return (<Container fluid>
@ -28,9 +29,15 @@ function PageNotFound() {
function Footer() {
const {t} = useContext(ThemeContext);
const {status} = useContext(StatusContext);
const {version} = status;
return <Container textAlign='center' style={{marginTop: '1.5em', marginBottom: '1em'}}>
<span {...t}>WROLPi v{version} <a href='https://github.com/lrnselfreliance/wrolpi'>GitHub</a></span>
let {version} = status;
version = version ? `v${version}` : null;
return <Container textAlign='center' style={{marginTop: '1.5em', marginBottom: '1em', ...t}}>
<span {...t}>
WROLPi {version} &nbsp;•&nbsp;
<Link to='/donate'>Donate</Link> &nbsp;•&nbsp;
<a href='https://github.com/lrnselfreliance/wrolpi'>GitHub</a> &nbsp;•&nbsp;
<a href='https://discord.gg/HrwFk7nqA2'>Discord</a>
</span>
</Container>
}
@ -54,6 +61,7 @@ export default function App() {
<Route path='/archive/*' element={<ArchiveRoute/>}/>
<Route path='/map/*' element={<MapRoute/>}/>
<Route path='/files/*' element={<FilesRoute/>}/>
<Route path='/donate' element={<Donate/>}/>
<Route element={<PageNotFound/>}/>
</Routes>
</>

View file

@ -85,7 +85,7 @@ function DashboardStatus() {
{bandwidths}
</Link>
<Divider/>
<Divider style={{marginTop: '3em'}}/>
<Link to='/admin'>
<StatisticGroup size='mini'>

View file

@ -437,7 +437,7 @@ function ChannelPage({create, header}) {
onConfirm={handleDeleteConfirm}
/>
<Button
color='blue'
color='violet'
onClick={handleDownloadChannel}
disabled={!channel.url || !channel.download_frequency}
>

View file

@ -1,5 +1,5 @@
import React, {useContext, useEffect, useState} from "react";
import {Card, Container, IconGroup, Input, Modal, Pagination, Responsive} from 'semantic-ui-react';
import {Card, Container, IconGroup, Image, Input, Modal, Pagination, Responsive} from 'semantic-ui-react';
import {Link, NavLink} from "react-router-dom";
import Message from "semantic-ui-react/dist/commonjs/collections/Message";
import {useDownloaders, useHotspot, useThrottle} from "../hooks/customHooks";
@ -423,6 +423,18 @@ export function CardGroupCentered(props) {
</div>)
}
export function CardPosterLink({to, poster_url, imageLabel}) {
const {s} = useContext(ThemeContext);
const style = {display: 'flex', justifyContent: 'center', ...s['style']};
return <Link to={to} style={style}>
<Image fluid
src={poster_url}
label={imageLabel}
style={{maxHeight: '163px', width: 'auto'}}
/>
</Link>
}
export function HelpPopup({icon, size, content, position}) {
return <Popup
content={content}

View file

@ -0,0 +1,68 @@
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 QRCode from "react-qr-code";
const bitcoinAddress = '1mi1ddLSd6LmkuwJd1ttZsKuED724vYjS';
const bitcoinContent = `bitcoin:${bitcoinAddress}`;
const ethereumAddress = '0xC27C39b31A3a9D12C345A58aFe8a42a2e1eb0448';
const ethereumContent = `ethereum:${ethereumAddress}`;
const litecoinAddress = `LKngzDZUZcggxk2fTAZYmBcksLBMrnhioA`;
const litecoinContent = `litecoin:${litecoinAddress}`;
const moneroAddress = '87jv2NpGb5sbUwk7zYYwEY5RAoh1jRfTo4d1BAewVdJJFKg2bDF2UXtLfTc8LZkkSagDsnJyevLpZaZ846QHcLDjUenBrcY';
const moneroContent = `monero:${moneroAddress};`
function CoinQRButton({qrCodeValue, header, buttonColor}) {
const [open, setOpen] = useState(false);
return <>
<Button icon color={buttonColor}
onClick={() => setOpen(true)}>
<Icon name='qrcode' size='big'/>
</Button>
<Modal closeIcon
open={open}
onClose={() => setOpen(false)}
onOpen={() => setOpen(true)}
>
<Modal.Header>{header}</Modal.Header>
<Modal.Content>
<QRCode value={qrCodeValue} size={300}/>
</Modal.Content>
</Modal>
</>
}
function CoinRow({header, qrCodeValue, address, buttonColor}) {
return <>
<Header as='h3'>{header}</Header>
<Table stackable>
<TableBody>
<TableRow>
<TableCell width={1}>
<CoinQRButton qrCodeValue={qrCodeValue} header={header} buttonColor={buttonColor}/>
</TableCell>
<TableCell width={15} textAlign='left'>
<pre>{address}</pre>
</TableCell>
</TableRow>
</TableBody>
</Table>
</>
}
export function Donate() {
useTitle('Donate');
return (<PageContainer>
<Segment>
<Header as='h1'>Donate</Header>
<Header as='h3'>We appreciate any support you can provide to WROLPi!</Header>
<CoinRow header='Monero' qrCodeValue={moneroContent} address={moneroAddress} buttonColor='orange'/>
<CoinRow header='Litecoin' qrCodeValue={litecoinContent} address={litecoinAddress} buttonColor='grey'/>
<CoinRow header='Ethereum' qrCodeValue={ethereumContent} address={ethereumAddress} buttonColor='blue'/>
<CoinRow header='Bitcoin' qrCodeValue={bitcoinContent} address={bitcoinAddress} buttonColor='yellow'/>
</Segment>
</PageContainer>);
}

View file

@ -2,6 +2,7 @@ import React, {useContext, useEffect, useState} from 'react';
import {Link, Route, Routes, useParams} from "react-router-dom";
import {
CardLink,
CardPosterLink,
defaultSearchOrder,
defaultVideoOrder,
Duration,
@ -317,19 +318,13 @@ export function VideoCard({file}) {
if (video.favorite) {
imageLabel = {corner: 'left', icon: 'heart', color: 'green'};
}
let poster = <CardIcon><FileIcon file={file}/></CardIcon>;
let poster = <Link to={video_url}><CardIcon><FileIcon file={file}/></CardIcon></Link>;
if (poster_url) {
poster = <Image wrapped
src={poster_url}
label={imageLabel}
style={{position: 'relative', width: '100%'}}
/>;
poster = <CardPosterLink to={video_url} poster_url={poster_url} imageLabel={imageLabel}/>;
}
return (<Card color={mimetypeColor(file.mimetype)}>
<Link to={video_url}>
{poster}
</Link>
{poster}
<Duration video={video}/>
<Card.Content {...s}>
<Card.Header>