Skip to content

Commit

Permalink
Remove dashboard page and make bookings page default
Browse files Browse the repository at this point in the history
  • Loading branch information
jloh02 committed Feb 15, 2024
1 parent fadb368 commit 9704892
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
selectSelectedVenue,
successBookingFormSubmissionAction,
} from "../../redux/slices/booking-creation-slice";
import { BOOKINGS_PATH } from "../../routes/paths";
import { DASHBOARD_PATH } from "../../routes/paths";
import { FieldType } from "../../types/venues";
import { resolveApiError } from "../../utils/error-utils";
import { displayDateTimeRange } from "../../utils/transform-utils";
Expand Down Expand Up @@ -208,7 +208,7 @@ function BookingCreationFinalizeView() {
<Button
color="blue"
content="Done"
onClick={() => history.push(BOOKINGS_PATH)}
onClick={() => history.push(DASHBOARD_PATH)}
/>
</HorizontalLayoutContainer>
) : (
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import FullPageContainer from "../full-page-container";
import PageBody from "../page-body";
// import EventsTab from "./events-tab";
import RoleRestrictedWrapper from "../role-restricted-wrapper";
import BookingsTab from "./bookings-tab";
import DashboardTab from "./dashboard-tab";
import DesktopAboutTab from "./desktop-about-tab";
import DesktopAdminTab from "./desktop-admin-tab";
Expand Down Expand Up @@ -47,7 +46,6 @@ function NavigationContainer({ children }: Props) {
>
<LogoTab onTabClick={closeSidebar} />
<DashboardTab onTabClick={closeSidebar} />
<BookingsTab onTabClick={closeSidebar} />
{/* <EventsTab onTabClick={closeSidebar} /> */}
<MobileAboutTab onTabClick={closeSidebar} />
<RoleRestrictedWrapper allowedRoles={[Role.Admin]}>
Expand All @@ -62,7 +60,6 @@ function NavigationContainer({ children }: Props) {
<>
<LogoTab />
<DashboardTab />
<BookingsTab />
{/* <EventsTab /> */}
<DesktopAboutTab />
<RoleRestrictedWrapper allowedRoles={[Role.Admin]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Button, Icon } from "semantic-ui-react";

import BookingCreationSection from "../../components/booking-creation-section";
import useScrollToTop from "../../custom-hooks/use-scroll-to-top";
import { BOOKINGS_PATH } from "../../routes/paths";
import { DASHBOARD_PATH } from "../../routes/paths";

function BookingsCreationPage() {
useScrollToTop();
Expand All @@ -15,7 +15,7 @@ function BookingsCreationPage() {
fluid
color="red"
as={Link}
to={BOOKINGS_PATH}
to={DASHBOARD_PATH}
>
<Button.Content hidden content="Cancel Booking Creation" />
<Button.Content visible content={<Icon name="times" fitted />} />
Expand Down
35 changes: 24 additions & 11 deletions frontend/src/pages/bookings-page/bookings-page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCallback, useEffect } from "react";
import { Link } from "react-router-dom";
import { Button, Icon, Popup } from "semantic-ui-react";
import { useMediaQuery } from "react-responsive";

import BookingUserCalendar from "../../components/booking-user-calendar";
import BookingUserTable from "../../components/booking-user-table";
Expand Down Expand Up @@ -33,6 +34,10 @@ const OPTIONS: TabOption[] = [
];

function BookingsPage() {
const { name } = useAppSelector(selectCurrentUserDisplayInfo) ?? {};

const isTabletOrLarger = useMediaQuery({ query: "(min-width: 768px)" });

const { getBookings: _getBookings } = useGetBookings();
const loading = useAppSelector(selectBookingsLoadingState);
const { id: userId } =
Expand All @@ -59,17 +64,13 @@ function BookingsPage() {

return (
<>
<Button
animated="vertical"
fluid
color="teal"
as={Link}
to={BOOKINGS_CREATION_PATH}
>
<Button.Content hidden content="Create New Bookings" />
<Button.Content visible content={<Icon name="plus" fitted />} />
</Button>

<h2>Welcome, {name}!</h2>
<p>
<strong>Note:</strong> Treeckle is currently in development and we are
working hard towards making residential life better for you. For urgent
queries or if you have found any bugs, please contact us at
[email protected].
</p>
<h1>
<HorizontalLayoutContainer align="center">
<span>My Bookings</span>
Expand All @@ -90,6 +91,18 @@ function BookingsPage() {
/>
</HorizontalLayoutContainer>
</h1>
<Button
animated="vertical"
fluid
color="teal"
as={Link}
to={BOOKINGS_CREATION_PATH}
>
<Button.Content hidden content="Create New Bookings" />
<Button.Content visible content={<Icon name="plus" fitted />} />
</Button>

{isTabletOrLarger ? <div /> : <br />}

<Tab options={OPTIONS} showTitle={false} />
</>
Expand Down
10 changes: 0 additions & 10 deletions frontend/src/pages/dashboard-page/dashboard-page.module.scss

This file was deleted.

39 changes: 0 additions & 39 deletions frontend/src/pages/dashboard-page/dashboard-page.tsx

This file was deleted.

1 change: 0 additions & 1 deletion frontend/src/pages/dashboard-page/index.ts

This file was deleted.

3 changes: 1 addition & 2 deletions frontend/src/routes/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { EVENT_ID, USER_ID, VENUE_ID } from "../constants";

export const HOME_PATH = "/";
export const DASHBOARD_PATH = "/dashboard";
export const BOOKINGS_PATH = "/bookings";
export const BOOKINGS_CREATION_PATH = "/bookings/create";
export const BOOKINGS_CREATION_PATH = "/dashboard/create";
export const EVENTS_PATH = "/events";
export const EVENTS_SIGNED_UP_PATH = "/events/signedup";
export const EVENTS_SUBSCRIPTIONS_PATH = "/events/subscriptions";
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/routes/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
ADMIN_VENUES_EDIT_PATH,
ADMIN_VENUES_PATH,
BOOKINGS_CREATION_PATH,
BOOKINGS_PATH,
DASHBOARD_PATH,
HOME_PATH,
// AUTH_CALLBACK_PATH,
Expand All @@ -42,7 +41,6 @@ import RoleRestrictedRoute from "./role-restricted-route";
import GaProvider from "../components/ga-provider";

// Code splitting
const DashboardPage = lazy(() => import("../pages/dashboard-page"));
// const EventsPage = lazy(() => import("../pages/events-page"));
const BookingsPage = lazy(() => import("../pages/bookings-page"));
const AdminBookingsPage = lazy(() => import("../pages/admin-bookings-page"));
Expand Down Expand Up @@ -110,10 +108,6 @@ function Routes() {
{/* Authenticated routes */}

<Route path={DASHBOARD_PATH} exact strict>
<DashboardPage />
</Route>

<Route path={BOOKINGS_PATH} exact strict>
<BookingsPage />
</Route>

Expand Down

0 comments on commit 9704892

Please sign in to comment.