From 647a416b61106cccdcc1ff0cef40023e99ec0f4f Mon Sep 17 00:00:00 2001
From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com>
Date: Mon, 27 Jan 2025 17:34:07 +0530
Subject: [PATCH 1/7] move validator dropdown to iframe, update tests, reuse
app colors
---
.../widget/app.jsx | 22 +-
.../widget/components/OverlayTrigger.jsx | 8 +-
.../widget/components/StakedNearIframe.jsx | 75 +--
.../widget/components/templates/AppLayout.jsx | 138 +----
.../widget/lib/common.jsx | 133 +++++
.../widget/pages/dashboard/Chart.jsx | 23 +-
.../widget/pages/payments/Table.jsx | 2 +-
.../stake-delegation/CreateStakeRequest.jsx | 195 ++-----
.../stake-delegation/CreateUnstakeRequest.jsx | 148 +----
.../ValidatorsDropDownWithSearch.jsx | 507 ++++++++++++++++++
.../pages/stake-delegation/WalletDropdown.jsx | 2 +-
.../stake-delegation/stake-delegation.spec.js | 68 ++-
12 files changed, 828 insertions(+), 493 deletions(-)
create mode 100644 instances/widgets.treasury-factory.near/widget/pages/stake-delegation/ValidatorsDropDownWithSearch.jsx
diff --git a/instances/widgets.treasury-factory.near/widget/app.jsx b/instances/widgets.treasury-factory.near/widget/app.jsx
index d2fcc990..593402b9 100644
--- a/instances/widgets.treasury-factory.near/widget/app.jsx
+++ b/instances/widgets.treasury-factory.near/widget/app.jsx
@@ -13,10 +13,6 @@ const { AppLayout } = VM.require(
const instance = "${REPL_INSTANCE}";
const treasuryDaoID = "${REPL_TREASURY}";
-const { Theme } = VM.require(`${instance}/widget/config.css`) || {
- Theme: () => <>>,
-};
-
if (!page) {
// If no page is specified, we default to the feed page TEMP
page = "dashboard";
@@ -84,14 +80,12 @@ function Page() {
}
return (
-
-
-
-
-
+
+
+
);
diff --git a/instances/widgets.treasury-factory.near/widget/components/OverlayTrigger.jsx b/instances/widgets.treasury-factory.near/widget/components/OverlayTrigger.jsx
index 1aa6916e..37ea2634 100644
--- a/instances/widgets.treasury-factory.near/widget/components/OverlayTrigger.jsx
+++ b/instances/widgets.treasury-factory.near/widget/components/OverlayTrigger.jsx
@@ -3,9 +3,9 @@ const { instance } = props;
if (!instance) {
return <>>;
}
-const { getColors } = VM.require(
- "${REPL_BASE_DEPLOYMENT_ACCOUNT}/widget/components.templates.AppLayout"
-) || { getColors: () => {} };
+const { getAllColorsAsCSSVariables } = VM.require(
+ "${REPL_BASE_DEPLOYMENT_ACCOUNT}/widget/lib.common"
+) || { getAllColorsAsCSSVariables: () => {} };
const { treasuryDaoID } = VM.require(`${instance}/widget/config.data`);
const config = treasuryDaoID ? Near.view(treasuryDaoID, "get_config") : null;
@@ -44,7 +44,7 @@ const overlayStyle = props.overlayStyle ?? {
};
const ThemeColorsContainer = styled.div`
- ${() => getColors(isDarkTheme, "", "")}
+ ${() => getAllColorsAsCSSVariables(isDarkTheme, "")}
`;
const overlay = (
diff --git a/instances/widgets.treasury-factory.near/widget/components/StakedNearIframe.jsx b/instances/widgets.treasury-factory.near/widget/components/StakedNearIframe.jsx
index e445d33f..aa2a0a60 100644
--- a/instances/widgets.treasury-factory.near/widget/components/StakedNearIframe.jsx
+++ b/instances/widgets.treasury-factory.near/widget/components/StakedNearIframe.jsx
@@ -168,42 +168,45 @@ const code = `