Skip to content

Commit

Permalink
Fix/issue #129 (#130)
Browse files Browse the repository at this point in the history
* Fix : 프로젝트 글쓰기 권한 전체로 변경

* Fix : local 삭제후 commit
  • Loading branch information
teagu123 authored Oct 5, 2024
1 parent 8c5f11c commit 428a53e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
17 changes: 1 addition & 16 deletions src/pages/project/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import * as P from './HeaderStyle';
import WriteIcon from '../../../img/project/write.svg';
import { useNavigate } from 'react-router-dom';
import { ProjectAPI } from './ProjectList';

import { Gen } from '../register/RegisterOptions';
import { useAuth } from '../../../hooks/useAuth';
import { RolePriority } from '../../../constants/Role';

interface IHeader {
setProjectApi: React.Dispatch<React.SetStateAction<ProjectAPI>>;
Expand All @@ -19,18 +16,6 @@ function Header({ setProjectApi }: IHeader) {
setActiveTab(index);
};

const { userinfo, isLoading } = useAuth();
const isSuperAdminInfo =
RolePriority.findIndex(role => role === userinfo.role) >= 3;

const [isAdmin, setIsAdmin] = useState<boolean>(false);

useEffect(() => {
if (isSuperAdminInfo && !isLoading) {
setIsAdmin(true);
}
}, [isLoading, isSuperAdminInfo]);

useEffect(() => {
// 전체를 클릭할 경우
if (activeTab === undefined) {
Expand Down Expand Up @@ -82,7 +67,7 @@ function Header({ setProjectApi }: IHeader) {
</P.Tab>
</P.TabContainer>

<P.WriteBtn isAdmin={isAdmin} onClick={goRegister}>
<P.WriteBtn onClick={goRegister}>
<img src={WriteIcon} alt="write" />
글쓰기
</P.WriteBtn>
Expand Down
5 changes: 2 additions & 3 deletions src/pages/project/components/HeaderStyle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,13 @@ export const Divider = styled.div`
display: none;
`;

export const WriteBtn = styled.button<{ isAdmin: boolean }>`
display: ${props => (props.isAdmin ? 'inline-flex' : 'none')};
export const WriteBtn = styled.button`
margin-left: 20px;
padding: 8px 20px 8px 14px;
justify-content: center;
align-items: center;
gap: 6px;
display: inline-flex;
border-radius: 6px;
border: none;
background: var(--Orange-600, #ff7710);
Expand Down

0 comments on commit 428a53e

Please sign in to comment.