"use client" import React, { useState } from 'react' import { Box, Container, Paper, Table, Button, TextInput, useMantineTheme, Flex, Image, Grid, Space, Divider } from '@mantine/core' import NextImage from 'next/image' import Prawn from "../images/aussietigerprawns.jpg" interface InventoryItem { id: number name: string price: number quantity: number } async function fetchBlob(url: string) { const response = await fetch(url) return response.blob() } export default function InventoryPage() { const theme = useMantineTheme() const [items, setItems] = useState([]) const [name, setName] = useState('') const [price, setPrice] = useState('') const [quantity, setQuantity] = useState('') const addItem = () => { setItems([ ...items, { id: items.length + 1, name, price: parseFloat(price), quantity: parseInt(quantity), }, ]) setName('') setPrice('') setQuantity('') } const [imageSourceUrl, setImageSourceUrl] = React.useState("") const downloadImageAndSetSource = async (imageUrl: any) => { const image = await fetchBlob(imageUrl) setImageSourceUrl(URL.createObjectURL(image)) } return ( {/* {items.map((item) => ( ))}
ID Name Price Quantity
{item.id} {item.name} {item.price} {item.quantity}
*/} {/* use a grid */} setName(event.currentTarget.value)} /> setPrice(event.currentTarget.value)} /> setQuantity(event.currentTarget.value)} />
{/* 1 2 3 4 */} {/* why is there a scroll area on the grid */}
) }