Skip to content

Commit

Permalink
feat: Commit: rename allocation button and update proposal page chart
Browse files Browse the repository at this point in the history
  • Loading branch information
Mati0x committed Nov 7, 2024
1 parent 14e3159 commit d2cca78
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
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
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
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"
>
Submit allocation
Submit your support!
</Button>
</div>
: <div>
Expand Down

0 comments on commit d2cca78

Please sign in to comment.