|
| 1 | +import { useCallback, useState } from 'react'; |
| 2 | +import styled from 'styled-components'; |
| 3 | +import Button from './Button.tsx'; |
| 4 | + |
| 5 | +const CloseButton = ({ |
| 6 | + setVisible, |
| 7 | +}: { |
| 8 | + setVisible: (show: boolean) => void; |
| 9 | +}) => { |
| 10 | + const close = useCallback(() => { |
| 11 | + setVisible(false); |
| 12 | + }, [setVisible]); |
| 13 | + return ( |
| 14 | + <div |
| 15 | + style={{ |
| 16 | + position: 'absolute', |
| 17 | + top: '5px', |
| 18 | + right: '5px', |
| 19 | + }} |
| 20 | + > |
| 21 | + <Button style={{ padding: '5px' }} onClick={close}> |
| 22 | + [X] |
| 23 | + </Button> |
| 24 | + </div> |
| 25 | + ); |
| 26 | +}; |
| 27 | + |
| 28 | +export default function About({ |
| 29 | + setVisible, |
| 30 | +}: { |
| 31 | + setVisible: (show: boolean) => void; |
| 32 | +}) { |
| 33 | + const [showTos, setShowTos] = useState<boolean>(false); |
| 34 | + |
| 35 | + if (showTos) { |
| 36 | + return <Tos setVisible={setShowTos} />; |
| 37 | + } |
| 38 | + |
| 39 | + return ( |
| 40 | + <AboutPanel> |
| 41 | + <CloseButton setVisible={setVisible} /> |
| 42 | + <BannerContainer> |
| 43 | + <Banner>{'{paste}'}</Banner> |
| 44 | + </BannerContainer> |
| 45 | + <p> |
| 46 | + <b>paste is a simple web app for writing & sharing code</b>. It's a |
| 47 | + different take on conventional pastebin sites like pastebin.com or |
| 48 | + hastebin. |
| 49 | + </p> |
| 50 | + {window.location.hostname === 'pastes.dev' && ( |
| 51 | + <> |
| 52 | + <p> |
| 53 | + <b>pastes.dev</b> is the official, publicly accessible paste |
| 54 | + instance, and can be used by anyone, subject to the{' '} |
| 55 | + <a |
| 56 | + href="#" |
| 57 | + onClick={e => { |
| 58 | + setShowTos(true); |
| 59 | + e.preventDefault(); |
| 60 | + }} |
| 61 | + > |
| 62 | + Terms of Service |
| 63 | + </a> |
| 64 | + . |
| 65 | + </p> |
| 66 | + <p> |
| 67 | + To access pastes.dev programmatically, please use the{' '} |
| 68 | + <a href="https://github.com/lucko/paste#readme" target="_blank"> |
| 69 | + API |
| 70 | + </a> |
| 71 | + . :) |
| 72 | + </p> |
| 73 | + <p> |
| 74 | + Please{' '} |
| 75 | + <b> |
| 76 | + <a |
| 77 | + href="#" |
| 78 | + onClick={e => { |
| 79 | + setShowTos(true); |
| 80 | + e.preventDefault(); |
| 81 | + }} |
| 82 | + > |
| 83 | + report |
| 84 | + </a> |
| 85 | + </b>{' '} |
| 86 | + illegal, malicious, or abusive content so it can be removed. |
| 87 | + </p> |
| 88 | + </> |
| 89 | + )} |
| 90 | + <p style={{ textAlign: 'center' }}> |
| 91 | + <a href="https://github.com/lucko/paste" target="_blank"> |
| 92 | + paste |
| 93 | + </a>{' '} |
| 94 | + is free & open source on GitHub. |
| 95 | + <br /> |
| 96 | + Copyright © 2021-{new Date().getFullYear()}{' '} |
| 97 | + <a href="https://github.com/lucko" target="_blank"> |
| 98 | + lucko |
| 99 | + </a>{' '} |
| 100 | + & other paste{' '} |
| 101 | + <a |
| 102 | + href="https://github.com/lucko/paste/graphs/contributors" |
| 103 | + target="_blank" |
| 104 | + > |
| 105 | + contributors |
| 106 | + </a> |
| 107 | + . |
| 108 | + </p> |
| 109 | + </AboutPanel> |
| 110 | + ); |
| 111 | +} |
| 112 | + |
| 113 | +const Tos = ({ setVisible }: { setVisible: (show: boolean) => void }) => { |
| 114 | + return ( |
| 115 | + <AboutPanel> |
| 116 | + <CloseButton setVisible={setVisible} /> |
| 117 | + <h1>Terms of Service</h1> |
| 118 | + <p> |
| 119 | + Welcome to pastes.dev. By using this service, you agree to the following |
| 120 | + terms: |
| 121 | + </p> |
| 122 | + <ol> |
| 123 | + <li> |
| 124 | + <b>No Illegal Use:</b> You may not use pastes.dev to share, store, or |
| 125 | + distribute any content that is illegal, harmful, or violates any laws |
| 126 | + or regulations. |
| 127 | + </li> |
| 128 | + <li> |
| 129 | + <b>No Malicious Content:</b> Do not upload or share content intended |
| 130 | + to harm others, including but not limited to malware, phishing links, |
| 131 | + or personal data without consent. |
| 132 | + </li> |
| 133 | + <li> |
| 134 | + <b>Content Responsibility:</b> You are solely responsible for the |
| 135 | + content you post. We do not review content and are not liable for what |
| 136 | + users choose to share. |
| 137 | + </li> |
| 138 | + <li> |
| 139 | + <b>Moderation:</b> We reserve the right to remove any content at our |
| 140 | + discretion, and to restrict or terminate access to the service for |
| 141 | + abuse or violations of these terms. |
| 142 | + </li> |
| 143 | + <li> |
| 144 | + <b>No Guarantees:</b> This service is provided "as is" with no |
| 145 | + warranties. We do not guarantee uptime, data retention, or |
| 146 | + availability. |
| 147 | + </li> |
| 148 | + </ol> |
| 149 | + <p> |
| 150 | + By using pastes.dev, you accept these terms. If you do not agree, please |
| 151 | + do not use the service. |
| 152 | + </p> |
| 153 | + <p> |
| 154 | + <b>Reporting Abuse</b> |
| 155 | + <br /> |
| 156 | + If you encounter illegal or malicious content, please report it by email |
| 157 | + to report-abuse {'<at>'} pastes.dev. |
| 158 | + </p> |
| 159 | + </AboutPanel> |
| 160 | + ); |
| 161 | +}; |
| 162 | + |
| 163 | +const AboutPanel = styled.div` |
| 164 | + position: absolute; |
| 165 | + top: 50%; |
| 166 | + left: 50%; |
| 167 | + transform: translate(-50%, -50%); |
| 168 | + z-index: 99; |
| 169 | + max-width: 650px; |
| 170 | +
|
| 171 | + color: ${props => props.theme.primary}; |
| 172 | + background-color: ${props => props.theme.secondary}; |
| 173 | +
|
| 174 | + padding: 10px; |
| 175 | +`; |
| 176 | + |
| 177 | +const BannerContainer = styled.div` |
| 178 | + display: flex; |
| 179 | + justify-content: center; |
| 180 | +`; |
| 181 | + |
| 182 | +const Banner = styled.div` |
| 183 | + background-color: ${props => props.theme.background}; |
| 184 | + color: ${props => props.theme.logo}; |
| 185 | + border-radius: 20px; |
| 186 | + font-size: 70px; |
| 187 | + letter-spacing: -5px; |
| 188 | + padding: 10px; |
| 189 | + font-weight: bold; |
| 190 | +`; |
0 commit comments