some css fix and websocket fix for item update
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
import { HotelProvider, useHotel } from "./HotelContext";
|
||||
import { HotelProvider, useHotel } from "./context/HotelContext";
|
||||
import RoomWidget from "./widget/roomWidget"
|
||||
import ChatWidget from "./widget/chatWidget"
|
||||
import InventoryWidget from "./widget/inventoryWidget";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import "./MainApp.css"
|
||||
import AdminWidget from "./widget/adminWidget";
|
||||
|
||||
export default function MainAppWrapper({resClientId}) {
|
||||
const accessToken = localStorage.getItem("access_tokens");
|
||||
const accessToken = localStorage.getItem("access_tokens");
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<HotelProvider accessToken={accessToken} resClientId={resClientId}>
|
||||
@@ -18,25 +21,29 @@ export default function MainAppWrapper({resClientId}) {
|
||||
|
||||
function MainApp() {
|
||||
const accessToken = localStorage.getItem("access_tokens");
|
||||
const { rooms, conversations, users } = useHotel();
|
||||
const VIEW = {
|
||||
ROOMS: "rooms",
|
||||
INVENTORY: "inventory",
|
||||
ADMIN: "admin",
|
||||
};
|
||||
|
||||
const { rooms } = useHotel();
|
||||
const { conversations } = useHotel();
|
||||
const { users } = useHotel();
|
||||
|
||||
const [view, setView] = useState(VIEW.ROOMS)
|
||||
|
||||
return (
|
||||
<div style={{ padding: "2rem" }}>
|
||||
<h1>Welcome to MyHotel!</h1>
|
||||
<div>
|
||||
<div className="toolbar">
|
||||
<button className="toolbutton" onClick={() => setView(VIEW.ROOMS)}>Rooms</button>
|
||||
<button className="toolbutton" onClick={() => setView(VIEW.INVENTORY)}>Inventory</button>
|
||||
</div>
|
||||
|
||||
<h2>Access token</h2>
|
||||
<pre>{accessToken}</pre>
|
||||
<h3>Rooms: {rooms.length}</h3>
|
||||
<h3>Conversations: {conversations.length}</h3>
|
||||
<h3>Users: {users.length}</h3>
|
||||
<h2>Dashboard</h2>
|
||||
<section className="main">
|
||||
|
||||
|
||||
<RoomWidget roomlist={rooms}/>
|
||||
<ChatWidget convlist={conversations}/>
|
||||
<InventoryWidget/>
|
||||
<AdminWidget/>
|
||||
{view === VIEW.ROOMS && <RoomWidget />}
|
||||
{view === VIEW.INVENTORY && <InventoryWidget />}
|
||||
<ChatWidget convlist={conversations} />
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user