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

@ -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>