Skip to content

Commit

Permalink
Merge pull request #1713 from innovationacademy-kr/dev
Browse files Browse the repository at this point in the history
DEV TO MAIN
  • Loading branch information
seonmiki authored Nov 22, 2024
2 parents 935cdc3 + 5561a14 commit c185c90
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
currentSectionCabinetState,
currentSectionColNumState,
} from "@/Cabinet/recoil/selectors";
import { DISABLED_FLOOR } from "@/Cabinet/pages/AvailablePage";
import CabinetList from "@/Cabinet/components/CabinetList/CabinetList";
import EmptySection from "@/Cabinet/components/CabinetList/EmptySection/EmptySection";
import RealViewNotification from "@/Cabinet/components/CabinetList/RealViewNotification/RealViewNotification";
Expand All @@ -19,10 +20,11 @@ import useMultiSelect from "@/Cabinet/hooks/useMultiSelect";

interface ICabinetListContainer {
isAdmin: boolean;
currentFloor: number;
}

const CabinetListContainer = ({
isAdmin,
isAdmin, currentFloor
}: ICabinetListContainer): JSX.Element => {
const colNum = useRecoilValue(currentSectionColNumState);
const currentSectionCabinets = useRecoilValue<CabinetPreviewInfo[]>(
Expand Down Expand Up @@ -50,17 +52,23 @@ const CabinetListContainer = ({
/>
</div>
)}
{currentFloorSectionNames.includes(currentSectionName) && (
{currentFloorSectionNames.includes(currentSectionName) && !(DISABLED_FLOOR.includes(currentFloor.toString())) && (
<RealViewNotification colNum={colNum as number} />
)}
<CabinetList
colNum={colNum as number}
cabinetInfo={currentSectionCabinets}
isAdmin={isAdmin}
/>
{(currentSectionName === SectionType.elevator ||
currentSectionName === SectionType.stairs) && (
<EmptySection message={"여기엔 사물함이 없어요!"} />
{(!isAdmin && DISABLED_FLOOR.includes(currentFloor.toString())) ? (
<EmptySection message={`${currentFloor}층은 현재 이용 불가입니다!`} />
) : (
<>
<CabinetList
colNum={colNum as number}
cabinetInfo={currentSectionCabinets}
isAdmin={isAdmin}
/>
{(currentSectionName === SectionType.elevator ||
currentSectionName === SectionType.stairs) && (
<EmptySection message={"여기엔 사물함이 없어요!"} />
)}
</>
)}
</React.Fragment>
);
Expand Down
29 changes: 16 additions & 13 deletions frontend/src/Cabinet/components/LeftNav/LeftMainNav/LeftMainNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ReactComponent as ProfileImg } from "@/Cabinet/assets/images/profile-ci
import { ReactComponent as SlackAlarmImg } from "@/Cabinet/assets/images/slack-alarm.svg";
import { ReactComponent as SlackImg } from "@/Cabinet/assets/images/slack.svg";
import { ReactComponent as StoreImg } from "@/Cabinet/assets/images/storeIconGray.svg";
import { DISABLED_FLOOR } from "@/Cabinet/pages/AvailablePage";

interface ILeftMainNav {
pathname: string;
Expand Down Expand Up @@ -57,19 +58,21 @@ const LeftMainNav = ({
Home
</TopBtnStyled>
{floors &&
floors.map((floor, index) => (
<TopBtnStyled
className={
pathname.includes("main") && floor === currentFloor
? "leftNavButtonActive cabiButton"
: "cabiButton"
}
onClick={() => onClickFloorButton(floor)}
key={index}
>
{floor + "층"}
</TopBtnStyled>
))}
floors.map((floor, index) =>
!(!isAdmin && DISABLED_FLOOR.includes(floor.toString())) ? (
<TopBtnStyled
className={
pathname.includes("main") && floor === currentFloor
? "leftNavButtonActive cabiButton"
: "cabiButton"
}
onClick={() => onClickFloorButton(floor)}
key={index}
>
{floor + "층"}
</TopBtnStyled>
) : null
)}
<TopBtnStyled
className={
pathname.includes("available")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { useLocation } from "react-router-dom";
import { useRecoilValue } from "recoil";
import { useRecoilState } from "recoil";
import styled from "styled-components";
import { currentSectionNameState } from "@/Cabinet/recoil/atoms";
import { currentSectionNameState, currentFloorNumberState } from "@/Cabinet/recoil/atoms";
import { DISABLED_FLOOR } from "@/Cabinet/pages/AvailablePage";
import { currentFloorSectionState } from "@/Cabinet/recoil/selectors";
import CabinetColorTable from "@/Cabinet/components/LeftNav/CabinetColorTable/CabinetColorTable";
import { clubSectionsData } from "@/Cabinet/assets/data/mapPositionData";
Expand All @@ -17,6 +18,7 @@ const LeftSectionNav = ({ closeLeftNav }: { closeLeftNav: () => void }) => {
const [currentFloorSection, setCurrentFloorSection] = useRecoilState<string>(
currentSectionNameState
);
const currentFloorNumber = useRecoilValue<number>(currentFloorNumberState);
const { pathname } = useLocation();
const isAdmin = pathname.includes("admin");

Expand Down Expand Up @@ -45,6 +47,7 @@ const LeftSectionNav = ({ closeLeftNav }: { closeLeftNav: () => void }) => {
<IconWrapperStyled>
{!isAdmin &&
!isClubSection &&
!DISABLED_FLOOR.includes(currentFloorNumber.toString()) &&
(section.alarmRegistered ? (
<FilledHeartIcon />
) : (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styled from "styled-components";
import { DISABLED_FLOOR } from "@/Cabinet/pages/AvailablePage";

const MapFloorSelectOption: React.FC<{
selectFloor: Function;
Expand All @@ -7,6 +8,7 @@ const MapFloorSelectOption: React.FC<{
return (
<OptionWrapperStyled id="mapFloorOptionBox">
{floorInfo.map((info, idx) => (
!(DISABLED_FLOOR.includes(info.toString())) &&
<OptionStyled
className="cabiButton"
onClick={() => selectFloor(info)}
Expand Down
13 changes: 10 additions & 3 deletions frontend/src/Cabinet/components/MapInfo/MapInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import styled from "styled-components";
import MapFloorSelect from "@/Cabinet/components/MapInfo/MapFloorSelect/MapFloorSelect";
import MapGrid from "@/Cabinet/components/MapInfo/MapGrid/MapGrid";
import { DISABLED_FLOOR } from "@/Cabinet/pages/AvailablePage";

const DEFAULT_FLOOR = 2;
const MapInfo = ({
touchStart,
touchEnd,
Expand All @@ -12,11 +14,16 @@ const MapInfo = ({
}: {
touchStart: React.TouchEventHandler;
touchEnd: React.TouchEventHandler;
floor: number;
floor: number | undefined;
setFloor: React.Dispatch<React.SetStateAction<number>>;
floorInfo: number[];
closeMap: React.MouseEventHandler;
}) => {
const currentFloor = floor ?? DEFAULT_FLOOR;
const validFloor = DISABLED_FLOOR.includes(currentFloor.toString())
? DEFAULT_FLOOR
: currentFloor;

return (
<MapInfoContainerStyled
id="mapInfo"
Expand All @@ -33,8 +40,8 @@ const MapInfo = ({
style={{ width: "24px", cursor: "pointer" }}
/>
</HeaderStyled>
<MapFloorSelect floor={floor} setFloor={setFloor} floorInfo={floorInfo} />
<MapGrid floor={floor} />
<MapFloorSelect floor={validFloor} setFloor={setFloor} floorInfo={floorInfo} />
<MapGrid floor={validFloor} />
</MapInfoContainerStyled>
);
};
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/Cabinet/pages/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,10 @@ const MainPage = () => {
</AlertStyled>
<SectionPaginationContainer />
<CabinetListWrapperStyled>
<CabinetListContainer isAdmin={false} />
<CabinetListContainer isAdmin={false} currentFloor={currentFloor} />
{currentSectionName !== SectionType.elevator &&
currentSectionName !== SectionType.stairs && (
currentSectionName !== SectionType.stairs &&
!DISABLED_FLOOR.includes(currentFloor.toString()) && (
<RefreshButtonStyled
className="cabiButton"
title="새로고침"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Cabinet/pages/admin/AdminMainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const AdminMainPage = () => {
/>
</MultiSelectButtonWrapperStyled>
<CabinetListWrapperStyled>
<CabinetListContainer isAdmin={true} />
<CabinetListContainer isAdmin={true} currentFloor={currentFloorNumber} />

<RefreshButtonStyled
className="cabiButton"
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import url("https://fonts.googleapis.com/css2?family=Do+Hyeon&display=swap&text=새롬관로그인중수요지식회여기엔사물함이없어");
@import url("https://fonts.googleapis.com/css2?family=Do+Hyeon&display=swap&text=새롬관로그인중수요지식회여기엔사물함이없어4층은현재용불가입니다!");
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;700&display=swap");

:root {
Expand Down Expand Up @@ -224,6 +224,7 @@ input {
-ms-overflow-style: none;
scrollbar-width: none;
}

.noScrollbar::-webkit-scrollbar {
display: none;
}
Expand Down Expand Up @@ -254,4 +255,4 @@ input {

.domainButtonActive {
color: var(--sys-main-color) !important;
}
}

0 comments on commit c185c90

Please sign in to comment.