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

D123 #126

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

D123 #126

Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion src/Components/CardModal/Activity.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, {useState, useRef} from 'react';

import apis from '../../Library/Apis';

function Activity({data, getCard, putActivity, deleteActivity, detail}) {
function Activity({data, getCard, putActivity, isComment, deleteActivity, detail}) {

const inputRef = useRef();

Expand Down
59 changes: 23 additions & 36 deletions src/Components/CardModal/CardModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,10 @@ function CardModal({
setDescription({ ...description, text: response.data.description });
})
.catch(function (error) {
if (error.response) {
console.log(
"요청이 이루어졌으며 서버가 2xx의 범위를 벗어나는 상태 코드로 응답했습니다."
);
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
} else if (error.request) {
console.log("요청이 이루어 졌으나 응답을 받지 못했습니다.");
// `error.request`는 브라우저의 XMLHttpRequest 인스턴스 또는
// Node.js의 http.ClientRequest 인스턴스입니다.
console.log(error.request);
} else {
console.log(
"오류를 발생시킨 요청을 설정하는 중에 문제가 발생했습니다."
);
console.log("Error", error.message);
}
console.log(error.config);
});
}
console.log(error);
}
)};


useEffect(() => {
getCard();
Expand Down Expand Up @@ -94,6 +77,8 @@ function CardModal({
//댓글 달고 저장하기
const saveComment = () => {
postActivity(String(card_id), comment);
setButton({display: false, green: false});
setComment("");
};

//해당 카드 지우기
Expand Down Expand Up @@ -143,7 +128,8 @@ function CardModal({
});
const saveDescription = () => {
setDescription({...description, edit: false});
putCard({ cId: card_id, description: description.content })
putCard({ cId: card_id, description: description['text'] });
console.log(description.['text']);
}

// 멤버 추가하기
Expand Down Expand Up @@ -186,7 +172,8 @@ function CardModal({
};
//"Thu Jan 14 2021 00:00:00 GMT+0900 (대한민국 표준시)00:30"

const activities = useRef();
const activityy = useRef();
console.log(description);

return (
<div
Expand Down Expand Up @@ -234,8 +221,7 @@ function CardModal({
<button
style={{ float: "right", display: "inline-block", width: 25 }}
className="card-modal-x"
id="exit"
>
id="exit">
×
</button>
</div>
Expand All @@ -248,7 +234,7 @@ function CardModal({
<div id="card-modal-bottom">
<div id="card-modal-left" style={{ maxHeight: 550, overflowY: 'auto' }}>
<p className="title">Description</p>
{description.edit
{description['edit']

? (
<div style={{height: 100}}><textarea
Expand All @@ -257,13 +243,13 @@ function CardModal({
marginLeft: 5,
borderRadius: 5,
outline: "none",
cols: '4900px',
width: 460,

border: "1px solid lightgray",
marginRight: 5,
padding: 5
}}
value={description.content}
value={description['text']}
onChange={(e) =>
setDescription({
...description,
Expand Down Expand Up @@ -291,22 +277,22 @@ function CardModal({
</div>
)

: (!(description === undefined || description['content'] === undefined || description['content' === ""]))
: (!(description === undefined || description['text'] === undefined || description['text'] === "" || description['text'] === null))

? (
<div onClick={() => setDescription({...description, edit: true})} style={{width: 485, marginBottom: 10, marginTop: 10, height: 'fit-content'}}>
<ReactMarkdown id="Markdown" style={{height: 'fit-content', background: 'pink'}}>
{description['content']}
{description['text']}
</ReactMarkdown>
</div> )
: (
<button
style={{width: 485, textAlign: 'left', height: 50, paddingLeft: 10, marginLeft: 5, paddingTop: 0}}
<><button
style={{width: 480, textAlign: 'left', height: 50, padding: 25, alignItems: 'center', marginLeft: 5,}}
onClick={() => setDescription({ ...description, edit: true })}
id="card-modal-add-descrip"
>
Add a more detailed description...
</button>
</button></>
)}

<div style={{ display: "flex", flexDirection: 'row'}}>
Expand All @@ -315,9 +301,9 @@ function CardModal({
</p>
<button id="card-modal-detail"
onClick={(e) => setDetail(!detail)}
style={{width: 100, position: 'relative', left: 324, top: 10}}>{detail? "Hide Details" : "Show Details"}</button>
style={{width: 100, position: 'relative', left: 322, top: 10}}>{detail? "Hide Details" : "Show Details"}</button>
</div>
<div ref={activities} id="card-modal-activities" style={{marginTop: 20}}>
<div ref={activityy} iyd="card-modal-activities" style={{marginTop: 20}}>
<div style={{display: 'flex', flexDirection: 'row'}}>
<img
style={{
Expand Down Expand Up @@ -383,9 +369,10 @@ function CardModal({
.reverse()
.map((data, index) => (
<Activity
data={data}
data={Object.assign(data)}
getCard={getCard}
key={index}
isComment={data.is_comment}
postActivity={postActivity}
putActivity={putActivity}
deleteActivity={deleteActivity}
Expand Down