Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
survey
Commits
b430d9e4
Commit
b430d9e4
authored
Jul 27, 2022
by
Jiwon Yoon
Browse files
Merge branch 'jiwon0727' into develop0727
parents
e5778631
91ca8892
Changes
13
Show whitespace changes
Inline
Side-by-side
frontend/src/App.tsx
View file @
b430d9e4
import
React
from
"
react
"
;
import
React
from
"
react
"
;
import
{
Outlet
}
from
"
react-router-dom
"
;
import
{
Outlet
}
from
"
react-router-dom
"
;
import
{
AuthProvider
}
from
"
./auth/auth.context
"
;
import
{
AuthProvider
}
from
"
./auth/auth.context
"
;
import
{
Header
}
from
"
./commons
"
;
import
{
Footer
,
Header
}
from
"
./commons
"
;
const
App
=
()
=>
(
const
App
=
()
=>
(
<
AuthProvider
>
<
AuthProvider
>
<
Header
/>
<
Header
/>
<
div
style
=
{
{
minHeight
:
"
80vh
"
}
}
>
<
Outlet
/>
<
Outlet
/>
</
div
>
<
Footer
/>
</
AuthProvider
>
</
AuthProvider
>
);
);
...
...
frontend/src/answers/ACheckboxForm.tsx
View file @
b430d9e4
...
@@ -33,9 +33,9 @@ export const ACheckboxForm = ({ element, answerQuestion }: Props) => {
...
@@ -33,9 +33,9 @@ export const ACheckboxForm = ({ element, answerQuestion }: Props) => {
console
.
log
(
answerQuestion
);
console
.
log
(
answerQuestion
);
};
};
return
(
return
(
<
div
className
=
"flex w-full gap-2 justify-
around
my-3"
>
<
div
className
=
"flex w-full gap-2 justify-
center
my-3"
>
{
element
.
content
.
choices
.
map
((
choice
)
=>
(
{
element
.
content
.
choices
.
map
((
choice
)
=>
(
<
div
key
=
{
choice
.
value
}
>
<
div
key
=
{
choice
.
value
}
className
=
"mx-2"
>
<
input
<
input
className
=
"mr-2 w-4 h-4"
className
=
"mr-2 w-4 h-4"
type
=
"checkbox"
type
=
"checkbox"
...
...
frontend/src/answers/ARadioForm.tsx
View file @
b430d9e4
...
@@ -20,9 +20,9 @@ export const ARadioForm = ({ element, answerQuestion }: Props) => {
...
@@ -20,9 +20,9 @@ export const ARadioForm = ({ element, answerQuestion }: Props) => {
console
.
log
(
answerQuestion
);
console
.
log
(
answerQuestion
);
};
};
return
(
return
(
<
div
className
=
"flex w-full gap-2 justify-
around
my-3"
>
<
div
className
=
"flex w-full gap-2 justify-
center
my-3"
>
{
element
.
content
.
choices
.
map
((
choice
)
=>
(
{
element
.
content
.
choices
.
map
((
choice
)
=>
(
<
div
key
=
{
choice
.
value
}
>
<
div
key
=
{
choice
.
value
}
className
=
"mx-2"
>
<
input
<
input
className
=
"mr-2"
className
=
"mr-2"
type
=
"radio"
type
=
"radio"
...
...
frontend/src/answers/ARatingForm.tsx
View file @
b430d9e4
...
@@ -23,7 +23,7 @@ export const ARatingForm = ({ element, answerQuestion }: Props) => {
...
@@ -23,7 +23,7 @@ export const ARatingForm = ({ element, answerQuestion }: Props) => {
console
.
log
(
answerQuestion
);
console
.
log
(
answerQuestion
);
}
}
return
(
return
(
<
div
className
=
"flex w-full justify-
items-
center my-3 overflow-x-
scroll
"
>
<
div
className
=
"flex w-full justify-center my-3 overflow-x-
auto
"
>
<
label
className
=
"mt-3"
>
{
element
.
content
.
minRateDescription
}
</
label
>
<
label
className
=
"mt-3"
>
{
element
.
content
.
minRateDescription
}
</
label
>
{
element
.
content
.
choices
.
map
((
choice
)
=>
(
{
element
.
content
.
choices
.
map
((
choice
)
=>
(
<
div
className
=
"flex gap-4 mx-1"
key
=
{
choice
.
value
}
>
<
div
className
=
"flex gap-4 mx-1"
key
=
{
choice
.
value
}
>
...
...
frontend/src/answers/AnswerSurveyForm.tsx
View file @
b430d9e4
...
@@ -89,7 +89,7 @@ export const AnswerSurveyForm = () => {
...
@@ -89,7 +89,7 @@ export const AnswerSurveyForm = () => {
const
newAnswer
:
AnswerType
=
await
answerApi
.
saveAnswers
(
formData
);
const
newAnswer
:
AnswerType
=
await
answerApi
.
saveAnswers
(
formData
);
console
.
log
(
newAnswer
);
console
.
log
(
newAnswer
);
sessionStorage
.
setItem
(
`survey_
${
surveyId
}
`
,
surveyId
??
""
);
sessionStorage
.
setItem
(
`survey_
${
surveyId
}
`
,
surveyId
??
""
);
navigate
(
"
/survey/complete
"
);
navigate
(
"
/survey/complete
"
,
{
replace
:
false
}
);
setSuccess
(
true
);
setSuccess
(
true
);
setError
(
""
);
setError
(
""
);
...
...
frontend/src/auth/Login.tsx
View file @
b430d9e4
...
@@ -36,7 +36,7 @@ export const Login = () => {
...
@@ -36,7 +36,7 @@ export const Login = () => {
}
}
return
(
return
(
<
div
className
=
"flex flex-col items-center
mt-5
"
>
<
div
className
=
"flex flex-col items-center"
>
<
div
className
=
"text-2xl mt-20"
>
로그인
</
div
>
<
div
className
=
"text-2xl mt-20"
>
로그인
</
div
>
<
form
onSubmit
=
{
handleSubmit
}
className
=
"flex flex-col mt-3 w-80"
>
<
form
onSubmit
=
{
handleSubmit
}
className
=
"flex flex-col mt-3 w-80"
>
<
label
className
=
"block text-gray-700 text-sm font-bold mb-2 mt-3"
>
<
label
className
=
"block text-gray-700 text-sm font-bold mb-2 mt-3"
>
...
@@ -65,11 +65,11 @@ export const Login = () => {
...
@@ -65,11 +65,11 @@ export const Login = () => {
value
=
{
loginData
.
password
}
value
=
{
loginData
.
password
}
/>
/>
{
error
&&
(
{
error
&&
(
<
div
className
=
"text-red-500 text-sm m
b-6
"
>
<
div
className
=
"text-red-500 text-sm m
t-3
"
>
<
p
>
{
error
}
</
p
>
<
p
>
{
error
}
</
p
>
</
div
>
</
div
>
)
}
)
}
<
div
className
=
"text-center"
>
<
div
className
=
"text-center
mt-3
"
>
<
button
<
button
type
=
"submit"
type
=
"submit"
disabled
=
{
loading
?
true
:
false
}
disabled
=
{
loading
?
true
:
false
}
...
...
frontend/src/auth/SignUp.tsx
View file @
b430d9e4
...
@@ -67,8 +67,8 @@ export const SignUp = () => {
...
@@ -67,8 +67,8 @@ export const SignUp = () => {
}
}
return
(
return
(
<
div
className
=
"flex flex-col items-center
mt-5
"
>
<
div
className
=
"flex flex-col items-center"
>
<
div
className
=
"text-2xl mt-
2
0"
>
회원가입
</
div
>
<
div
className
=
"text-2xl mt-
1
0"
>
회원가입
</
div
>
<
form
onSubmit
=
{
handleSubmit
}
className
=
"flex flex-col mt-3 w-80"
>
<
form
onSubmit
=
{
handleSubmit
}
className
=
"flex flex-col mt-3 w-80"
>
<
label
className
=
"block text-gray-700 text-sm font-bold mb-2 mt-3"
>
<
label
className
=
"block text-gray-700 text-sm font-bold mb-2 mt-3"
>
이름
이름
...
@@ -125,7 +125,7 @@ export const SignUp = () => {
...
@@ -125,7 +125,7 @@ export const SignUp = () => {
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
/>
/>
{
error
&&
(
{
error
&&
(
<
div
className
=
"text-red-500 text-sm"
>
<
div
className
=
"text-red-500 text-sm
mt-3
"
>
<
p
>
{
error
}
</
p
>
<
p
>
{
error
}
</
p
>
</
div
>
</
div
>
)
}
)
}
...
...
frontend/src/commons/Footer.tsx
0 → 100644
View file @
b430d9e4
import
React
from
"
react
"
;
export
const
Footer
=
()
=>
{
return
(
<
div
className
=
"flex justify-center mt-5 py-1 bg-gray-100"
>
<
p
className
=
"text-gray-500 text-sm"
>
Copyright © 2022 Simple Survey Form. All rights reserved.
</
p
>
</
div
>
);
};
frontend/src/commons/index.tsx
View file @
b430d9e4
export
{
Header
}
from
"
./Header
"
;
export
{
Header
}
from
"
./Header
"
;
export
{
Footer
}
from
"
./Footer
"
;
export
{
QUESTION_TYPES
}
from
"
./constants
"
;
export
{
QUESTION_TYPES
}
from
"
./constants
"
;
frontend/src/home/Home.tsx
View file @
b430d9e4
...
@@ -32,7 +32,7 @@ export const Home = () => {
...
@@ -32,7 +32,7 @@ export const Home = () => {
</
div
>
</
div
>
<
p
className
=
"text-center text-xl text-black mt-3"
>
Create now!
</
p
>
<
p
className
=
"text-center text-xl text-black mt-3"
>
Create now!
</
p
>
</
div
>
</
div
>
<
div
className
=
"flex justify-center"
>
<
div
className
=
"flex justify-center
mt-3
"
>
<
img
src
=
{
SurveyImg
}
className
=
"object-scale-down justify-center"
/>
<
img
src
=
{
SurveyImg
}
className
=
"object-scale-down justify-center"
/>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
frontend/src/profile/MySurveyCard.tsx
View file @
b430d9e4
...
@@ -28,11 +28,13 @@ export const MySurveyCard = ({ data }: Props) => {
...
@@ -28,11 +28,13 @@ export const MySurveyCard = ({ data }: Props) => {
};
};
async
function
deleteSurvey
()
{
async
function
deleteSurvey
()
{
if
(
window
.
confirm
(
"
해당 설문조사를 삭제하시겠습니까?
"
))
{
try
{
try
{
if
(
data
.
_id
)
{
if
(
data
.
_id
)
{
const
survey
=
await
surveyApi
.
deleteSurvey
(
data
.
_id
);
const
survey
=
await
surveyApi
.
deleteSurvey
(
data
.
_id
);
setSuccess
(
true
);
setSuccess
(
true
);
setError
(
""
);
setError
(
""
);
alert
(
"
삭제되었습니다.
"
);
location
.
reload
();
location
.
reload
();
}
else
{
}
else
{
setLoading
(
true
);
setLoading
(
true
);
...
@@ -43,17 +45,20 @@ export const MySurveyCard = ({ data }: Props) => {
...
@@ -43,17 +45,20 @@ export const MySurveyCard = ({ data }: Props) => {
}
finally
{
}
finally
{
setLoading
(
false
);
setLoading
(
false
);
}
}
}
else
{
alert
(
"
삭제를 취소합니다.
"
);
}
}
}
return
(
return
(
<
div
className
=
"w-40 h-48 md:w-52 md:h-60 rounded border-2 hover:border-2 hover:border-themeColor"
>
<
div
className
=
"w-40 h-48 md:w-52 md:h-60 rounded border-2 hover:border-2 hover:border-themeColor"
>
<
button
className
=
"w-full"
onClick
=
{
editSurvey
}
>
<
button
className
=
"w-full
mt-2
"
onClick
=
{
editSurvey
}
>
<
p
className
=
"font-bold"
>
<
p
className
=
"font-bold"
>
{
data
.
title
?
data
.
title
:
"
제목없는 설문조사
"
}
{
data
.
title
?
data
.
title
:
"
제목없는 설문조사
"
}
</
p
>
</
p
>
<
div
className
=
"h-24 md:h-36 p-3
text-ellipsis
overflow-y-
scroll
"
>
<
div
className
=
"h-24 md:h-36 p-3
overflow-y-hidden hover:
overflow-y-
auto
"
>
<
p
className
=
"text-gray-700"
>
<
p
className
=
"text-gray-700
text-justify
"
>
{
data
.
comment
?
data
.
comment
:
"
설명없는 설문조사
"
}
{
data
.
comment
?
data
.
comment
:
"
설명없는 설문조사
"
}
</
p
>
</
p
>
</
div
>
</
div
>
...
...
frontend/src/questions/Question.tsx
View file @
b430d9e4
...
@@ -54,12 +54,8 @@ Props) => {
...
@@ -54,12 +54,8 @@ Props) => {
selectedType
===
"
dropdown
"
||
selectedType
===
"
dropdown
"
||
selectedType
===
"
checkbox
"
selectedType
===
"
checkbox
"
)
{
)
{
content
=
{
element
.
content
=
{
choices
:
[
choices
:
[{
text
:
""
,
value
:
0
}],
{
text
:
""
,
value
:
0
},
{
text
:
""
,
value
:
1
},
{
text
:
""
,
value
:
2
},
],
};
};
}
else
if
(
selectedType
===
"
essay
"
)
{
}
else
if
(
selectedType
===
"
essay
"
)
{
content
=
{
choices
:
[]
};
content
=
{
choices
:
[]
};
...
@@ -67,11 +63,7 @@ Props) => {
...
@@ -67,11 +63,7 @@ Props) => {
content
=
{
content
=
{
minRateDescription
:
""
,
minRateDescription
:
""
,
maxRateDescription
:
""
,
maxRateDescription
:
""
,
choices
:
[
choices
:
[{
text
:
""
,
value
:
0
}],
{
text
:
""
,
value
:
0
},
{
text
:
""
,
value
:
1
},
{
text
:
""
,
value
:
2
},
],
};
};
}
}
// question.type = selectedType;
// question.type = selectedType;
...
@@ -151,7 +143,12 @@ Props) => {
...
@@ -151,7 +143,12 @@ Props) => {
};
};
const
handleDelete
=
()
=>
{
const
handleDelete
=
()
=>
{
deleteQuestion
(
question
.
_id
);
if
(
window
.
confirm
(
"
질문을 삭제하시겠습니까?
"
))
{
deleteQuestion
(
element
.
_id
);
alert
(
"
삭제되었습니다.
"
);
}
else
{
alert
(
"
질문 삭제를 취소합니다.
"
);
}
};
};
const
handleEditClick
=
()
=>
{
const
handleEditClick
=
()
=>
{
...
...
frontend/src/questions/RatingForm.tsx
View file @
b430d9e4
...
@@ -38,11 +38,11 @@ export const RatingForm = ({ element, handleQuestion, save }: Props) => {
...
@@ -38,11 +38,11 @@ export const RatingForm = ({ element, handleQuestion, save }: Props) => {
return
(
return
(
<>
<>
<
div
className
=
"flex place-content-
between
items-center w-full p-5 overflow-x-
scroll
"
>
<
div
className
=
"flex place-content-
center
items-center w-full p-5 overflow-x-
auto
"
>
<
input
<
input
name
=
"minRateDescription"
name
=
"minRateDescription"
className
=
"border-b-2 text-center"
className
=
"border-b-2 text-center"
size
=
{
3
}
size
=
{
5
}
placeholder
=
"비동의"
placeholder
=
"비동의"
value
=
{
element
.
content
.
minRateDescription
}
value
=
{
element
.
content
.
minRateDescription
}
onChange
=
{
handleContent
}
onChange
=
{
handleContent
}
...
@@ -65,7 +65,7 @@ export const RatingForm = ({ element, handleQuestion, save }: Props) => {
...
@@ -65,7 +65,7 @@ export const RatingForm = ({ element, handleQuestion, save }: Props) => {
<
input
<
input
name
=
"maxRateDescription"
name
=
"maxRateDescription"
className
=
"border-b-2 text-center"
className
=
"border-b-2 text-center"
size
=
{
3
}
size
=
{
5
}
placeholder
=
"동의"
placeholder
=
"동의"
value
=
{
element
.
content
.
maxRateDescription
}
value
=
{
element
.
content
.
maxRateDescription
}
onChange
=
{
handleContent
}
onChange
=
{
handleContent
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment