Skip to content

Commit

Permalink
Projects test coverage (#422)
Browse files Browse the repository at this point in the history
* add search, filter, watchlist, involved projects view

* fix tests

* fix tests

* add back some tests
  • Loading branch information
Megha-Dev-19 authored Jun 24, 2024
1 parent eed77f3 commit 6868725
Show file tree
Hide file tree
Showing 9 changed files with 371 additions and 219 deletions.
3 changes: 2 additions & 1 deletion aliases.mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"socialdb": "social.near",
"gateway_url": "https://nearbuilders.org",
"new": "builddao.near",
"old": "buildhub.near"
"old": "buildhub.near",
"potlock": "potlock.near"
}
3 changes: 2 additions & 1 deletion aliases.testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"socialdb": "v1.social08.testnet",
"gateway_url": "https://test.nearbuilders.org",
"new": "builddao.testnet",
"old": "buildhub.testnet"
"old": "buildhub.testnet",
"potlock": "potlock.testnet"
}
1 change: 1 addition & 0 deletions apps/new/widget/components/project/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const EditButton = ({ item }) => {
id: item.path,
},
})}
onClick={(e) => e.stopPropagation()}
type="icon"
className={"rounded-3"}
variant="primary"
Expand Down
5 changes: 4 additions & 1 deletion apps/new/widget/page/projects/MainViewContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ const ProjectCardWrapper = ({ children, project }) => {
return (
<div
className="cursor d-flex flex-1"
onClick={() => setShowQuickView(project)}
onClick={(e) => {
e.stopPropagation();
setShowQuickView(project);
}}
>
{children}
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/new/widget/page/projects/PotlockImport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ const { Button } = VM.require("${alias_old}/widget/components") || {
Button: () => <></>,
};
const { getTagsFromSocialProfileData, getTeamMembersFromSocialProfileData } =
VM.require("potlock.near/widget/utils") || {
VM.require("${alias_potlock}/widget/utils") || {
getTagsFromSocialProfileData: () => [],
getTeamMembersFromSocialProfileData: () => [],
};

const bootstrapTheme = props.bootstrapTheme || "dark";

let ListsSDK =
VM.require("potlock.near/widget/SDK.lists") ||
VM.require("${alias_potlock}/widget/SDK.lists") ||
(() => ({
getRegistrations: () => {},
}));
Expand Down
17 changes: 10 additions & 7 deletions apps/new/widget/page/projects/PotlockProjectCard.jsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
const { potId, potDetail, payoutDetails, projects } = props;
const { nearToUsd, ipfsUrlFromCid, yoctosToNear, yoctosToUsdWithFallback } =
VM.require("potlock.near/widget/utils") || {
VM.require("${alias_potlock}/widget/utils") || {
ipfsUrlFromCid: () => "",
yoctosToNear: () => "",
yoctosToUsdWithFallback: () => "",
nearToUsd: 1,
};

const { _address } = VM.require(
`potlock.near/widget/Components.DonorsUtils`,
"${alias_potlock}/widget/Components.DonorsUtils",
) || {
_address: (address) => address,
};

const { ownerId, NADA_BOT_URL, SUPPORTED_FTS } = VM.require(
"potlock.near/widget/constants",
"${alias_potlock}/widget/constants",
) || {
ownerId: "",
NADA_BOT_URL: "",
SUPPORTED_FTS: {},
};
const { getTagsFromSocialProfileData } = VM.require(
"potlock.near/widget/utils",
"${alias_potlock}/widget/utils",
) || {
getTagsFromSocialProfileData: () => [],
};

const PotSDK = VM.require("potlock.near/widget/SDK.pot") || {
const PotSDK = VM.require("${alias_potlock}/widget/SDK.pot") || {
getDonationsForProject: () => {},
};

let DonateSDK =
VM.require("potlock.near/widget/SDK.donate") ||
VM.require("${alias_potlock}/widget/SDK.donate") ||
(() => ({
getDonationsForRecipient: () => {},
}));
Expand Down Expand Up @@ -363,7 +363,10 @@ const profileImageStyle = {
const tags = getTagsFromSocialProfileData(profile);

return (
<div onClick={() => props.setShowCreateModalProjectId(projectId)}>
<div
data-testid="potlock-card"
onClick={() => props.setShowCreateModalProjectId(projectId)}
>
<Card>
<HeaderContainer className="pt-0 position-relative">
<BackgroundImageContainer>
Expand Down
2 changes: 2 additions & 0 deletions apps/old/widget/components/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function Button({
className={linkClassName}
style={{ textDecoration: "none" }}
target={target}
onClick={(e) => e.stopPropagation()}
>
<StyledButton
id={id}
Expand All @@ -128,6 +129,7 @@ function Button({
className={linkClassName}
style={{ textDecoration: "none" }}
target={target}
onClick={(e) => e.stopPropagation()}
>
<StyledButton
id={id}
Expand Down
Loading

0 comments on commit 6868725

Please sign in to comment.