mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
rename plebbit options variables, only show data path on electron
This commit is contained in:
@@ -12,7 +12,7 @@ interface SettingsProps {
|
||||
maticRpcRef?: RefObject<HTMLTextAreaElement>;
|
||||
avaxRpcRef?: RefObject<HTMLTextAreaElement>;
|
||||
plebbitRpcRef?: RefObject<HTMLInputElement>;
|
||||
nodeDataPathRef?: RefObject<HTMLInputElement>;
|
||||
plebbitDataPathRef?: RefObject<HTMLInputElement>;
|
||||
}
|
||||
|
||||
const IPFSGatewaysSettings = ({ ipfsGatewayUrlsRef, mediaIpfsGatewayUrlRef }: SettingsProps) => {
|
||||
@@ -119,21 +119,23 @@ const PlebbitRPCSettings = ({ plebbitRpcRef }: SettingsProps) => {
|
||||
);
|
||||
};
|
||||
|
||||
const NodeDataPathSettings = ({ nodeDataPathRef }: SettingsProps) => {
|
||||
const PlebbitDataPathSettings = ({ plebbitDataPathRef }: SettingsProps) => {
|
||||
const plebbitRpc = usePlebbitRpcSettings();
|
||||
const { plebbitRpcSettings } = plebbitRpc || {};
|
||||
const isConnectedToRpc = plebbitRpc?.state === 'succeeded';
|
||||
const path = plebbitRpcSettings?.plebbitOptions?.dataPath || '';
|
||||
const path = plebbitRpcSettings?.plebbitOptions?.plebbitDataPath || '';
|
||||
|
||||
return (
|
||||
<div className={styles.nodeDataPathSettings}>
|
||||
<div className={styles.plebbitDataPathSettings}>
|
||||
<div>
|
||||
<input type='text' defaultValue={path} disabled={!isConnectedToRpc} ref={nodeDataPathRef} />
|
||||
<input type='text' defaultValue={path} disabled={!isConnectedToRpc} ref={plebbitDataPathRef} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const isElectron = window.isElectron === true;
|
||||
|
||||
const PlebbitOptions = () => {
|
||||
const { t } = useTranslation();
|
||||
const account = useAccount();
|
||||
@@ -147,7 +149,7 @@ const PlebbitOptions = () => {
|
||||
const maticRpcRef = useRef<HTMLTextAreaElement>(null);
|
||||
const avaxRpcRef = useRef<HTMLTextAreaElement>(null);
|
||||
const plebbitRpcRef = useRef<HTMLInputElement>(null);
|
||||
const nodeDataPathRef = useRef<HTMLInputElement>(null);
|
||||
const plebbitDataPathRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const handleSave = async () => {
|
||||
const ipfsGatewayUrls = ipfsGatewayUrlsRef.current?.value.split('\n').map((url) => url.trim());
|
||||
@@ -158,7 +160,7 @@ const PlebbitOptions = () => {
|
||||
const maticRpcUrls = maticRpcRef.current?.value.split('\n').map((url) => url.trim());
|
||||
const avaxRpcUrls = avaxRpcRef.current?.value.split('\n').map((url) => url.trim());
|
||||
const plebbitRpcClientsOptions = plebbitRpcRef.current?.value.trim();
|
||||
const dataPath = nodeDataPathRef.current?.value.trim();
|
||||
const plebbitDataPath = plebbitDataPathRef.current?.value.trim();
|
||||
|
||||
const chainProviders = {
|
||||
eth: {
|
||||
@@ -189,7 +191,7 @@ const PlebbitOptions = () => {
|
||||
pubsubHttpClientsOptions,
|
||||
chainProviders,
|
||||
plebbitRpcClientsOptions,
|
||||
dataPath,
|
||||
plebbitDataPath,
|
||||
},
|
||||
});
|
||||
alert('Options saved.');
|
||||
@@ -230,17 +232,19 @@ const PlebbitOptions = () => {
|
||||
</span>
|
||||
</div>
|
||||
<div className={styles.category}>
|
||||
<span className={styles.categoryTitle}>node RPC:</span>
|
||||
<span className={styles.categoryTitle}>plebbit RPC:</span>
|
||||
<span className={styles.categorySettings}>
|
||||
<PlebbitRPCSettings plebbitRpcRef={plebbitRpcRef} />
|
||||
</span>
|
||||
</div>
|
||||
<div className={styles.category}>
|
||||
<span className={styles.categoryTitle}>node data path:</span>
|
||||
<span className={styles.categorySettings}>
|
||||
<NodeDataPathSettings nodeDataPathRef={nodeDataPathRef} />
|
||||
</span>
|
||||
</div>
|
||||
{isElectron && (
|
||||
<div className={styles.category}>
|
||||
<span className={styles.categoryTitle}>plebbit data path:</span>
|
||||
<span className={styles.categorySettings}>
|
||||
<PlebbitDataPathSettings plebbitDataPathRef={plebbitDataPathRef} />
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user