@@ -133,7 +212,58 @@ const AppHeader = ({ page, routes, ...props }) => (
})}
-
+
+
+
+
+ -
+
+
+ View source
+
+
+ -
+
+
+ Edit code
+
+
+
+
@@ -186,7 +316,50 @@ const AppHeader = ({ page, routes, ...props }) => (
);
})}
-
+
+
+
+
+ -
+
+
+ View source
+
+
+ -
+
+
+ Edit code
+
+
+
+
diff --git a/apps/builddao/widget/config/app.jsx b/apps/builddao/widget/config/app.jsx
index 592517b5..a090135a 100644
--- a/apps/builddao/widget/config/app.jsx
+++ b/apps/builddao/widget/config/app.jsx
@@ -44,5 +44,13 @@ return {
},
hide: true,
},
+ inspect: {
+ path: "buildhub.near/widget/page.inspect",
+ blockHeight: "final",
+ init: {
+ name: "Inspect",
+ },
+ hide: true,
+ },
},
};
diff --git a/apps/builddao/widget/inspect/WidgetDependencies.jsx b/apps/builddao/widget/inspect/WidgetDependencies.jsx
new file mode 100644
index 00000000..34c76bd0
--- /dev/null
+++ b/apps/builddao/widget/inspect/WidgetDependencies.jsx
@@ -0,0 +1,50 @@
+const src = props.src;
+const code = props.code ?? Social.get(src);
+
+const dependencyMatch =
+ code && code.matchAll(/
/g);
+let dependencySources = [...(dependencyMatch || [])]
+ .map((r) => r[1])
+ .filter((r) => !!r);
+dependencySources = dependencySources
+ .filter((r, i) => dependencySources.indexOf(r) === i && r !== "(.+)")
+ .map((src) => {
+ const parts = src.split("/");
+ return { src, accountId: parts[0], widgetName: parts[2] };
+ });
+
+const { href } = VM.require("buildhub.near/widget/lib.url") || {
+ href: () => {},
+};
+
+return (
+ <>
+ {dependencySources.map((c, i) => (
+
+ (
+
+ Source
+
+ ),
+ }}
+ />
+
+ ))}
+ >
+);
diff --git a/apps/builddao/widget/inspect/WidgetSource.jsx b/apps/builddao/widget/inspect/WidgetSource.jsx
new file mode 100644
index 00000000..4b6a13aa
--- /dev/null
+++ b/apps/builddao/widget/inspect/WidgetSource.jsx
@@ -0,0 +1,26 @@
+const src = props.src ?? "mob.near/widget/WidgetSource";
+const blockHeight = props.blockHeight;
+const [accountId, widget, widgetName] = src.split("/");
+
+const code = Social.get(src, blockHeight);
+
+const text = `
+\`\`\`jsx
+${code}
+\`\`\`
+`;
+
+return (
+ <>
+
+
+
Dependencies
+
+ >
+);
diff --git a/apps/builddao/widget/page/inspect.jsx b/apps/builddao/widget/page/inspect.jsx
new file mode 100644
index 00000000..95e90c65
--- /dev/null
+++ b/apps/builddao/widget/page/inspect.jsx
@@ -0,0 +1,33 @@
+const StyledWidgetSource = styled.div`
+ pre {
+ margin: 1rem 0;
+ div {
+ border-radius: 1rem;
+ }
+ }
+
+ h3 {
+ color: var(--text-color, #fff);
+ margin-bottom: 1rem;
+ }
+
+ .text-truncate {
+ color: var(--text-color, #fff);
+ }
+
+ span {
+ color: var(--text-color, #fff);
+ }
+`;
+
+return (
+
+
+
+);
diff --git a/src/pages/EditorPage.js b/src/pages/EditorPage.js
index bdbba954..20a5a0c3 100644
--- a/src/pages/EditorPage.js
+++ b/src/pages/EditorPage.js
@@ -901,7 +901,7 @@ export default function EditorPage(props) {
>