From d4eaa00e9b0cebe7d6036d8d0dfbaf3c7927d601 Mon Sep 17 00:00:00 2001 From: KKA11010 Date: Mon, 18 Dec 2023 13:44:49 +0100 Subject: [PATCH 01/13] update the release context and component --- assets/translations/de.json | 3 ++- assets/translations/en.json | 3 ++- assets/translations/es.json | 3 ++- assets/translations/fr.json | 3 ++- assets/translations/hu.json | 3 ++- assets/translations/sw.json | 3 ++- src/components/Icons.tsx | 7 +++++++ src/context/Release.tsx | 14 ++++++++++---- src/screens/Settings/MenuItem.tsx | 6 ++++-- src/screens/Settings/index.tsx | 16 ++++++++++------ 10 files changed, 43 insertions(+), 18 deletions(-) diff --git a/assets/translations/de.json b/assets/translations/de.json index 2407dac6..ef153b90 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -263,7 +263,8 @@ "swapHint": "Diese Option erfordert eine Lightning-Zahlung, bringt Gebühren mit sich und kann die unbekannte Mint dennoch zur Liste hinzufügen, wenn eine Gebühren-Rückzahlung erfolgt.", "trustHint": "Die mit dem Token verbundene Mint wird zu Ihrer Vertrauensliste hinzugefügt.", "noDefaultHint": "Sie müssen eine Standard-Mint einrichten, um einen automatischen Tausch durchzuführen.", - "autoSwapSuccess": "Tausch erfolgreich!" + "autoSwapSuccess": "Tausch erfolgreich!", + "noReleaseData": "Keine Versionsdaten verfügbar" }, "error": { "checkSpendableErr": "Fehler beim Überprüfen, ob der Token ausgegeben werden kann", diff --git a/assets/translations/en.json b/assets/translations/en.json index 15fb2fd7..11bf8324 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -263,7 +263,8 @@ "swapHint": "This option requires a Lightning payment, involves fees, and may still add the unknown mint to the list if a fee refund occurs.", "trustHint": "The mint associated with the token will be added to your trusted list.", "noDefaultHint": "You need to setup a default mint to perform an auto swap.", - "autoSwapSuccess": "Swap successful!" + "autoSwapSuccess": "Swap successful!", + "noReleaseData": "Release data not available" }, "error": { "checkSpendableErr": "Error while checking if token is spendable", diff --git a/assets/translations/es.json b/assets/translations/es.json index ced34a39..f8b7c5d0 100644 --- a/assets/translations/es.json +++ b/assets/translations/es.json @@ -263,7 +263,8 @@ "swapHint": "Esta opción requiere un pago Lightning, implica una tarifa y aún puede agregar la ceca desconocida a la lista si se produce un reembolso de tarifa.", "trustHint": "La ceca asociada al token se añadirá a tu lista de confianza.", "noDefaultHint": "Necesitas configurar una ceca predeterminada para realizar un intercambio automático.", - "autoSwapSuccess": "¡Intercambio exitoso!" + "autoSwapSuccess": "¡Intercambio exitoso!", + "noReleaseData": "No hay datos de versión" }, "error": { "checkSpendableErr": "Error al comprobar si el token puede ser gastado", diff --git a/assets/translations/fr.json b/assets/translations/fr.json index bd9fc499..e85b57f4 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -263,7 +263,8 @@ "swapHint": "Ce choix nécessite un paiement Lightning et peut entraîner des frais associés.", "trustHint": "La menthe associée au jeton sera ajoutée à votre liste de confiance.", "noDefaultHint": "Vous devez configurer une mint par défaut pour effectuer un échange automatique.", - "autoSwapSuccess": "Échange réussi!" + "autoSwapSuccess": "Échange réussi!", + "noReleaseData": "Donnée de version indisponible" }, "error": { "checkSpendableErr": "Erreur lors de la vérification si le token est dépensable", diff --git a/assets/translations/hu.json b/assets/translations/hu.json index 14996ad7..f32a1edf 100644 --- a/assets/translations/hu.json +++ b/assets/translations/hu.json @@ -263,7 +263,8 @@ "swapHint": "Ez az opció egy Lightning-fizetést igényel ami költségekkel jár, és még akkor is hozzáadhatja az ismeretlen verdét a listádhoz, ha költségvisszatérítésre kerül sor.", "trustHint": "A tokenhez kapcsolódó verde hozzá lesz adva a megbízott listához.", "noDefaultHint": "Be kell állítanod egy alapértelmezett verdét az automatikus cseréhez.", - "autoSwapSuccess": "Csere sikeres!" + "autoSwapSuccess": "Csere sikeres!", + "noReleaseData": "Nincs elérhető verzió információ" }, "error": { "checkSpendableErr": "Hiba a token elkölthetőségének ellenőrzése közben", diff --git a/assets/translations/sw.json b/assets/translations/sw.json index 8ba1ff1f..2e6c2204 100644 --- a/assets/translations/sw.json +++ b/assets/translations/sw.json @@ -263,7 +263,8 @@ "swapHint": "Chaguo hili linahitaji malipo ya Lightning, linajumuisha ada, na linaweza bado kuongeza mint isiyojulikana kwenye orodha ikiwa kuna marejesho ya ada.", "trustHint": "Minti inayohusiana na alama itaongezwa kwenye orodha yako ya kuaminika.", "noDefaultHint": "Unahitaji kuweka kalibu ya kufanya ubadilishaji wa moja kwa moja.", - "autoSwapSuccess": "Kubadilishana kufanikiwa!" + "autoSwapSuccess": "Kubadilishana kufanikiwa!", + "noReleaseData": "Hakuna data ya toleo" }, "error": { "checkSpendableErr": "Kumetokea kosa wakati wa kuangalia ikiwa kijenzi kina pesa za kutumiwa", diff --git a/src/components/Icons.tsx b/src/components/Icons.tsx index 06cd7301..c162ff95 100644 --- a/src/components/Icons.tsx +++ b/src/components/Icons.tsx @@ -632,6 +632,13 @@ export function BatteryChargingIcon({ width, height, color }: TIconProps) { ) } +export function ConnectionErrorIcon({ width, height, color }: TIconProps) { + return ( + + + + ) +} const styles = StyleSheet.create({ nostrIcon: { marginLeft: -5 diff --git a/src/context/Release.tsx b/src/context/Release.tsx index 4c685e83..223cc2cb 100644 --- a/src/context/Release.tsx +++ b/src/context/Release.tsx @@ -1,3 +1,4 @@ +import { l } from '@log' import type { GithubLatest } from '@model/github' import { extractVersion, getLatestVersion } from '@util/github' import { createContext, useContext, useEffect, useState } from 'react' @@ -10,10 +11,15 @@ const useRelease = () => { useEffect(() => { void (async () => { - const releaseInfo = await getLatestVersion() - setInfo(releaseInfo) - const latest = extractVersion(releaseInfo.tag_name) - setIsOutdated(latest !== version) + try { + const releaseInfo = await getLatestVersion() + if (!releaseInfo) { return l('[useRelease] no release info') } + setInfo(releaseInfo) + const latest = extractVersion(releaseInfo.tag_name) + setIsOutdated(latest !== version) + } catch (error) { + l('[useRelease] error', error) + } })() }, []) diff --git a/src/screens/Settings/MenuItem.tsx b/src/screens/Settings/MenuItem.tsx index c74d34bb..49f16a80 100644 --- a/src/screens/Settings/MenuItem.tsx +++ b/src/screens/Settings/MenuItem.tsx @@ -12,21 +12,23 @@ interface IMenuItemProps { icon: React.ReactElement hasSeparator?: boolean hasChevron?: boolean + disabled?: boolean } -export default function SettingsMenuItem({ txt, icon, onPress, hasSeparator, hasChevron }: IMenuItemProps) { +export default function SettingsMenuItem({ txt, icon, onPress, hasSeparator, hasChevron, disabled }: IMenuItemProps) { const { color } = useThemeContext() return ( <> {icon} {hasChevron && } diff --git a/src/screens/Settings/index.tsx b/src/screens/Settings/index.tsx index ab9860c5..f90d6eef 100644 --- a/src/screens/Settings/index.tsx +++ b/src/screens/Settings/index.tsx @@ -1,4 +1,4 @@ -import { AboutIcon, HeartIcon, MintBoardIcon, OptionsIcon, ReadmeIcon, ReleaseTagIcon } from '@comps/Icons' +import { AboutIcon, ConnectionErrorIcon, HeartIcon, MintBoardIcon, OptionsIcon, ReadmeIcon, ReleaseTagIcon } from '@comps/Icons' import { ZapModal } from '@comps/modal/Zap' import Screen from '@comps/Screen' import Txt from '@comps/Txt' @@ -22,7 +22,7 @@ import MenuItem from './MenuItem' export default function Settings({ navigation, route }: TSettingsPageProps) { const { t } = useTranslation([NS.common]) const { color } = useThemeContext() - const { isOutdated } = useReleaseContext() + const { info, isOutdated } = useReleaseContext() const [confirmReset, setConfirmReset] = useState(false) const [zapModal, setZapModal] = useState(false) @@ -63,10 +63,14 @@ export default function Settings({ navigation, route }: TSettingsPageProps) { hasChevron /> : } - onPress={() => navigation.navigate('release')} - hasChevron + txt={!info ? t('noReleaseData') : isOutdated ? t('newRelease') : t('releaseNotes')} + icon={!info ? : isOutdated ? : } + onPress={() => { + if (!info) { return } + navigation.navigate('release') + }} + disabled={!info} + hasChevron={!!info} hasSeparator /> Date: Mon, 18 Dec 2023 14:05:35 +0100 Subject: [PATCH 02/13] improve pin screen contrast for light themes --- src/screens/Auth/Hint.tsx | 10 +++++----- src/screens/Auth/PinDots.tsx | 5 ++++- src/screens/Auth/PinPad.tsx | 14 +++++++------- src/screens/Auth/index.tsx | 22 +++++++++++----------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/screens/Auth/Hint.tsx b/src/screens/Auth/Hint.tsx index cb90d7b9..9d54b772 100644 --- a/src/screens/Auth/Hint.tsx +++ b/src/screens/Auth/Hint.tsx @@ -1,5 +1,6 @@ +import { useThemeContext } from '@src/context/Theme' import { NS } from '@src/i18n' -import { mainColors } from '@src/styles' +import { getColor } from '@styles/colors' import { useTranslation } from 'react-i18next' import { Text } from 'react-native' import { ScaledSheet } from 'react-native-size-matters' @@ -13,6 +14,7 @@ interface IPinHintProps { export default function PinHint({ confirm, login, shouldEdit, shouldRemove }: IPinHintProps) { const { t } = useTranslation([NS.auth]) + const { color, highlight } = useThemeContext() const getRightHeaderTxt = () => { if (login && !shouldEdit && !shouldRemove) { return t('welcomeBack') } if (shouldRemove) { return t('removePin') } @@ -30,11 +32,11 @@ export default function PinHint({ confirm, login, shouldEdit, shouldRemove }: IP return ( <> {!confirm && - + {getRightHeaderTxt()} } - + {getRightTxt()} @@ -44,12 +46,10 @@ export default function PinHint({ confirm, login, shouldEdit, shouldRemove }: IP const styles = ScaledSheet.create({ welcome: { fontSize: '20@vs', - color: mainColors.WHITE, marginVertical: '10@vs', }, txt: { fontSize: '12@vs', - color: mainColors.WHITE, textAlign: 'center', marginBottom: '20@vs', paddingHorizontal: '20@s', diff --git a/src/screens/Auth/PinDots.tsx b/src/screens/Auth/PinDots.tsx index 54745571..e6248855 100644 --- a/src/screens/Auth/PinDots.tsx +++ b/src/screens/Auth/PinDots.tsx @@ -1,11 +1,14 @@ +import { useThemeContext } from '@src/context/Theme' import { mainColors } from '@styles' +import { getColor } from '@styles/colors' import { View } from 'react-native' import { s, ScaledSheet } from 'react-native-size-matters' export default function PinDots({ input, mismatch }: { input: number[], mismatch?: boolean }) { + const { color, highlight } = useThemeContext() return ( - {input.map((_n, i) => )} + {input.map((_n, i) => )} ) } diff --git a/src/screens/Auth/PinPad.tsx b/src/screens/Auth/PinPad.tsx index 6ee68f22..ea68d0cf 100644 --- a/src/screens/Auth/PinPad.tsx +++ b/src/screens/Auth/PinPad.tsx @@ -1,5 +1,6 @@ import { BackspaceIcon, CheckmarkIcon } from '@comps/Icons' import { useThemeContext } from '@src/context/Theme' +import { getColor } from '@styles/colors' import { getPinpadBg, mainColors } from '@styles' import { Text, TouchableOpacity, View } from 'react-native' import { s, ScaledSheet } from 'react-native-size-matters' @@ -21,7 +22,7 @@ interface IPinPadProps { } export default function PinPad({ pinInput, confirmInput, isConfirm, mismatch, handleInput }: IPinPadProps) { - const { highlight } = useThemeContext() + const { color, highlight } = useThemeContext() // should pad input be disabled const shouldDisablePad = (val: number) => ( mismatch || @@ -51,15 +52,15 @@ export default function PinPad({ pinInput, confirmInput, isConfirm, mismatch, ha style={[styles.numWrap, pad.n < 10 ? { backgroundColor: getPinpadBg(highlight) } : {}]} disabled={shouldDisablePad(pad.n)} > - {pad.n === 10 ? // backspace - : pad.n === 11 ? // submit + {pad.n === 10 ? // backspace + : pad.n === 11 ? // submit : // number pads <> - + {pad.n} {pad.t && - + {pad.t} } @@ -91,10 +92,9 @@ const styles = ScaledSheet.create({ num: { fontSize: '24@vs', fontWeight: '300', - color: mainColors.WHITE, }, char: { fontSize: '8@vs', - color: mainColors.WHITE, + marginTop: '-4@vs', }, }) \ No newline at end of file diff --git a/src/screens/Auth/index.tsx b/src/screens/Auth/index.tsx index 89844dba..ff499e48 100644 --- a/src/screens/Auth/index.tsx +++ b/src/screens/Auth/index.tsx @@ -10,6 +10,7 @@ import { NS } from '@src/i18n' import { secureStore, store } from '@store' import { SECURESTORE_KEY, STORE_KEYS } from '@store/consts' import { highlight as hi, mainColors } from '@styles' +import { getColor } from '@styles/colors' import { formatSeconds, vib } from '@util' import { hash256 } from '@util/crypto' import { useContext, useEffect, useState } from 'react' @@ -26,7 +27,7 @@ export default function AuthPage({ navigation, route }: TAuthPageProps) { const { pinHash, shouldEdit, shouldRemove } = route.params const { t } = useTranslation([NS.common]) const { anim, shake } = useShakeAnimation() - const { highlight } = useThemeContext() + const { color, highlight } = useThemeContext() // PIN mismatch context const { attempts, setAttempts } = useContext(PinCtx) // auth state @@ -226,16 +227,16 @@ export default function AuthPage({ navigation, route }: TAuthPageProps) { ]} > {success ? - + : <> {attempts.locked && !isConfirm && } - + {!shouldEdit && !shouldRemove && auth.length > 0 && - + } {attempts.locked && !isConfirm && @@ -248,12 +249,12 @@ export default function AuthPage({ navigation, route }: TAuthPageProps) { : {attempts.mismatch && - + } {shouldShowPinSection() ? @@ -318,7 +319,6 @@ const styles = ScaledSheet.create({ lockTxt: { marginTop: '10@vs', marginBottom: '20@vs', - color: mainColors.WHITE }, bottomSection: { justifyContent: 'center', From 534a99e20f99d3e7dcd26654f5e7dccf8c75dd4c Mon Sep 17 00:00:00 2001 From: KKA11010 Date: Mon, 18 Dec 2023 14:07:11 +0100 Subject: [PATCH 03/13] lint --- src/screens/Auth/PinPad.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/Auth/PinPad.tsx b/src/screens/Auth/PinPad.tsx index ea68d0cf..fed24db5 100644 --- a/src/screens/Auth/PinPad.tsx +++ b/src/screens/Auth/PinPad.tsx @@ -1,7 +1,7 @@ import { BackspaceIcon, CheckmarkIcon } from '@comps/Icons' import { useThemeContext } from '@src/context/Theme' -import { getColor } from '@styles/colors' import { getPinpadBg, mainColors } from '@styles' +import { getColor } from '@styles/colors' import { Text, TouchableOpacity, View } from 'react-native' import { s, ScaledSheet } from 'react-native-size-matters' From 13eece25ff652a64335bcd41c8f05b56ed2178e1 Mon Sep 17 00:00:00 2001 From: KKA11010 Date: Mon, 18 Dec 2023 14:33:29 +0100 Subject: [PATCH 04/13] fix buggy bottom nav, Fixes #285 --- src/components/nav/BottomNav.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/nav/BottomNav.tsx b/src/components/nav/BottomNav.tsx index 9a1ed085..20276b99 100644 --- a/src/components/nav/BottomNav.tsx +++ b/src/components/nav/BottomNav.tsx @@ -109,6 +109,6 @@ const styles = ScaledSheet.create({ }, iconTxt: { fontSize: '12@vs', - marginTop: '4@vs', + marginTop: '2@vs', } }) \ No newline at end of file From e605d58f131a54a4072c65ebc2a676ed189b98ec Mon Sep 17 00:00:00 2001 From: KKA11010 Date: Mon, 18 Dec 2023 15:33:30 +0100 Subject: [PATCH 05/13] improve UX while scanning from history details --- src/screens/History/Details.tsx | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/screens/History/Details.tsx b/src/screens/History/Details.tsx index 61ad19d9..a2eed7df 100644 --- a/src/screens/History/Details.tsx +++ b/src/screens/History/Details.tsx @@ -58,6 +58,7 @@ export default function DetailsPage({ navigation, route }: THistoryEntryPageProp const tokenMemo = useMemo(() => !isLn.current && type !== txType.RESTORE ? getDecodedToken(value).memo : t('noMemo', { ns: NS.history }), [t, value, type]) const { openPromptAutoClose } = usePromptContext() const [customMints, setCustomMints] = useState([{ mintUrl: '', customName: '' }]) + const intervalRef = useRef(null) useEffect(() => { void (async () => { @@ -158,6 +159,42 @@ export default function DetailsPage({ navigation, route }: THistoryEntryPageProp return t('noMemo', { ns: NS.history }) } + // used in interval to check if token is spent while qr sheet is open + const checkPayment = async () => { + l('checking if token has been spent') + l('checking if token has been spent promise') + const isSpendable = await isTokenSpendable(value) + setSpent(!isSpendable) + if (!isSpendable) { + clearTokenInterval() + setQr({ ...qr, open: false }) + openPromptAutoClose({ msg: t('isSpent', { ns: NS.history }), success: true }) + // update history item + await historyStore.updateHistoryEntry(route.params.entry, { ...route.params.entry, isSpent: true }) + } + } + + const startTokenInterval = () => { + if (spent) { return } + intervalRef.current = setInterval(() => { + void checkPayment() + }, 3000) + } + + const clearTokenInterval = () => { + if (intervalRef.current) { + clearInterval(intervalRef.current) + } + } + + // auto check payment in intervals + useEffect(() => { + if (!qr.open || spent) { return clearTokenInterval() } + startTokenInterval() + return () => clearTokenInterval() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [qr.open]) + return ( Date: Tue, 19 Dec 2023 10:09:54 +0100 Subject: [PATCH 06/13] update deps and children types to jsx.element --- package-lock.json | 18 +++++++++--------- package.json | 18 +++++++++--------- src/components/App.tsx | 2 +- src/components/Screen.tsx | 2 +- src/components/modal/index.tsx | 2 +- src/context/FocusClaim.tsx | 2 +- src/context/Keyboard.tsx | 2 +- src/context/Nostr.tsx | 2 +- src/context/Privacy.tsx | 2 +- src/context/Prompt.tsx | 2 +- src/context/Release.tsx | 2 +- src/context/Theme.tsx | 2 +- 12 files changed, 28 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7f0cc9cf..e3c3969d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,22 +58,22 @@ "@babel/core": "^7.23.6", "@babel/plugin-proposal-private-methods": "^7.18.6", "@getify/eslint-plugin-proper-arrows": "^11.0.3", - "@testing-library/react-native": "^12.4.1", + "@testing-library/react-native": "^12.4.2", "@types/babel__core": "^7.20.5", "@types/crypto-js": "^4.2.1", "@types/jest": "^29.5.11", - "@types/node": "^20.10.4", - "@types/react": "~18.2.43", + "@types/node": "^20.10.5", + "@types/react": "~18.2.45", "@types/react-native-onboarding-swiper": "^1.1.8", "@types/sqlite3": "^3.1.11", - "@typescript-eslint/eslint-plugin": "^6.14.0", - "@typescript-eslint/parser": "^6.14.0", + "@typescript-eslint/eslint-plugin": "^6.15.0", + "@typescript-eslint/parser": "^6.15.0", "dotenv": "^16.3.1", - "eslint": "^8.55.0", + "eslint": "^8.56.0", "eslint-plugin-deprecate": "^0.8.4", - "eslint-plugin-import": "^2.29.0", + "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^27.6.0", - "eslint-plugin-jsdoc": "^46.9.0", + "eslint-plugin-jsdoc": "^46.9.1", "eslint-plugin-json": "^3.1.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^6.1.1", @@ -84,7 +84,7 @@ "expo-dev-client": "~2.4.12", "jest": "^29.7.0", "jest-expo": "^49.0.0", - "metro-config": "^0.80.1", + "metro-config": "^0.80.2", "prettier": "^3.1.1", "ts-jest": "^29.1.1", "ts-jest-resolver": "^2.0.1", diff --git a/package.json b/package.json index c2c2aac4..04c5a8c1 100644 --- a/package.json +++ b/package.json @@ -88,22 +88,22 @@ "@babel/core": "^7.23.6", "@babel/plugin-proposal-private-methods": "^7.18.6", "@getify/eslint-plugin-proper-arrows": "^11.0.3", - "@testing-library/react-native": "^12.4.1", + "@testing-library/react-native": "^12.4.2", "@types/babel__core": "^7.20.5", "@types/crypto-js": "^4.2.1", "@types/jest": "^29.5.11", - "@types/node": "^20.10.4", - "@types/react": "~18.2.43", + "@types/node": "^20.10.5", + "@types/react": "~18.2.45", "@types/react-native-onboarding-swiper": "^1.1.8", "@types/sqlite3": "^3.1.11", - "@typescript-eslint/eslint-plugin": "^6.14.0", - "@typescript-eslint/parser": "^6.14.0", + "@typescript-eslint/eslint-plugin": "^6.15.0", + "@typescript-eslint/parser": "^6.15.0", "dotenv": "^16.3.1", - "eslint": "^8.55.0", + "eslint": "^8.56.0", "eslint-plugin-deprecate": "^0.8.4", - "eslint-plugin-import": "^2.29.0", + "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^27.6.0", - "eslint-plugin-jsdoc": "^46.9.0", + "eslint-plugin-jsdoc": "^46.9.1", "eslint-plugin-json": "^3.1.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^6.1.1", @@ -114,7 +114,7 @@ "expo-dev-client": "~2.4.12", "jest": "^29.7.0", "jest-expo": "^49.0.0", - "metro-config": "^0.80.1", + "metro-config": "^0.80.2", "prettier": "^3.1.1", "ts-jest": "^29.1.1", "ts-jest-resolver": "^2.0.1", diff --git a/src/components/App.tsx b/src/components/App.tsx index d390f3b2..ac6f08ca 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -238,7 +238,7 @@ function _App() { ) } -function NavContainer({ children }: { children: React.ReactNode }) { +function NavContainer({ children }: { children: JSX.Element | JSX.Element[] }) { const navigation = useRef>(null) const { theme } = useThemeContext() diff --git a/src/components/Screen.tsx b/src/components/Screen.tsx index 3450a45d..cd905840 100644 --- a/src/components/Screen.tsx +++ b/src/components/Screen.tsx @@ -4,7 +4,7 @@ import { globals } from '@styles' import { View } from 'react-native' interface IContainerProps { - children: React.ReactNode + children: JSX.Element | JSX.Element[] screenName?: string withBackBtn?: boolean withCancelBtn?: boolean diff --git a/src/components/modal/index.tsx b/src/components/modal/index.tsx index 1f2d069a..799fca98 100644 --- a/src/components/modal/index.tsx +++ b/src/components/modal/index.tsx @@ -12,7 +12,7 @@ interface IMyModalProps { success?: boolean hasNoPadding?: boolean close?: () => void - children: React.ReactNode + children: JSX.Element | JSX.Element[] } export default function MyModal({ diff --git a/src/context/FocusClaim.tsx b/src/context/FocusClaim.tsx index d8a0eeec..9553f3f8 100644 --- a/src/context/FocusClaim.tsx +++ b/src/context/FocusClaim.tsx @@ -108,7 +108,7 @@ const FocusClaimCtx = createContext({ export const useFocusClaimContext = () => useContext(FocusClaimCtx) -export const FocusClaimProvider = ({ children }: { children: React.ReactNode }) => ( +export const FocusClaimProvider = ({ children }: { children: JSX.Element }) => ( {children} diff --git a/src/context/Keyboard.tsx b/src/context/Keyboard.tsx index dbddde81..825ce220 100644 --- a/src/context/Keyboard.tsx +++ b/src/context/Keyboard.tsx @@ -29,7 +29,7 @@ const KeyboardCtx = createContext({ export const useKeyboardCtx = () => useContext(KeyboardCtx) -export const KeyboardProvider = ({ children }: { children: React.ReactNode }) => ( +export const KeyboardProvider = ({ children }: { children: JSX.Element | JSX.Element[] }) => ( {children} diff --git a/src/context/Nostr.tsx b/src/context/Nostr.tsx index ea667c47..c507d800 100644 --- a/src/context/Nostr.tsx +++ b/src/context/Nostr.tsx @@ -128,7 +128,7 @@ const NostrContext = createContext({ export const useNostrContext = () => useContext(NostrContext) -export const NostrProvider = ({ children }: { children: React.ReactNode }) => ( +export const NostrProvider = ({ children }: { children: JSX.Element }) => ( {children} diff --git a/src/context/Privacy.tsx b/src/context/Privacy.tsx index 06a802ea..2f13c14d 100644 --- a/src/context/Privacy.tsx +++ b/src/context/Privacy.tsx @@ -81,7 +81,7 @@ const PrivacyContext = createContext({ export const usePrivacyContext = () => useContext(PrivacyContext) -export const PrivacyProvider = ({ children }: { children: React.ReactNode }) => ( +export const PrivacyProvider = ({ children }: { children: JSX.Element }) => ( {children} diff --git a/src/context/Prompt.tsx b/src/context/Prompt.tsx index 94ea06c8..b68c939b 100644 --- a/src/context/Prompt.tsx +++ b/src/context/Prompt.tsx @@ -56,7 +56,7 @@ const PromptCtx = createContext({ export const usePromptContext = () => useContext(PromptCtx) -export const PromptProvider = ({ children }: { children: React.ReactNode }) => ( +export const PromptProvider = ({ children }: { children: JSX.Element }) => ( {children} diff --git a/src/context/Release.tsx b/src/context/Release.tsx index 223cc2cb..bcc15850 100644 --- a/src/context/Release.tsx +++ b/src/context/Release.tsx @@ -41,7 +41,7 @@ const ReleaseCtx = createContext({ export const useReleaseContext = () => useContext(ReleaseCtx) -export const ReleaseProvider = ({ children }: { children: React.ReactNode }) => ( +export const ReleaseProvider = ({ children }: { children: JSX.Element | JSX.Element[] }) => ( {children} diff --git a/src/context/Theme.tsx b/src/context/Theme.tsx index 8da89303..ef726342 100644 --- a/src/context/Theme.tsx +++ b/src/context/Theme.tsx @@ -85,7 +85,7 @@ const ThemeContext = createContext({ export const useThemeContext = () => useContext(ThemeContext) -export const ThemeProvider = ({ children }: { children: React.ReactNode }) => ( +export const ThemeProvider = ({ children }: { children: JSX.Element }) => ( {children} From 12cfc6ae1eca2d35dd975cae6713f2e3e5ec3795 Mon Sep 17 00:00:00 2001 From: KKA11010 Date: Tue, 19 Dec 2023 13:58:05 +0100 Subject: [PATCH 07/13] update options modal --- src/components/modal/OptsModal.tsx | 129 +++++++++++++++++++++-------- src/components/modal/index.tsx | 2 +- src/screens/Dashboard.tsx | 2 +- 3 files changed, 96 insertions(+), 37 deletions(-) diff --git a/src/components/modal/OptsModal.tsx b/src/components/modal/OptsModal.tsx index 4874964d..cd28c83f 100644 --- a/src/components/modal/OptsModal.tsx +++ b/src/components/modal/OptsModal.tsx @@ -1,13 +1,14 @@ import { TxtButton } from '@comps/Button' -import { CopyIcon, NostrIcon, ReceiveIcon, SendMsgIcon, ZapIcon } from '@comps/Icons' -import Option from '@comps/Option' +import { CopyIcon, NostrIcon, SendMsgIcon, ZapIcon } from '@comps/Icons' +import Loading from '@comps/Loading' +import Separator from '@comps/Separator' import Txt from '@comps/Txt' import { useNostrContext } from '@src/context/Nostr' import { useThemeContext } from '@src/context/Theme' import { NS } from '@src/i18n' import { mainColors } from '@styles' import { useTranslation } from 'react-i18next' -import { ScrollView } from 'react-native' +import { Text, TouchableOpacity, View } from 'react-native' import { s, ScaledSheet, vs } from 'react-native-size-matters' import MyModal from '.' @@ -46,48 +47,106 @@ export default function OptsModal({ center styles={[styles.hint]} /> - - + > + + + + + + {t('receiveEcashNostr')} + + + {t('receiveEcashNostrHint')} + + + + + + } + + + + + + + {button2Txt} + + + {isSend ? t('payInvoiceDashboard') : t('createInvoiceDashboard')} + + + + ) } const styles = ScaledSheet.create({ - optionWrap: { + container: { + flexDirection: 'row', + alignItems: 'center', width: '100%', - paddingHorizontal: '10@s' + }, + iconContainer: { + minWidth: '10%', + }, + txtWrap: { + width: '90%', + }, + actionText: { + fontSize: '14@vs', + fontWeight: '500', + marginBottom: '4@vs', + }, + descriptionText: { + fontSize: '12@vs', }, hint: { fontSize: '18@vs', + marginTop: '5@vs', marginBottom: '30@vs', }, + separator: { + width: '100%', + marginTop: '10@vs', + marginBottom: '10@vs' + } }) \ No newline at end of file diff --git a/src/components/modal/index.tsx b/src/components/modal/index.tsx index 799fca98..1f2d069a 100644 --- a/src/components/modal/index.tsx +++ b/src/components/modal/index.tsx @@ -12,7 +12,7 @@ interface IMyModalProps { success?: boolean hasNoPadding?: boolean close?: () => void - children: JSX.Element | JSX.Element[] + children: React.ReactNode } export default function MyModal({ diff --git a/src/screens/Dashboard.tsx b/src/screens/Dashboard.tsx index 857d5ed9..25e3ecf8 100644 --- a/src/screens/Dashboard.tsx +++ b/src/screens/Dashboard.tsx @@ -5,12 +5,12 @@ import useLoading from '@comps/hooks/Loading' import useCashuToken from '@comps/hooks/Token' import { AboutIcon, ChevronRightIcon, PlusIcon, ReceiveIcon, ScanQRIcon, SendIcon } from '@comps/Icons' import InitialModal from '@comps/InitialModal' +import OptsModal from '@comps/modal/OptsModal' import { PromptModal } from '@comps/modal/Prompt' import Txt from '@comps/Txt' import { _testmintUrl } from '@consts' import { addMint, getBalance, getMintsUrls, hasMints } from '@db' import { l } from '@log' -import OptsModal from '@modal/OptsModal' import TrustMintModal from '@modal/TrustMint' import type { TBeforeRemoveEvent, TDashboardPageProps } from '@model/nav' import BottomNav from '@nav/BottomNav' From 20f95f3a4eb351329890c2528edf2103ed8214ca Mon Sep 17 00:00:00 2001 From: KKA11010 Date: Tue, 19 Dec 2023 14:59:16 +0100 Subject: [PATCH 08/13] adapt styling of the trust mint modal --- src/components/modal/OptsModal.tsx | 2 +- src/components/modal/TrustMint.tsx | 90 +++++++++++++++++++----------- 2 files changed, 58 insertions(+), 34 deletions(-) diff --git a/src/components/modal/OptsModal.tsx b/src/components/modal/OptsModal.tsx index cd28c83f..d178c2d0 100644 --- a/src/components/modal/OptsModal.tsx +++ b/src/components/modal/OptsModal.tsx @@ -126,7 +126,7 @@ const styles = ScaledSheet.create({ width: '100%', }, iconContainer: { - minWidth: '10%', + minWidth: '11%', }, txtWrap: { width: '90%', diff --git a/src/components/modal/TrustMint.tsx b/src/components/modal/TrustMint.tsx index 59938388..b20ace3e 100644 --- a/src/components/modal/TrustMint.tsx +++ b/src/components/modal/TrustMint.tsx @@ -1,7 +1,7 @@ import { TxtButton } from '@comps/Button' import { ReceiveIcon, SwapIcon } from '@comps/Icons' +import Loading from '@comps/Loading' import Separator from '@comps/Separator' -import Txt from '@comps/Txt' import type { ITokenInfo } from '@model' import type { RootStackParamList } from '@model/nav' import { type NavigationProp, useNavigation } from '@react-navigation/core' @@ -82,39 +82,49 @@ export default function TrustMintModal({ loading, tokenInfo, handleTrustModal, c void handleAutoSwap()} - style={{ opacity: defaultMint.length === 0 ? 0.4 : 1 }} + style={[styles.container, { opacity: defaultMint.length === 0 ? 0.4 : 1 }]} disabled={defaultMint.length === 0} > - - - - - - + + + + + + {t('autoSwapToDefaulMint')} + + {defaultMint.length === 0 ? - + t('noDefaultHint') : - + t('swapHint') } - + - - - + + + {loading ? + + + + : - - - - - + } + + + + {loading ? t('claiming', { ns: NS.wallet }) : t('trustMintOpt')} + + + {t('trustHint')} + Date: Tue, 19 Dec 2023 15:17:16 +0100 Subject: [PATCH 09/13] use React.ReactNode as type for children elements --- src/components/App.tsx | 2 +- src/components/Screen.tsx | 2 +- src/context/FocusClaim.tsx | 2 +- src/context/Keyboard.tsx | 2 +- src/context/Nostr.tsx | 2 +- src/context/Privacy.tsx | 2 +- src/context/Prompt.tsx | 2 +- src/context/Release.tsx | 2 +- src/context/Theme.tsx | 2 +- src/screens/Addressbook/Contact/index.tsx | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index ac6f08ca..d390f3b2 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -238,7 +238,7 @@ function _App() { ) } -function NavContainer({ children }: { children: JSX.Element | JSX.Element[] }) { +function NavContainer({ children }: { children: React.ReactNode }) { const navigation = useRef>(null) const { theme } = useThemeContext() diff --git a/src/components/Screen.tsx b/src/components/Screen.tsx index cd905840..3450a45d 100644 --- a/src/components/Screen.tsx +++ b/src/components/Screen.tsx @@ -4,7 +4,7 @@ import { globals } from '@styles' import { View } from 'react-native' interface IContainerProps { - children: JSX.Element | JSX.Element[] + children: React.ReactNode screenName?: string withBackBtn?: boolean withCancelBtn?: boolean diff --git a/src/context/FocusClaim.tsx b/src/context/FocusClaim.tsx index 9553f3f8..d8a0eeec 100644 --- a/src/context/FocusClaim.tsx +++ b/src/context/FocusClaim.tsx @@ -108,7 +108,7 @@ const FocusClaimCtx = createContext({ export const useFocusClaimContext = () => useContext(FocusClaimCtx) -export const FocusClaimProvider = ({ children }: { children: JSX.Element }) => ( +export const FocusClaimProvider = ({ children }: { children: React.ReactNode }) => ( {children} diff --git a/src/context/Keyboard.tsx b/src/context/Keyboard.tsx index 825ce220..dbddde81 100644 --- a/src/context/Keyboard.tsx +++ b/src/context/Keyboard.tsx @@ -29,7 +29,7 @@ const KeyboardCtx = createContext({ export const useKeyboardCtx = () => useContext(KeyboardCtx) -export const KeyboardProvider = ({ children }: { children: JSX.Element | JSX.Element[] }) => ( +export const KeyboardProvider = ({ children }: { children: React.ReactNode }) => ( {children} diff --git a/src/context/Nostr.tsx b/src/context/Nostr.tsx index c507d800..ea667c47 100644 --- a/src/context/Nostr.tsx +++ b/src/context/Nostr.tsx @@ -128,7 +128,7 @@ const NostrContext = createContext({ export const useNostrContext = () => useContext(NostrContext) -export const NostrProvider = ({ children }: { children: JSX.Element }) => ( +export const NostrProvider = ({ children }: { children: React.ReactNode }) => ( {children} diff --git a/src/context/Privacy.tsx b/src/context/Privacy.tsx index 2f13c14d..06a802ea 100644 --- a/src/context/Privacy.tsx +++ b/src/context/Privacy.tsx @@ -81,7 +81,7 @@ const PrivacyContext = createContext({ export const usePrivacyContext = () => useContext(PrivacyContext) -export const PrivacyProvider = ({ children }: { children: JSX.Element }) => ( +export const PrivacyProvider = ({ children }: { children: React.ReactNode }) => ( {children} diff --git a/src/context/Prompt.tsx b/src/context/Prompt.tsx index b68c939b..94ea06c8 100644 --- a/src/context/Prompt.tsx +++ b/src/context/Prompt.tsx @@ -56,7 +56,7 @@ const PromptCtx = createContext({ export const usePromptContext = () => useContext(PromptCtx) -export const PromptProvider = ({ children }: { children: JSX.Element }) => ( +export const PromptProvider = ({ children }: { children: React.ReactNode }) => ( {children} diff --git a/src/context/Release.tsx b/src/context/Release.tsx index bcc15850..223cc2cb 100644 --- a/src/context/Release.tsx +++ b/src/context/Release.tsx @@ -41,7 +41,7 @@ const ReleaseCtx = createContext({ export const useReleaseContext = () => useContext(ReleaseCtx) -export const ReleaseProvider = ({ children }: { children: JSX.Element | JSX.Element[] }) => ( +export const ReleaseProvider = ({ children }: { children: React.ReactNode }) => ( {children} diff --git a/src/context/Theme.tsx b/src/context/Theme.tsx index ef726342..8da89303 100644 --- a/src/context/Theme.tsx +++ b/src/context/Theme.tsx @@ -85,7 +85,7 @@ const ThemeContext = createContext({ export const useThemeContext = () => useContext(ThemeContext) -export const ThemeProvider = ({ children }: { children: JSX.Element }) => ( +export const ThemeProvider = ({ children }: { children: React.ReactNode }) => ( {children} diff --git a/src/screens/Addressbook/Contact/index.tsx b/src/screens/Addressbook/Contact/index.tsx index 0b426652..c1291042 100644 --- a/src/screens/Addressbook/Contact/index.tsx +++ b/src/screens/Addressbook/Contact/index.tsx @@ -225,7 +225,7 @@ export default function ContactPage({ navigation, route }: IContactPageProps) { } interface ISmallBtnProps { - children: JSX.Element + children: React.ReactNode onPress: () => void } From 646b5d354fb92e2d7490c01a759399f63939b7d4 Mon Sep 17 00:00:00 2001 From: KKA11010 Date: Tue, 19 Dec 2023 21:13:33 +0100 Subject: [PATCH 10/13] update scanning error screen layout --- src/screens/Payment/ProcessingError.tsx | 5 +++++ src/styles/globals.ts | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/screens/Payment/ProcessingError.tsx b/src/screens/Payment/ProcessingError.tsx index 42d702da..d66b4393 100644 --- a/src/screens/Payment/ProcessingError.tsx +++ b/src/screens/Payment/ProcessingError.tsx @@ -73,6 +73,11 @@ const styles = ScaledSheet.create({ setion: { alignItems: 'center', }, + errMsg: { + color: mainColors.ERROR, + marginVertical: '15@vs', + fontSize: '18@vs', + }, hint: { fontSize: '14@vs', marginTop: '10@vs', diff --git a/src/styles/globals.ts b/src/styles/globals.ts index a833425f..aef53c12 100644 --- a/src/styles/globals.ts +++ b/src/styles/globals.ts @@ -8,6 +8,9 @@ export const globalStyles = (color?: Theme, h?: HighlightKey) => ScaledSheet.cre paddingTop: '90@vs', backgroundColor: color?.BACKGROUND }, + fullWidth: { + width: '100%', + }, txt: { fontSize: '14@vs', color: color?.TEXT From 9a44cb110f54be57a71ccb15f37619b7639b94e8 Mon Sep 17 00:00:00 2001 From: First-Terraner Date: Wed, 20 Dec 2023 20:08:32 +0100 Subject: [PATCH 11/13] add missing function call parentheses --- src/screens/Payment/Receive/Invoice.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/Payment/Receive/Invoice.tsx b/src/screens/Payment/Receive/Invoice.tsx index d0376609..3c49d118 100644 --- a/src/screens/Payment/Receive/Invoice.tsx +++ b/src/screens/Payment/Receive/Invoice.tsx @@ -72,7 +72,7 @@ export default function InvoiceScreen({ navigation, route }: TMintInvoicePagePro value: paymentRequest, mints: [mintUrl], }) - clearInvoiceInterval + clearInvoiceInterval() navigation.navigate('success', { amount, mint: formatMintUrl(mintUrl) }) return } From decbb9da102a5e9f4d33e377c8af726df0177a72 Mon Sep 17 00:00:00 2001 From: First-Terraner Date: Thu, 21 Dec 2023 18:09:27 +0100 Subject: [PATCH 12/13] minor padding change in dashboard --- src/components/Balance.tsx | 2 +- src/screens/Payment/Receive/Invoice.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/Balance.tsx b/src/components/Balance.tsx index 1d9d7a0e..926cb18a 100644 --- a/src/components/Balance.tsx +++ b/src/components/Balance.tsx @@ -178,7 +178,7 @@ const styles = ScaledSheet.create({ board: { borderBottomLeftRadius: 50, borderBottomRightRadius: 50, - paddingHorizontal: '30@s', + paddingHorizontal: '20@s', paddingTop: '40@vs', paddingBottom: '50@vs', minHeight: '50%' diff --git a/src/screens/Payment/Receive/Invoice.tsx b/src/screens/Payment/Receive/Invoice.tsx index 3c49d118..fe40f475 100644 --- a/src/screens/Payment/Receive/Invoice.tsx +++ b/src/screens/Payment/Receive/Invoice.tsx @@ -112,7 +112,6 @@ export default function InvoiceScreen({ navigation, route }: TMintInvoicePagePro txt={t('cancel')} handlePress={() => void handlePayment(true)} /> - Date: Thu, 8 Feb 2024 16:01:00 +0100 Subject: [PATCH 13/13] fix ci --- src/screens/History/Details.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/screens/History/Details.tsx b/src/screens/History/Details.tsx index a2eed7df..1f61adfe 100644 --- a/src/screens/History/Details.tsx +++ b/src/screens/History/Details.tsx @@ -161,8 +161,6 @@ export default function DetailsPage({ navigation, route }: THistoryEntryPageProp // used in interval to check if token is spent while qr sheet is open const checkPayment = async () => { - l('checking if token has been spent') - l('checking if token has been spent promise') const isSpendable = await isTokenSpendable(value) setSpent(!isSpendable) if (!isSpendable) {