From 87e153ffd156c0f56400aae35a0f12ed45dfa3a3 Mon Sep 17 00:00:00 2001 From: gagdiez Date: Mon, 25 Mar 2024 16:23:49 +0100 Subject: [PATCH] fix: international build (#1843) --- website/src/components/social-widget.js | 65 +++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 website/src/components/social-widget.js diff --git a/website/src/components/social-widget.js b/website/src/components/social-widget.js new file mode 100644 index 00000000000..a44b8fc96d6 --- /dev/null +++ b/website/src/components/social-widget.js @@ -0,0 +1,65 @@ +import React, { useState, useEffect } from "react"; +import { useWallet } from '@theme/scripts/wallet-selector'; +import BrowserOnly from '@docusaurus/BrowserOnly'; +import "react-bootstrap-typeahead/css/Typeahead.css"; +import "react-bootstrap-typeahead/css/Typeahead.bs5.css"; + +export function WidgetEditor({ children, id = 1, height = "160px" }) { + + return ( + Loading... }> + {() => { + let startCode = ''; + try { + if (!children.length) children = [children] + startCode = children[0].props.children.props.children; + } catch (e) { } + const { Widget, useInitNear } = require('near-social-vm'); + const MonacoEditor = require('react-monaco-editor').default; + + const [code, setCode] = useState(startCode); + const { initNear } = useInitNear(); + const { selector } = useWallet(); + + useEffect(() => { + initNear && selector && initNear({ networkId: 'testnet', selector }); + }, [initNear, selector]); + + return
+
+ setCode(newValue)} + /> +
+ +
+
+
+ +
+
+
+ {children[1]} +
+ }} +
+ ) +} + +export default WidgetEditor; \ No newline at end of file