web/donate: initial re-redesign

This commit is contained in:
dumbmoron 2024-08-04 13:24:10 +00:00
parent d431e9e9a2
commit e72efae24d
No known key found for this signature in database
5 changed files with 114 additions and 242 deletions

View file

@ -92,6 +92,9 @@ importers:
'@eslint/js': '@eslint/js':
specifier: ^9.5.0 specifier: ^9.5.0
version: 9.8.0 version: 9.8.0
'@fontsource/redaction-10':
specifier: ^5.0.2
version: 5.0.2
'@sveltejs/adapter-static': '@sveltejs/adapter-static':
specifier: ^3.0.2 specifier: ^3.0.2
version: 3.0.2(@sveltejs/kit@2.5.19(@sveltejs/vite-plugin-svelte@3.1.1(svelte@4.2.18)(vite@5.3.5(@types/node@20.14.14)))(svelte@4.2.18)(vite@5.3.5(@types/node@20.14.14))) version: 3.0.2(@sveltejs/kit@2.5.19(@sveltejs/vite-plugin-svelte@3.1.1(svelte@4.2.18)(vite@5.3.5(@types/node@20.14.14)))(svelte@4.2.18)(vite@5.3.5(@types/node@20.14.14)))
@ -324,6 +327,9 @@ packages:
'@fontsource/ibm-plex-mono@5.0.13': '@fontsource/ibm-plex-mono@5.0.13':
resolution: {integrity: sha512-gtlMmvk//2AgDEZDFsoL5z9mgW3ZZg/9SC7pIfDwNKp5DtZpApgqd1Fua3HhPwYRIHrT76IQ1tMTzQKLEGtJGQ==} resolution: {integrity: sha512-gtlMmvk//2AgDEZDFsoL5z9mgW3ZZg/9SC7pIfDwNKp5DtZpApgqd1Fua3HhPwYRIHrT76IQ1tMTzQKLEGtJGQ==}
'@fontsource/redaction-10@5.0.2':
resolution: {integrity: sha512-PODxYvb06YrNxdUBGcygiMibpgcZihzmvkmlX/TQAA2F7BUU/anfSKQi/VnLdJ/8LIK81/bUY+i7L/GP27FkVw==}
'@humanwhocodes/config-array@0.11.14': '@humanwhocodes/config-array@0.11.14':
resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==} resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==}
engines: {node: '>=10.10.0'} engines: {node: '>=10.10.0'}
@ -1945,6 +1951,8 @@ snapshots:
'@fontsource/ibm-plex-mono@5.0.13': {} '@fontsource/ibm-plex-mono@5.0.13': {}
'@fontsource/redaction-10@5.0.2': {}
'@humanwhocodes/config-array@0.11.14': '@humanwhocodes/config-array@0.11.14':
dependencies: dependencies:
'@humanwhocodes/object-schema': 2.0.3 '@humanwhocodes/object-schema': 2.0.3

4
web/i18n/en/donate.json Normal file
View file

@ -0,0 +1,4 @@
{
"title": "Support a safe\nand open Internet",
"subtitle": "donate to imput or share the\njoy of cobalt with a friend"
}

View file

@ -25,6 +25,7 @@
"homepage": "https://cobalt.tools/", "homepage": "https://cobalt.tools/",
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.5.0", "@eslint/js": "^9.5.0",
"@fontsource/redaction-10": "^5.0.2",
"@sveltejs/adapter-static": "^3.0.2", "@sveltejs/adapter-static": "^3.0.2",
"@sveltejs/kit": "^2.0.0", "@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0", "@sveltejs/vite-plugin-svelte": "^3.0.0",

View file

