fix rent initial values

This commit is contained in:
Niklas Meinzer
2024-10-04 12:05:39 +02:00
parent 4a0f47f03b
commit 243ca18eb5
2 changed files with 3 additions and 4 deletions

View File

@@ -25,7 +25,7 @@ function App() {
const [selectedRoom, setSelectedRoom] = useState();
const [numAdults, setNumAdults] = useState();
const [rent, setRent] = useState();
const [rent, setRent] = useState(0);
const [flatRent, setFlatRent] = useState();
const theme = extendTheme({

View File

@@ -220,7 +220,7 @@ export function SelfEvaluationCard({ rent, setRent }) {
const [sliderValue, setSliderValue] = useState(30)
const [showTooltip, setShowTooltip] = useState(false)
const [income, setIncome] = useState(1000)
const [income, setIncome] = useState(0)
const formatEuro = (val) => val + ' €';
const parseEuro = (val) => val.replace(/^€/, '')
@@ -299,8 +299,7 @@ export function ResultsCard({ rent, flat, room, numAdults, flatRent }) {
var body = <CardBody></CardBody>
if (flat && (room || flat.wgRoomList.length === 0) && flatRent) {
var totalSize = flat.calcTotalPayedArea(room)
var kitchenCost = flat.wgRoomList.length > 0 ? 50 / flat.wgRoomList.length : 50;
var relativeRent = (rent - kitchenCost - (60 * numAdults)) / totalSize;
var relativeRent = (rent) / totalSize;
var rangePosition = ((rent - flatRent.min) / (flatRent.maxCovering - flatRent.min)) * 100;
if (rangePosition < 0) { rangePosition = 0; }