Skip to content

Commit

Permalink
Merge pull request #6 from NEARBuilders/formating-fix
Browse files Browse the repository at this point in the history
Formating fix
  • Loading branch information
Jikugodwill authored Sep 11, 2024
2 parents 41e2a0e + b46ff37 commit 6205d9f
Show file tree
Hide file tree
Showing 13 changed files with 3,061 additions and 3,315 deletions.
2 changes: 1 addition & 1 deletion aliases.mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"MOB": "mob.near",
"NEAR": "near",
"DEVS": "devs.near",
"GENADROP":"bos.genadrop.near",
"GENADROP": "bos.genadrop.near",
"CART_KEY": "blackdragon-cart"
}
8 changes: 4 additions & 4 deletions bos.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"account": "blackdrogon.near",
"aliases": ["./aliases.mainnet.json"],
"index":"blackdrogon.near/widget/Index"
}
"account": "blackdrogon.near",
"aliases": ["./aliases.mainnet.json"],
"index": "blackdrogon.near/widget/Index"
}
2 changes: 1 addition & 1 deletion config/rspack.development.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require("path");
const { HotModuleReplacementPlugin } = require('@rspack/core');
const { HotModuleReplacementPlugin } = require("@rspack/core");

module.exports = () => ({
devtool: "inline-source-map",
Expand Down
6 changes: 3 additions & 3 deletions config/rspack.production.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const rspack = require("@rspack/core");
const path = require("path");

module.exports = () => {
Expand Down Expand Up @@ -55,7 +55,7 @@ module.exports = () => {
new rspack.CssExtractRspackPlugin({
filename: "styles/[name].[contenthash].css",
chunkFilename: "[id].css",
})
}),
],
optimization: {
minimize: true,
Expand All @@ -67,7 +67,7 @@ module.exports = () => {
compress: {
drop_console: true,
},
}
},
}),
],
runtimeChunk: {
Expand Down
2 changes: 1 addition & 1 deletion playwright-tests/tests/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("test data-component attribute", () => {
page,
}) => {
const src = "meta-pool-official.near/widget/MetaPoolStakeEth";
const config = { "vm": { "features": {"enableComponentSrcDataKey": true }}}
const config = { vm: { features: { enableComponentSrcDataKey: true } } };

await setupNearSocialViewer(page, src, config);

Expand Down
8 changes: 6 additions & 2 deletions playwright-tests/tests/network.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ test("should use default network (mainnet) when network value not provided", asy
await page.goto("/");

await page.evaluate(() => {
const config = JSON.stringify({ "vm": { "features": {"enableComponentSrcDataKey": true }}})
const config = JSON.stringify({
vm: { features: { enableComponentSrcDataKey: true } },
});

document.body.innerHTML = `
<near-social-viewer src="devs.near/widget/default" config='${config}'></near-social-viewer>
Expand Down Expand Up @@ -55,7 +57,9 @@ test("should use testnet network when network attribute is provided", async ({

// Set the netork attribute to testnet
await page.evaluate(() => {
const config = JSON.stringify({ "vm": { "features": {"enableComponentSrcDataKey": true }}})
const config = JSON.stringify({
vm: { features: { enableComponentSrcDataKey: true } },
});

document.body.innerHTML = `
<near-social-viewer src="neardevs.testnet/widget/default" network="testnet" config='${config}'></near-social-viewer>
Expand Down
12 changes: 8 additions & 4 deletions playwright-tests/tests/router.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ test("Verify default route loads successfully and displays expected content", as
await page.goto("/");

await page.evaluate(() => {
const config = JSON.stringify({ "vm": { "features": {"enableComponentSrcDataKey": true }}})
const config = JSON.stringify({
vm: { features: { enableComponentSrcDataKey: true } },
});

document.body.innerHTML = `
<near-social-viewer src="devs.near/widget/default" initialprops='{"message": "hello world!"}' config='${config}'></near-social-viewer>
Expand Down Expand Up @@ -55,8 +57,8 @@ test("should load the other routes with params when provided", async ({

// Verify route loads
await waitForSelectorToBeVisible(
page,
'body > near-social-viewer > div > div > div > div'
page,
"body > near-social-viewer > div > div > div > div"
);

// Verify provided props are active
Expand All @@ -70,7 +72,9 @@ test("should be possible to set initialProps and src widget for the root path",
}) => {
await page.goto("/");
await page.evaluate(() => {
const config = JSON.stringify({ "vm": { "features": {"enableComponentSrcDataKey": true }}})
const config = JSON.stringify({
vm: { features: { enableComponentSrcDataKey: true } },
});

document.body.innerHTML = `
<near-social-viewer src="devhub.near/widget/app" initialProps='{"page": "community", "handle": "webassemblymusic"}' config='${config}'></near-social-viewer>
Expand Down
9 changes: 6 additions & 3 deletions playwright-tests/tests/rpc.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ test("Verify default RPC is called when value not provided", async ({
await page.goto("/");

await page.evaluate(() => {
const config = JSON.stringify({ "vm": { "features": {"enableComponentSrcDataKey": true }}})

const config = JSON.stringify({
vm: { features: { enableComponentSrcDataKey: true } },
});

document.body.innerHTML = `
<near-social-viewer src="devs.near/widget/default" config='${config}'></near-social-viewer>
Expand Down Expand Up @@ -65,7 +66,9 @@ test("Verify custom RPC is called when provided", async ({ page }) => {

// Set the rpc attribute to a custom rpc value
await page.evaluate((url) => {
const config = JSON.stringify({ "vm": { "features": {"enableComponentSrcDataKey": true }}})
const config = JSON.stringify({
vm: { features: { enableComponentSrcDataKey: true } },
});

document.body.innerHTML = `
<near-social-viewer src="devs.near/widget/default" rpc="${url}" config='${config}'></near-social-viewer>
Expand Down
2 changes: 1 addition & 1 deletion playwright-tests/tests/web3.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test("should be possible to interact with web3 widgets", async ({ page }) => {
'near-social-viewer[src="meta-pool-official.near/widget/MetaPoolStakeEth"]'
);

const header = page.getByRole('heading', { name: 'Stake ETH' });
const header = page.getByRole("heading", { name: "Stake ETH" });
await expect(header).toBeVisible();

const Web3ConnectButton = page.getByRole("button", {
Expand Down
4 changes: 2 additions & 2 deletions rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = function (env) {
options: {
jsc: {
parser: {
syntax: 'ecmascript',
syntax: "ecmascript",
jsx: true,
},
externalHelpers: true,
Expand All @@ -44,7 +44,7 @@ module.exports = function (env) {
targets: "Chrome >= 48",
},
},
type: 'javascript/auto',
type: "javascript/auto",
},
// Images: Copy image files to build folder
{ test: /\.(?:ico|gif|png|jpg|jpeg)$/i, type: "asset/resource" },
Expand Down
3 changes: 2 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ function App(props) {
},
},
features: {
enableComponentSrcDataKey: config?.vm?.features?.enableComponentSrcDataKey,
enableComponentSrcDataKey:
config?.vm?.features?.enableComponentSrcDataKey,
},
config: {
defaultFinality: undefined,
Expand Down
14 changes: 7 additions & 7 deletions widget/page/product.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
const { isDarkModeOn, metadataId, accountId, connectedDao } = props;

if (!metadataId) {
return <h1>NFT Metadata ID not provided</h1>
return <h1>NFT Metadata ID not provided</h1>;
}
const extractedContactId = metadataId.split(":")[0];
const contractId =
props.contractId || extractedContactId;
const contractId = props.contractId || extractedContactId;

const buySvg = (
<svg
Expand All @@ -25,13 +24,13 @@ const Navbar = styled.div`
display: flex;
flex-direction: row;
align-items: center;
background: ${isDarkModeOn ? "#282a3a" : "#f6f5f4"};
background: #f6f5f4;
height: 50px;
width: 100%;
.buy {
background: none;
border: 1px solid #5b5d6b;
color: ${isDarkModeOn ? "#ffffff" : "#000000"};
color: #000000;
outline: none;
margin-top: 30px;
padding: 5px 20px;
Expand All @@ -55,7 +54,7 @@ const Navbar = styled.div`
.button {
background: none;
border: 1px solid #5b5d6b;
color: ${isDarkModeOn ? "#ffffff" : "#000000"};
color: #000000;
outline: none;
padding: 5px 20px;
border-radius: 5px;
Expand Down Expand Up @@ -220,7 +219,8 @@ const fetchNFTData = (contractId) => {
return response.body.data.mb_views_active_listings;
};
const nftData = fetchNFTData(contractId);
const { listingCount, infoNFT, nftCount, dataTransaction } = fetchStoreFrontData(metadataId);
const { listingCount, infoNFT, nftCount, dataTransaction } =
fetchStoreFrontData(metadataId);

const isMintedContract = ["mintbase1.near", "mintspace2.testnet"].some(
(substring) => contractId?.includes(substring)
Expand Down
Loading

0 comments on commit 6205d9f

Please sign in to comment.