Skip to content

Commit

Permalink
Fix multichoice result and input for amount on lockup (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryzettler authored Apr 3, 2024
1 parent ebe8efa commit b9ff0f6
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 84 deletions.
2 changes: 0 additions & 2 deletions .env.development

This file was deleted.

1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_SOLANA_URL=
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"date-fns": "^3.3.1",
"lucide-react": "^0.323.0",
"markdown-it": "^14.0.0",
"next": "14.1.0",
"next": "^14.1.4",
"next-themes": "^0.2.1",
"react": "^18",
"react-async-hook": "^4.0.0",
Expand Down
16 changes: 8 additions & 8 deletions src/components/LockTokensForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,9 @@ export const LockTokensForm: FC<{

setAmount(
parseFloat(
Math.max(
Number(mintMinAmount),
Math.min(Number(maxLockupAmount), Number(e.target.value))
).toFixed(currentPrecision)
Math.max(Number(mintMinAmount), Number(e.target.value)).toFixed(
currentPrecision
)
)
);
};
Expand Down Expand Up @@ -204,7 +203,6 @@ export const LockTokensForm: FC<{
</div>
<Input
placeholder="Enter amount"
max={maxLockupAmount}
min={mintMinAmount}
value={amount}
type="number"
Expand Down Expand Up @@ -387,7 +385,7 @@ export const LockTokensForm: FC<{
{
lock:
!amount ||
!maxLockupAmount ||
amount > maxLockupAmount ||
!lockupPeriod.value ||
lockupPeriod.value === 0 ||
isSubmitting,
Expand All @@ -397,15 +395,17 @@ export const LockTokensForm: FC<{
isSubmitting,
split:
!amount ||
!maxLockupAmount ||
amount > maxLockupAmount ||
!lockupPeriod.value ||
lockupPeriod.value === 0 ||
isSubmitting,
}[mode]
}
>
{isSubmitting && <Loader2 className="size-5 animate-spin" />}
{submitText}
{!amount || amount <= maxLockupAmount
? submitText
: `Insufficient ${upperNetwork}`}
</Button>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Proposals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const Proposals: FC<React.PropsWithChildren<{ className?: string }>> = ({
</div>
)}
</section>
{inactiveProposals.length > 0 || React.Children.count(children) > 0 ? (
{inactiveProposals.length > 0 || children ? (
<section className="flex flex-col gap-4 my-4">
<h5>Closed Votes</h5>
<div className="grid grid-cols-1 gap-4 md:grid-cols-3">
Expand Down
7 changes: 6 additions & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { IdlAccounts } from "@coral-xyz/anchor";
import { Proposal } from "@helium/modular-governance-idls/lib/types/proposal";

export type ProposalState = "active" | "cancelled" | "passed" | "failed";
export type ProposalState =
| "active"
| "cancelled"
| "passed"
| "failed"
| "completed";
export interface ILegacyProposal {
id: string;
deadline: number;
Expand Down
4 changes: 4 additions & 0 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ export const getDerivedProposalState = (
if (keys.includes("voting")) return "active";
if (keys.includes("cancelled")) return "cancelled";
if (keys.includes("resolved") && proposal.state.resolved) {
if (proposal.choices.length > 2) {
return "completed";
}

if (
(proposal.state.resolved.choices.length === 1 &&
proposal.choices[proposal.state.resolved.choices[0]].name.startsWith(
Expand Down
134 changes: 63 additions & 71 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,14 @@
"@helium/organization-sdk" "^0.0.8"
"@solana/web3.js" "^1.78.4"

"@helium/modular-governance-idls@^0.0.8":
"@helium/modular-governance-idls@^0.0.8", "@helium/modular-governance-idls@^0.0.8-next":
version "0.0.8"
resolved "https://registry.yarnpkg.com/@helium/modular-governance-idls/-/modular-governance-idls-0.0.8.tgz#b913b28790ff80359c7470d9d6665468f5f1b435"
integrity sha512-vmBw9dRUsYKX5ZXiMJaCoKYv5yNBLHpXKb5LI/5cIq0KrGNC4quzMuoMzeehXGgDkIIM9VLnk8YP1Bz8CvUzqA==
dependencies:
"@coral-xyz/anchor" "^0.28.0"
"@solana/web3.js" "^1.78.4"

"@helium/modular-governance-idls@^0.0.8-next":
version "0.0.8-next"
resolved "https://registry.yarnpkg.com/@helium/modular-governance-idls/-/modular-governance-idls-0.0.8-next.tgz#1c2d1f260e78967114dfe5951d463dad4204e053"
integrity sha512-bge5rzoRYkXJC4q+12UWF4vzWYSCVuGkwEBD4hvC/gTx69fBVcDjcfU75Rs1wxsB9o8rHrTh2b+Q6VbQXFZgbQ==
dependencies:
"@coral-xyz/anchor" "^0.28.0"
"@solana/web3.js" "^1.78.4"

"@helium/organization-sdk@^0.0.8":
version "0.0.8"
resolved "https://registry.yarnpkg.com/@helium/organization-sdk/-/organization-sdk-0.0.8.tgz#4738619a929999af6529f21e80e79ab766472322"
Expand Down Expand Up @@ -509,10 +501,10 @@
bn.js "^5.2.0"
debug "^4.3.4"

"@next/env@14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@next/env/-/env-14.1.0.tgz#43d92ebb53bc0ae43dcc64fb4d418f8f17d7a341"
integrity sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==
"@next/env@14.1.4":
version "14.1.4"
resolved "https://registry.yarnpkg.com/@next/env/-/env-14.1.4.tgz#432e80651733fbd67230bf262aee28be65252674"
integrity sha512-e7X7bbn3Z6DWnDi75UWn+REgAbLEqxI8Tq2pkFOFAMpWAWApz/YCUhtWMWn410h8Q2fYiYL7Yg5OlxMOCfFjJQ==

"@next/eslint-plugin-next@14.1.0":
version "14.1.0"
Expand All @@ -521,50 +513,50 @@
dependencies:
glob "10.3.10"

"@next/swc-darwin-arm64@14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.0.tgz#70a57c87ab1ae5aa963a3ba0f4e59e18f4ecea39"
integrity sha512-nUDn7TOGcIeyQni6lZHfzNoo9S0euXnu0jhsbMOmMJUBfgsnESdjN97kM7cBqQxZa8L/bM9om/S5/1dzCrW6wQ==

"@next/swc-darwin-x64@14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.0.tgz#0863a22feae1540e83c249384b539069fef054e9"
integrity sha512-1jgudN5haWxiAl3O1ljUS2GfupPmcftu2RYJqZiMJmmbBT5M1XDffjUtRUzP4W3cBHsrvkfOFdQ71hAreNQP6g==

"@next/swc-linux-arm64-gnu@14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.1.0.tgz#893da533d3fce4aec7116fe772d4f9b95232423c"
integrity sha512-RHo7Tcj+jllXUbK7xk2NyIDod3YcCPDZxj1WLIYxd709BQ7WuRYl3OWUNG+WUfqeQBds6kvZYlc42NJJTNi4tQ==

"@next/swc-linux-arm64-musl@14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.1.0.tgz#d81ddcf95916310b8b0e4ad32b637406564244c0"
integrity sha512-v6kP8sHYxjO8RwHmWMJSq7VZP2nYCkRVQ0qolh2l6xroe9QjbgV8siTbduED4u0hlk0+tjS6/Tuy4n5XCp+l6g==

"@next/swc-linux-x64-gnu@14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.1.0.tgz#18967f100ec19938354332dcb0268393cbacf581"
integrity sha512-zJ2pnoFYB1F4vmEVlb/eSe+VH679zT1VdXlZKX+pE66grOgjmKJHKacf82g/sWE4MQ4Rk2FMBCRnX+l6/TVYzQ==

"@next/swc-linux-x64-musl@14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.1.0.tgz#77077cd4ba8dda8f349dc7ceb6230e68ee3293cf"
integrity sha512-rbaIYFt2X9YZBSbH/CwGAjbBG2/MrACCVu2X0+kSykHzHnYH5FjHxwXLkcoJ10cX0aWCEynpu+rP76x0914atg==

"@next/swc-win32-arm64-msvc@14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.1.0.tgz#5f0b8cf955644104621e6d7cc923cad3a4c5365a"
integrity sha512-o1N5TsYc8f/HpGt39OUQpQ9AKIGApd3QLueu7hXk//2xq5Z9OxmV6sQfNp8C7qYmiOlHYODOGqNNa0e9jvchGQ==

"@next/swc-win32-ia32-msvc@14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.1.0.tgz#21f4de1293ac5e5a168a412b139db5d3420a89d0"
integrity sha512-XXIuB1DBRCFwNO6EEzCTMHT5pauwaSj4SWs7CYnME57eaReAKBXCnkUE80p/pAZcewm7hs+vGvNqDPacEXHVkw==

"@next/swc-win32-x64-msvc@14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.1.0.tgz#e561fb330466d41807123d932b365cf3d33ceba2"
integrity sha512-9WEbVRRAqJ3YFVqEZIxUqkiO8l1nool1LmNxygr5HWF8AcSYsEpneUDhmjUVJEzO2A04+oPtZdombzzPPkTtgg==
"@next/swc-darwin-arm64@14.1.4":
version "14.1.4"
resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.4.tgz#a3bca0dc4393ac4cf3169bbf24df63441de66bb7"
integrity sha512-ubmUkbmW65nIAOmoxT1IROZdmmJMmdYvXIe8211send9ZYJu+SqxSnJM4TrPj9wmL6g9Atvj0S/2cFmMSS99jg==

"@next/swc-darwin-x64@14.1.4":
version "14.1.4"
resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.4.tgz#ba3683d4e2d30099f3f2864dd7349a4d9f440140"
integrity sha512-b0Xo1ELj3u7IkZWAKcJPJEhBop117U78l70nfoQGo4xUSvv0PJSTaV4U9xQBLvZlnjsYkc8RwQN1HoH/oQmLlQ==

"@next/swc-linux-arm64-gnu@14.1.4":
version "14.1.4"
resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.1.4.tgz#3519969293f16379954b7e196deb0c1eecbb2f8b"
integrity sha512-457G0hcLrdYA/u1O2XkRMsDKId5VKe3uKPvrKVOyuARa6nXrdhJOOYU9hkKKyQTMru1B8qEP78IAhf/1XnVqKA==

"@next/swc-linux-arm64-musl@14.1.4":
version "14.1.4"
resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.1.4.tgz#4bb3196bd402b3f84cf5373ff1021f547264d62f"
integrity sha512-l/kMG+z6MB+fKA9KdtyprkTQ1ihlJcBh66cf0HvqGP+rXBbOXX0dpJatjZbHeunvEHoBBS69GYQG5ry78JMy3g==

"@next/swc-linux-x64-gnu@14.1.4":
version "14.1.4"
resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.1.4.tgz#1b3372c98c83dcdab946cdb4ee06e068b8139ba3"
integrity sha512-BapIFZ3ZRnvQ1uWbmqEGJuPT9cgLwvKtxhK/L2t4QYO7l+/DxXuIGjvp1x8rvfa/x1FFSsipERZK70pewbtJtw==

"@next/swc-linux-x64-musl@14.1.4":
version "14.1.4"
resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.1.4.tgz#8459088bdc872648ff78f121db596f2533df5808"
integrity sha512-mqVxTwk4XuBl49qn2A5UmzFImoL1iLm0KQQwtdRJRKl21ylQwwGCxJtIYo2rbfkZHoSKlh/YgztY0qH3wG1xIg==

"@next/swc-win32-arm64-msvc@14.1.4":
version "14.1.4"
resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.1.4.tgz#84280a08c00cc3be24ddd3a12f4617b108e6dea6"
integrity sha512-xzxF4ErcumXjO2Pvg/wVGrtr9QQJLk3IyQX1ddAC/fi6/5jZCZ9xpuL9Tzc4KPWMFq8GGWFVDMshZOdHGdkvag==

"@next/swc-win32-ia32-msvc@14.1.4":
version "14.1.4"
resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.1.4.tgz#23ff7f4bd0a27177428669ef6fa5c3923c738031"
integrity sha512-WZiz8OdbkpRw6/IU/lredZWKKZopUMhcI2F+XiMAcPja0uZYdMTZQRoQ0WZcvinn9xZAidimE7tN9W5v9Yyfyw==

"@next/swc-win32-x64-msvc@14.1.4":
version "14.1.4"
resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.1.4.tgz#bccf5beccfde66d6c66fa4e2509118c796385eda"
integrity sha512-4Rto21sPfw555sZ/XNLqfxDUNeLhNYGO2dlPqsnuCg8N8a2a9u1ltqBOPQ4vj1Gf7eJC0W2hHG2eYUHuiXgY2w==

"@noble/curves@^1.1.0", "@noble/curves@^1.2.0":
version "1.3.0"
Expand Down Expand Up @@ -3900,28 +3892,28 @@ next-themes@^0.2.1:
resolved "https://registry.yarnpkg.com/next-themes/-/next-themes-0.2.1.tgz#0c9f128e847979daf6c67f70b38e6b6567856e45"
integrity sha512-B+AKNfYNIzh0vqQQKqQItTS8evEouKD7H5Hj3kmuPERwddR2TxvDSFZuTj6T7Jfn1oyeUyJMydPl1Bkxkh0W7A==

next@14.1.0:
version "14.1.0"
resolved "https://registry.yarnpkg.com/next/-/next-14.1.0.tgz#b31c0261ff9caa6b4a17c5af019ed77387174b69"
integrity sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q==
next@^14.1.4:
version "14.1.4"
resolved "https://registry.yarnpkg.com/next/-/next-14.1.4.tgz#203310f7310578563fd5c961f0db4729ce7a502d"
integrity sha512-1WTaXeSrUwlz/XcnhGTY7+8eiaFvdet5z9u3V2jb+Ek1vFo0VhHKSAIJvDWfQpttWjnyw14kBeq28TPq7bTeEQ==
dependencies:
"@next/env" "14.1.0"
"@next/env" "14.1.4"
"@swc/helpers" "0.5.2"
busboy "1.6.0"
caniuse-lite "^1.0.30001579"
graceful-fs "^4.2.11"
postcss "8.4.31"
styled-jsx "5.1.1"
optionalDependencies:
"@next/swc-darwin-arm64" "14.1.0"
"@next/swc-darwin-x64" "14.1.0"
"@next/swc-linux-arm64-gnu" "14.1.0"
"@next/swc-linux-arm64-musl" "14.1.0"
"@next/swc-linux-x64-gnu" "14.1.0"
"@next/swc-linux-x64-musl" "14.1.0"
"@next/swc-win32-arm64-msvc" "14.1.0"
"@next/swc-win32-ia32-msvc" "14.1.0"
"@next/swc-win32-x64-msvc" "14.1.0"
"@next/swc-darwin-arm64" "14.1.4"
"@next/swc-darwin-x64" "14.1.4"
"@next/swc-linux-arm64-gnu" "14.1.4"
"@next/swc-linux-arm64-musl" "14.1.4"
"@next/swc-linux-x64-gnu" "14.1.4"
"@next/swc-linux-x64-musl" "14.1.4"
"@next/swc-win32-arm64-msvc" "14.1.4"
"@next/swc-win32-ia32-msvc" "14.1.4"
"@next/swc-win32-x64-msvc" "14.1.4"

no-case@^3.0.4:
version "3.0.4"
Expand Down

0 comments on commit b9ff0f6

Please sign in to comment.