Skip to content

Commit

Permalink
weekly promotion of develop to main (#406)
Browse files Browse the repository at this point in the history
* Landing page (#290)

* Add new landing page

* Use new landing page

---------

Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>

* Ft: New `buildhub` app (#303)

* renamed new folder to `buildhub`

* added github job

* added mainnet job

* prettier update

* set new and old

---------

Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>

* Fix: builddao.testnet public key

* small change to trigger build

* small change to trigger build

* fix: gateway reference in testnet

* Fix notification issues (#304)

* Fix notifications count not resetting

* Supress console.logs

* Fix black background on notifications page

* Revert changes to post and comment

* Remove console logs and navbar from viewer for now

* Remove white bg

* Added commit modal bypass for all (#313)

* Added commit modal bypass for all

* Removed injectedConfig

* clean features

* changelog

---------

Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>

* App.js formatting fix

* Fix: Propose UI stuck partway through process (#302)

* Bug Fix 244

* "cleanup"

* New modal design implementation

* new-changes

* refactored code

* resolved comments

* latest-changes

* Initialize with essential routes (#312)

* Initialize with essential routes

* Move home to /page

* Add navbar

* Add footer to all pages

* Fix fmt?

* fix links

---------

Co-authored-by: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com>
Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>

* Test button Fix (#315)

* test-btn-fix

* toggle gateway urls

* New changes in design implemented

* Network button implementation

* rename vertical

* fix codeowners

* Projects feed new (#319)

* Sidebar

* Initialize Projects page

* Add CSS file

* Align projects page with new design

* Rename to kebab case

* Align card design with new figma

* Add List view

* 100vh height

* New projects feed updates & organization (#320)

* reorganizing

* formatting

* adds label

* Shift to pascal case

* Add state for projects view

* Rename folder structure

* Fix links

* Resolve comments

---------

Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>

* fix-network-links (#323)

* Resource page new (#325)

* Resources Page V0

* Resources Page V0 cleanup

* Header Removed

* Remaining Projects Routes (#328)

* Project Routes

* Refactor StarProjects

* Use star app logic for handling starring projects

* Resolve comments

* Project-new (#329)

* Remove "Error" from project-data helper

* Added route to index page for Project

* Created layout

* Added this to store entire project details with it's layout

* Added changes to index file

* Added overview

* Added Metadata

* Added activity and updated links

* Updated link to project details

* Used recent falbackUrl

* Added new fallbackUrl

* Updated links back to "projects"

* Added the rest of the pages and retructured project component

* Rearranged folder structure

* renamed routes to meet

* Prettier

* Fixed link to Metadata

* Navigation new (#331)

* Move navbar to new app and fix default route for sidebar

* Navbar changes to adapt to new style

* Revert some changes for now

* Add activity page

* Notifications Page (#336)

* Notifications Page

* Notifications Items fix

* Comments Resolved

* Tests for Login and Logout (#333)

* test-btn-fix

* toggle gateway urls

* New changes in design implemented

* Network button implementation

* Login and Logout tests

* Resource page new (#335)

* Resources Page V0

* Resources Page V0 cleanup

* Header Removed

* Adding new resources

* Move activity to new app pattern (#337)

* Move create project to separate page, edit support and refactoring (#321)

* moved create project to page, added roles and edit support

* show success modal after project is created

* fmt

* rebased and added reusable view container

* bug fixes

* add logs

* css update

* update login container css

* Fixed task editor and minor UI updates (#339)

* fixed task editor

* remove logs

* fmt

* Fix projects visibility on testnet (#342)

* Fix projects visibility

* fmt

* Convert starredProjects to star (#346)

* convert starredProjects to star

* notify account

* fmt

---------

Co-authored-by: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com>

* sets new index (#344)

* yarn.lock

* update bos-workspace

* downgrade to .20

* latest

* bos-workspace no bos-cli

* Add feed to project page (#356)

* Add feed to project page

* Change editor

* resolve comments

* Resolve comment

* use config_index

---------

Co-authored-by: Megha <100185149+Megha-Dev-19@users.noreply.github.com>

* Fix search in projects (#359)

* Project creation form fixes (#360)

* Add indicators for required fields

* Add prefix to inputfield

* Align typeahead with our input field style

* Resolve commits

* Fix projects bugs (#364)

* fix tags structure

* added border and error state

* add border to list card

* add autocomplete to projects

* fmt

---------

Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>

* Add form bounty template

* Image uploader module (#361)

* test-btn-fix

* toggle gateway urls

* New changes in design implemented

* Network button implementation

* Login and Logout tests

* Image Uploader module

* Implemented Files component

* run prettier format on commit (#369)

* Responsiveness and Adding Missing Pages (#365)

* Landing Page Update 3.0

* Responsiveness

* Add Inspect and Profile Page to new app

* Comments Resolved

* update yarn

* Fix red flashes, init to [] rather than {} and hide open roles (#370)

* fix red flashes, init to [] rather than {} and hide open roles

* fix formatting

* Fix red flash (#371)

* fix red flashes, init to [] rather than {} and hide open roles

* fix formatting

* default empty array

* Move proposals related files and fix notification roles selector (#377)

* move proposals related files

* minor fixes

* fix pre-commit command

* Fixes authentication tests (#381)

* remove Dummy

* cleans up auth tests

* fmt

* Refactors Project Card (#382)

* remove Dummy

* cleans up auth tests

* fmt

* tests to validate navigation

* combines and replaces two cards

* fmt

* Landing Page Refactor (#383)

* Landing Page Update 4.0

* URL Update

* fix links

* fmt

---------

Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>

* Upgrade the gateway to new app and some fixes (#386)

* Upgrade the gateway to new app and some fixes

* Fix project card

* fmt

* Update release-new-mainnet.yml

* Login/Logout Page Update / Profile.Index Update (#389)

* Landing Page Update 4.0

* URL Update

* Login Logout Page Design Update

* fix conflict

* fix links for signin, signout

---------

Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>

* fix landing page links (#394)

* Defaults fallback for Object.keys (fix red flash on projects page) (#396)

* increment

* adds fallbacks

* fmt

* Ft: Project quick view (#388)

* added canvas

* add UI

* css update

* fix tests and add mobile responsiveness

* fix potlock search (#397)

* added changelog

* Fix project creation w/ tests (#402)

* init tests

* fmt

* rename test

* fmt

* clean test

* formatting

* working as-is test

* fmt

* fix upload image

* fmt

* complete editor tests

* projects tests

* fmt

* remove unused

* Add resources tests (#425)

* Add resources tests

* Resolve comments

* Delete project (#417)

* added delete project

* Fix project creation w/ tests (#402)

* init tests

* fmt

* rename test

* fmt

* clean test

* formatting

* working as-is test

* fmt

* fix upload image

* fmt

* complete editor tests

* projects tests

* fmt

* remove unused

* added delete project

* added delete project test

* add edit project test

* fix tests

* added delete project test

* add edit project test

* fix tests

---------

Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>

* Landing page regression tests (#416)

* test-btn-fix

* toggle gateway urls

* New changes in design implemented

* Network button implementation

* Login and Logout tests

* Image Uploader module

* Implemented Files component

* lp-reg-tests

* start project and explore projects changes in redirection

* added the assertion for login and changed the structure

* added wait

* connect-btn-test-fix

* added wait for create project title

---------

Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>

* fix transfer proposal (#427)

* Navbar reg tests (#424)

* test-btn-fix

* toggle gateway urls

* New changes in design implemented

* Network button implementation

* Login and Logout tests

* Image Uploader module

* Implemented Files component

* lp-reg-tests

* start project and explore projects changes in redirection

* added the assertion for login and changed the structure

* added wait

* connect-btn-test-fix

* added wait for create project title

* navbar-reg-tests

* added page visiblity assertions

* fixed source btn locator

---------

Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>

* Fix overflow activity feed (#420)

* Fix overflow activity feed

* Sidebar style update

* Move fix to CSS

* increment version

---------

Co-authored-by: Muhammad Saad Iqbal <saadiqbal.dev@outlook.com>
Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>
Co-authored-by: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com>
Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>
Co-authored-by: Jiku Godwill Nsanwi <65053264+Jikugodwill@users.noreply.github.com>
Co-authored-by: Marpureddy Saswat <91129111+Eren-Yeaager@users.noreply.github.com>
Co-authored-by: heroes-bounty[bot] <167169790+heroes-bounty[bot]@users.noreply.github.com>
  • Loading branch information
8 people authored Jun 20, 2024
1 parent fac6fa1 commit b292faa
Show file tree
Hide file tree
Showing 19 changed files with 925 additions and 79 deletions.
8 changes: 8 additions & 0 deletions apps/new/widget/CSS.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ const CSS = styled.div`
.placeholder-glow {
background: var(--bg-1, black);
}
.content {
background: var(--bg-1, #000);
.main {
min-width: 0;
}
}
`;

return { CSS };
1 change: 0 additions & 1 deletion apps/new/widget/components/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ function findDefaultRoute(routesObject) {
const tab = props.tab ?? findDefaultRoute(routes);

const Sidebar = styled.div`
background: #000;
display: flex;
min-width: 259px;
min-height: 100vh;
Expand Down
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 @@ -107,6 +107,7 @@ const Tag = styled.div`
const EditButton = ({ item }) => {
return (
<Button
data-testid="edit-btn"
href={href({
widgetSrc: `${config_index}`,
params: {
Expand Down
2 changes: 1 addition & 1 deletion apps/new/widget/lib/projects.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const getProjectMeta = (id) => {
};

const getProjectIdFromPath = (id) => {
return id.split("/")[2] ?? null;
return (id ?? "").split("/")[2] ?? null;
};

return {
Expand Down
204 changes: 192 additions & 12 deletions apps/new/widget/page/projects/Editor.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
const accountId = context.accountId;

if (!context.accountId) {
return (
<Widget
src="${config_account}/widget/components.LoginAction"
loading=""
props={{
text: "Please log in in order to see create or edit a project.",
}}
/>
);
}

const { Button, InputField, TextEditor, Modal } = VM.require(
"${alias_old}/widget/components",
) || {
Expand All @@ -11,7 +24,7 @@ const { normalize } = VM.require("${alias_devs}/widget/lib.stringUtils") || {
normalize: () => {},
};

const { getProjectMeta } = VM.require(
const { getProjectMeta, getProjectIdFromPath } = VM.require(
"${config_account}/widget/lib.projects",
) || {
getProjectMeta: () => {},
Expand All @@ -36,7 +49,7 @@ const isNearAddress = (address) => {
return false;
}

const parts = address.split(".");
const parts = (address ?? "").split(".");

if (parts[0].length < 2 || parts[0].length > 32) {
return false;
Expand Down Expand Up @@ -103,6 +116,8 @@ const [roles, setRoles] = useState([]);
const [currentScreen, setCurrentScreen] = useState(1);
const [projectIdForSocialDB, setProjectId] = useState(null); // for edit changes
const [contributorSearchTerm, setContributorSearch] = useState("");
const [showDeleteModal, setShowDeleteModal] = useState(false);
const [showDeleteSuccessModal, setShowDeleteSuccessModal] = useState(false);

function removeWhiteSpace(str) {
return str.replace(/\s/g, "-").toLowerCase();
Expand Down Expand Up @@ -163,6 +178,10 @@ useEffect(() => {
}
}, [potlockProjectProfile]);

useEffect(() => {
setProjectId(getProjectIdFromPath(editProjectId));
}, [editProjectId]);

useEffect(() => {
if (editProjectData && !title) {
const {
Expand All @@ -183,7 +202,6 @@ useEffect(() => {
setTitle(title);
setLocation(location);
setTeamSize(teamSize);
setProjectId(editProjectId.split("project/")[1]);
setDescription(description);
setContributorsWithRoles(contributorsWithRoles ?? []);
setContributors(contributors ?? []);
Expand Down Expand Up @@ -341,6 +359,15 @@ const Container = styled.div`
}
}
.destructive {
background-color: #fd2a5c;
color: white;
border-color: #fd2a5c;
&:hover {
background-color: #fd2a5c !important;
}
}
.err,
.err-p_id {
color: #ff8888;
Expand Down Expand Up @@ -427,6 +454,85 @@ const SuccessModal = () => {
);
};

function onSuccessDeleteModalToggle(v) {
setShowDeleteSuccessModal(v);
}

const SuccessDeleteModal = () => {
return (
<ModalContainer>
<Modal
open={showDeleteSuccessModal}
onOpenChange={onSuccessDeleteModalToggle}
toggle={onSuccessDeleteModalToggle}
>
<div className="d-flex flex-column gap-2 align-items-center">
<img
src="https://ipfs.near.social/ipfs/bafkreidhpcgdofhhvyybz3d4xmoheovksulnatfsdyfljpphwvm74kl43e"
width={50}
/>
<div className="h5">Project Deleted successfully!</div>

<div className="text-center mt-2">
<Button
variant="primary"
href={href({
widgetSrc: `${alias_new}/widget/Index`,
params: {
page: "projects",
tab: "myProjects",
},
})}
>
View My Projects Page
</Button>
</div>
</div>
</Modal>
</ModalContainer>
);
};

function onDeletModalToggle(v) {
setShowDeleteModal(v);
}

const DeleteConfirmationModal = () => {
return (
<ModalContainer>
<Modal
open={showDeleteModal}
onOpenChange={onDeletModalToggle}
toggle={onDeletModalToggle}
>
<div className="d-flex flex-column gap-2 align-items-center">
<img
src="https://ipfs.near.social/ipfs/bafkreicuj5kuflnu4w3gsjre7erix2pxqmtcrp3aamdkt7viea3pldafpi"
width={50}
/>
<div className="h5 mb-0">Would like to delete this project?</div>
<div>This action can't be undone.</div>
<div className="d-flex justify-content-center gap-3 mt-2">
<Button variant="outline" onClick={() => setShowDeleteModal(false)}>
Cancel
</Button>
<Button
variant="outline"
className="destructive"
onClick={() => {
setShowDeleteModal(true);
onDeleteProject();
}}
>
Confirm
</Button>
</div>
</div>
</Modal>
</ModalContainer>
);
};

function onCreateProject() {
const projectID = isEditScreen ? projectIdForSocialDB : normalize(title, "-");
const project = {
Expand Down Expand Up @@ -489,7 +595,7 @@ function onCreateProject() {
methodName: "add_proposal",
args: {
proposal: {
description: `Project creation using BuildDAO created by ${context.accountId}`,
description: `This project was created using the Nearbuilder's gateway by ${context.accountId}`,
kind: {
FunctionCall: {
receiver_id: "${alias_socialdb}",
Expand Down Expand Up @@ -517,6 +623,62 @@ function onCreateProject() {
}
}

function onDeleteProject() {
const projectID = projectIdForSocialDB;
const data = {
project: {
[projectID]: null,
},
[app]: {
project: {
[`${context.accountId}_project_${projectID}`]: null,
},
},
};
if (projectAccount.includes(".sputnik-dao.near")) {
const policy = Near.view(projectAccount, "get_policy");
const base64 = Buffer.from(
JSON.stringify({
data: {
[projectAccount]: data,
},
options: { refund_unused_deposit: true },
}),
"utf-8",
).toString("base64");
Near.call({
contractName: projectAccount,
methodName: "add_proposal",
args: {
proposal: {
description: `This project was deleted using the Nearbuilder's gateway by ${context.accountId}`,
kind: {
FunctionCall: {
receiver_id: "${alias_socialdb}",
actions: [
{
method_name: "set",
args: base64,
deposit: "100000000000000000000000",
gas: "200000000000000",
},
],
},
},
},
},
deposit: policy?.proposal_bond || 100000000000000000000000,
gas: 200000000000000,
});
} else {
Social.set(data, {
onCommit: () => {
setShowDeleteSuccessModal(true);
},
});
}
}

function getSuggestiveAccounts() {
let suugestiveAccounts = [];
const profilesData = Social.get("*/profile/name", "final") || {};
Expand Down Expand Up @@ -557,6 +719,20 @@ function getSuggestiveAccounts() {
return suugestiveAccounts.slice(0, limit);
}

const DeleteProjectBtn = () => {
if (isEditScreen) {
return (
<Button
variant="outline"
className="destructive"
onClick={() => setShowDeleteModal(true)}
>
Delete Project
</Button>
);
} else return null;
};

const SecondScreen = () => {
return (
<>
Expand Down Expand Up @@ -661,7 +837,7 @@ const SecondScreen = () => {
src="${alias_old}/widget/components.UploadField"
props={{
image: avatar,
onChange: (image) => setAvatar({ image }),
onChange: (image) => setAvatar(image),
}}
/>
</div>
Expand All @@ -671,7 +847,7 @@ const SecondScreen = () => {
src="${alias_old}/widget/components.UploadField"
props={{
image: coverImage,
onChange: (image) => setCoverImage({ image }),
onChange: (image) => setCoverImage(image),
}}
/>
</div>
Expand Down Expand Up @@ -719,11 +895,16 @@ const SecondScreen = () => {
/>
</div>
<div className="d-flex align-items-center justify-content-end gap-2 mt-3">
<DeleteProjectBtn />
<Button variant="outline" onClick={() => setCurrentScreen(1)}>
Back
</Button>

<Button variant="primary" onClick={onCreateProject}>
<Button
variant="primary"
onClick={onCreateProject}
disabled={invalidContributorFound}
>
{isEditScreen ? "Save Changes" : "Create"}
</Button>
</div>
Expand Down Expand Up @@ -865,6 +1046,7 @@ const FirstScreen = () => {
</div>

<div className="d-flex align-items-center justify-content-end gap-2 mt-3">
<DeleteProjectBtn />
<Button
variant="outline"
href={href({
Expand All @@ -880,11 +1062,7 @@ const FirstScreen = () => {
<Button
variant="primary"
disabled={
invalidContributorFound ||
invalidProjectAccount ||
!title ||
!description ||
!projectAccount
invalidProjectAccount || !title || !description || !projectAccount
}
onClick={() => setCurrentScreen(2)}
>
Expand All @@ -904,6 +1082,8 @@ return (
Easily create, share, and track all projects within our vibrant builder
community.
</p>
<DeleteConfirmationModal />
<SuccessDeleteModal />
<SuccessModal />
{currentScreen === 1 ? <FirstScreen /> : <SecondScreen />}
</div>
Expand Down
5 changes: 4 additions & 1 deletion apps/new/widget/page/projects/ImportAndCreateModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ return (
onOpenChange={toggleModal}
toggle={toggle}
>
<Container className="d-flex flex-column gap-4 my-2">
<Container
className="d-flex flex-column gap-4 my-2"
data-testid="create-project-modal"
>
<Item
title="Create my own project"
description="Create your own completely new project, customize it your way!"
Expand Down
8 changes: 4 additions & 4 deletions apps/new/widget/page/proposals/create/Transfer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ const TextareaWrapper = styled.div`
`;

const sdkCall = () => {
let ftMetadata = tokensData.find((item) => item.tokenId === token);
const amountInYocto = Big(amount)
.mul(Big(10).pow(ftMetadata.decimals))
.toFixed();
sdk.createTransferProposal({
description: text,
tokenId: token === NearTokenId ? "" : token,
Expand Down Expand Up @@ -313,10 +317,6 @@ return (
className="ms-auto"
variant="primary"
onClick={() => {
let ftMetadata = tokensData.find((item) => item.tokenId === token);
const amountInYocto = Big(amount)
.mul(Big(10).pow(ftMetadata.decimals))
.toFixed();
setInfoModalActive(true);
}}
>
Expand Down
Loading

0 comments on commit b292faa

Please sign in to comment.