From ef05065467daae876ca9ddc1670d9f52d44418b3 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 14:22:39 +0200 Subject: [PATCH 01/19] style: add jamColor to 50% jar --- public/sprite.svg | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/public/sprite.svg b/public/sprite.svg index 858019903..b620d5c56 100644 --- a/public/sprite.svg +++ b/public/sprite.svg @@ -165,17 +165,17 @@ - - - - - - - - - - - + + + + + + + + + + + @@ -209,17 +209,17 @@ - - - - - - - - - - - + + + + + + + + + + + From 0069e351ec9994e415b0ad1827b126d3dbad614a Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 15:10:42 +0200 Subject: [PATCH 02/19] style(svg): add jamColor to all jars --- public/sprite.svg | 84 +++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/public/sprite.svg b/public/sprite.svg index b620d5c56..389f5bdfa 100644 --- a/public/sprite.svg +++ b/public/sprite.svg @@ -154,14 +154,14 @@ - - - - - - - - + + + + + + + + @@ -179,33 +179,33 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - + + + + + + + + @@ -223,19 +223,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + From 851c9c36cc164d510679edf00727dc7dae666325 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 15:11:43 +0200 Subject: [PATCH 03/19] feat: add jar flavor based on index --- src/components/jars/Jar.module.css | 20 ++++++++++++++++++++ src/components/jars/Jar.tsx | 19 ++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/components/jars/Jar.module.css b/src/components/jars/Jar.module.css index 57e428da3..247f0ddbe 100644 --- a/src/components/jars/Jar.module.css +++ b/src/components/jars/Jar.module.css @@ -8,6 +8,26 @@ margin: 0 0 0.25rem 0; } +.apricotJam { + --jamColor: #ffb765; +} + +.blueberryJam { + --jamColor: #6a9bff; +} + +.cherryJam { + --jamColor: #ff636b; +} + +.dateJam { + --jamColor: #ff422c; +} + +.elderberryJam { + --jamColor: #0c80b9; +} + .jarIndex { font-size: 0.8rem; color: var(--bs-gray-600); diff --git a/src/components/jars/Jar.tsx b/src/components/jars/Jar.tsx index 8192873a8..48dc25863 100644 --- a/src/components/jars/Jar.tsx +++ b/src/components/jars/Jar.tsx @@ -62,9 +62,26 @@ const Jar = ({ index, balance, fillLevel, isOpen = false }: JarProps) => { } }, [fillLevel, isOpen]) + const jarFlavor = useMemo(() => { + switch (index) { + case 0: + return styles.apricotJam + case 1: + return styles.blueberryJam + case 2: + return styles.cherryJam + case 3: + return styles.dateJam + case 4: + return styles.elderberryJam + default: + return styles.neutralJam + } + }, [fillLevel, isOpen]) + return (
- +
{'#' + index}
From 2fd2d7cd8e489786834b0821a9d8c069506acb74 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 15:25:27 +0200 Subject: [PATCH 04/19] style(jars): adjust date and elderberry colors --- src/components/jars/Jar.module.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/jars/Jar.module.css b/src/components/jars/Jar.module.css index 247f0ddbe..869a4002b 100644 --- a/src/components/jars/Jar.module.css +++ b/src/components/jars/Jar.module.css @@ -21,11 +21,11 @@ } .dateJam { - --jamColor: #ff422c; + --jamColor: #964b00; } .elderberryJam { - --jamColor: #0c80b9; + --jamColor: #7b3183; } .jarIndex { From d8e90b84624537afba9a713768f38fb2db31c606 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 15:27:03 +0200 Subject: [PATCH 05/19] fix: use index in memo --- src/components/jars/Jar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/jars/Jar.tsx b/src/components/jars/Jar.tsx index 48dc25863..6a9ff7804 100644 --- a/src/components/jars/Jar.tsx +++ b/src/components/jars/Jar.tsx @@ -77,7 +77,7 @@ const Jar = ({ index, balance, fillLevel, isOpen = false }: JarProps) => { default: return styles.neutralJam } - }, [fillLevel, isOpen]) + }, [index]) return (
From 37888c70ff841da23fc4f71594c87c41dc37c34d Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 15:34:22 +0200 Subject: [PATCH 06/19] feat(jar): named jars with bold initial --- src/components/jars/Jar.tsx | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/components/jars/Jar.tsx b/src/components/jars/Jar.tsx index 6a9ff7804..a1eab7440 100644 --- a/src/components/jars/Jar.tsx +++ b/src/components/jars/Jar.tsx @@ -79,10 +79,33 @@ const Jar = ({ index, balance, fillLevel, isOpen = false }: JarProps) => { } }, [index]) + const jarName = useMemo(() => { + switch (index) { + case 0: + return 'Apricot' + case 1: + return 'Blueberry' + case 2: + return 'Cherry' + case 3: + return 'Date' + case 4: + return 'Elderberry' + default: + return 'Jam' + } + }, [index]) + + const jarInitial = Array.from(jarName)[0] + const jarInitialRemoved = jarName.slice(1) + return (
-
{'#' + index}
+
+ {jarInitial} + {jarInitialRemoved} +
From 536c3ad63aa618111dc98c15d106412ea2dc5554 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 15:47:33 +0200 Subject: [PATCH 07/19] refactor: export jarName, jarInitial --- src/components/jars/Jar.tsx | 66 +++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/src/components/jars/Jar.tsx b/src/components/jars/Jar.tsx index a1eab7440..8b5ac2ba8 100644 --- a/src/components/jars/Jar.tsx +++ b/src/components/jars/Jar.tsx @@ -43,6 +43,40 @@ const calculateFillLevel = (accountBalance: number, totalBalance: number): JarFi return 0 } +const jarName = (index: Number) => { + switch (index) { + case 0: + return 'Apricot' + case 1: + return 'Blueberry' + case 2: + return 'Cherry' + case 3: + return 'Date' + case 4: + return 'Elderberry' + default: + return 'Jam' + } +} + +const jarInitial = (index: Number) => { + switch (index) { + case 0: + return 'A' + case 1: + return 'B' + case 2: + return 'C' + case 3: + return 'D' + case 4: + return 'E' + default: + return 'X' + } +} + /** * A jar with index and balance. */ @@ -62,7 +96,7 @@ const Jar = ({ index, balance, fillLevel, isOpen = false }: JarProps) => { } }, [fillLevel, isOpen]) - const jarFlavor = useMemo(() => { + const flavorStyle = useMemo(() => { switch (index) { case 0: return styles.apricotJam @@ -79,32 +113,16 @@ const Jar = ({ index, balance, fillLevel, isOpen = false }: JarProps) => { } }, [index]) - const jarName = useMemo(() => { - switch (index) { - case 0: - return 'Apricot' - case 1: - return 'Blueberry' - case 2: - return 'Cherry' - case 3: - return 'Date' - case 4: - return 'Elderberry' - default: - return 'Jam' - } - }, [index]) - - const jarInitial = Array.from(jarName)[0] - const jarInitialRemoved = jarName.slice(1) + const flavorName = jarName(index) + const flavorInitial = jarInitial(index) + const flavorInitialRemoved = flavorName.slice(1) return (
- +
- {jarInitial} - {jarInitialRemoved} + {flavorInitial} + {flavorInitialRemoved}
@@ -179,4 +197,4 @@ const OpenableJar = ({ index, balance, fillLevel, tooltipText, onClick }: JarPro ) } -export { calculateFillLevel, SelectableJar, OpenableJar } +export { calculateFillLevel, SelectableJar, OpenableJar, jarName, jarInitial } From 0b30bac5eb727749026631cfafafc96e229a8d78 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 15:53:28 +0200 Subject: [PATCH 08/19] feat(jar-detail): use initial, not index --- src/components/jar_details/JarDetailsOverlay.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/jar_details/JarDetailsOverlay.tsx b/src/components/jar_details/JarDetailsOverlay.tsx index 593d3fffd..70d699de4 100644 --- a/src/components/jar_details/JarDetailsOverlay.tsx +++ b/src/components/jar_details/JarDetailsOverlay.tsx @@ -13,6 +13,7 @@ import SegmentedTabs from '../SegmentedTabs' import { UtxoList } from './UtxoList' import { DisplayBranchHeader, DisplayBranchBody } from './DisplayBranch' import styles from './JarDetailsOverlay.module.css' +import { jarName, jarInitial } from '../jars/Jar' const TABS = { UTXOS: 'UTXOS', @@ -295,10 +296,10 @@ const JarDetailsOverlay = (props: JarDetailsOverlayProps) => { const utxoListTitle = () => { const utxos = props.utxosByAccount[accountIndex] || [] - if (utxos.length === 0) return t('jar_details.utxo_list.title_no_utxos', { jar: accountIndex }) - if (utxos.length === 1) return t('jar_details.utxo_list.title_1_utxo', { jar: accountIndex }) + if (utxos.length === 0) return t('jar_details.utxo_list.title_no_utxos', { jar: jarInitial(accountIndex) }) + if (utxos.length === 1) return t('jar_details.utxo_list.title_1_utxo', { jar: jarInitial(accountIndex) }) - return t('jar_details.utxo_list.title_num_utxos', { num: utxos.length, jar: accountIndex }) + return t('jar_details.utxo_list.title_num_utxos', { num: utxos.length, jar: jarInitial(accountIndex) }) } const refreshButton = () => { From de798a430765c43442d49d73e685637d9cd60026 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 15:58:38 +0200 Subject: [PATCH 09/19] feat(jar-detail): use initial, not index --- src/components/jar_details/JarDetailsOverlay.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/jar_details/JarDetailsOverlay.tsx b/src/components/jar_details/JarDetailsOverlay.tsx index 70d699de4..153d0c400 100644 --- a/src/components/jar_details/JarDetailsOverlay.tsx +++ b/src/components/jar_details/JarDetailsOverlay.tsx @@ -66,7 +66,9 @@ const Header = ({ account, nextAccount, previousAccount, setTab, onHide, initial
- #{account.account} + + {jarInitial(Number(account.account))} +
nextAccount()}> From 3c252cd2e24c244ad3210490e7cba87804f58910 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 16:01:58 +0200 Subject: [PATCH 10/19] feat: 'Jar #0' -> 'Jar A' --- src/i18n/locales/en/translation.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 4bf729c80..5db4f1920 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -424,9 +424,9 @@ "progress_current_state": "Waiting for transaction <1>{{ current }} of <3>{{ total }} to process...", "progress_done": "All transactions completed successfully. The scheduler will stop soon.", "precondition": { - "hint_missing_utxos": "To run the scheduler you need at least one UTXO with <2>{{ minConfirmations }} confirmations in Jar #0. Fund your wallet and wait for <6>{{ minConfirmations }} blocks.", - "hint_missing_confirmations": "The scheduler requires one of your UTXOs in Jar #0 to have <2>{{ minConfirmations }} or more confirmations. Wait for <6>{{ amountOfMissingConfirmations }} more block(s).", - "hint_missing_overall_retries": "You've tried running the scheduler unsuccessfully too many times in a row. For security reasons, you need a fresh UTXO in Jar #0 to try again. See <2>the docs for more information." + "hint_missing_utxos": "To run the scheduler you need at least one UTXO with <2>{{ minConfirmations }} confirmations in Jar A. Fund your wallet and wait for <6>{{ minConfirmations }} blocks.", + "hint_missing_confirmations": "The scheduler requires one of your UTXOs in Jar A to have <2>{{ minConfirmations }} or more confirmations. Wait for <6>{{ amountOfMissingConfirmations }} more block(s).", + "hint_missing_overall_retries": "You've tried running the scheduler unsuccessfully too many times in a row. For security reasons, you need a fresh UTXO in Jar A to try again. See <2>the docs for more information." } }, "modal": { From 9423f9fe5dc4e667241a7374d08fe382ac821604 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 16:02:37 +0200 Subject: [PATCH 11/19] fix: remove unused import --- src/components/jar_details/JarDetailsOverlay.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/jar_details/JarDetailsOverlay.tsx b/src/components/jar_details/JarDetailsOverlay.tsx index 153d0c400..cfaabea73 100644 --- a/src/components/jar_details/JarDetailsOverlay.tsx +++ b/src/components/jar_details/JarDetailsOverlay.tsx @@ -13,7 +13,7 @@ import SegmentedTabs from '../SegmentedTabs' import { UtxoList } from './UtxoList' import { DisplayBranchHeader, DisplayBranchBody } from './DisplayBranch' import styles from './JarDetailsOverlay.module.css' -import { jarName, jarInitial } from '../jars/Jar' +import { jarInitial } from '../jars/Jar' const TABS = { UTXOS: 'UTXOS', From 38a581cd249c720b0a451f21f6f6d59973d4ecfc Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 16:05:05 +0200 Subject: [PATCH 12/19] feat(fidelity-bonds): use initial, not index --- src/components/fb/FidelityBondSteps.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/fb/FidelityBondSteps.tsx b/src/components/fb/FidelityBondSteps.tsx index ff04f7804..01a7b656b 100644 --- a/src/components/fb/FidelityBondSteps.tsx +++ b/src/components/fb/FidelityBondSteps.tsx @@ -13,6 +13,7 @@ import { CopyButton } from '../CopyButton' import LockdateForm from './LockdateForm' import * as fb from './utils' import styles from './FidelityBondSteps.module.css' +import { jarInitial } from '../jars/Jar' const cx = classnamesBind.bind(styles) @@ -169,7 +170,7 @@ const SelectUtxos = ({ walletInfo, jar, utxos, selectedUtxos, onUtxoSelected, on return (
-
{t('earn.fidelity_bond.select_utxos.description', { jar })}
+
{t('earn.fidelity_bond.select_utxos.description', jarInitial(jar))}
{utxos.map((utxo, index) => { return ( {t('earn.fidelity_bond.freeze_utxos.description_unselected_utxos')}{' '} - {t('earn.fidelity_bond.freeze_utxos.description_selected_utxos_to_freeze', { jar })} + {t('earn.fidelity_bond.freeze_utxos.description_selected_utxos_to_freeze', jarInitial(jar))}
)} {utxosToFreeze.map((utxo, index) => ( @@ -292,7 +293,7 @@ const ReviewInputs = ({ lockDate, jar, utxos, selectedUtxos, timelockedAddress } { icon: , label: t('earn.fidelity_bond.review_inputs.label_jar'), - content: t('earn.fidelity_bond.review_inputs.label_jar_n', { jar }), + content: t('earn.fidelity_bond.review_inputs.label_jar_n', jarInitial(jar)), }, { icon: , From 66fd3cbf4f209e214b6765cd34a89de5b4d6e359 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 16:05:36 +0200 Subject: [PATCH 13/19] feat: "Jar #{n}" -> "Jar {X}" --- src/i18n/locales/en/translation.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 5db4f1920..052566eac 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -290,7 +290,7 @@ "text_primary_button": "Next", "text_primary_button_unsafe": "Select potentially less private UTXOs", "text_secondary_button": "Cancel", - "description": "Select one or more UTXOs from Jar #{{ jar }} to use for the fidelity bond.", + "description": "Select one or more UTXOs from Jar {{ jar }} to use for the fidelity bond.", "utxo_card": { "confirmations": "{{ confs }} Confirmations", "label_frozen": "frozen", @@ -305,7 +305,7 @@ "text_secondary_button": "Cancel", "description_selected_utxos": "Selected UTXOs:", "description_unselected_utxos": "The following UTXOs will not be used for the fidelity bond:", - "description_selected_utxos_to_freeze": "They will be frozen to remain in Jar #{{ jar }}. You can unfreeze them anytime after creating the bond." + "description_selected_utxos_to_freeze": "They will be frozen to remain in Jar {{ jar }}. You can unfreeze them anytime after creating the bond." }, "review_inputs": { "text_primary_button": "Create fidelity bond", @@ -314,7 +314,7 @@ "description": "You configured the fidelity bond as follows:", "label_lock_date": "Locked until", "label_jar": "Funded from", - "label_jar_n": "Jar #{{ jar }}", + "label_jar_n": "Jar {{ jar }}", "label_amount": "Amount to be locked", "label_address": "Funds will be time-locked and sent to", "label_selected_utxos": "UTXOs that will be time-locked:" From 8af0dc9682c273365b291a5512d300c666861c34 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 16:10:54 +0200 Subject: [PATCH 14/19] feat(send): use jar initial, not index --- src/components/Send.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/Send.jsx b/src/components/Send.jsx index 722f331e3..4b288e74b 100644 --- a/src/components/Send.jsx +++ b/src/components/Send.jsx @@ -20,6 +20,7 @@ import { SATS, formatBtc, formatSats } from '../utils' import { routes } from '../constants/routes' import styles from './Send.module.css' import { ConfirmModal } from './Modal' +import { jarInitial } from './jars/Jar' const IS_COINJOIN_DEFAULT_VAL = true // initial value for `minimum_makers` from the default joinmarket.cfg (last check on 2022-02-20 of v0.9.5) @@ -954,9 +955,7 @@ export default function Send() { {t('send.confirm_modal.label_source_jar')} - {t('send.confirm_modal.text_source_jar', { - jarId: `#${account}`, - })} + {t('send.confirm_modal.text_source_jar', { jarId: jarInitial(account) })} From f5fa43b7b4ee7aefaa093e884878dc16304d8b3c Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 18 Aug 2022 16:25:35 +0200 Subject: [PATCH 15/19] feat(send): use full name in from & recipient --- src/components/Send.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Send.jsx b/src/components/Send.jsx index 4b288e74b..af68194bb 100644 --- a/src/components/Send.jsx +++ b/src/components/Send.jsx @@ -20,7 +20,7 @@ import { SATS, formatBtc, formatSats } from '../utils' import { routes } from '../constants/routes' import styles from './Send.module.css' import { ConfirmModal } from './Modal' -import { jarInitial } from './jars/Jar' +import { jarInitial, jarName } from './jars/Jar' const IS_COINJOIN_DEFAULT_VAL = true // initial value for `minimum_makers` from the default joinmarket.cfg (last check on 2022-02-20 of v0.9.5) @@ -770,7 +770,7 @@ export default function Send() { .sort((lhs, rhs) => lhs.accountIndex - rhs.accountIndex) .map(({ accountIndex, totalBalance, calculatedTotalBalanceInSats }) => (