Skip to content

Commit

Permalink
Fix Build error (#614)
Browse files Browse the repository at this point in the history
* remove common.jsx use

* update href
  • Loading branch information
Megha-Dev-19 authored Dec 30, 2023
1 parent accfdee commit bf0e1ee
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 83 deletions.
9 changes: 0 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,6 @@ We use [Playwright](https://playwright.dev) for tests, which are located in the

See the [test-pipeline](./.github/workflows/continuous-integration-workflow.yml) for what dependencies that needs to be installed on your workstation for tests to run.


#### Making Changes to common.jsx

The `common.jsx` file contains a set of shared utilities that are often reused in DevHub widgets. When you need to change it, just edit the file in the root of the project, and update the widgets with this one command:

```
npm run build
```

#### Storage Deposit

Sometimes there is a need to deposit extra tokens to cover the widgets’ storage cost. You can do that with [`bos` CLI](https://github.com/FroVolod/bos-cli-rs):
Expand Down
46 changes: 0 additions & 46 deletions module/include.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"fmt": "prettier --write '**/*.{js,jsx,ts,tsx,json}'",
"fmt:check": "prettier --check '**/*.{js,jsx,ts,tsx,json}'",
"build": "npm run fmt && node ./module/include.js",
"build": "npm run fmt",
"dev:testnet": "./scripts/dev.sh",
"dev:mainnet": "./scripts/dev.sh -a devhub.near -c devgovgigs.near -n mainnet",
"build:preview": "node ./scripts/build-preview.mjs",
Expand Down
44 changes: 17 additions & 27 deletions src/devhub/entity/post/History.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,7 @@ props.newTab: boolean;
props.timestamp: number;
props.referral: any;
*/

function href(widgetName, linkProps) {
linkProps = { ...linkProps };
if (props.referral) {
linkProps.referral = props.referral;
}

const linkPropsQuery = Object.entries(linkProps)
.filter(([_key, nullable]) => (nullable ?? null) !== null)
.map(([key, value]) => `${key}=${value}`)
.join("&");

return `/${REPL_DEVHUB}/widget/devhub.page.${widgetName}${
linkPropsQuery ? "?" : ""
}${linkPropsQuery}`;
}
/* END_INCLUDE: "common.jsx" */
const { href } = VM.require("${REPL_DEVHUB}/widget/core.lib.url") || (() => {});

const postId = props.post.id ?? (props.id ? parseInt(props.id) : 0);
const post =
Expand Down Expand Up @@ -93,11 +77,14 @@ const history = (
>
<a
class="dropdown-item"
href={href("post", {
id: postId,
timestamp: item.timestamp,
compareTimestamp: null,
referral,
href={href({
widgetSrc: "${REPL_DEVHUB}/widget/devhub.entity.post.Post",
params: {
id: postId,
timestamp: item.timestamp,
compareTimestamp: null,
referral,
},
})}
target={props.newTab ? "_blank" : undefined}
>
Expand All @@ -121,11 +108,14 @@ const history = (
</div>
<a
class="dropdown-item"
href={href("Post", {
id: postId,
timestamp: currentTimestamp,
compareTimestamp: item.timestamp,
referral,
href={href({
widgetSrc: "${REPL_DEVHUB}/widget/devhub.entity.post.Post",
params: {
id: postId,
timestamp: currentTimestamp,
compareTimestamp: item.timestamp,
referral,
},
})}
>
<i class="bi bi-file-earmark-diff" />
Expand Down

0 comments on commit bf0e1ee

Please sign in to comment.