Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

submit proposal and store in IPFS #95

Merged
merged 20 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dapp/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ SOROBAN_NETWORK="testnet | public"

PUBLIC_DEFAULT_FEE="100"
PUBLIC_DEFAULT_TIMEOUT=30

PUBLIC_STORACHA_SING_PRIVATE_KEY=""
PUBLIC_STORACHA_PROOF=""
3 changes: 3 additions & 0 deletions dapp/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { defineConfig } from "astro/config";
import react from "@astrojs/react";
import tailwind from "@astrojs/tailwind";
import netlify from "@astrojs/netlify";

// https://astro.build/config
export default defineConfig({
integrations: [react(), tailwind()],
output: "hybrid",
adapter: netlify(),
});
3 changes: 3 additions & 0 deletions dapp/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/netlify": "^5.5.4",
"@astrojs/react": "^3.6.2",
"@astrojs/tailwind": "5.1.2",
"@creit.tech/sorobandomains-sdk": "^0.1.4",
"@creit.tech/stellar-wallets-kit": "^1.2.5",
"@mdxeditor/editor": "^3.19.2",
"@nanostores/react": "^0.8.0",
"@stellar/stellar-sdk": "^13.0.0",
"@web3-storage/w3up-client": "^16.5.1",
"astro": "4.16.14",
"astro-seo": "^0.8.4",
"github-markdown-css": "^5.8.0",
Expand Down
1 change: 0 additions & 1 deletion dapp/src/components/page/dashboard/ProjectList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ const ProjectList = () => {
};

const checkProjectOnChain = async (projectName) => {
console.log("search:", projectName);
setIsLoading(true);
try {
const project = await getProjectFromName(projectName);
Expand Down
23 changes: 20 additions & 3 deletions dapp/src/components/page/governance/GovernancePageTitle.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,36 @@ import Topic from "../../utils/Topic.astro";
</div>

<script>
import { navigate } from "astro:transitions/client";
import { projectNameForGovernance } from "utils/store";
import { capitalizeFirstLetter } from "utils/utils";

document.addEventListener("astro:page-load", async () => {
projectNameForGovernance.subscribe((projectName) => {
if (projectName) {
let projectName = "";
projectNameForGovernance.subscribe((_projectName) => {
if (_projectName) {
const titleElement = document
.getElementById("proposal-page-topic")
?.querySelector("span");
if (titleElement) {
titleElement.textContent = `${capitalizeFirstLetter(projectName)} Governance`;
titleElement.textContent = `${capitalizeFirstLetter(_projectName)} Governance`;
}
projectName = _projectName;
}
});

const submitProposalButton = document.getElementById(
"wrap-create-proposal-button",
);

if (submitProposalButton) {
submitProposalButton.addEventListener("click", () => {
if (projectName) {
navigate(`/proposal/new?name=${projectName}`);
} else {
alert("Project name is not provided");
}
});
}
});
</script>
13 changes: 13 additions & 0 deletions dapp/src/components/page/governance/NewProposalPage.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
import ProposalForm from "./ProposalForm";
---

<div
class="relative flex flex-col items-center lg:flex-row my-6 bg-zinc-100 rounded-[45px]"
>
<div
class="row items-center py-12 px-4 sm:px-12 md:px-20 md:py-10 w-full lg:max-w-none"
>
<ProposalForm client:load />
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
import Topic from "components/utils/Topic.astro";
---

<div
class="relative flex flex-col items-center md:flex-row justify-between mb-1.5 mt-4 sm:mt-8 md:mt-12 gap-y-4"
>
<Topic title="Create Proposal" description="" id="new-proposal-topic" />
</div>
12 changes: 9 additions & 3 deletions dapp/src/components/page/governance/ProposalCard.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import React from "react";
import ProposalStatusShow from "./ProposalStatusShow";
import type { ProposalCardView } from "types/proposal";
import { calculateDateDifference } from "utils/formatTimeFunctions";
import { navigate } from "astro:transitions/client";
import { useStore } from "@nanostores/react";
import { calculateDateDifference } from "utils/formatTimeFunctions";
import { projectNameForGovernance } from "utils/store";
import type { ProposalCardView } from "types/proposal";

const ProposalCard: React.FC<ProposalCardView> = ({
proposalNumber,
proposalTitle,
proposalStatus,
endDate,
}) => {
const projectName = useStore(projectNameForGovernance);

return (
<div
className="w-full px-2 sm:px-4 md:pl-8 py-2 sm:py-3 md:py-4.5 bg-white border border-zinc-300 rounded-lg sm:rounded-xl cursor-pointer hover:border-lime hover:bg-zinc-500"
onClick={() => navigate(`/proposal?id=${proposalNumber}`)}
onClick={() =>
navigate(`/proposal?id=${proposalNumber}&&name=${projectName}`)
}
>
<div className="w-full flex justify-between items-center">
<div className="lg:max-w-[calc(100%-240px)] flex items-start gap-2">
Expand Down
Loading
Loading