Fix donation progress bar

This commit is contained in:
Alex Cabal 2024-12-30 22:04:09 -06:00
parent d146550bf3
commit 616b9677a9
6 changed files with 14 additions and 11 deletions

View file

@ -91,7 +91,7 @@ Define conf_rewrite_root ${web_root}/config/apache/rewrites
SSLCertificateFile /etc/letsencrypt/live/${domain}/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/${domain}/privkey.pem
Header always set Strict-Transport-Security "max-age=15768000"
Header set Content-Security-Policy "default-src 'self';"
Header set Content-Security-Policy "default-src 'self'; style-src 'self' 'unsafe-inline';"
<Directory "${web_root}/www/">
# Disable .htaccess files

View file

@ -73,7 +73,7 @@ Define conf_rewrite_root ${web_root}/config/apache/rewrites
SSLCertificateFile ${web_root}/config/ssl/${domain}.crt
SSLCertificateKeyFile ${web_root}/config/ssl/${domain}.key
Header always set Strict-Transport-Security "max-age=15768000"
Header set Content-Security-Policy "default-src 'self';"
Header set Content-Security-Policy "default-src 'self'; style-src 'self' 'unsafe-inline';"
<Directory "${web_root}/www/">
# Disable .htaccess files

View file

@ -101,7 +101,7 @@ const DONATION_DRIVE_DATES = [
NOW < new DateTimeImmutable('January 7') ? new DateTimeImmutable('November 25 -1 year') : new DateTimeImmutable('November 25'),
NOW < new DateTimeImmutable('January 7') ? new DateTimeImmutable('January 7') : new DateTimeImmutable('January 7 +1 year'),
75,
25
50
)
];

View file

@ -57,7 +57,7 @@ class DonationDrive{
if(!isset($this->_TargetDonationCount)){
$this->_TargetDonationCount = $this->BaseTargetDonationCount;
if($this->DonationCount > $this->BaseTargetDonationCount){
if($this->DonationCount >= $this->BaseTargetDonationCount){
$this->_TargetDonationCount = $this->_TargetDonationCount + $this->StretchTargetDonationCount;
}
}

View file

@ -40,6 +40,10 @@ else{
$timeString = 'Only ' . $timeString;
}
}
if($donationDrive->IsStretchEnabled){
$stretchStartingPosition = round( ($donationDrive->BaseTargetDonationCount / $donationDrive->TargetDonationCount) * 100, 0, PHP_ROUND_HALF_DOWN);
}
?>
<aside class="donation closable">
<? if($autoHide){ ?>
@ -62,7 +66,7 @@ else{
<p>Help us meet our stretch goal of<br/> <?= number_format($donationDrive->TargetDonationCount) ?> new patrons by <?= $deadline ?></p>
</header>
<? } ?>
<div class="progress">
<div class="progress"<? if($donationDrive->IsStretchEnabled){ ?> style="--stretch-starting-position: <?= $stretchStartingPosition ?>%; --stretch-base-counter-position: <?= $stretchStartingPosition - 1 ?>%"<? } ?>>
<div aria-hidden="true">
<p class="start">0</p>
<p><?= number_format($donationDrive->DonationCount) ?>/<?= number_format($donationDrive->TargetDonationCount) ?></p>
@ -77,7 +81,7 @@ else{
<? } ?>
</div>
<? if($donationDrive->IsStretchEnabled){ ?>
<p>When we started this drive, we set a goal of <?= number_format($donationDrive->BaseTargetDonationCount) ?> Patrons Circle members by <?= $deadline ?>. Thanks to the incredible generosity of literature lovers like you, we hit that goal!</p>
<p>When we started this drive, we set a goal of <?= number_format($donationDrive->BaseTargetDonationCount) ?> Patrons Circle members by <?= $deadline ?>. Thanks to the incredible generosity of literature lovers like you, we hit that goal faster than we hoped!</p>
<p>Since theres still some time left in our drive, we thought wed challenge our readers to help us reach our stretch goal of <?= number_format($donationDrive->TargetDonationCount) ?> patrons, so that we can continue on a rock-solid financial footing. Will you help us with a donation, and support free and unrestricted digital literature?</p>
<? }else{ ?>
<p>It takes a huge amount of resources and highly-skilled work to create and distribute each of our free ebooks, and we need your support to keep it up. Thats why we want to welcome <?= number_format($donationDrive->TargetDonationCount) ?> new patrons by <?= $deadline ?>. Its our patrons who keep us on the stable financial footing we need to continue producing and giving away beautiful ebooks.</p>

View file

@ -2861,21 +2861,20 @@ progress::-moz-progress-bar{
box-shadow: 1px 0 1px rgba(0, 0, 0, .25);
}
p.stretch-base{
div.progress p.stretch-base{
position: absolute;
border: none;
background: none;
padding: 0;
left: 70.5%;
left: var(--stretch-base-counter-position);
font-size: .75rem;
}
progress.stretch{
--starting-pos: 71.5%;
position: absolute;
left: var(--starting-pos);
left: var(--stretch-starting-position);
width: calc(100% - var(--stretch-starting-position) + 1px);
top: 0;
width: calc(100% - var(--starting-pos) + 1px);
border-top-left-radius: 0;
border-bottom-left-radius: 0;
overflow: auto; /* enable drop shadow glow */