Skip to content

Commit

Permalink
basic mobile UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lucia-gomez committed Sep 19, 2024
1 parent 78d5cde commit a15a5c1
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Typography } from "@mui/material";
import { Box, Typography, useMediaQuery, useTheme } from "@mui/material";
import { CalendarApi, DateSelectArg, EventClickArg } from "@fullcalendar/core";
import { CalendarEvent, RoomSetting } from "../../../../types";
import CalendarEventBlock, { NEW_TITLE_TAG } from "./CalendarEventBlock";
Expand Down Expand Up @@ -83,6 +83,9 @@ export default function CalendarVerticalResource({
} = useContext(BookingContext);
const ref = useRef(null);

const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));

const resources = useMemo(
() =>
rooms.map((room) => ({
Expand Down Expand Up @@ -215,7 +218,7 @@ export default function CalendarVerticalResource({
slotMinTime="09:00:00"
slotMaxTime="21:00:00"
allDaySlot={false}
aspectRatio={1.5}
aspectRatio={isMobile ? 0.5 : 1.5}
expandRows={true}
stickyHeaderDates={true}
ref={ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function BookingFormDetailsPage({
return (
<Grid container>
<Grid width={330} />
<Grid xs={7} paddingRight={2}>
<Grid xs={12} md={7} margin={2} paddingRight={{ xs: 0, md: 2 }}>
<FormInput {...{ isEdit, isWalkIn, calendarEventId }} />
</Grid>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ export default function LandingPage() {
const router = useRouter();

return (
<Center sx={{ width: "100vw", height: "90vh" }}>
<Center
sx={{ width: "100vw" }}
height={{ xs: "unset", md: "90vh" }}
padding={{ xs: 3 }}
// marginTop={{ xs: "10vh", md: 0 }}
>
<Title as="h1">370🅙 Media Commons Reservation Form</Title>
<p>Thank you for your interest in booking with the Media Commons</p>
<Modal padding={4}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { Box, Stack, Typography } from "@mui/material";
import { Box, Stack, Typography, useMediaQuery, useTheme } from "@mui/material";
import React, { useContext, useMemo, useState } from "react";

import { BookingContext } from "../bookingProvider";
Expand All @@ -27,6 +27,8 @@ export default function SelectRoomPage({
const { selectedRooms, setSelectedRooms } = useContext(BookingContext);
const [date, setDate] = useState<Date>(new Date());
useCheckFormMissingData();
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));

const roomsToShow = useMemo(() => {
return !isWalkIn
Expand All @@ -36,9 +38,12 @@ export default function SelectRoomPage({

return (
<Box sx={{ flexGrow: 1 }}>
<Grid container>
<Grid width={330}>
<Stack spacing={2}>
<Grid container={!isMobile}>
<Grid width={{ xs: "100%", md: 330 }}>
<Stack
spacing={{ xs: 0, md: 2 }}
alignItems={{ xs: "center", md: "unset" }}
>
{!isWalkIn && <CalendarDatePicker handleChange={setDate} />}
<Box paddingLeft="24px">
<Typography fontWeight={500}>Spaces</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const Center = styled(Box)`
`;

const Container = styled(Box)(({ theme }) => ({
width: "50%",
display: "flex",
flexDirection: "column",
alignItems: "center",
Expand Down Expand Up @@ -60,7 +59,12 @@ export default function UserRolePage({

return (
<Center>
<Container padding={4} marginTop={6}>
<Container
padding={4}
margin={3}
marginTop={6}
width={{ xs: "100%", md: "50%" }}
>
<Typography fontWeight={500}>Affiliation</Typography>
<Dropdown
value={department}
Expand Down
20 changes: 14 additions & 6 deletions booking-app/components/src/client/routes/components/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ import {
import React from "react";
import { styled } from "@mui/system";

const Clip = styled(Box)`
overflow-x: auto;
`;

const TableCustom = styled(MuiTable)(({ theme }) => ({
border: `1px solid ${theme.palette.custom.border}`,
borderCollapse: "separate",
borderRadius: "0px 0px 4px 4px",
// overflowX: "scroll",

"& tr:last-child td": {
borderBottom: "none",
Expand All @@ -31,6 +36,7 @@ const ShadedHeader = styled(TableHead)(({ theme }) => ({
}));

export const TableTopRow = styled(MuiTable)`
width: 100%;
height: 48px;
border-bottom: none;
border-collapse: separate;
Expand Down Expand Up @@ -69,12 +75,14 @@ export default function Table({ columns, children, topRow, sx }: Props) {
</TableRow>
</TableBody>
</TableTopRow>
<TableCustom size="small" sx={sx ?? {}}>
<ShadedHeader>
<TableRow>{columns}</TableRow>
</ShadedHeader>
<TableBody>{children}</TableBody>
</TableCustom>
<Clip>
<TableCustom size="small" sx={sx ?? {}}>
<ShadedHeader>
<TableRow>{columns}</TableRow>
</ShadedHeader>
<TableBody>{children}</TableBody>
</TableCustom>
</Clip>
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
Select,
Toolbar,
Typography,
useMediaQuery,
useTheme,
} from "@mui/material";
import React, { useContext, useEffect, useMemo, useState } from "react";
import { usePathname, useRouter } from "next/navigation";
Expand Down Expand Up @@ -58,6 +60,8 @@ export default function NavBar() {
PagePermission.BOOKING
);
const pathname = usePathname();
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));

const netId = userEmail?.split("@")[0];

Expand Down Expand Up @@ -169,7 +173,7 @@ export default function NavBar() {
<Nav>
<LogoBox onClick={handleClickHome}>
<Image src={SVGLOGO} alt="Media Commons logo" height={40} />
<Title as="h1">Media Commons {envTitle}</Title>
{!isMobile && <Title as="h1">Media Commons {envTitle}</Title>}
</LogoBox>
<Box display="flex" alignItems="center">
{button}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ const Center = styled(Box)`
align-items: center;
`;

const Container = styled(Box)`
width: 65%;
margin: 48px;
`;

export default function MyBookingsPage() {
return (
<Center>
<Box width="65%" margin={6}>
<Box width={{ xs: "90%", md: "65%" }} margin={6}>
<Typography variant="h6">Welcome</Typography>
<Bookings pageContext={PageContextLevel.USER} />
</Box>
Expand Down

0 comments on commit a15a5c1

Please sign in to comment.