@ -1,13 +1,11 @@
<script lang="ts"> <script lang="ts">
import "@fontsource/redaction-10/400.css";
import { t } from "$lib/i18n/translations"; import { t } from "$lib/i18n/translations";
import { donate } from "$lib/env"; import { donate } from "$lib/env";
import IconCoin from "@tabler/icons-svelte/IconCoin.svelte"; import IconHeart from "@tabler/icons-svelte/IconHeart.svelte";
import IconCoffee from "@tabler/icons-svelte/IconCoffee.svelte"; import Meowbalt from "$components/misc/Meowbalt.svelte";
import IconPizza from "@tabler/icons-svelte/IconPizza.svelte";
import IconQuestionMark from "@tabler/icons-svelte/IconQuestionMark.svelte";
import IconRepeat from "@tabler/icons-svelte/IconRepeat.svelte";
import IconWallet from "@tabler/icons-svelte/IconWallet.svelte";
let customAmountOnceInput: HTMLInputElement; let customAmountOnceInput: HTMLInputElement;
let customAmountRecurringInput: HTMLInputElement; let customAmountRecurringInput: HTMLInputElement;
@ -36,271 +34,127 @@
</svelte:head> </svelte:head>
<main id="donate-page"> <main id="donate-page">
<h1>support cobalt</h1> <header id="banner">
<p> <div id="banner-contents">
cobalt doesn't shove ads in your face and doesn't sell your personal data, meaning that <div id="banner-left">
it's <em>completely free to use</em> for everyone. but development and maintenance of a media-heavy <img id="imput-logo" src="/icons/imput.svg" alt="imput logo" />
service used by over 1 million people is quite costly. both in terms of time and money. <div id="banner-title">{$t('donate.title')}</div>
</p> <div id="banner-subtitle">{$t('donate.subtitle')}</div>
</div>
<p> <div id="banner-right">
if cobalt helped you in the past and you want to keep it growing and evolving, you can <Meowbalt emotion="fast" />
return the favor by making a donation! </div>
</p>
<p>
your donation will help all cobalt users: educators, students, content creators, artists,
musicians, and many, many more!
</p>
<p>
in past, donations have let cobalt:
</p>
<ul>
<li>increase stability and uptime to nearly 100%.</li>
<li>speed up ALL downloads, especially heavier ones.</li>
<li>open the api for free public use.</li>
<li>withstand several huge user influxes with 0 downtime.</li>
<li>add resource-intensive features (such as gif conversion).</li>
<li>continue improving our infrastructure.</li>
<li>keep developers happy.</li>
</ul>
<p>
<em>every cent matters and is extremely appreciated</em>, you can truly make a difference!
</p>
<p>
if you can't donate, share cobalt with a friend! we don't get ads anywhere, so cobalt
is spread by word of mouth.
</p>
<p>
sharing is the easiest way to help achieve the goal of better internet for everyone.
</p>
<section>
<h3><IconCoin /> make a one-time donation via stripe</h3>
<div class="donation-options">
<button
class="donation-option"
on:click={() => donateStripe(500)}
>
<h3 class="amount">$5</h3>
<div class="donate-description">
<IconCoffee class="description-icon" />
<p>a cup of coffee</p>
</div>
</button>
<button
class="donation-option"
on:click={() => donateStripe(1000)}
>
<h3 class="amount">$10</h3>
<div class="donate-description">
<IconPizza class="description-icon" />
<p>a pizza</p>
</div>
</button>
<button
class="donation-option"
on:click={(e) => {
if (e.target !== customAmountOnceInput) {
if (!customAmountOnceInput.reportValidity()) {
return;
}
const amount = Number(customAmountOnceInput.value);
donateStripe(amount * 100);
}
}}
>
<h3 class="amount" id="donation-custom">
$ <input
type="number"
placeholder="20"
min="2"
max="10000"
required
bind:this={customAmountOnceInput}
>
</h3>
<div class="donate-description">
<IconQuestionMark class="description-icon" />
<p>whatever you like!</p>
</div>
</button>
</div> </div>
</section> <div id="banner-background">
<div id="banner-background-animation">
<section> <div id="banner-background-inner">
<h3><IconRepeat /> make a recurring donation via liberapay</h3> {#each {length: 144} as _}
<div class="donation-options"> <IconHeart class="heart-icon" />
<button {/each}
class="donation-option"
on:click={() => donateLibera(200)}
>
<h3 class="amount">$2/month</h3>
<div class="donate-description">
<p>idk</p>
</div> </div>
</button> </div>
<button
class="donation-option"
on:click={() => donateLibera(500)}
>
<h3 class="amount">$5/month</h3>
<div class="donate-description">
<IconCoffee class="description-icon" />
<p>a cup of coffee</p>
</div>
</button>
<button
class="donation-option"
on:click={(e) => {
if (e.target !== customAmountRecurringInput) {
if (!customAmountRecurringInput.reportValidity()) {
return;
}
const amount = Number(customAmountRecurringInput.value);
donateLibera(amount * 100);
}
}}
>
<h3 class="amount" id="donation-custom">
$ <input
type="number"
placeholder="10"
min="5"
max="1000"
required
bind:this={customAmountRecurringInput}
>
</h3>
<div class="donate-description">
<IconQuestionMark class="description-icon" />
<p>whatever you like!</p>
</div>
</button>
</div> </div>
</section> </header>
<section>
<h3><IconWallet /> donate with cryptocurrencies</h3>
<div class="crypto-wallets">
{#each Object.entries(donate.crypto) as [ name, address ]}
<div class="wallet">
<div class="wallet-name">{ name } (press to copy)</div>
<button
class="wallet-address"
on:click={() => toClipboard(address)}
>
{ address }
</button>
</div>
{/each}
</div>
</section>
</main> </main>
<style> <style>
#donate-page { #donate-page {
max-width: 850px; max-width: 950px;
margin: 0 auto; margin: 0 auto;
overflow-x: hidden; overflow-x: hidden;
padding: var(--padding); padding: var(--padding);
} }
em { #banner {
font-style: italic; position: relative;
border-bottom: 2px dotted var(--secondary); border-radius: calc(3 * var(--border-radius));
background: linear-gradient(
190deg,
#1a1a1a 30%,
#3c3c3c 100%
);
} }
section h3 > :global(*) { #banner-contents {
vertical-align: middle; position: relative;
}
section > h3 {
padding: var(--padding) 0;
}
.donation-options {
display: flex; display: flex;
justify-content: space-evenly;
}
.donation-option {
display: flex;
flex-direction: column;
width: 15rem;
padding: 1em;
}
.amount {
font-size: 2em;
}
.donate-description {
color: var(--gray);
padding-top: .5em;
}
.donate-description p {
margin: 0;
}
#donation-custom {
display: flex;
}
#donation-custom input {
background: transparent;
font-size: inherit;
border: none;
border-bottom: 4px dotted var(--secondary);
width: 2.5em;
text-align: center;
appearance: textfield;
color: var(--secondary);
}
.wallet-address {
width: 100%; width: 100%;
display: block; z-index: 2;
text-align: left;
font-size: .75em;
overflow: hidden;
text-overflow: ellipsis;
} }
.crypto-wallets { #banner-background {
position: absolute;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
opacity: 10%;
mask-image: linear-gradient(
145deg,
rgba(0,0,0,1) 0%,
rgba(255,255,255,0) 60%
);
}
#banner-background-inner {
color: white;
transform: rotate(-8deg) scale(1.5) translateY(-4em);
}
#banner-background-inner :global(.heart-icon) {
height: 3em;
width: 3em;
stroke-width: 1.5px;
margin: -.15em;
}
#banner-right :global(.meowbalt) {
height: 40vmin;
margin-top: -2em;
margin-left: -4em;
}
#banner-right {
transform: translate(12px, 48px);
display: flex;
align-items: center;
}
#imput-logo {
width: 3em;
}
#banner-left {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center;
padding: 2.5em 3.5em;
color: white;
gap: 1em; gap: 1em;
padding-left: calc(2 * var(--padding)); white-space: pre-wrap;
} }
.wallet { #banner-title {
display: flex; font-family: 'Redaction 10', serif;
flex-direction: column; font-size: 3em;
gap: .25em; font-weight: 400;
line-height: 0.95;
} }
input::-webkit-outer-spin-button, #banner-subtitle {
input::-webkit-inner-spin-button { color: var(--gray);
-webkit-appearance: none; }
margin: 0; #banner-background-animation {
animation: heart-move 5s infinite linear;
} }
@media screen and (max-width: 750px) { @keyframes heart-move {
.donation-options { from {
flex-direction: column; transform: translateX(0) translateY(0);
gap: 1em;
align-items: center;
} }
.crypto-wallets { to {
padding-left: 0; transform: translate(74px) translateY(61px);
} }
} }
</style> </style>

View file

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 532 283">
<path fill="#fff" d="M0 282.717v-62.5886h531.441v62.5886z"/>
<path fill="#fff" d="m103.176 35.2625 54.20331759-31.2943 139.958 242.41436693-54.20331759 31.2943z"/>
<path fill="#fff" d="m368.95 0 54.20331759 31.2943-134.6 233.1340387L234.35 233.1340387z"/>
</svg>

After

Width:  |  Height:  |  Size: 343 B