diff --git a/src/pages/Dashboards/Dashboard.tsx b/src/pages/Dashboards/Dashboard.tsx index 28f3eee0..b5609408 100644 --- a/src/pages/Dashboards/Dashboard.tsx +++ b/src/pages/Dashboards/Dashboard.tsx @@ -23,8 +23,14 @@ import { useAppStore } from '@/layouts/MainLayout/providers/AppProvider'; import { EditTileType, ImportDashboardType, Tile as TileType } from '@/@types/parseable/api/dashboards'; import { templates } from './assets/templates'; -const { toggleCreateDashboardModal, toggleCreateTileModal, toggleDuplicateTileModal, toggleDeleteTileModal, handlePaging, toggleImportDashboardModal } = - dashboardsStoreReducers; +const { + toggleCreateDashboardModal, + toggleCreateTileModal, + toggleDuplicateTileModal, + toggleDeleteTileModal, + handlePaging, + toggleImportDashboardModal, +} = dashboardsStoreReducers; const TilesView = (props: { onLayoutChange: (layout: Layout[]) => void }) => { const [activeDashboard, setDashbaordsStore] = useDashboardsStore((store) => store.activeDashboard); @@ -66,7 +72,7 @@ const TilesView = (props: { onLayoutChange: (layout: Layout[]) => void }) => { if (showNoTilesView) return ; return ( - + { ); }; -const DashboardTemplates = (props: {onImport: (template: ImportDashboardType) => void; isImportingDashboard: boolean}) => { +const DashboardTemplates = (props: { + onImport: (template: ImportDashboardType) => void; + isImportingDashboard: boolean; +}) => { return ( {_.map(templates, (template) => { @@ -174,12 +183,12 @@ const DashboardTemplates = (props: {onImport: (template: ImportDashboardType) => })} ); -} +}; const ImportDashboardModal = () => { const [importDashboardModalOpen, setDashboardStore] = useDashboardsStore((store) => store.importDashboardModalOpen); const [activeDashboard] = useDashboardsStore((store) => store.activeDashboard); - const [isStandAloneMode] = useAppStore(store => store.isStandAloneMode) + const [isStandAloneMode] = useAppStore((store) => store.isStandAloneMode); const [file, setFile] = useState(null); const closeModal = useCallback(() => { setDashboardStore((store) => toggleImportDashboardModal(store, false)); @@ -208,9 +217,9 @@ const ImportDashboardModal = () => { const newDashboard: ImportDashboardType = JSON.parse(target.result); if (_.isEmpty(newDashboard)) return; - return makePostCall(newDashboard) + return makePostCall(newDashboard); } catch (error) { - console.log("error", error) + console.log('error', error); } }; reader.readAsText(file); @@ -336,13 +345,13 @@ const InvalidDashboardView = () => { }; const findTileByTileId = (tiles: TileType[], tileId: string | null) => { - return _.find(tiles, tile => tile.tile_id === tileId) -} + return _.find(tiles, (tile) => tile.tile_id === tileId); +}; const DuplicateTileModal = () => { - const [duplicateTileModalOpen, setDashboardsStore] = useDashboardsStore(store => store.duplicateTileModalOpen) - const [editTileId] = useDashboardsStore(store => store.editTileId); - const [activeDashboard] = useDashboardsStore(store => store.activeDashboard) + const [duplicateTileModalOpen, setDashboardsStore] = useDashboardsStore((store) => store.duplicateTileModalOpen); + const [editTileId] = useDashboardsStore((store) => store.editTileId); + const [activeDashboard] = useDashboardsStore((store) => store.activeDashboard); const [inputValue, setInputValue] = useState(''); const onClose = useCallback(() => { setDashboardsStore((store) => toggleDuplicateTileModal(store, false, null)); @@ -399,7 +408,9 @@ const DuplicateTileModal = () => { - + @@ -422,9 +433,9 @@ const Dashboard = () => { return ( - + - + {activeDashboard ? : } ); diff --git a/src/pages/Dashboards/Toolbar.tsx b/src/pages/Dashboards/Toolbar.tsx index 8ab847d9..0b85b510 100644 --- a/src/pages/Dashboards/Toolbar.tsx +++ b/src/pages/Dashboards/Toolbar.tsx @@ -158,10 +158,15 @@ const DeleteDashboardModal = () => { Are you sure want to delete this dashboard and its contents ? + + Please type {`"${activeDashboard.name}"`}{' '} + to confirm deletion. + + diff --git a/src/pages/Dashboards/styles/DashboardView.module.css b/src/pages/Dashboards/styles/DashboardView.module.css index 2cb77ecf..84f5148d 100644 --- a/src/pages/Dashboards/styles/DashboardView.module.css +++ b/src/pages/Dashboards/styles/DashboardView.module.css @@ -16,6 +16,10 @@ align-self: center; } +.tilesViewContainer { + margin-bottom: 1rem; +} + .dashboardIcon { color: var(--mantine-color-brandPrimary-4); } diff --git a/src/pages/Dashboards/styles/toolbar.module.css b/src/pages/Dashboards/styles/toolbar.module.css index b1139485..bb8ed882 100644 --- a/src/pages/Dashboards/styles/toolbar.module.css +++ b/src/pages/Dashboards/styles/toolbar.module.css @@ -1,71 +1,80 @@ .editLayoutBtn { - color: var(--mantine-color-gray-7); - border: 1px #e9ecef solid; - border-radius: rem(8px); - font-size: 0.65rem; + color: var(--mantine-color-gray-7); + border: 1px #e9ecef solid; + border-radius: rem(8px); + font-size: 0.65rem; - &:hover { - color: black; - background-color: white; - } + &:hover { + color: black; + background-color: white; + } - &.active { - color: white; + &.active { + color: white; - &:hover { - background-color: var(--mantine-color-brandPrimary-4); - color: white; - } - } + &:hover { + background-color: var(--mantine-color-brandPrimary-4); + color: white; + } + } } .addTileBtn { - background-color: white; - color: var(--mantine-color-gray-7); - border: 1px #e9ecef solid; - border-radius: rem(8px); - font-size: 0.65rem; + background-color: white; + color: var(--mantine-color-gray-7); + border: 1px #e9ecef solid; + border-radius: rem(8px); + font-size: 0.65rem; - &:hover { - color: black; - } + &:hover { + color: black; + } } .addTileBtn:hover { - background-color: #E0E0E0; + background-color: #e0e0e0; } .editLayoutBtn:hover { - background-color: #E0E0E0; + background-color: #e0e0e0; } .toolbarContainer { - padding: 0.4rem 0.8rem; - border-bottom: 1px solid var(--mantine-color-gray-1); + padding: 0.4rem 0.8rem; + border-bottom: 1px solid var(--mantine-color-gray-1); } .dashboardTitle { - font-size: 0.8rem; - font-weight: 500; + font-size: 0.8rem; + font-weight: 500; } .dashboardDescription { - font-size: 0.7rem; - color: var(--mantine-color-gray-6); + font-size: 0.7rem; + color: var(--mantine-color-gray-6); } .editIcon { - padding: 0.25rem; - cursor: pointer; - border-radius: 50%; - margin-left: 0.2rem; + padding: 0.25rem; + cursor: pointer; + border-radius: 50%; + margin-left: 0.2rem; - &:hover { - background-color: var(--mantine-color-gray-1); - } + &:hover { + background-color: var(--mantine-color-gray-1); + } } .deleteWarningText { - font-size: 0.7rem; - color: var(--mantine-color-gray-6); -} \ No newline at end of file + font-size: 0.7rem; + color: var(--mantine-color-gray-7); +} + +.deleteConfirmationText { + font-size: 0.7rem; + color: var(--mantine-color-gray-6); +} + +.deleteConfirmationTextHighlight { + font-weight: 500; +}