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

Zak branch3 #35

Merged
merged 3 commits into from
Sep 14, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ const ReadyQuestionPaperDashboard = () => {
</div>
</div>
))}

<center>
<button
className="question_submit-button"
>
Submit
</button>
</center>
</div>
</>) : (<>
<div className="no-questions-container">
Expand Down
8 changes: 5 additions & 3 deletions src/edit_question/EditQuestion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const EditQuestion = () => {
const [questionDescription, setQuestionDescription] = useState(location.state.questionDescription);
const [compilerReq, setCompilerReq] = useState(location.state.compilerReq);
const [marks, setMarks] = useState(location.state.marks);
const [image, setImage] = useState(null);
const [image, setImage] = useState(location.state.image);
const [loading, setLoading] = useState(false);
const [loadingSpinner,setLoadingSpinner] = useState(true);
const [modalIsOpen, setModalIsOpen] = useState(false);
Expand Down Expand Up @@ -176,8 +176,10 @@ const EditQuestion = () => {
<input {...getInputProps()} />
{image ? (
<div className="add_question_image_preview">
<img src={URL.createObjectURL(image)} alt="Question" className="add_question_preview_image" />
<FaTimes className="add_question_remove_image_icon" onClick={handleRemoveImage} />
<img src={image ? typeof image === 'string'
? image: URL.createObjectURL(image):
URL.createObjectURL(image)} alt="Question" className="add_question_preview_image" />
<FaTimes className="add_question_remove_image_icon" onClick={(e)=>{e.stopPropagation();handleRemoveImage()}} />
</div>
) : (
<p>
Expand Down
17 changes: 10 additions & 7 deletions src/edit_ready_question/EditReadyQuestion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const EditReadyQuestion = () => {
const [questionDescription, setQuestionDescription] = useState(location.state.questionDescription);
const [compilerReq, setCompilerReq] = useState(location.state.compilerReq);
const [marks, setMarks] = useState(location.state.marks);
const [image, setImage] = useState(null);
const [image, setImage] = useState(location.state.image);
const [loading, setLoading] = useState(false);
const [loadingSpinner,setLoadingSpinner] = useState(true);
const [modalIsOpen, setModalIsOpen] = useState(false);
Expand All @@ -27,7 +27,7 @@ const EditReadyQuestion = () => {
const navigate = useNavigate();

useEffect(()=>{setTimeout(()=>{setLoadingSpinner(false)},1000);},[]);

console.log(location.state);
const handleEditQuestion = async () => {
if (!questionheading || !questionDescription || !compilerReq || !marks) {
setModalMessage('Please fill in all the required fields.');
Expand Down Expand Up @@ -108,7 +108,7 @@ const EditReadyQuestion = () => {
onDrop,
maxSize: 10485760, // 10MB limit
});
console.log(paperId);
console.log(image);
return (
<>
<Navbar />
Expand Down Expand Up @@ -162,10 +162,11 @@ console.log(paperId);
<input
type="number"
value={marks}
onChange={(e) => setMarks(e.target.value)}
onChange={() => setMarks(marks)}
placeholder="Enter marks"
required
className="add_question_input"
disabled
/>
</div>
</div>
Expand All @@ -176,9 +177,11 @@ console.log(paperId);
<input {...getInputProps()} />
{image ? (
<div className="add_question_image_preview">
<img src={URL.createObjectURL(image)} alt="Question" className="add_question_preview_image" />
<FaTimes className="add_question_remove_image_icon" onClick={handleRemoveImage} />
</div>
<img src={image ? typeof image === 'string'
? image: URL.createObjectURL(image):
URL.createObjectURL(image)} alt="Question" className="add_question_preview_image" />
<FaTimes className="add_question_remove_image_icon" onClick={(e)=>{e.stopPropagation();handleRemoveImage()}} />
</div>
) : (
<p>
<div className='add_question_cloudicon'>
Expand Down
Loading