diff --git a/src/app/components/Zap.svelte b/src/app/components/Zap.svelte index 56aa79a2..1fffdb1b 100644 --- a/src/app/components/Zap.svelte +++ b/src/app/components/Zap.svelte @@ -1,4 +1,5 @@ @@ -145,12 +118,15 @@ {/snippet} - + + {#each $zapAmounts as preset} + selectAmount(preset)}> + {preset} + + {/each} + diff --git a/src/app/components/ZapInvoice.svelte b/src/app/components/ZapInvoice.svelte index f11f71c0..7bcc8b37 100644 --- a/src/app/components/ZapInvoice.svelte +++ b/src/app/components/ZapInvoice.svelte @@ -1,5 +1,6 @@ @@ -189,12 +162,15 @@ {/snippet} - + + {#each $zapAmounts as preset} + selectAmount(preset)}> + {preset} + + {/each} + Want to zap directly? diff --git a/src/app/settings.ts b/src/app/settings.ts index 71e6c006..9d02cf02 100644 --- a/src/app/settings.ts +++ b/src/app/settings.ts @@ -109,6 +109,10 @@ export const notificationSettings = withGetter( }), ) +export const defaultZapAmounts = [21, 210, 2100, 21000] + +export const zapAmounts = withGetter(writable([...defaultZapAmounts])) + export const makeSettings = async (params: Partial) => { const json = JSON.stringify({...get(userSettingsValues), ...params}) const content = await signer.get().nip44.encrypt(pubkey.get()!, json) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 210610a0..fc1671a5 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -35,7 +35,7 @@ import {authPolicy, blockPolicy, trustPolicy, mostlyRestrictedPolicy} from "@app/policies" import {db, kv, ss} from "@app/storage" import {device} from "@app/device" - import {getSetting, userSettingsValues, notificationSettings} from "@app/settings" + import {getSetting, userSettingsValues, notificationSettings, zapAmounts} from "@app/settings" import {DUFFLEPUD_URL, INDEXER_RELAYS, POMADE_SIGNERS} from "@app/env" import {pushState} from "@app/push/adapters/common" import {syncApplicationData} from "@app/sync" @@ -200,6 +200,11 @@ store: notificationSettings, storage: kv, }), + sync({ + key: "zapAmounts", + store: zapAmounts, + storage: kv, + }), sync({ key: "notificationState", store: pushState, diff --git a/src/routes/settings/wallet/+page.svelte b/src/routes/settings/wallet/+page.svelte index a3119af6..45c6e77a 100644 --- a/src/routes/settings/wallet/+page.svelte +++ b/src/routes/settings/wallet/+page.svelte @@ -1,12 +1,17 @@ @@ -206,4 +258,50 @@ {/if} + + + + Zap Amounts + + Preset amounts shown when sending a zap. + + {#each zapAmountDraft as amount, index} + + removeZapAmount(index)} + disabled={zapAmountDraft.length === 1}> + + + + + + + + {/each} + + + Add amount + + + + + Discard Changes + + + Save Changes + + +
Want to zap directly? diff --git a/src/app/settings.ts b/src/app/settings.ts index 71e6c006..9d02cf02 100644 --- a/src/app/settings.ts +++ b/src/app/settings.ts @@ -109,6 +109,10 @@ export const notificationSettings = withGetter( }), ) +export const defaultZapAmounts = [21, 210, 2100, 21000] + +export const zapAmounts = withGetter(writable([...defaultZapAmounts])) + export const makeSettings = async (params: Partial) => { const json = JSON.stringify({...get(userSettingsValues), ...params}) const content = await signer.get().nip44.encrypt(pubkey.get()!, json) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 210610a0..fc1671a5 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -35,7 +35,7 @@ import {authPolicy, blockPolicy, trustPolicy, mostlyRestrictedPolicy} from "@app/policies" import {db, kv, ss} from "@app/storage" import {device} from "@app/device" - import {getSetting, userSettingsValues, notificationSettings} from "@app/settings" + import {getSetting, userSettingsValues, notificationSettings, zapAmounts} from "@app/settings" import {DUFFLEPUD_URL, INDEXER_RELAYS, POMADE_SIGNERS} from "@app/env" import {pushState} from "@app/push/adapters/common" import {syncApplicationData} from "@app/sync" @@ -200,6 +200,11 @@ store: notificationSettings, storage: kv, }), + sync({ + key: "zapAmounts", + store: zapAmounts, + storage: kv, + }), sync({ key: "notificationState", store: pushState, diff --git a/src/routes/settings/wallet/+page.svelte b/src/routes/settings/wallet/+page.svelte index a3119af6..45c6e77a 100644 --- a/src/routes/settings/wallet/+page.svelte +++ b/src/routes/settings/wallet/+page.svelte @@ -1,12 +1,17 @@ @@ -206,4 +258,50 @@ {/if} + + + + Zap Amounts + + Preset amounts shown when sending a zap. + + {#each zapAmountDraft as amount, index} + + removeZapAmount(index)} + disabled={zapAmountDraft.length === 1}> + + + + + + + + {/each} + + + Add amount + + + + + Discard Changes + + + Save Changes + + +
Preset amounts shown when sending a zap.