-
-
-
- {output}
-
-
+
+ Table View}>
+
+ ,
+ JSON View}>
+
+ ,
+ ]}
+ selIndex={viewMode === 'Table' ? 0 : 1}
+ />
+
+
+ {renderOutput()}
-
diff --git a/apps/frontend/src/components/shared/ToggleSwitch/ToggleSwitch.scss b/apps/frontend/src/components/shared/ToggleSwitch/ToggleSwitch.scss
index f6411e08..dbfaafa9 100644
--- a/apps/frontend/src/components/shared/ToggleSwitch/ToggleSwitch.scss
+++ b/apps/frontend/src/components/shared/ToggleSwitch/ToggleSwitch.scss
@@ -16,6 +16,13 @@
display: flex;
justify-content: flex-start;
+ &.toggle-disabled {
+ opacity: 0.45;
+ &:hover {
+ cursor: not-allowed;
+ }
+ }
+
& .toggle-bg-text {
height: 100%;
}
diff --git a/apps/frontend/src/components/shared/ToggleSwitch/ToggleSwitch.test.tsx b/apps/frontend/src/components/shared/ToggleSwitch/ToggleSwitch.test.tsx
index 314bf6b4..65079e48 100644
--- a/apps/frontend/src/components/shared/ToggleSwitch/ToggleSwitch.test.tsx
+++ b/apps/frontend/src/components/shared/ToggleSwitch/ToggleSwitch.test.tsx
@@ -4,7 +4,6 @@ import { APP_ANIMATION_DURATION } from '../../../utilities/constants';
import { createMockStore } from '../../../utilities/test-utilities/mockStore';
import { mockAppStore } from '../../../utilities/test-utilities/mockData';
import ToggleSwitch from './ToggleSwitch';
-import { Units } from '../../../utilities/constants';
describe('ToggleSwitch component ', () => {
it('should be in the document', async () => {
@@ -13,9 +12,8 @@ describe('ToggleSwitch component ', () => {
{}}
/>
);
diff --git a/apps/frontend/src/components/shared/ToggleSwitch/ToggleSwitch.tsx b/apps/frontend/src/components/shared/ToggleSwitch/ToggleSwitch.tsx
index 6098f619..37405c27 100755
--- a/apps/frontend/src/components/shared/ToggleSwitch/ToggleSwitch.tsx
+++ b/apps/frontend/src/components/shared/ToggleSwitch/ToggleSwitch.tsx
@@ -1,52 +1,56 @@
import './ToggleSwitch.scss';
-import { useState } from 'react';
+import { useEffect, useState } from 'react';
import { motion } from 'framer-motion';
-import { SPRING_VARIANTS } from '../../../utilities/constants';
-import { RootService } from '../../../services/http.service';
-import { setConfig } from '../../../store/rootSlice';
-import { useDispatch, useSelector } from 'react-redux';
-import { selectAppConfig } from '../../../store/rootSelectors';
+import { BOUNCY_SPRING_VARIANTS_1 } from '../../../utilities/constants';
-const ToggleSwitch = props => {
- const dispatch = useDispatch();
- const [isSwitchOn, setIsSwitchOn] = useState(props.selValue === props.values[1]);
- const appConfig = useSelector(selectAppConfig);
-
- const changeValueHandler = async() => {
- setIsSwitchOn((prevValue) => !prevValue);
- const currValue = isSwitchOn ? 0 : 1;
- const updatedConfig = {
- ...appConfig,
- uiConfig: {
- ...appConfig.uiConfig,
- unit: props.values[currValue]
- }
- };
- await RootService.updateConfig(updatedConfig);
- dispatch(setConfig(updatedConfig));
+const ToggleSwitch = ({
+ values,
+ selIndex,
+ onChange,
+ className = '',
+ disabled = false,
+}: {
+ values: (string | React.ReactNode)[];
+ selIndex: number;
+ onChange: (index: number) => void;
+ className?: string;
+ disabled?: boolean;
+}) => {
+ const [isSwitchOn, setIsSwitchOn] = useState(selIndex === 1);
+
+ useEffect(() => {
+ setIsSwitchOn(selIndex === 1);
+ }, [selIndex]);
+
+ const changeValueHandler = () => {
+ if (disabled) return;
+ const nextIndex = isSwitchOn ? 0 : 1;
+ setIsSwitchOn(!isSwitchOn);
+ onChange(nextIndex);
};
return (
- {props.values[0]}
- {props.values[1]}
+ {values[0]}
+ {values[1]}
- {props.selValue}
+ {isSwitchOn ? values[1] : values[0]}
);
diff --git a/apps/frontend/src/components/ui/Loading/Loading.tsx b/apps/frontend/src/components/ui/Loading/Loading.tsx
index 85958916..b5cee2f3 100644
--- a/apps/frontend/src/components/ui/Loading/Loading.tsx
+++ b/apps/frontend/src/components/ui/Loading/Loading.tsx
@@ -7,7 +7,7 @@ export const Loading = () => {
-
Loading...
+
Loading...
);
diff --git a/apps/frontend/src/components/ui/Settings/Settings.tsx b/apps/frontend/src/components/ui/Settings/Settings.tsx
index 9256eff8..4e3acae1 100755
--- a/apps/frontend/src/components/ui/Settings/Settings.tsx
+++ b/apps/frontend/src/components/ui/Settings/Settings.tsx
@@ -1,18 +1,22 @@
import './Settings.scss';
import { Dropdown } from 'react-bootstrap';
-
+import { useDispatch, useSelector } from 'react-redux';
import logger from '../../../services/logger.service';
import useBreakpoint from '../../../hooks/use-breakpoint';
-import { CURRENCY_UNITS } from '../../../utilities/constants';
+import { CURRENCY_UNITS, Units } from '../../../utilities/constants';
import { SettingsSVG } from '../../../svgs/Settings';
import FiatSelection from '../../shared/FiatSelection/FiatSelection';
import ToggleSwitch from '../../shared/ToggleSwitch/ToggleSwitch';
import { setShowModals } from '../../../store/rootSlice';
-import { useDispatch, useSelector } from 'react-redux';
+import { RootService } from '../../../services/http.service';
+import { setConfig } from '../../../store/rootSlice';
+import { selectAppConfig } from '../../../store/rootSelectors';
import { selectIsAuthenticated, selectNodeInfo, selectServerConfig, selectShowModals, selectUIConfigUnit, selectWalletConnect } from '../../../store/rootSelectors';
+import { ApplicationConfiguration } from '../../../types/root.type';
const Settings = (props) => {
const dispatch = useDispatch();
+ const appConfig = useSelector(selectAppConfig);
const isAuthenticated = useSelector(selectIsAuthenticated);
const uiConfigUnit = useSelector(selectUIConfigUnit);
const nodeInfo = useSelector(selectNodeInfo);
@@ -22,6 +26,18 @@ const Settings = (props) => {
const currentScreenSize = useBreakpoint();
logger.info('Screen Size Changed: ' + currentScreenSize);
+ const changeCurrencyUnitHandler = async(changedIndex: number) => {
+ const updatedConfig: ApplicationConfiguration = {
+ ...appConfig,
+ uiConfig: {
+ ...appConfig.uiConfig,
+ unit: CURRENCY_UNITS[changedIndex]
+ }
+ };
+ await RootService.updateConfig(updatedConfig);
+ dispatch(setConfig(updatedConfig));
+ };
+
return (
@@ -40,7 +56,7 @@ const Settings = (props) => {
}
Fiat Currency
- Currency
+ Currency
);
diff --git a/apps/frontend/src/services/http.service.ts b/apps/frontend/src/services/http.service.ts
index 2a20a51b..e140e5ba 100644
--- a/apps/frontend/src/services/http.service.ts
+++ b/apps/frontend/src/services/http.service.ts
@@ -227,6 +227,10 @@ export class RootService {
return HttpService.clnCall('sql', { query });
}
+ static async listSqlSchemas(table?: string) {
+ return HttpService.clnCall('listsqlschemas', { table });
+ }
+
static async fetchAuthData() {
const [ config, authStatus ] = await Promise.all([
this.getAppConfigurations(),
diff --git a/apps/frontend/src/styles/constants.scss b/apps/frontend/src/styles/constants.scss
index b2fcc3b6..f50f0d58 100644
--- a/apps/frontend/src/styles/constants.scss
+++ b/apps/frontend/src/styles/constants.scss
@@ -39,6 +39,7 @@ $theme-colors: (
light: #9f9f9f,
);
+$border-radius-sm: 0.375rem;
$border-radius: 1.25rem;
$btn-link-color: $primary;
$btn-padding-x: 0.625rem;
diff --git a/apps/frontend/src/styles/shared.scss b/apps/frontend/src/styles/shared.scss
index 4aa78538..3c23d326 100755
--- a/apps/frontend/src/styles/shared.scss
+++ b/apps/frontend/src/styles/shared.scss
@@ -477,6 +477,7 @@ svg {
opacity: 1;
z-index: 99;
width: 0.5rem;
+ background-color: transparent;
& .ps__thumb-y {
width: 0.25rem;
background-color: #DFB316;
diff --git a/apps/frontend/src/utilities/constants.ts b/apps/frontend/src/utilities/constants.ts
index 5b8e055c..95beb43d 100755
--- a/apps/frontend/src/utilities/constants.ts
+++ b/apps/frontend/src/utilities/constants.ts
@@ -68,7 +68,7 @@ export const channelStateMap: Record
= {
DUALOPEND_OPEN_COMMIT_READY: "Dual Open Commit Ready",
};
-export const CURRENCY_UNITS = ['SATS', 'BTC'];
+export const CURRENCY_UNITS: Units[] = [Units.SATS, Units.BTC];
export const CURRENCY_UNIT_FORMATS = { Sats: '1.0-0', BTC: '1.6-6', OTHER: '1.2-2' };