fix rent initial values
This commit is contained in:
@@ -25,7 +25,7 @@ function App() {
|
|||||||
const [selectedRoom, setSelectedRoom] = useState();
|
const [selectedRoom, setSelectedRoom] = useState();
|
||||||
const [numAdults, setNumAdults] = useState();
|
const [numAdults, setNumAdults] = useState();
|
||||||
|
|
||||||
const [rent, setRent] = useState();
|
const [rent, setRent] = useState(0);
|
||||||
const [flatRent, setFlatRent] = useState();
|
const [flatRent, setFlatRent] = useState();
|
||||||
|
|
||||||
const theme = extendTheme({
|
const theme = extendTheme({
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ export function SelfEvaluationCard({ rent, setRent }) {
|
|||||||
const [sliderValue, setSliderValue] = useState(30)
|
const [sliderValue, setSliderValue] = useState(30)
|
||||||
const [showTooltip, setShowTooltip] = useState(false)
|
const [showTooltip, setShowTooltip] = useState(false)
|
||||||
|
|
||||||
const [income, setIncome] = useState(1000)
|
const [income, setIncome] = useState(0)
|
||||||
|
|
||||||
const formatEuro = (val) => val + ' €';
|
const formatEuro = (val) => val + ' €';
|
||||||
const parseEuro = (val) => val.replace(/^€/, '')
|
const parseEuro = (val) => val.replace(/^€/, '')
|
||||||
@@ -299,8 +299,7 @@ export function ResultsCard({ rent, flat, room, numAdults, flatRent }) {
|
|||||||
var body = <CardBody></CardBody>
|
var body = <CardBody></CardBody>
|
||||||
if (flat && (room || flat.wgRoomList.length === 0) && flatRent) {
|
if (flat && (room || flat.wgRoomList.length === 0) && flatRent) {
|
||||||
var totalSize = flat.calcTotalPayedArea(room)
|
var totalSize = flat.calcTotalPayedArea(room)
|
||||||
var kitchenCost = flat.wgRoomList.length > 0 ? 50 / flat.wgRoomList.length : 50;
|
var relativeRent = (rent) / totalSize;
|
||||||
var relativeRent = (rent - kitchenCost - (60 * numAdults)) / totalSize;
|
|
||||||
|
|
||||||
var rangePosition = ((rent - flatRent.min) / (flatRent.maxCovering - flatRent.min)) * 100;
|
var rangePosition = ((rent - flatRent.min) / (flatRent.maxCovering - flatRent.min)) * 100;
|
||||||
if (rangePosition < 0) { rangePosition = 0; }
|
if (rangePosition < 0) { rangePosition = 0; }
|
||||||
|
|||||||
Reference in New Issue
Block a user