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

Fixing-beta #491

Merged
merged 17 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ export default function Page({
proposalNumber={Number(proposalIdNumber)}
timeToPass={Number(timeToPass)}
onReadyToExecute={triggerConvictionRefetch}
defaultChartMaxValue
/>
</>
}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/Charts/ChartWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ChartWrapper = ({
{
name: "Conviction",
className: "bg-primary-content h-4 w-4 rounded-full",
info: "Accumulated pool weight for a proposal, increasing over time, based on the conviction growth param.",
info: "Accumulated pool weight for a proposal, increasing over time, based on the conviction growth.",
},
{
name: "Threshold",
Expand Down
18 changes: 13 additions & 5 deletions apps/web/components/Charts/ConvictionBarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type ConvictionBarChartProps = {
proposalNumber: number;
compact?: boolean;
timeToPass?: number;
defaultChartMaxValue?: boolean;
onReadyToExecute?: () => void;
};

Expand All @@ -31,6 +32,7 @@ export const ConvictionBarChart = ({
compact,
timeToPass,
onReadyToExecute,
defaultChartMaxValue = false,
}: ConvictionBarChartProps) => {
const supportNeeded = (thresholdPct - proposalSupportPct).toFixed(2);
const scenarioMappings: Record<string, ScenarioMapping> = {
Expand Down Expand Up @@ -181,7 +183,7 @@ export const ConvictionBarChart = ({
disabled: true,
};

const borderRadius = [50, 0, 0, 50];
const borderRadius = defaultChartMaxValue ? [50, 50] : [50, 0, 0, 50];

const markLine: MarkLineComponentOption = {
symbol: "none",
Expand Down Expand Up @@ -213,6 +215,12 @@ export const ConvictionBarChart = ({
},
z: 50,
};

const chartMaxValue =
defaultChartMaxValue ?
Math.max(currentConvictionPct, proposalSupportPct, thresholdPct)
: 100;

const option: EChartsOption = {
emphasis: emphasis,
yAxis: {
Expand All @@ -228,12 +236,12 @@ export const ConvictionBarChart = ({
axisLabel: {
show: false,
formatter: "{value}%",
fontSize: 10,
fontSize: 8,
},
axisLine: {
show: false,
},
max: 100,
max: chartMaxValue,
},
tooltip: {
trigger: "axis",
Expand Down Expand Up @@ -273,7 +281,7 @@ export const ConvictionBarChart = ({
show: !compact,
position: "insideRight",
color: "#191919",
fontSize: 10,
fontSize: 8,
formatter: "{@score} %",
},
z:
Expand All @@ -294,7 +302,7 @@ export const ConvictionBarChart = ({
show: !compact,
position: "insideRight",
color: "#FFFFFF",
fontSize: 10,
fontSize: 8,
formatter: "{@score} %",
width: 0,
},
Expand Down
4 changes: 3 additions & 1 deletion apps/web/components/Forms/PoolEditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ export default function PoolEditForm({
const shouldRenderInput = (key: string): boolean => {
if (
PoolTypes[proposalType] === "signaling" &&
(key === "spendingLimit" || key === "minThresholdPoints")
(key === "spendingLimit" ||
key === "minThresholdPoints" ||
key === "minimumConviction")
) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/web/components/Forms/PoolForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export function PoolForm({ token, communityAddr }: Props) {
rulingTime: parseTimeUnit(DEFAULT_RULING_TIMEOUT_SEC, "seconds", "days"),
defaultResolution: 1,
minThresholdPoints: 0,
poolTokenAddress: token.id,
poolTokenAddress: "",
proposalCollateral:
chain.id === polygon.id ?
defaultMaticProposalColateral
Expand Down Expand Up @@ -711,7 +711,7 @@ export function PoolForm({ token, communityAddr }: Props) {
registerKey="maxAmount"
type="number"
placeholder="0"
suffix={token.symbol}
suffix={customTokenData?.symbol}
/>
</div>
)}
Expand Down
34 changes: 17 additions & 17 deletions apps/web/components/PoolCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,32 +62,32 @@ export function PoolCard({ pool, tokenGarden }: Props) {
</h3>
</Skeleton>
<div className="flex justify-between items-center w-full">
<h6>ID #{poolId}</h6>
<h6>POOL ID: #{poolId}</h6>
<Badge type={poolType} />
</div>
</header>
<div className="mb-8 flex min-h-[60px] flex-col gap-2">
<div className="mb-8 flex flex-col gap-2">
<Statistic
icon={<BoltIcon />}
label="voting weight"
count={capitalize(PointSystems[config?.pointSystem])}
/>
<Statistic
icon={<HandRaisedIcon />}
count={proposals.length}
label="proposals"
/>
<Statistic
icon={<CurrencyDollarIcon />}
label="funds"
className={`${poolType && PoolTypes[poolType] === "funding" ? "visible" : "invisible"}`}
>
<DisplayNumber
number={[BigInt(poolAmount), tokenGarden.decimals]}
compact={true}
tokenSymbol={tokenGarden.symbol}
{isEnabled && (
<Statistic
icon={<HandRaisedIcon />}
count={proposals.length}
label="proposals"
/>
</Statistic>
)}
{isEnabled && poolType && PoolTypes[poolType] === "funding" && (
<Statistic icon={<CurrencyDollarIcon />} label="funds">
<DisplayNumber
number={[BigInt(poolAmount), tokenGarden.decimals]}
compact={true}
tokenSymbol={tokenGarden.symbol}
/>
</Statistic>
)}
</div>
{!isEnabled ?
<div className="banner md:min-w-[262px]">
Expand Down
40 changes: 20 additions & 20 deletions apps/web/components/ProposalCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,32 +154,32 @@ export function ProposalCard({
const proposalCardContent = (
<>
<div
className={`flex gap-3 justify-between py-3 flex-wrap ${isAllocationView ? `section-layout ${isNewProposal ? "shadow-2xl" : ""}` : ""}`}
className={`flex gap-3 justify-between flex-wrap ${isAllocationView ? `section-layout ${isNewProposal ? "shadow-2xl" : ""}` : ""}`}
>
<div className="flex flex-col sm:flex-row w-full">
<div className="flex flex-col sm:flex-row w-full justify-between gap-2">
{/* icon title and id */}
<div className="flex gap-6 flex-1">
<div className="hidden sm:block">
<header className="flex justify-between items-start gap-2 ">
<div className="hidden lg:block">
<Hashicon value={id} size={45} />
</div>
<div>
<h4 className="sm:max-w-md lg:max-w-lg">
<Skeleton isLoading={!metadata} className="sm:w-96 h-5">
<TooltipIfOverflow className="first-letter:uppercase">
{metadata?.title}
</TooltipIfOverflow>
</Skeleton>
</h4>
<div className="flex items-baseline gap-3">
<h6 className="text-sm">ID {proposalNumber}</h6>
<p className="text-sm text-neutral-soft-content">
{prettyTimestamp(proposalData.createdAt ?? 0)}
</p>
<div className="flex w-full items-start flex-col gap-1">
<Skeleton isLoading={!metadata}>
<h3 className="flex items-start w-fit max-w-full">
<TooltipIfOverflow>{metadata?.title}</TooltipIfOverflow>
</h3>
</Skeleton>
<div className="flex justify-between items-center">
<div className="flex items-baseline gap-3">
<h6 className="text-sm">ID {proposalNumber}</h6>
<p className="text-sm text-neutral-soft-content">
{prettyTimestamp(proposalData.createdAt ?? 0)}
</p>
</div>
</div>
</div>
</div>
</header>
{/* amount requested and proposal status */}
<div className="flex gap-6 text-neutral-soft-content">
<div className="flex gap-6 text-neutral-soft-content justify-end">
{!isSignalingType && poolToken && (
<div className="flex items-center gap-1 justify-self-end">
<p>Requested amount: </p>
Expand Down Expand Up @@ -299,7 +299,7 @@ export function ProposalCard({
</div>
</div>
{!isAllocationView && stakedFilter && stakedFilter?.value > 0 && (
<p className="flex items-baseline text-xs">
<p className="flex items-baseline text-xs mt-2">
Your support: {poolWeightAllocatedInProposal}%
</p>
)}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/Proposals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ export function Proposals({
}
tooltip="Make changes in proposals support first"
>
Allocate
Submit your support
</Button>
</div>
: <div>
Expand Down
2 changes: 1 addition & 1 deletion funding.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"opRetro": {
"projectId": "0xf87dc66be181007e6d394553b4498ef833f7a53059d86e6ae399b4ca8db61543"
"projectId": "0xdde46a1ddca8effe3f50996d8a674fc0ed79d2c7e9dab310cba65529f97dc2d6"
}
}
Loading