Skip to content

Commit

Permalink
fix question ui bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gamer-1478 committed Apr 4, 2022
1 parent 4fcc99b commit ccb174d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .slugignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./react-app
./.test.env
4 changes: 0 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ app.use(session({
secret: process.env.SECRET,
resave: true,
saveUninitialized: true,
sameSite: 'none',
overwrite: true,
secure: false,
maxAge: 1000 * 60 * 60 * 24 * 7
}));
}

Expand Down
44 changes: 30 additions & 14 deletions react-app/src/Pages/Question/Question.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,42 @@ function Question() {
}

function showProblem() {
if (loadedv === true) {
document.getElementById('question-container').style.display = 'flex';
}
let interval = setInterval(() => {
if (loadedv === true) {
document.getElementById('question-container').style.display = 'flex';
clearInterval(interval);
}
}, 100)
}

function hideProblem() {
if (loadedv === true) {
document.getElementById('question-container').style.display = 'none';
}
let interval = setInterval(() => {
if (loadedv === true) {
document.getElementById('question-container').style.display = 'none';
clearInterval(interval);
}
}, 100);

}

function showSubmission() {
if (loadedv === true && document.getElementById('submissions-container') !== null) {
document.getElementById('submissions-container').style.display = 'flex';
}
let interval = setInterval(() => {
if (loadedv === true && document.getElementById('submissions-container') !== null) {
document.getElementById('submissions-container').style.display = 'flex';
clearInterval(interval);
}

}, 100);

}

function hideSubmission() {
if (loadedv === true && document.getElementById('submissions-container') !== null) {
document.getElementById('submissions-container').style.display = 'none';
}
let interval = setInterval(() => {
if (loadedv === true && document.getElementById('submissions-container') !== null) {
document.getElementById('submissions-container').style.display = 'none';
clearInterval(interval);
}
}, 100);
}

function verifyLogged(redirect) {
Expand Down Expand Up @@ -228,14 +244,14 @@ function Question() {
<ul className='question-nav-menu'>
<li className='question-nav-item'>
<Link
to={`/question/${questionid}/Problem`} className='question-nav-links' onClick={()=>{ showProblem(); hideSubmission();}}>
to={`/question/${questionid}/Problem`} className='question-nav-links' onClick={() => { showProblem(); hideSubmission(); }}>
Problem
</Link>
</li >
{logged ? (
<li className='question-nav-item'>
<Link
to={`/question/${questionid}/Submissions`} className='question-nav-links' onClick={() => {hideProblem(); showSubmission()}}>
to={`/question/${questionid}/Submissions`} className='question-nav-links' onClick={() => { hideProblem(); showSubmission() }}>
Submissions
</Link>
</li>
Expand Down

0 comments on commit ccb174d

Please sign in to comment.