-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from woowacourse/feat/15-keyword
feat: 로드맵 키워드 어드민 기능 구현
- Loading branch information
Showing
33 changed files
with
3,707 additions
and
2,208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: deploy for prod | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- name: Checkout Source Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache node_modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-modules- | ||
- name: Install Dependencies | ||
run: | | ||
yarn install | ||
- name: Build | ||
run: | | ||
yarn build | ||
env: | ||
CI: false | ||
|
||
- name: Deploy to S3 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
run: | | ||
aws s3 cp --recursive --region ap-northeast-2 build s3://prolog-admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: deploy for dev | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- name: Checkout Source Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache node_modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-modules- | ||
- name: Install Dependencies | ||
run: | | ||
yarn install | ||
- name: Build | ||
run: | | ||
yarn build | ||
env: | ||
CI: false | ||
|
||
- name: Deploy to S3 | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
run: | | ||
aws s3 cp --recursive --region ap-northeast-2 build s3://prolog-dev-admin | ||
- name: Invalidate CloudFront Cache | ||
run: aws cloudfront create-invalidation --region ap-northeast-2 --distribution-id ${{secrets.AWS_CLOUDFRONT_DISTRIBUTION}} --paths "/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/components/PopularStudylogsUpdate.tsx → ...ages/PopularStudylogsUpdatePage/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
src/customPages/RoadmapEditKeywordPage/components/AddKeywordModal/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
import { Modal, Box, TextField } from '@mui/material'; | ||
import { useAddKeyword } from '../../../../hooks/roadmap'; | ||
import useInput from '../../../../hooks/useInput'; | ||
import { | ||
validateDescription, | ||
validateName, | ||
validateImportance, | ||
validateOrder, | ||
} from '../../../../utils/validator'; | ||
import { AddKeywordModalProps } from './type'; | ||
|
||
export const AddKeywordModal = ({ | ||
open, | ||
onClose, | ||
sessionId, | ||
parentKeywordId, | ||
}: AddKeywordModalProps) => { | ||
const name = useInput('', validateName); | ||
const importance = useInput('', validateImportance); | ||
const description = useInput('', validateDescription); | ||
const order = useInput('', validateOrder); | ||
|
||
const isAllValidated = | ||
name.isValidated && description.isValidated && importance.isValidated; | ||
|
||
const { mutate: addKeyword } = useAddKeyword({ successCallback: onClose }); | ||
|
||
return ( | ||
<Modal | ||
open={open} | ||
onClose={onClose} | ||
aria-labelledby="modal-modal-title" | ||
aria-describedby="modal-modal-description" | ||
> | ||
<Box sx={style}> | ||
<form | ||
onSubmit={(event) => { | ||
event.preventDefault(); | ||
|
||
if (name.value && importance.value && description.value) { | ||
addKeyword({ | ||
sessionId, | ||
name: name.value, | ||
importance: Number(importance.value), | ||
description: description.value, | ||
order: Number(order.value), | ||
parentKeywordId, | ||
}); | ||
} | ||
}} | ||
> | ||
<div> | ||
<TextField | ||
required | ||
label="이름" | ||
fullWidth | ||
onChange={name.onChange} | ||
value={name.value} | ||
error={!name.isValidated} | ||
helperText={name.message} | ||
/> | ||
</div> | ||
<div> | ||
<TextField | ||
required | ||
label="설명" | ||
fullWidth | ||
multiline | ||
maxRows={4} | ||
onChange={description.onChange} | ||
value={description.value} | ||
error={!description.isValidated} | ||
helperText={description.message} | ||
/> | ||
</div> | ||
<div> | ||
<TextField | ||
required | ||
label="중요도" | ||
fullWidth | ||
onChange={importance.onChange} | ||
value={importance.value} | ||
error={!importance.isValidated} | ||
helperText={importance.message} | ||
/> | ||
</div> | ||
<div> | ||
<TextField | ||
required | ||
label="순서" | ||
fullWidth | ||
onChange={order.onChange} | ||
value={order.value} | ||
error={!order.isValidated} | ||
helperText={order.message} | ||
/> | ||
</div> | ||
<div> | ||
<TextField | ||
required | ||
disabled | ||
label="상위 키워드 Id" | ||
fullWidth | ||
value={parentKeywordId} | ||
/> | ||
</div> | ||
<button disabled={!isAllValidated}>키워드 추가</button> | ||
</form> | ||
</Box> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export const style = { | ||
position: 'absolute' as const, | ||
top: '50%', | ||
left: '50%', | ||
transform: 'translate(-50%, -50%)', | ||
width: 400, | ||
bgcolor: 'background.paper', | ||
border: '2px solid #646464', | ||
boxShadow: 24, | ||
p: 4, | ||
}; |
6 changes: 6 additions & 0 deletions
6
src/customPages/RoadmapEditKeywordPage/components/AddKeywordModal/type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export type AddKeywordModalProps = { | ||
open: boolean; | ||
onClose: () => void; | ||
sessionId: number; | ||
parentKeywordId: number | null; | ||
}; |
47 changes: 47 additions & 0 deletions
47
src/customPages/RoadmapEditKeywordPage/components/CustomTableCell/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { TableCell, Button } from '@mui/material'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { ChildrenKeyword } from '../../../../types'; | ||
|
||
export const CustomTableCell = ({ | ||
item, | ||
sessionId, | ||
}: { | ||
item: ChildrenKeyword; | ||
sessionId: number; | ||
}) => { | ||
const navigate = useNavigate(); | ||
return ( | ||
<> | ||
{Object.values(item).map((itemValue, index) => { | ||
if (Array.isArray(itemValue)) { | ||
return ( | ||
<TableCell key={index} component="th" scope="row"> | ||
<Button | ||
key={itemValue} | ||
variant="contained" | ||
onClick={() => | ||
navigate(`/roadmap/${sessionId}/editSubKeywords`, { | ||
state: { | ||
childrenKeywordList: itemValue, | ||
sessionId, | ||
name: item.name, | ||
parentKeywordId: item.keywordId, | ||
}, | ||
}) | ||
} | ||
> | ||
하위 키워드({itemValue.length}개) 목록 보기 | ||
</Button> | ||
</TableCell> | ||
); | ||
} | ||
|
||
return ( | ||
<TableCell key={index} component="th" scope="row"> | ||
{itemValue} | ||
</TableCell> | ||
); | ||
})} | ||
</> | ||
); | ||
}; |
Oops, something went wrong.