Skip to content

Commit

Permalink
Merge pull request #96 from CAUCSE/feat/#87
Browse files Browse the repository at this point in the history
[FEAT] 서비스 오픈 대비 유지보수 배포 4차
  • Loading branch information
selfishAltruism authored Mar 7, 2024
2 parents 13afaf0 + b5d0ab5 commit 58f4134
Show file tree
Hide file tree
Showing 16 changed files with 131 additions and 72 deletions.
6 changes: 3 additions & 3 deletions src/@types/user.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ declare namespace User {

// findPrivilegedUsers
export interface FindPrivilegedUsersResponseDto {
presidentUsers: Model.User[];
vicePresidentUsers: Model.User[];
presidentUsers: UserDto[];
vicePresidentUsers: UserDto[];
councilUsers: UserDto[];
leaderGradeUsers: UserDto[];
leaderCircleUsers: UserDto[];
leaderAlumni: Model.User[];
leaderAlumni: UserDto[];
}

export interface FindPrivilegedUsersResponse {
Expand Down
11 changes: 9 additions & 2 deletions src/pages/auth/useTerms/UseTermsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import styled from '@emotion/styled';
import { observer } from 'mobx-react-lite';
import React from 'react';
import { useHistory, generatePath } from 'react-router-dom';
Expand All @@ -15,6 +16,11 @@ import {
import { PAGE_URL } from '@/configs/path';
import { useRootStore } from '@/stores/RootStore';

const Title = styled.div`
font-size: 18px;
font-weight: bold;
`;

const UseTermsPage: React.FC = observer(() => {
const { replace, push } = useHistory();
const {
Expand All @@ -31,7 +37,7 @@ const UseTermsPage: React.FC = observer(() => {
<Header title="이용 약관" />
<PageBody>
<BodyScreen>
서비스 이용약관
<Title>서비스 이용약관</Title>
<br />
제1조(목적)
<br />
Expand Down Expand Up @@ -427,9 +433,10 @@ const UseTermsPage: React.FC = observer(() => {
서비스와 관련하여 분쟁이 발생한 경우 관할법원은 위원회 소재지 관할법원으로 정하며,
준거법은 대한민국의 법령을 적용합니다.
<br />
<br />부 칙
<br />
<br />
<Title>부 칙</Title>
<br />
제1조(시행일)
<br />본 약관은 2024.03.07부터 시행됩니다.  <br />
<br />
Expand Down
82 changes: 40 additions & 42 deletions src/pages/board/boardCreate/BoardCreatePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const BoardCreatePage: React.FC = observer(() => {
name: undefined,
description: undefined,
category: '공지 게시판',
circleName: '전체',
circleName: '',
},
});

Expand All @@ -54,47 +54,43 @@ const BoardCreatePage: React.FC = observer(() => {
createRoleList: [],
circleId: null,
};
if (me?.isCircleLeader && data.circleName !== '전체') {
//동아리장이 동아리 게시판을 생성하는 경우
if (data.category === '동아리 공지 게시판') {
body.createRoleList = ['ADMIN', 'VICE_PRESIDENT', 'PRESIDENT', 'LEADER_CIRCLE'];
body.circleId =
me.circleIds![me.circleNames!.findIndex(circleName => circleName === data.circleName)];
} else if (data.category === '동아리 자유 게시판') {
body.createRoleList = [
'ADMIN',
'VICE_PRESIDENT',
'PRESIDENT',
'LEADER_CIRCLE',
'LEADER_1',
'LEADER_2',
'LEADER_3',
'LEADER_4',
'COUNCIL',
'COMMON',
];
body.circleId =
me.circleIds![me.circleNames!.findIndex(circleName => circleName === data.circleName)];
}
} else {
//학생회장 혹은 관리자가 동아리 게시판을 생성하는 경우
if (data.category === '공지 게시판') {
body.createRoleList = ['ADMIN', 'VICE_PRESIDENT', 'PRESIDENT', 'COUNCIL'];
} else if (data.category === '자유 게시판') {
body.createRoleList = [
'ADMIN',
'VICE_PRESIDENT',
'PRESIDENT',
'LEADER_CIRCLE',
'LEADER_1',
'LEADER_2',
'LEADER_3',
'LEADER_4',
'COUNCIL',
'COMMON',
];
}

if (me && data.category === '동아리 공지 게시판') {
body.createRoleList = ['ADMIN', 'VICE_PRESIDENT', 'PRESIDENT', 'LEADER_CIRCLE'];
body.circleId =
me.circleIds![me.circleNames!.findIndex(circleName => circleName === data.circleName)];
} else if (me && data.category === '동아리 자유 게시판') {
body.createRoleList = [
'ADMIN',
'VICE_PRESIDENT',
'PRESIDENT',
'LEADER_CIRCLE',
'LEADER_1',
'LEADER_2',
'LEADER_3',
'LEADER_4',
'COUNCIL',
'COMMON',
];
body.circleId =
me.circleIds![me.circleNames!.findIndex(circleName => circleName === data.circleName)];
} else if (me && data.category === '공지 게시판') {
body.createRoleList = ['ADMIN', 'VICE_PRESIDENT', 'PRESIDENT', 'COUNCIL'];
} else if (me && data.category === '자유 게시판') {
body.createRoleList = [
'ADMIN',
'VICE_PRESIDENT',
'PRESIDENT',
'LEADER_CIRCLE',
'LEADER_1',
'LEADER_2',
'LEADER_3',
'LEADER_4',
'COUNCIL',
'COMMON',
];
}

const { success } = (await create(body)) as unknown as StoreAPI;
if (success) {
replace(PAGE_URL.Board);
Expand All @@ -104,8 +100,10 @@ const BoardCreatePage: React.FC = observer(() => {

useEffect(() => {
fetch();
if (me?.isCircleLeader && !(me.isAdmin || me.isPresidents))
if (me?.isCircleLeader) {
setValue('circleName', me.circleNames![0]);
setValue('category', '동아리 공지 게시판');
}
}, []);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import SendIcon from '@mui/icons-material/Send';
import { observer } from 'mobx-react-lite';
import { useEffect, useRef, useState } from 'react';
import { useFormContext } from 'react-hook-form';
import { useHistory } from 'react-router-dom';

import { Form, InputBox, SendButton, Textarea } from './styled';

Expand All @@ -16,6 +17,9 @@ export const CommentInputView: React.FC<Props> = observer(({ onSubmit }) => {
const { register, setFocus, setValue } = useFormContext();
const { ref, ...rest } = register('content');
const [isFocus, setIsFocus] = useState(false);
const {
location: { pathname },
} = useHistory();

useEffect(() => {
const { isEdit, isReply, target } = commentInput;
Expand All @@ -25,6 +29,8 @@ export const CommentInputView: React.FC<Props> = observer(({ onSubmit }) => {
setValue('content', content);
}, [commentInput, setFocus, setValue]);

console.log(pathname.indexOf('comment'));

return (
<Form onSubmit={onSubmit} isFocus={isFocus}>
<InputBox>
Expand All @@ -35,7 +41,7 @@ export const CommentInputView: React.FC<Props> = observer(({ onSubmit }) => {
}}
minRows={1}
maxRows={3}
placeholder="댓글 내용 입력"
placeholder={pathname.indexOf('comment') === -1 ? '댓글 내용 입력' : '답글 내용 입력'}
onFocus={() => setIsFocus(true)}
{...rest}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const PostReplyComments: React.FC = observer(() => {

return parent ? (
<CommentsBox>
<BackLink onClick={handleBack}>전체 댓글</BackLink>
<BackLink onClick={handleBack}>전체 댓글로 이동하기</BackLink>
<CommentCard model={parent} />
<Virtuoso
ref={virtuoso}
Expand Down
7 changes: 3 additions & 4 deletions src/pages/board/postDetail/styled.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import styled from '@emotion/styled';

export const PostContent = styled.p`
background-color: red;
width: 100%;
padding: 0;
height: auto;
font-size: 14px;
line-height: 1.5;
> p {
width: 100%;
height: 100%;
img {
max-width: 100%;
height: auto;
}
`;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { flow, makeObservable } from 'mobx';

import { ModalUi } from '@/stores';
import { UserRepoImpl as Repo } from '@/stores/repositories/UserRepo';
import { CircleRepoImpl as Repo } from '@/stores/repositories/CircleRepo';

export class RestoreModalUi extends ModalUi<Model.CircleUser> {
constructor() {
Expand All @@ -14,7 +14,7 @@ export class RestoreModalUi extends ModalUi<Model.CircleUser> {

*restore(target: Model.CircleUser): Generator {
try {
yield Repo.restore(target.user.id);
yield Repo.restoreUser(target.circle.id, target.user.id);
return { success: true } as StoreAPI;
} catch (error) {
return error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const SubmitButton = observer(() => {

return (
<PageFooter>
{isSelectedMine ? (
{/* {isSelectedMine ? (
// TODO : 반복 버튼 컴포넌트 만들기
<NavButton
disabled={!target}
Expand All @@ -44,7 +44,7 @@ export const SubmitButton = observer(() => {
>
연장하기
</NavButton>
) : null}
) : null} */}
<NavButton disabled={!target} onClick={handleClick(isSelectedMine, target)}>
{isSelectedMine ? '반환하기' : '신청하기'}
</NavButton>
Expand Down
5 changes: 5 additions & 0 deletions src/pages/setting/profile/SettingProfilePageUiStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export class SettingProfilePageUiStore {

this.file = file;
this.blobUrl = URL.createObjectURL(file);
} else {
this.file = null;
this.blobUrl = undefined;
}
}

Expand All @@ -53,6 +56,8 @@ export class SettingProfilePageUiStore {
IMAGE_TYPE.USER_PROFILE,
this.file,
)) as string;
} else {
body.profileImage = '';
}

yield Repo.update(body);
Expand Down
28 changes: 22 additions & 6 deletions src/pages/setting/profile/components/ProfileImage/ProfileImage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { observer } from 'mobx-react-lite';
import React, { useEffect, useRef } from 'react';
import React, { useEffect, useRef, useState } from 'react';

import { Button, TempImage } from './styled';
import { Button, TempImage, BasicProfileButton } from './styled';

import { usePageUiStore } from '@/hooks';
import { useRootStore } from '@/stores/RootStore';
Expand All @@ -12,7 +12,11 @@ export const ProfileImage: React.FC = observer(() => {
} = useRootStore();
const { blobUrl, setFile } = usePageUiStore<PageUiStore.SettingProfile>();
const ref = useRef<HTMLInputElement | null>(null);
const handleClick = () => ref.current?.click();
const [basicProfile, setBaisicProfile] = useState<boolean>(false);
const handleClick = () => {
setBaisicProfile(false);
ref.current?.click();
};

useEffect(() => {
const input = document.createElement('input');
Expand All @@ -23,8 +27,20 @@ export const ProfileImage: React.FC = observer(() => {
}, []);

return (
<Button type="button" onClick={handleClick}>
<TempImage src={blobUrl ?? me?.profileImage ?? ''} />
</Button>
<>
<Button type="button" onClick={handleClick}>
<TempImage
src={basicProfile ? '/images/default_profile.png' : blobUrl ?? me?.profileImage ?? ''}
/>
</Button>
<BasicProfileButton
onClick={() => {
setBaisicProfile(true);
setFile(null);
}}
>
기본 이미지 변경
</BasicProfileButton>
</>
);
});
20 changes: 19 additions & 1 deletion src/pages/setting/profile/components/ProfileImage/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ClearButton, ProfileImageBox } from '@/components';
export const Button = styled(ClearButton)`
position: relative;
display: block;
margin: 10px auto 20px;
margin: 10px auto -6px;
`;

export const TempImage = styled(ProfileImageBox)`
Expand All @@ -24,6 +24,24 @@ export const TempImage = styled(ProfileImageBox)`
}
`;

export const BasicProfileButton = styled(ClearButton)`
position: relative;
margin: 10px auto 20px;
display: block;
font-size: 12px;
color: white;
bottom: 0;
width: 120px;
height: 20px;
border-radius: 10px;
background-color: #312ed7;
border: 1px solid #312ed7;
overflow: hidden;
`;

export const ProfileIcon = styled(FaceRetouchingNaturalIcon)`
position: absolute;
right: -25px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export const InactiveUserRow: React.FC<{ model: Model.User }> = memo(({ model })
return (
<Row>
<UserName>
<ClearButton onClick={handleOpenInfoModal}>{model.nameWithAdmission}</ClearButton>
<ClearButton onClick={handleOpenInfoModal}>
{model.nameWithAdmission} {model.state === 'DROP' ? '(추방)' : '(탈퇴)'}
</ClearButton>
</UserName>

<RowButton onClick={handleOpenRestoreModel}>
Expand Down
3 changes: 2 additions & 1 deletion src/stores/models/AuthorModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export class AuthorModel {
constructor(admissionYear: number, name: string, profileImage: string | null) {
this.admissionYear = admissionYear;
this.name = name;
this.profileImage = profileImage ?? '/images/default_profile.png';
this.profileImage =
!profileImage || profileImage === '' ? '/images/default_profile.png' : profileImage;
}

get nameWithAdmission(): string {
Expand Down
Loading

0 comments on commit 58f4134

Please sign in to comment.