Swiggy Menu Item Editor Grid
At Swiggy, empowering our restaurant partners with efficient tools to manage their offerings is paramount. One such critical tool is the menu management system. This problem focuses on building a core component of that system: an editable data grid for menu items. This component allows restaurant staff to quickly view, update, add, and remove menu items, directly impacting the accuracy of what customers see and the operational efficiency of our partners.
Your task is to build a React component that displays a list of menu items in a tabular format and allows for in-place editing, addition, and deletion of these items.
menuItems data in a grid/table structure.price and category fields directly within the grid. When a cell is clicked/focused, it should transform into an input field. Changes should be saved upon pressing Enter or blurring the input.available field should be represented by a toggle switch or checkbox. Clicking it should immediately update the item's availability status.ID, Name, Price, Category, Available, and Actions.Price and Category cells should visually indicate their editable nature (e.g., on hover, or an input field appears on click/focus). The available field should be a simple toggle (checkbox or switch).price cell makes it editable, and changes are saved to state on Enter or blur.category cell makes it editable, and changes are saved to state on Enter or blur.available toggle/checkbox instantly updates the item's availability status in the UI and state.Constraints
price will be a valid number (no complex number validation needed).Loading editor...