Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: 스터디 개설 페이지 레이아웃 #21

Merged
merged 30 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1ae4c49
feat: layout
eugene028 Aug 12, 2024
3c8b5e3
chore: lock 패키지 변경 사항 반영
eugene028 Aug 12, 2024
96dcb69
chore: 중복된 Navbar 컴포넌트 삭제
ghdtjgus76 Aug 12, 2024
10a576b
feat: 개설 스터디 기본 잡기
eugene028 Aug 12, 2024
dcd3e0b
feat: 스터디 개설 페이지 레이아웃
eugene028 Aug 13, 2024
e135d97
chore:패키지 설치
eugene028 Aug 13, 2024
5d35442
fix: 찌그러짐 방지용 minWidth 추가
eugene028 Aug 13, 2024
a77f7e6
feat: 스터디 개설하기 뷰 생성
eugene028 Aug 13, 2024
dcbb5b3
fix: 개설된 스터디로 화면 옮기기
eugene028 Aug 13, 2024
cec09ee
feat: auth 체크용 middleWare 생성
eugene028 Aug 13, 2024
333e298
fix: utils fetcher 함수 export 경로 변경
eugene028 Aug 13, 2024
f122b3d
feat: 스터디 생성하기 페이지 생성
eugene028 Aug 13, 2024
d1b9aa6
fix: router handler 삭제
eugene028 Aug 13, 2024
ab0a88f
fix:로그인 로직 합치기
eugene028 Aug 13, 2024
38dcff3
refactor: api path 상수로 수정
eugene028 Aug 13, 2024
0ccf38f
feat: isAdmin 함수 추가
eugene028 Aug 13, 2024
96dead7
fix: 코드리뷰 반영
eugene028 Aug 13, 2024
beae0f1
fix: admin여부에 따라 스터디 생성 박스 보이지 않도록
eugene028 Aug 13, 2024
329670f
chore: dev 머지
eugene028 Aug 14, 2024
8bbc939
chore: 패키지 설치
eugene028 Aug 14, 2024
30d8e7c
fix: 빌드에러 고치기
eugene028 Aug 14, 2024
9e03318
fix: 고친 로그인 로직 머지
eugene028 Aug 14, 2024
e09a96d
fix: isadmin 판별 로직 미들웨어에서 진행
eugene028 Aug 14, 2024
8efc686
feat: 역할 논리 다시
eugene028 Aug 14, 2024
00020f8
fix: 폴더명 변경
eugene028 Aug 14, 2024
625326e
fix: createStudy 경로 변경
eugene028 Aug 14, 2024
387950c
feat:wow-icons 추가
eugene028 Aug 14, 2024
b963913
fix: 폴더구조 변경
eugene028 Aug 16, 2024
af73c1f
fix: 폴더 복수형 변경
eugene028 Aug 16, 2024
b01d21e
fix: conflict 해결
eugene028 Aug 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit"
},
"eslint.workingDirectories": [
{
"mode": "auto"
Expand Down
6 changes: 6 additions & 0 deletions apps/admin/app/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"use client";
const ErrorPage = () => {
return <div>error</div>;
};

export default ErrorPage;
ghdtjgus76 marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 1 addition & 5 deletions apps/admin/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import "./global.css";
import "wowds-ui/styles.css";

import Navbar from "components/Navbar";
import type { Metadata } from "next";

import { JotaiProvider } from "../components/JotaiProvider";
Expand All @@ -19,10 +18,7 @@ const RootLayout = ({
return (
<html lang="ko">
<body>
<JotaiProvider>
<Navbar />
{children}
</JotaiProvider>
<JotaiProvider>{children}</JotaiProvider>
</body>
</html>
);
Expand Down
5 changes: 5 additions & 0 deletions apps/admin/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const NotFound = () => {
return <div>요청하신 페이지를 찾을 수 없어요.</div>;
};

export default NotFound;
5 changes: 5 additions & 0 deletions apps/admin/app/studies/createStudy/page.tsx
eugene028 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const CreateStudyPage = () => {
return <div>스터디 생성</div>;
};

export default CreateStudyPage;
20 changes: 20 additions & 0 deletions apps/admin/app/studies/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Flex, styled } from "@styled-system/jsx";
import Navbar from "components/Navbar";
const StudiesLayout = ({
children,
}: Readonly<{
children: React.ReactNode;
}>) => {
return (
<>
<Navbar />
<styled.div padding="54px 101px" width="100%">
<Flex direction="column" gap="sm" width="100%">
{children}
</Flex>
</styled.div>
ghdtjgus76 marked this conversation as resolved.
Show resolved Hide resolved
</>
);
};

export default StudiesLayout;
15 changes: 14 additions & 1 deletion apps/admin/app/studies/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import { css } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import CreateStudyButton from "components/createStudy/CreateStudyButton";
import SelectStudySemester from "components/createStudy/SelectStudySemester";

const Studies = () => {
eugene028 marked this conversation as resolved.
Show resolved Hide resolved
return <div>Studies</div>;
return (
<>
<Flex align="center" justifyContent="space-between">
<p className={css({ textStyle: "h1" })}>개설된 스터디</p>
<SelectStudySemester />
</Flex>
<CreateStudyButton />
</>
);
};

export default Studies;
1 change: 1 addition & 0 deletions apps/admin/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default Navbar;

const navbarContainerStyle = css({
width: "250px",
minWidth: "250px",
minHeight: "100vh",
paddingTop: "54px",
borderRightWidth: "arrow",
Expand Down
50 changes: 50 additions & 0 deletions apps/admin/components/createStudy/CreateStudyButton.tsx
eugene028 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"use client";
import { css } from "@styled-system/css";
import { Flex } from "@styled-system/jsx";
import { useRouter } from "next/navigation";

const CreateStudyButton = () => {
const router = useRouter();
return (
<button
className={createStudyButtonStyle}
onClick={() => router.push("studies/createStudy")}
>
eugene028 marked this conversation as resolved.
Show resolved Hide resolved
<Flex gap="xs">
<p className={css({ textStyle: "label1", color: "sub" })}>
새로운 스터디 개설하기
</p>
<div className={PlusIconStyle}>+</div>
</Flex>
</button>
);
};

export default CreateStudyButton;

const createStudyButtonStyle = css({
width: "100%",
display: "flex",
justifyContent: "center",
borderRadius: "md",
borderStyle: "dashed",
borderWidth: "1px",
borderColor: "outline",
padding: "32px",
_hover: {
backgroundColor: "backgroundAlternative",
borderWidth: "0px",
cursor: "pointer",
},
});

const PlusIconStyle = css({
display: "flex",
justifyContent: "center",
alignItems: "center",
width: "20px",
height: "20px",
borderRadius: "full",
backgroundColor: "primary",
color: "white",
});
20 changes: 20 additions & 0 deletions apps/admin/components/createStudy/SelectStudySemester.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { styled } from "@styled-system/jsx";
import { Suspense } from "react";
import DropDown from "wowds-ui/DropDown";
import DropDownOption from "wowds-ui/DropDownOption";

//TODO: 추후 학기 API 생성되면 대체할 것
const SelectStudySemester = () => {
return (
<Suspense fallback={null}>
<styled.div width="120px">
<DropDown defaultValue="all">
<DropDownOption text="2024-2" value="2024-2" />
<DropDownOption text="전체" value="all" />
</DropDown>
</styled.div>
</Suspense>
);
};

export default SelectStudySemester;
17 changes: 17 additions & 0 deletions apps/admin/middleware.tsx
eugene028 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { cookies } from "next/headers";
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";

export const config = {
matcher: ["/studies/:path*", "/participants/:path*"],
};

export function middleware(req: NextRequest) {
const cookieStore = cookies();
const accessToken = cookieStore.get("accessToken")?.value;
eugene028 marked this conversation as resolved.
Show resolved Hide resolved

if (!accessToken) {
return NextResponse.redirect(new URL("/not-found", req.url));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3;
현재는 accessToken 여부만 파악해서 리다이렉트 시키고 있는데, 멘토/코멤 여부에 따라서 특정 경로만 허용하는 로직을 추가하면 좋을 것 같아요.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

admin 확인 여부는 isAdmin 이라는 함수를 통해서 구별할 수 있도록 했어요!
0ccf38f

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p5;
클라이언트 페이지에서는 토큰이 없으면 /auth 페이지로 가도록 해놨는데 이 부분도 논의해서 통일해두면 좋을 거 같아요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 좋습니당 🥹 env 파일 통일되어서 전역으로 불러와서 쓰면 좋겠네용.

return NextResponse.next();
}
1 change: 0 additions & 1 deletion apps/admin/styled-system/types/prop-type.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ export interface UtilityValues {
| "h1"
| "h2"
| "h3"
| "body0"
eugene028 marked this conversation as resolved.
Show resolved Hide resolved
| "body1"
| "body2"
| "body3"
Expand Down
32 changes: 32 additions & 0 deletions apps/admin/types/MemberType.ts
eugene028 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { Status } from "types/status";
import type { User } from "types/user";

export interface MemberInfoResponse {
member: User;
currentRecruitmentRound: CurrentRecruitmentType;
currentMembership: CurrentMembershipType;
}

export interface CurrentRecruitmentType {
recruitmentId: number;
eugene028 marked this conversation as resolved.
Show resolved Hide resolved
name: string;
period: {
startDate: string;
endDate: string;
open: boolean;
};
fee: number;
roundType: "FIRST" | "SECOND";
roundTypeValue: string;
}

export interface CurrentMembershipType {
membershipId: number;
memberId: number;
recruitmentId: number;
regularRequirement: {
paymentStatus: Status;
allSatisfied: boolean;
paymentSatisfied: boolean;
};
}
3 changes: 3 additions & 0 deletions apps/admin/types/role.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type ManageRole = "ADMIN" | "NONE";
export type StudyRole = "MENTOR" | "STUDENT";
export type UserRoleType = "GUEST" | "ASSOCIATE" | "REGULAR";
2 changes: 2 additions & 0 deletions apps/admin/types/status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export type Status = "UNSATISFIED" | "SATISFIED";
export type UnivEmailStatus = "IN_PROGRESS" | "UNSATISFIED" | "SATISFIED";
33 changes: 33 additions & 0 deletions apps/admin/types/user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { ManageRole, StudyRole, UserRoleType } from "./role";
import type { Status, UnivEmailStatus } from "./status";

export type User = {
memberId: string; // C000000 (학번)
role: UserRoleType;
basicInfo: UserBasicInfo;
manageRole: ManageRole;
studyRole: StudyRole;
associateRequirement: {
univStatus: UnivEmailStatus;
discordStatus: Status;
bevyStatus: Status;
infoStatus: Status;
};
};

export type AssociateRequirement = {
univStatus: UnivEmailStatus;
discordStatus: Status;
bevyStatus: Status;
infoStatus: Status;
};

export type UserBasicInfo = {
name: string;
studentId: string;
email: string;
department: string;
phone: string;
discordUsername: string;
nickname: string;
};
14 changes: 14 additions & 0 deletions apps/admin/utils/isMentor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { fetcher } from "@wow-class/utils";
import type { User } from "types/user";

const isMentor = async () => {
const response = await fetcher
.get<User>("/onboarding/members/me/dashboard", {
eugene028 marked this conversation as resolved.
Show resolved Hide resolved
eugene028 marked this conversation as resolved.
Show resolved Hide resolved
credentials: "include",
})
.then((response) => {
console.log(response.data?.studyRole);
});
};

export default isMentor;
1 change: 0 additions & 1 deletion apps/client/styled-system/types/prop-type.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ export interface UtilityValues {
| "h1"
| "h2"
| "h3"
| "body0"
| "body1"
| "body2"
| "body3"
Expand Down
1 change: 0 additions & 1 deletion packages/ui/styled-system/types/prop-type.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ export interface UtilityValues {
| "h1"
| "h2"
| "h3"
| "body0"
| "body1"
| "body2"
| "body3"
Expand Down
7 changes: 6 additions & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "@wow-class/utils",
"version": "0.0.0",
"private": true,
"exports": {
".": "./src/index.tsx"
},
"scripts": {
"test": "jest"
},
Expand All @@ -10,6 +13,8 @@
"jest": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"ts-jest": "^29.2.4",
"@wow-class/typescript-config": "workspace:*"
"@wow-class/typescript-config": "workspace:*",
"@wow-class/eslint-config": "workspace:*",
"typescript": "^5.3.3"
}
}
1 change: 1 addition & 0 deletions packages/utils/src/index.tsx
eugene028 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./fetcher";
3 changes: 3 additions & 0 deletions packages/utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "@wow-class/typescript-config/basic.json",
"compilerOptions": {
"baseUrl": "./src"
},
"include": ["src", "jest.setup.ts"],
"exclude": ["node_modules"]
}
Loading