-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from onicai/main
Merge newest changes
- Loading branch information
Showing
27 changed files
with
811 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...src/donation_frontend/components/DonationCreationProcess/CurrencyInfo/CurrencyStep.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script lang="ts"> | ||
import { currentDonationCreationObject } from "../../../store"; | ||
import PaymentTypeInfo from "./PaymentTypeInfo.svelte"; // This component displays info on the selected paymentType | ||
import PaymentOptions from './PaymentOptions.svelte'; | ||
</script> | ||
|
||
<section class="bg-white dark:bg-gray-900 bg-[url('/images/hero-pattern.svg')]" > | ||
<div class="py-8 px-4 mx-auto max-w-screen-xl text-center lg:py-16 z-10 relative"> | ||
<h1 class="mb-4 text-4xl font-extrabold tracking-tight leading-none text-gray-900 md:text-5xl lg:text-6xl dark:text-white"> | ||
Select Currency</h1> | ||
|
||
<p class="mt-4 text-black dark:text-white font-semibold">Currently selected payment type: {$currentDonationCreationObject.donation.paymentType}</p> | ||
<p class="mt-2 text-black dark:text-white">You can change the payment type. Options are available below.</p> | ||
|
||
<div class="py-4 mt-4 space-y-3 bg-blue-50 dark:bg-blue-800 shadow-md border border-gray-300 dark:border-gray-700 rounded-lg"> | ||
<PaymentTypeInfo /> | ||
</div> | ||
|
||
<PaymentOptions /> | ||
</div> | ||
</section> |
50 changes: 50 additions & 0 deletions
50
...c/donation_frontend/components/DonationCreationProcess/CurrencyInfo/PaymentOptions.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<script lang="ts"> | ||
import { currentDonationCreationObject, supportedPaymentTypes } from "../../../store"; | ||
// Reactive statement to ensure we react to changes in the current donation creation object | ||
$: currentDonation = $currentDonationCreationObject; | ||
function updatePaymentType(type) { | ||
currentDonationCreationObject.update((currentDonation) => { | ||
currentDonation.donation.paymentType = type; | ||
switch(type) { | ||
case 'BTC': | ||
currentDonation.donation.currencyUnitText = "Satoshi"; | ||
currentDonation.donation.needsCurrencyUnitAddition = true; | ||
break; | ||
case 'ckBTC': | ||
currentDonation.donation.currencyUnitText = "ckSatoshi"; | ||
currentDonation.donation.needsCurrencyUnitAddition = true; | ||
break; | ||
// Add cases for other supported payment types here | ||
}; | ||
return currentDonation; | ||
}); | ||
} | ||
// Determine available payment types based on peerToPeerPayment flag | ||
$: availablePaymentTypes = currentDonation.donation.peerToPeerPayment | ||
? Object.entries(currentDonation.recipient.recipientWalletAddresses).filter(([type, address]) => address !== null && address !== "") | ||
: Object.entries(currentDonation.donationWalletAddresses).filter(([type, address]) => address !== null && address !== ""); | ||
// Extract just the payment types for easier checking against supportedPaymentTypes | ||
$: enabledPaymentTypes = availablePaymentTypes.map(([type]) => type); | ||
</script> | ||
|
||
<div class="mt-4"> | ||
{#each $supportedPaymentTypes as type} | ||
{#if enabledPaymentTypes.includes(type)} | ||
<button | ||
on:click|preventDefault={() => updatePaymentType(type)} | ||
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded m-2"> | ||
Select {type} | ||
</button> | ||
{:else} | ||
<button | ||
disabled | ||
class="bg-gray-500 text-white font-bold py-2 px-4 rounded m-2"> | ||
{type} (Unavailable) | ||
</button> | ||
{/if} | ||
{/each} | ||
</div> |
Oops, something went wrong.