diff --git a/docker/regtest/docker-compose.yml b/docker/regtest/docker-compose.yml index 3af8e43d..e6c634e6 100644 --- a/docker/regtest/docker-compose.yml +++ b/docker/regtest/docker-compose.yml @@ -175,6 +175,10 @@ services: BTCEXP_BITCOIND_PORT: 43782 BTCEXP_BITCOIND_USER: regtest BTCEXP_BITCOIND_PASS: regtest + BTCEXP_BASIC_AUTH_PASSWORD: joinmarket + BTCEXP_PRIVACY_MODE: 'true' + BTCEXP_NO_RATES: 'true' + BTCEXP_RPC_ALLOWALL: 'true' ports: - "3002:3002" depends_on: diff --git a/src/components/App.tsx b/src/components/App.tsx index f3d39934..a71aba15 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useMemo, useState } from 'react' +import { Suspense, lazy, useCallback, useEffect, useMemo, useState } from 'react' import * as rb from 'react-bootstrap' import { useTranslation } from 'react-i18next' import { @@ -27,7 +27,7 @@ import { isDebugFeatureEnabled } from '../constants/debugFeatures' import CreateWallet from './CreateWallet' import ImportWallet from './ImportWallet' import Earn from './Earn' -import ErrorPage, { ErrorThrowingComponent } from './ErrorPage' +import ErrorPage from './ErrorPage' import Footer from './Footer' import Jam from './Jam' import Layout from './Layout' @@ -39,6 +39,7 @@ import Send from './Send' import RescanChain from './RescanChain' import Settings from './Settings' import Wallets from './Wallets' +const DevSetupPage = lazy(() => import('./DevSetupPage')) export default function App() { const { t } = useTranslation() @@ -168,6 +169,17 @@ export default function App() { {isDebugFeatureEnabled('errorExamplePage') && ( } /> )} + {isDebugFeatureEnabled('devSetupPage') && ( + }> + + + } + /> + )} } /> )} @@ -208,6 +220,23 @@ export default function App() { ) } +const Loading = () => { + const { t } = useTranslation() + return ( +
+
+ ) +} + +const ErrorThrowingComponent = () => { + useEffect(() => { + throw new Error('This error is thrown on purpose. Only to be used for testing.') + }, []) + return <> +} + const RELOAD_WALLET_INFO_DELAY: { AFTER_RESCAN: Milliseconds AFTER_UNLOCK: Milliseconds diff --git a/src/components/DevSetupPage.tsx b/src/components/DevSetupPage.tsx new file mode 100644 index 00000000..2894de4c --- /dev/null +++ b/src/components/DevSetupPage.tsx @@ -0,0 +1,111 @@ +import { Link } from 'react-router-dom' +import Sprite from './Sprite' +import PageTitle from './PageTitle' +import { routes } from '../constants/routes' + +const DEFAULT_BASIC_AUTH = { + user: 'joinmarket', + password: 'joinmarket', +} + +const LINK_JM_REGTEST_JOINMARKET2 = 'http://localhost:29080' +const LINK_JM_REGTEST_JOINMARKET2_AUTH = DEFAULT_BASIC_AUTH +const LINK_JM_REGTEST_JOINMARKET3 = 'http://localhost:30080' +const LINK_JM_REGTEST_EXPLORER = 'http://localhost:3002' +const LINK_JM_REGTEST_EXPLORER_AUTH = DEFAULT_BASIC_AUTH +const LINK_JM_REGTEST_RPC_TERMINAL = `${LINK_JM_REGTEST_EXPLORER}/rpc-terminal` + +export default function DevSetupPage() { + return ( +
+ +
+
+
Test Wallet
+
+ Name: Satoshi +
+ Password: test +
+
+
+ +
+
+
Links
+
+ + Error Example Page + +
+
+
+ +
+
Jam Instances
+
+ + +
+ Basic Authentication +
+ + User: {LINK_JM_REGTEST_JOINMARKET2_AUTH.user} +
+ Password: {LINK_JM_REGTEST_JOINMARKET2_AUTH.password} +
+
+ +
+
+ +
+
Block Explorer
+
+ {' '} + +
+ Basic Authentication +
+ + User: {LINK_JM_REGTEST_EXPLORER_AUTH.user} +
+ Password: {LINK_JM_REGTEST_EXPLORER_AUTH.password} +
+
+
+
+ +
+ Mine a block, e.g.: +
generatetoaddress 1 bcrt1qrnz0thqslhxu86th069r9j6y7ldkgs2tzgf5wx
+
+
+
+
+ ) +} diff --git a/src/components/ErrorPage.tsx b/src/components/ErrorPage.tsx index 4e09c1d1..5ad9159f 100644 --- a/src/components/ErrorPage.tsx +++ b/src/components/ErrorPage.tsx @@ -3,14 +3,6 @@ import * as rb from 'react-bootstrap' import { useRouteError } from 'react-router-dom' import PageTitle from './PageTitle' import { t } from 'i18next' -import { useEffect } from 'react' - -export function ErrorThrowingComponent() { - useEffect(() => { - throw new Error('This error is thrown on purpose. Only to be used for testing.') - }, []) - return <> -} interface ErrorViewProps { title: string diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index db77fcbb..f54261c6 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -8,8 +8,10 @@ import { useCurrentWallet } from '../context/WalletContext' import Sprite from './Sprite' import Cheatsheet from './Cheatsheet' import packageInfo from '../../package.json' -import { isDevMode } from '../constants/debugFeatures' +import { isDebugFeatureEnabled, isDevMode } from '../constants/debugFeatures' import { toSemVer } from '../utils' +import { Link } from 'react-router-dom' +import { routes } from '../constants/routes' const APP_DISPLAY_VERSION = (() => { const version = toSemVer(packageInfo.version) @@ -52,7 +54,7 @@ export default function Footer() { {t('footer.warning_alert_title')}

{t('footer.warning_alert_text')}

- JoinMarket: v{serviceInfo?.server?.version?.raw || 'unknown'} + JoinMarket: v{serviceInfo?.server?.version?.raw || '_unknown'}
Jam: v{APP_DISPLAY_VERSION}

@@ -68,13 +70,13 @@ export default function Footer() { -
-
+
+
This is pre-alpha software. setShowBetaWarning(true)} > Read this before using. @@ -102,7 +104,14 @@ export default function Footer() { )}
-
+ {isDebugFeatureEnabled('devSetupPage') && ( +
+ + Dev Setup + +
+ )} + -
+ -
|
+
|
{t('navbar.menu')}
+ {isDebugFeatureEnabled('fastThemeToggle') && ( + + + + )} {t('navbar.title')} @@ -314,6 +319,15 @@ export default function Navbar() { {t('navbar.button_create_wallet')} + + isExpanded && setIsExpanded(false)} + className="nav-link" + > + {t('navbar.button_import_wallet')} + + diff --git a/src/constants/debugFeatures.ts b/src/constants/debugFeatures.ts index 97e3ab76..43f9cfdb 100644 --- a/src/constants/debugFeatures.ts +++ b/src/constants/debugFeatures.ts @@ -3,6 +3,7 @@ interface DebugFeatures { allowCreatingExpiredFidelityBond: boolean skipWalletBackupConfirmation: boolean errorExamplePage: boolean + devSetupPage: boolean importDummyMnemonicPhrase: boolean rescanChainPage: boolean fastThemeToggle: boolean @@ -15,6 +16,7 @@ const debugFeatures: DebugFeatures = { insecureScheduleTesting: devMode, skipWalletBackupConfirmation: devMode, errorExamplePage: devMode, + devSetupPage: devMode, importDummyMnemonicPhrase: devMode, rescanChainPage: devMode, fastThemeToggle: devMode, diff --git a/src/constants/routes.ts b/src/constants/routes.ts index 68a20209..62b78a9a 100644 --- a/src/constants/routes.ts +++ b/src/constants/routes.ts @@ -11,6 +11,7 @@ export const routes = { importWallet: '/import-wallet', rescanChain: '/rescan', __errorExample: '/error-example', + __devSetup: '/dev-setup', } export type Route = keyof typeof routes diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 4f50da28..852ee544 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -37,6 +37,7 @@ "title": "Jam", "text_rescan_in_progress": "Rescanning...", "button_create_wallet": "Create Wallet", + "button_import_wallet": "Import Wallet", "tab_send": "Send", "tab_receive": "Receive", "tab_earn": "Earn", diff --git a/src/index.css b/src/index.css index 6316f9a7..ef2b6247 100644 --- a/src/index.css +++ b/src/index.css @@ -573,10 +573,6 @@ h2 { } /* Alpha Warning */ -.warning-hint { - font-size: 0.8rem; -} - .warning-card-wrapper { position: fixed; height: 100%; @@ -726,6 +722,7 @@ h2 { :root[data-theme='dark'] .link-dark { color: var(--bs-white) !important; + text-decoration-color: RGBA(var(--bs-white), var(--bs-link-underline-opacity, 1)) !important; } :root[data-theme='dark'] .toast {