Skip to content

Commit

Permalink
Added Ariz button (#483)
Browse files Browse the repository at this point in the history
* Added Ariz button

* Added owner check

* cleanup

* Repositioned button and added logo

* Added tests

* cleanup

* fix history

* fmt

* fix alias

* fix default router

---------

Co-authored-by: Elliot Braem <[email protected]>
  • Loading branch information
Jikugodwill and elliotBraem authored Jul 23, 2024
1 parent 9980bf3 commit 67e7cba
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
13 changes: 13 additions & 0 deletions playwright-tests/tests/project.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,19 @@ test.describe("?page=project&id=", () => {
expect(transactionObj).toMatchObject(expectedTransactionData);
});
});

test("should show Ariz portfolio button when owner of project", async ({
page,
}) => {
const arizButton = await page.getByTestId("ariz-portfolio");
expect(arizButton).toBeInTheDocument();
});

test("should navigate to Ariz portfolio when clicked", async ({ page }) => {
const arizButton = await page.getByTestId("ariz-portfolio");
await arizButton.click();
await expect(page).toHaveURL(/https:\/\/arizportfolio\.near\.page\//);
});
});
});

Expand Down
2 changes: 1 addition & 1 deletion widget/page/project/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const config = {
name: "Overview",
icon: "bi bi-house",
},
default: "true",
default: true,
},
tasks: {
path: "${config_account}/widget/page.project.Main",
Expand Down
28 changes: 28 additions & 0 deletions widget/page/project/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ const { Metadata } = VM.require(
const { href } = VM.require("${alias_devs}/widget/lib.url") || {
href: () => {},
};

const { Button } = VM.require("${config_account}/widget/components.Index") || {
Button: () => <></>,
};

const Layout = ({
projectAccountId,
projectId,
Expand All @@ -21,6 +26,8 @@ const Layout = ({
if (!projectAccountId) {
return <p className="fw-bold text-white">No Account ID</p>;
}
const isOwner = accountId === projectAccountId;

return (
<>
<div className="my-3 w-100">
Expand All @@ -37,6 +44,27 @@ const Layout = ({
<i className="bi bi-chevron-left"></i> Back to Projects
</span>
</Link>
{isOwner && (
<Button
href="https://arizportfolio.near.page/"
className=""
variant="primary"
target="_blank"
style={{
float: "right",
background: "#fff",
color: "#3d5443",
marginTop: -5,
}}
>
Open
<img
src="https://ipfs.near.social/ipfs/bafkreiewwaad6t7hhd6p4q6n7guranohznqaz634xuzgcgcoahxfayal5i"
width={"30px"}
/>
Portfolio
</Button>
)}
</div>
<Metadata
title={title}
Expand Down
2 changes: 1 addition & 1 deletion widget/page/project/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const config = {
init: {
...props,
},
default: "true",
default: true,
},
activity: {
path: "${config_account}/widget/page.project.tabs.Discussion",
Expand Down

0 comments on commit 67e7cba

Please sign in to comment.