diff --git a/src/components/LogOverlay.module.css b/src/components/LogOverlay.module.css index c3b78430..99e66bd1 100644 --- a/src/components/LogOverlay.module.css +++ b/src/components/LogOverlay.module.css @@ -1,5 +1,5 @@ .logContentPlaceholder { - height: 1rem; + height: 2.625rem; margin: 1px 0; } diff --git a/src/components/LogOverlay.tsx b/src/components/LogOverlay.tsx index 29e30efb..7921d0b1 100644 --- a/src/components/LogOverlay.tsx +++ b/src/components/LogOverlay.tsx @@ -7,6 +7,7 @@ import { useSettings } from '../context/SettingsContext' import { CurrentWallet } from '../context/WalletContext' import Sprite from './Sprite' import styles from './LogOverlay.module.css' +import { isDevMode } from '../constants/debugFeatures' const JMWALLETD_LOG_FILE_NAME = 'jmwalletd_stdout.log' @@ -74,7 +75,7 @@ export function LogOverlay({ currentWallet, show, onHide }: LogOverlayProps) { const [alert, setAlert] = useState() const [isInitialized, setIsInitialized] = useState(false) const [isLoading, setIsLoading] = useState(true) - const [content, setContent] = useState(null) + const [content, setContent] = useState() const refresh = useCallback( (signal: AbortSignal) => { @@ -85,9 +86,14 @@ export function LogOverlay({ currentWallet, show, onHide }: LogOverlayProps) { setAlert(undefined) setContent(data) }) - .catch((err) => { + .catch((e) => { if (signal.aborted) return - setAlert({ variant: 'danger', message: t('logs.error_loading_logs_failed') }) + setAlert({ + variant: 'danger', + message: t('logs.error_loading_logs_failed', { + reason: e.message || t('global.errors.reason_unknown'), + }), + }) }) .finally(() => { if (signal.aborted) return @@ -138,7 +144,7 @@ export function LogOverlay({ currentWallet, show, onHide }: LogOverlayProps) { {!isInitialized && isLoading ? ( - Array(12) + Array(5) .fill('') .map((_, index) => { return ( @@ -149,6 +155,13 @@ export function LogOverlay({ currentWallet, show, onHide }: LogOverlayProps) { }) ) : ( <> + {alert && !content && isDevMode() && ( +
+ dev + In order to test the log file feature, start the application with + npm run dev:start:secondary. +
+ )} {alert && {alert.message}} {content && ( diff --git a/src/components/Orderbook.module.css b/src/components/Orderbook.module.css index 0e98de8e..eecfd953 100644 --- a/src/components/Orderbook.module.css +++ b/src/components/Orderbook.module.css @@ -1,4 +1,4 @@ -.orderbook-line-placeholder { +.orderbookContentPlaceholder { height: 2.625rem; margin: 1px 0; } diff --git a/src/components/Orderbook.tsx b/src/components/Orderbook.tsx index 5e192d12..6b837f3d 100644 --- a/src/components/Orderbook.tsx +++ b/src/components/Orderbook.tsx @@ -461,7 +461,7 @@ export function OrderbookOverlay({ nickname, show, onHide }: OrderbookOverlayPro .map((_, index) => { return ( - + ) }) diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 0577b547..d9801e65 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -16,7 +16,7 @@ import languages from '../i18n/languages' import styles from './Settings.module.css' import SeedModal from './settings/SeedModal' import FeeConfigModal from './settings/FeeConfigModal' -import { isDebugFeatureEnabled } from '../constants/debugFeatures' +import { isDebugFeatureEnabled, isDevMode } from '../constants/debugFeatures' import { isFeatureEnabled } from '../constants/features' import { CurrentWallet } from '../context/WalletContext' @@ -86,11 +86,14 @@ export default function Settings({ wallet, stopWallet }: SettingsProps) { .then((data) => data && data.features) .then((features) => { if (abortCtrl.signal.aborted) return - setShowLogsEnabled(features && features.logs === true) + const hasLogsFeatureOld = features && features.logs === true + const hasLogsFeature = + features && Array.isArray(features) && features.some((it) => it.name === 'logs' && it.enabled === true) + setShowLogsEnabled(hasLogsFeatureOld || hasLogsFeature) }) .catch((_) => { if (abortCtrl.signal.aborted) return - setShowLogsEnabled(false) + setShowLogsEnabled(isDevMode()) }) return () => { @@ -179,15 +182,6 @@ export default function Settings({ wallet, stopWallet }: SettingsProps) { {showingFeeConfig && setShowingFeeConfig(false)} />} - {showLogsEnabled && ( - <> - setShowingLogs(true)}> - - {t('settings.show_logs')} - - setShowingLogs(false)} /> - - )}
{t('settings.section_title_wallet')}
setShowingSeed(true)}> @@ -230,6 +224,16 @@ export default function Settings({ wallet, stopWallet }: SettingsProps) { )} + + {showLogsEnabled && ( + <> + setShowingLogs(true)}> + + {t('settings.show_logs')} + + setShowingLogs(false)} /> + + )}
{t('settings.section_title_community')}