diff --git a/client/src/components/Canvas/Canvas.jsx b/client/src/components/Canvas/Canvas.jsx index f50075f..5b3158b 100644 --- a/client/src/components/Canvas/Canvas.jsx +++ b/client/src/components/Canvas/Canvas.jsx @@ -1,11 +1,10 @@ -import { Box } from "@chakra-ui/react"; -import GlobalMapCanvas from "./views/GlobalMap"; -import RegionalMapCanvas from "./views/RegionalMap"; -import VolcanoCanvas from "./views/Volcano"; -import AdminCanvas from "./views/Admin"; -import AccountCanvas from "./views/Account" -import SettingsCanvas from "./views/Settings" -import { HomeCanvas } from "./views/Home"; +import GlobalMap from "./views/GlobalMap"; +import RegionalMap from "./views/RegionalMap"; +import Volcano from "./views/Volcano"; +import Admin from "./views/Admin"; +import Account from "./views/Account" +import Settings from "./views/Settings" +import Home from "./views/Home"; import { DASHBOARD_VIEWS } from "@/constants/viewKeys"; export default function Canvas({...props}) { @@ -14,14 +13,14 @@ export default function Canvas({...props}) { <> {/* Check if view is a tab inside the Canvas Header */} { DASHBOARD_VIEWS.includes(view) && ( - + )} - {view === "global" && } - {view === "regional" && } - {view === "volcano" && } - {view === "admin" && } - {view === "account" && } - {view === "settings" && } + {view === "global" && } + {view === "regional" && } + {view === "volcano" && } + {view === "admin" && } + {view === "account" && } + {view === "settings" && } ); } \ No newline at end of file diff --git a/client/src/components/Canvas/views/Account.jsx b/client/src/components/Canvas/views/Account.jsx index ef1465d..b1646e6 100644 --- a/client/src/components/Canvas/views/Account.jsx +++ b/client/src/components/Canvas/views/Account.jsx @@ -1,7 +1,7 @@ import { Box, Flex, Field, Input, Stack, Heading, Button } from "@chakra-ui/react" import { useForm } from 'react-hook-form'; -export default function AccountCanvas() { +export default function Account() { const { register, handleSubmit, diff --git a/client/src/components/Canvas/views/Admin.jsx b/client/src/components/Canvas/views/Admin.jsx index 51a85c4..1c4b83a 100644 --- a/client/src/components/Canvas/views/Admin.jsx +++ b/client/src/components/Canvas/views/Admin.jsx @@ -1,6 +1,6 @@ import { Box, Text } from '@chakra-ui/react'; -export default function AdminCanvas() { +export default function Admin() { return ( diff --git a/client/src/components/Canvas/views/Home.jsx b/client/src/components/Canvas/views/Home.jsx index 1ee89fe..68558f2 100644 --- a/client/src/components/Canvas/views/Home.jsx +++ b/client/src/components/Canvas/views/Home.jsx @@ -1,6 +1,5 @@ import { HStack, Flex, Tabs } from "@chakra-ui/react"; -import { useState } from "react"; -import WidgetCanvas from "./HomeTabs/MyDashboard"; +import MyDashboard from "./HomeTabs/MyDashboard"; import { SearchBar } from "../CanvasComponents/SearchBar"; import { SettingsButton } from "../CanvasComponents/SettingsButton"; import { DailyActivity } from "./HomeTabs/DailyActivity"; @@ -11,7 +10,7 @@ import { CancelButton } from "../CanvasComponents/CancelButton"; import { SaveButton } from "../CanvasComponents/SaveButton"; import DeleteAllButton from "../CanvasComponents/DeleteAllButton"; -export function HomeCanvas({...props}) { +export default function Home({...props}) { // deconstructing props const { width, height, view, layout, setLayout, setOriginalLayout, onLayoutChange, onChangeView, onCancel, isDelete, setIsDelete, isEditable, setIsEditable, widgetArray, setWidgetArray } = props; @@ -84,7 +83,7 @@ export function HomeCanvas({...props}) { } // Prop Forwarding - const widgetCanvasProps = { layout, onLayoutChange, isEditable, isDelete, DeleteWidget, widgetArray }; + const MyDashboardProps = { layout, onLayoutChange, isEditable, isDelete, DeleteWidget, widgetArray }; const settingsButtonProps = { onAddWidget, onEditWidgets, onDeleteWidgets, setWidgetArray, widgetArray }; return ( @@ -113,7 +112,7 @@ export function HomeCanvas({...props}) { justify="space-between" > - + My Dashboard @@ -150,8 +149,8 @@ export function HomeCanvas({...props}) { {/* CANVAS */} - - + + diff --git a/client/src/components/Canvas/views/HomeTabs/MyDashboard.jsx b/client/src/components/Canvas/views/HomeTabs/MyDashboard.jsx index c790cf3..82b31bf 100644 --- a/client/src/components/Canvas/views/HomeTabs/MyDashboard.jsx +++ b/client/src/components/Canvas/views/HomeTabs/MyDashboard.jsx @@ -1,7 +1,7 @@ import GridLayout, { WidthProvider } from 'react-grid-layout'; import { useSlotRecipe, chakra, Flex } from '@chakra-ui/react'; -export default function WidgetCanvas({layout, onLayoutChange, isEditable, isDelete, DeleteWidget, widgetArray}) { +export default function MyDashboard({layout, onLayoutChange, isEditable, isDelete, DeleteWidget, widgetArray}) { console.log("rendering MyDashboard"); const recipe = useSlotRecipe({ key: "widget" }); const styles = recipe(); // using root recipe for widget below diff --git a/client/src/components/Canvas/views/RegionalMap.jsx b/client/src/components/Canvas/views/RegionalMap.jsx index 2377dd6..00ff9ae 100644 --- a/client/src/components/Canvas/views/RegionalMap.jsx +++ b/client/src/components/Canvas/views/RegionalMap.jsx @@ -1,7 +1,7 @@ import React from "react"; import { MapContainer, TileLayer, Marker, Popup } from "react-leaflet"; -export default function GlobalMapCanvas() { +export default function RegionalMap() { const position = [45.61142478054226, -122.49630033167544]; // [latitude, longitude] return ( diff --git a/client/src/components/Canvas/views/Settings.jsx b/client/src/components/Canvas/views/Settings.jsx index 3fb32bb..85440d6 100644 --- a/client/src/components/Canvas/views/Settings.jsx +++ b/client/src/components/Canvas/views/Settings.jsx @@ -1,6 +1,6 @@ import { Box, Text } from '@chakra-ui/react'; -export default function SettingsCanvas() { +export default function Settings() { return ( { console.log("Current view = ", view); const newIndex = buttons.findIndex((btn) => { - if (btn.view === "widget") { + if (btn.view === "mydashboard") { return DASHBOARD_VIEWS.includes(view); } return btn.view === view; diff --git a/client/src/constants/viewKeys.js b/client/src/constants/viewKeys.js index 6ae5832..02cf9fc 100644 --- a/client/src/constants/viewKeys.js +++ b/client/src/constants/viewKeys.js @@ -1,9 +1,9 @@ // Main views called from Sidebar -export const DASHBOARD_VIEWS = ["widget", "gas", "seismic", "remote", "daily"] +export const DASHBOARD_VIEWS = ["mydashboard", "gas", "seismic", "remote", "daily"] -// Sub views called from inside DashboardCanvas +// Sub views called from inside Home.jsx export const VIEW_LABELS = { - widget: "My Dashboard", + mydashboard: "My Dashboard", gas: "Gas", seismic: "Seismic", remote: "Remote Sensing",