Skip to content

Commit

Permalink
Fix red flashes, init to [] rather than {} and hide open roles (#370)
Browse files Browse the repository at this point in the history
* fix red flashes, init to [] rather than {} and hide open roles

* fix formatting
  • Loading branch information
elliotBraem authored Jun 11, 2024
1 parent 801ad4b commit 1b5ef70
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 39 deletions.
8 changes: 2 additions & 6 deletions apps/new/widget/page/projects/Involved.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ if (!context.accountId) {
const { fetchProjects } = VM.require(
"${config_account}/widget/lib.projects",
) || {
fetchProjects: () => {},
fetchProjects: () => [],
};

if (!fetchProjects) {
return "";
}

const projects = fetchProjects() || [];
const projects = fetchProjects();

projects = projects.filter((project) =>
project.contributors.includes(context.accountId),
Expand Down
12 changes: 2 additions & 10 deletions apps/new/widget/page/projects/List.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,10 @@ const { Button } = VM.require("${alias_old}/widget/components") || {
const { fetchProjects } = VM.require(
"${config_account}/widget/lib.projects",
) || {
fetchProjects: () => {},
fetchProjects: () => [],
};

if (!fetchProjects) {
return "";
}

const projects = fetchProjects() || [];

if (!projects) {
return "";
}
const projects = fetchProjects();

return (
<Widget
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 @@ -205,7 +205,10 @@ return (
Create Project
</Button>
)}
{showOpenRoles && <Button>Open Roles</Button>}
{/*
Commenting out until roles feature is included
{showOpenRoles && <Button>Open Roles</Button>}
*/}
</div>
</div>
<p>{description}</p>
Expand Down
12 changes: 2 additions & 10 deletions apps/new/widget/page/projects/MyProjects.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,14 @@ if (!context.accountId) {
const { fetchProjects } = VM.require(
"${config_account}/widget/lib.projects",
) || {
fetchProjects: () => {},
fetchProjects: () => [],
};

if (!fetchProjects) {
return "";
}

const projects = fetchProjects() || [];
const projects = fetchProjects();
projects = projects.filter(
(project) => project.accountId === context.accountId,
);

if (!projects) {
return "";
}

return (
<Widget
src="${config_account}/widget/page.projects.MainViewContainer"
Expand Down
16 changes: 4 additions & 12 deletions apps/new/widget/page/projects/Watchlist.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ if (!context.accountId) {
const { fetchProjects } = VM.require(
"${config_account}/widget/lib.projects",
) || {
fetchProjects: () => {},
fetchProjects: () => [],
};

if (!fetchProjects) {
return "";
}
const stars = Social.getr(
`${context.accountId}/graph/star/*/project`,
"final",
Expand Down Expand Up @@ -64,14 +61,9 @@ const starredProjectIds = starredProjects.map(
(project) => project.split("/")[2],
);

const projects =
fetchProjects().filter((project) =>
starredProjectIds.includes(project.projectID),
) || [];

if (!projects) {
return "";
}
const projects = fetchProjects().filter((project) =>
starredProjectIds.includes(project.projectID),
);

return (
<Widget
Expand Down

0 comments on commit 1b5ef70

Please sign in to comment.