Skip to content
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"firebase": "^9.12.1",
"formik": "^2.2.9",
"framer-motion": "^7.6.7",
"jquery": "^3.7.1",
"next": "^14.0.4",
"next-themes": "^0.2.0",
"react": "^18.2.0",
Expand Down
69 changes: 42 additions & 27 deletions public/assets/scss/components/_writing-evaluation-form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,45 +35,60 @@
.hovertextp {
position: relative;
display: inline-block;
}

.hovertextp .hovertext:before {
content: "Feedback: " attr(data-hover);
visibility: hidden;
background-color: rgba(0, 0, 0, 0.8);
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0; /* Position the tooltip */
position: absolute;
display: block;
z-index: 9999;
top: auto; /* Reset the top property */
overflow: visible;
width: max-content;
max-width: 200px;
}
.hovertext {
&:before {
content: "Feedback: " attr(data-hover);
visibility: hidden;
background-color: rgba(0, 0, 0, 0.8);
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0; /* Position the tooltip */
position: absolute;
display: block;
z-index: 9999;
top: auto; /* Reset the top property */
overflow: visible;
width: max-content;
max-width: 200px;
}

.hovertextp .hovertext:hover:before {
opacity: 1;
visibility: visible;
&:hover:before {
opacity: 1;
visibility: visible;
}
}
}


.nopaque {
opacity: 0.2;
}

.opaque {
opacity: 1.0;
background: #fff;
}


.waf-menu.waf-menu {

li {
padding-top: 10px;

&:after {
content: '';
}

&:hover {
background-color: #f0f0f0;
}

li {
padding-top: 0;
margin-top: 0;
}
}

a {
Expand All @@ -82,10 +97,15 @@
padding: 5px;
}

.waf-submenu {
ul {
display: none;
list-style-type: none;
padding: 0 0 20px 20px;
padding: 0 0 15px;
margin: 0;

ul {
padding: 0 0 5px;
}

&.active {
display: block;
Expand All @@ -94,11 +114,6 @@
}



.sentences {
display: none;
}

.waf-textarea {
textarea {
background: #f5f4f4;
Expand Down
58 changes: 43 additions & 15 deletions src/components/forms/writing-evaluation-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const WritingEvaluationForm = () => {
body: JSON.stringify({
essay,
task,
demo: true
// demo: true
})
});
if (!response.ok) throw new Error(response.statusText);
Expand All @@ -36,13 +36,6 @@ const WritingEvaluationForm = () => {
setResponse(item.passage_html + item.indicator_html);
setLoading(false);

// } catch (error) {
// console.error(error);
// setError(error.message);
// } finally {
// setLoading(false);
// }

}

const toggleSubmenu = (e) => {
Expand All @@ -53,11 +46,43 @@ const WritingEvaluationForm = () => {
el = el.parentNode;
}
if (el && el.tagName === "A") {
// ...do your state change...

console.log(el.nextSibling.classList.toggle('active'));
/**
* Show the UL next to the A tag
*/
let siblingUl = el.nextSibling;
if (siblingUl) {

el.nextSibling.classList.toggle('active');


/**
* Show the sentences for the current A tag
*/
if (el.classList.contains('waf-trigger-level1')) {

let triggers = siblingUl.querySelectorAll('a.waf-trigger-sentence'),
targets = document.querySelectorAll(`.content-box.hovertextp span`);


triggers.forEach((trigger) => {

trigger.addEventListener('click', (e) => {
e.preventDefault();

targets.forEach((target) => {
target.classList.remove('opaque');
});

let target = document.querySelector(`.content-box.hovertextp span.${trigger.dataset.sentence}`);
target.classList.add('opaque');

console.log(target)
})

});
}
}
}
}

Expand Down Expand Up @@ -89,7 +114,10 @@ const WritingEvaluationForm = () => {
data-gramm="false"
data-gramm_editor="false"
data-enable-grammarly="false"
spellcheck="false"
spellCheck="false"
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
/>
</div>

Expand All @@ -104,10 +132,10 @@ const WritingEvaluationForm = () => {
data-gramm="false"
data-gramm_editor="false"
data-enable-grammarly="false"
spellcheck="false"
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellCheck="false"
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
/>
</div>

Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3774,6 +3774,11 @@ iterator.prototype@^1.1.2:
reflect.getprototypeof "^1.0.4"
set-function-name "^2.0.1"

jquery@^3.7.1:
version "3.7.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.7.1.tgz#083ef98927c9a6a74d05a6af02806566d16274de"
integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==

"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz"
Expand Down