Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:innovationacademy-kr/42cabi into be/…
Browse files Browse the repository at this point in the history
…dev/feat_extension/#1386

# Conflicts:
#	config
  • Loading branch information
enaenen committed Oct 13, 2023
2 parents 66d962c + e18999b commit a4fd7ff
Show file tree
Hide file tree
Showing 15 changed files with 265 additions and 88 deletions.
1 change: 1 addition & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ sourceCompatibility = '11'

ext {
snippetsDir = file('build/generated-snippets')
snippetsDir.mkdirs()
outputDocs = file('src/main/resources/static/docs')
}

Expand Down
2 changes: 1 addition & 1 deletion backend/build_be.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi
echo -en $CYAN
if [ "$arg" == "build" ] || [ "$arg" == "re" ] || [ "$arg" == "all" ]; then
echo "Build with Gradle"
./gradlew clean build
./gradlew build -x test
fi

echo -en $CYAN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class DomainProperties {
@Value("${spring.oauth2.domain-name.main}")
private String main;

@Value("${spring.server.be-host}")
private String beHost;

@Value("${spring.server.fe-host}")
private String feHost;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.ftclub.cabinet.config.DomainProperties;
import org.ftclub.cabinet.redis.service.RedisService;
import org.ftclub.cabinet.utils.overdue.manager.OverdueType;
import org.springframework.stereotype.Service;
Expand All @@ -14,6 +15,8 @@
@Slf4j
public class FCMService {
private final RedisService redisService;
private final DomainProperties domainProperties;
private static final String ICON_FILE_PATH = "/src/assets/images/logo.svg";


public void sendPushMessage(String name, OverdueType overdueType, Long daysLeftFromExpireDate) {
Expand Down Expand Up @@ -46,7 +49,9 @@ private void sendOverdueMessage(String token, String name, Long daysLeftFromExpi
token, name, daysLeftFromExpireDate);
Message message = Message.builder()
.putData("title", "<CABI> 연체 알림")
.putData("content", name + "님, 대여한 사물함이 " + Math.abs(daysLeftFromExpireDate) + "일 연체되었습니다.")
.putData("body", name + "님, 대여한 사물함이 " + Math.abs(daysLeftFromExpireDate) + "일 연체되었습니다.")
.putData("icon", domainProperties.getFeHost() + ICON_FILE_PATH)
.putData("click_action", domainProperties.getFeHost())
.setToken(token)
.build();

Expand All @@ -63,7 +68,9 @@ private void sendSoonOverdueMessage(String token, String name, Long daysLeftFrom
}
Message message = Message.builder()
.putData("title", "<CABI> 연체 예정 알림")
.putData("content", "대여한 사물함이 " + daysLeftFromExpireDate + "일 후 연체됩니다.")
.putData("body", "대여한 사물함이 " + daysLeftFromExpireDate + "일 후 연체됩니다.")
.putData("icon", domainProperties.getFeHost() + ICON_FILE_PATH)
.putData("click_action", domainProperties.getFeHost())
.setToken(token)
.build();

Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"dev": "cp ../config/frontend/.env .env && vite",
"build": "tsc && vite build",
"preview": "vite preview",
"test": "vitest --reporter verbose",
Expand Down
4 changes: 2 additions & 2 deletions frontend/public/firebase-messaging-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ self.addEventListener("push", function (e) {
console.log("push: ", e.data.json());
if (!e.data.json()) return;

const resultData = e.data.json().notification;
const resultData = e.data.json().data;
const notificationTitle = resultData.title;
const notificationOptions = {
body: resultData.body,
body: resultData.content,
icon: resultData.image,
tag: resultData.tag,
...resultData,
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import LoginPage from "@/pages/LoginPage";
import MainPage from "@/pages/MainPage";
import AdminMainPage from "@/pages/admin/AdminMainPage";
import LoadingAnimation from "@/components/Common/LoadingAnimation";
import ProfilePage from "./pages/ProfilePage";
import "./firebase-messaging-sw"


const NotFoundPage = lazy(() => import("@/pages/NotFoundPage"));
const LoginFailurePage = lazy(() => import("@/pages/LoginFailurePage"));
const AdminLayout = lazy(() => import("@/pages/admin/AdminLayout"));
Expand All @@ -29,7 +31,8 @@ function App(): React.ReactElement {
<Route path="login" element={<LoginPage />} />
<Route path="home" element={<HomePage />} />
<Route path="main" element={<MainPage />} />
<Route path="log" element={<LogPage />} />
<Route path="profile/log" element={<LogPage />} />
<Route path="profile" element={<ProfilePage />} />
</Route>
{/* admin용 라우터 */}
<Route path="/admin/" element={<AdminLayout />}>
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/assets/images/link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions frontend/src/assets/images/profile-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ const LeftMainNavContainer = ({ isAdmin }: { isAdmin?: boolean }) => {
closeAll();
};

const onClickProfileButton = () => {
navigator("profile");
closeAll();
};

const onClickLogoutButton = (): void => {
const adminToken = isAdmin ? "admin_" : "";
if (import.meta.env.VITE_IS_LOCAL === "true") {
Expand Down Expand Up @@ -138,6 +143,7 @@ const LeftMainNavContainer = ({ isAdmin }: { isAdmin?: boolean }) => {
onClickSearchButton={onClickSearchButton}
onClickLogoutButton={onClickLogoutButton}
onClickClubButton={onClickClubButton}
onClickProfileButton={onClickProfileButton}
isAdmin={isAdmin}
/>
);
Expand Down
121 changes: 57 additions & 64 deletions frontend/src/components/LeftNav/LeftMainNav/LeftMainNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface ILeftMainNav {
onClickLentLogButton: React.MouseEventHandler;
onClickSearchButton: React.MouseEventHandler;
onClickClubButton: React.MouseEventHandler;
onClickProfileButton: React.MouseEventHandler;
isAdmin?: boolean;
}

Expand All @@ -23,6 +24,7 @@ const LeftMainNav = ({
onClickLentLogButton,
onClickSearchButton,
onClickClubButton,
onClickProfileButton,
isAdmin,
}: ILeftMainNav) => {
return (
Expand Down Expand Up @@ -58,75 +60,66 @@ const LeftMainNav = ({
<BottomSectionStyled>
<BottomBtnsStyled>
{isAdmin && (
<BottomBtnStyled
className={
pathname.includes("search")
? "active cabiButton"
: " cabiButton"
}
src={"/src/assets/images/search.svg"}
onClick={onClickSearchButton}
>
<div></div>
Search
</BottomBtnStyled>
)}
{!isAdmin && (
<BottomBtnStyled
className={
pathname.includes("log") ? "active cabiButton" : " cabiButton"
}
src={"/src/assets/images/log.svg"}
onClick={onClickLentLogButton}
>
<div></div>
Log
</BottomBtnStyled>
)}
<BottomBtnStyled
src={"/src/assets/images/slack.svg"}
className="cabiButton"
>
<a
href="https://42born2code.slack.com/archives/C02V6GE8LD7"
target="_blank"
title="슬랙 캐비닛 채널 새창으로 열기"
>
<div></div>
Contact
</a>
</BottomBtnStyled>
<BottomBtnStyled
src={"/src/assets/images/clubIconGray.svg"}
className="cabiButton"
>
{isAdmin ? (
<>
<a onClick={onClickClubButton}>
<>
<BottomBtnStyled
className={
pathname.includes("search")
? "active cabiButton"
: " cabiButton"
}
src={"/src/assets/images/search.svg"}
onClick={onClickSearchButton}
>
<div></div>
Search
</BottomBtnStyled>
<BottomBtnStyled
src={"/src/assets/images/slack.svg"}
className="cabiButton"
>
<a
href="https://42born2code.slack.com/archives/C02V6GE8LD7"
target="_blank"
title="슬랙 캐비닛 채널 새창으로 열기"
>
<div></div>
Club
Contact
</a>
</>
) : (
<a
href="https://docs.google.com/forms/d/e/1FAIpQLSfp-d7qq8gTvmQe5i6Gtv_mluNSICwuv5pMqeTBqt9NJXXP7w/closedform"
target="_blank"
title="동아리 사물함 사용 신청서 새창으로 열기"
</BottomBtnStyled>
<BottomBtnStyled
src={"/src/assets/images/clubIconGray.svg"}
className="cabiButton"
onClick={onClickClubButton}
>
<div></div>
Club
</a>
)}
</BottomBtnStyled>

<BottomBtnStyled
className="cabiButton"
onClick={onClickLogoutButton}
src={"/src/assets/images/close-square.svg"}
>
<div></div>
Logout
</BottomBtnStyled>
</BottomBtnStyled>
<BottomBtnStyled
className="cabiButton"
onClick={onClickLogoutButton}
src={"/src/assets/images/close-square.svg"}
>
<div></div>
Logout
</BottomBtnStyled>
</>
)}
{!isAdmin && (
<>
<BottomBtnStyled
className={
pathname.includes("profile")
? "active cabiButton"
: " cabiButton"
}
src={"/src/assets/images/profile-circle.svg"}
onClick={onClickProfileButton}
>
<div></div>
Profile
</BottomBtnStyled>
</>
)}
</BottomBtnsStyled>
</BottomSectionStyled>
</LeftNavStyled>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/LeftNav/LeftNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import styled from "styled-components";
import LeftMainNavContainer from "@/components/LeftNav/LeftMainNav/LeftMainNav.container";
import LeftSectionNavContainer from "@/components/LeftNav/LeftSectionNav/LeftSectionNav.container";

const LeftNav: React.FC<{ isVisible: boolean; isAdmin?: boolean }> = ({
isAdmin,
isVisible,
}) => {
const LeftNav: React.FC<{
isVisible: boolean;
isAdmin?: boolean;
}> = ({ isAdmin, isVisible }) => {
return (
<LeftNavWrapStyled id="leftNavWrap">
<LeftMainNavContainer isAdmin={isAdmin} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useLocation, useNavigate } from "react-router-dom";
import { useRecoilState, useRecoilValue } from "recoil";
import { currentSectionNameState } from "@/recoil/atoms";
import { currentFloorSectionState } from "@/recoil/selectors";
Expand All @@ -9,20 +10,54 @@ const LeftSectionNavContainer = ({ isVisible }: { isVisible: boolean }) => {
const [currentFloorSection, setCurrentFloorSection] = useRecoilState<string>(
currentSectionNameState
);

const navigator = useNavigate();
const { pathname } = useLocation();
const { closeLeftNav } = useMenu();
const isProfilePage: boolean = location.pathname.includes("profile");

const onClickSection = (section: string) => {
closeLeftNav();
setCurrentFloorSection(section);
};

const onClickProfile = () => {
closeLeftNav();
navigator("profile");
};

const onClickLentLogButton = () => {
closeLeftNav();
navigator("profile/log");
};

const onClickSlack = () => {
window.open(
"https://42born2code.slack.com/archives/C02V6GE8LD7",
"_blank",
"noopener noreferrer"
);
};

const onClickClubForm = () => {
window.open(
"https://docs.google.com/forms/d/e/1FAIpQLSfp-d7qq8gTvmQe5i6Gtv_mluNSICwuv5pMqeTBqt9NJXXP7w/closedform",
"_blank",
"noopener noreferrer"
);
};

return (
<LeftSectionNav
pathname={pathname}
isVisible={isVisible}
onClickSection={onClickSection}
isProfile={isProfilePage}
currentFloorSection={currentFloorSection}
floorSection={floorSection}
onClickSection={onClickSection}
onClickProfile={onClickProfile}
onClickLentLogButton={onClickLentLogButton}
onClickSlack={onClickSlack}
onClickClubForm={onClickClubForm}
/>
);
};
Expand Down
Loading

0 comments on commit a4fd7ff

Please sign in to comment.