Change Initial Token Supply from a line to a dot

This commit is contained in:
dapplion 2019-08-12 00:27:41 +02:00
parent 01adc3bace
commit f8b99d0727
2 changed files with 26 additions and 10 deletions

View File

@ -10,11 +10,11 @@ export default function CurveDesignInputParams({
curveParams: CurveParamsInterface; curveParams: CurveParamsInterface;
setCurveParams(newCurveParams: any): void; setCurveParams(newCurveParams: any): void;
}) { }) {
const [theta, setTheta] = useState(0.35); // fraction allocated to reserve (.) const [theta, setTheta] = useState(curveParams.theta); // fraction allocated to reserve (.)
const [p0, setP0] = useState(0.1); // Hatch sale Price p0 (DAI / token) const [p0, setP0] = useState(curveParams.p0); // Hatch sale Price p0 (DAI / token)
const [p1, setP1] = useState(0.3); // Return factor (.) const [p1, setP1] = useState(curveParams.p1); // Return factor (.)
const [wFee, setWFee] = useState(0.05); // friction coefficient (.) const [wFee, setWFee] = useState(curveParams.wFee); // friction coefficient (.)
const [vHalflife, setVHalflife] = useState(52); // friction coefficient (.) const [vHalflife, setVHalflife] = useState(curveParams.vHalflife); // friction coefficient (.)
useEffect(() => { useEffect(() => {
setTheta(curveParams.theta); setTheta(curveParams.theta);

View File

@ -7,6 +7,8 @@ import {
CartesianGrid, CartesianGrid,
Legend, Legend,
ReferenceLine, ReferenceLine,
ReferenceDot,
ReferenceArea,
ResponsiveContainer, ResponsiveContainer,
Tooltip Tooltip
} from "recharts"; } from "recharts";
@ -19,6 +21,10 @@ const isAnimationActive = false;
const keyHorizontal = "x"; const keyHorizontal = "x";
const keyVertical = "Supply (tokens) / Collateral (DAI)"; const keyVertical = "Supply (tokens) / Collateral (DAI)";
// Do to transparency and color merging issues
// these colors are handpicked to look the closest to the theme colors
const referenceLineColor = "#b7c1cb";
const useStyles = makeStyles((theme: Theme) => const useStyles = makeStyles((theme: Theme) =>
createStyles({ createStyles({
tooltip: { tooltip: {
@ -100,12 +106,12 @@ function SupplyVsDemandChart({
const { textAnchor, viewBox } = props; const { textAnchor, viewBox } = props;
return ( return (
<text <text
x={viewBox.x + 10} x={viewBox.x + viewBox.width / 4 + 10}
y={30} y={viewBox.y + 20}
fill={theme.palette.text.secondary} fill={referenceLineColor}
textAnchor={textAnchor} textAnchor={textAnchor}
> >
Initial value Initial Token Supply
</text> </text>
); );
} }
@ -183,12 +189,22 @@ function SupplyVsDemandChart({
fillOpacity={0.3} fillOpacity={0.3}
strokeWidth={2} strokeWidth={2}
/> />
{/* Necessary because ReferenceDot types do not allow "label" k */}
<ReferenceLine <ReferenceLine
x={R0_round} x={R0_round}
stroke={theme.palette.primary.main} y={f(R0_round)}
stroke={"transparent"}
strokeDasharray="9 0" strokeDasharray="9 0"
label={<ReferenceLabel />} label={<ReferenceLabel />}
/> />
<ReferenceDot
x={R0_round}
y={f(R0_round)}
r={6}
fill={theme.palette.primary.main}
stroke={2}
/>
<Legend formatter={renderColorfulLegendText} /> <Legend formatter={renderColorfulLegendText} />
</AreaChart> </AreaChart>
</ResponsiveContainer> </ResponsiveContainer>