import { Image, StyleSheet, Platform, ImageBackground } from 'react-native';

import { SafeAreaView } from 'react-native-safe-area-context';
import { MeasurementInput } from '@/components/LengthInput';
import { setupStore, useAppDispatch } from '../store';
import { selectProducts } from '@/features/product/productSlice';
import { Product } from '@/lib/product';
import { ProductTile } from '@/components/ProductTyle';
import { Measure, area, length } from 'enheter';

export default function HomeScreen() {

  const products = useAppDispatch(selectProducts);

  function calculatePrice() {

  }

  const selectProduct = (product : Product) => {

  }

  return (
    <SafeAreaView>
      <MeasurementInput onMeasurementSet={calculatePrice} />
      {products.map((product) => {
        <ProductTile product={product} onProductSelected={selectProduct} />
      })}
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  titleContainer: {
    flexDirection: 'row',
    alignItems: 'center',
    gap: 8,
  },
  stepContainer: {
    gap: 8,
    marginBottom: 8,
  },
  reactLogo: {
    height: 178,
    width: 290,
    bottom: 0,
    left: 0,
    position: 'absolute',
  },
});
