Commit f1765bc1 authored by Jorgen's avatar Jorgen

Make typo list scrollable. Improve styles.

parent 9594acdc
</div> </div>
</div> </div>
<div class="footer bg-primary"> <div class="footer">
<span class="text-white copyright">Копирайт (С) 2018 "Этерсофт"</span> <span class="copyright">Копирайт (С) 2018 "Этерсофт"</span>
</div> </div>
</body> </body>
......
<div id="root" class="body border border-light"> <div id="root" class="body border border-white">
</div> </div>
\ No newline at end of file
...@@ -96,16 +96,16 @@ export default class Typo extends Component { ...@@ -96,16 +96,16 @@ export default class Typo extends Component {
if (show) { if (show) {
console.log("Render typo #" + typo.id); console.log("Render typo #" + typo.id);
} else { } else {
console.log("Render hidden typo #" + typo.id); return null;
} }
if (!this.state.textHighlighted) { if (!this.state.textHighlighted) {
this._highlightTypoInContext(); this._highlightTypoInContext();
this.state.textHighlighted = true; this.state.textHighlighted = true;
} }
return ( return (
<Card className={className}> <Card id={`typo-${typo.id}`} className={className}>
<CardHeader> <CardHeader>
Опечатка #{typo.id} Опечатка #{typo.id}
<span id="typo-id"> <span id="typo-id">
...@@ -144,11 +144,25 @@ export default class Typo extends Component { ...@@ -144,11 +144,25 @@ export default class Typo extends Component {
); );
} }
/**
* Hides typo card
*/
hideTypoCard(completeFunc) {
$(`#typo-${this.typo.id}`).animate({
marginLeft: "3000px",
opacity: 0
}, 500, completeFunc);
}
applyCorrection = () => { applyCorrection = () => {
this.acceptCallback(this.typo.correctedText); this.hideTypoCard(() => {
this.acceptCallback(this.typo.correctedText);
});
}; };
declineCorrection = () => { declineCorrection = () => {
this.declineCallback(); this.hideTypoCard(() => {
this.declineCallback();
});
}; };
} }
\ No newline at end of file
.TypoCard { .TypoCard {
width: 80%; width: 80%;
margin: 0 auto; margin: 0 auto;
margin-bottom: 25px;
} }
.TypoCard .card-body { .TypoCard .card-body {
......
...@@ -13,8 +13,8 @@ const alertify = require("alertify.js"); ...@@ -13,8 +13,8 @@ const alertify = require("alertify.js");
export default class TypoList extends Component { export default class TypoList extends Component {
state = { state = {
currentTypo: 0,
siteId: 0, siteId: 0,
resolvedTypos: []
}; };
/** /**
...@@ -31,7 +31,7 @@ export default class TypoList extends Component { ...@@ -31,7 +31,7 @@ export default class TypoList extends Component {
alertify.success(`<p>Опечатка ${typoId} была подтверждена.</p> alertify.success(`<p>Опечатка ${typoId} была подтверждена.</p>
<p>Исправления применены к тексту, содержащему опечатку.</p>`); <p>Исправления применены к тексту, содержащему опечатку.</p>`);
this.state.currentTypo++; this.state.resolvedTypos.push(typoId)
this._decrementSiteTyposCount(); this._decrementSiteTyposCount();
this.forceUpdate(); this.forceUpdate();
return; return;
...@@ -54,7 +54,8 @@ export default class TypoList extends Component { ...@@ -54,7 +54,8 @@ export default class TypoList extends Component {
this._setTypoStatus(0, typoId, this.state.siteId) this._setTypoStatus(0, typoId, this.state.siteId)
.done(() => { .done(() => {
alertify.success(`Опечатка ${typoId} была отклонена`); alertify.success(`Опечатка ${typoId} была отклонена`);
this.state.currentTypo++;
this.state.resolvedTypos.push(typoId)
this._decrementSiteTyposCount(); this._decrementSiteTyposCount();
this.forceUpdate(); this.forceUpdate();
}) })
...@@ -112,13 +113,13 @@ export default class TypoList extends Component { ...@@ -112,13 +113,13 @@ export default class TypoList extends Component {
console.log("Render typolist for site " + this.state.siteId); console.log("Render typolist for site " + this.state.siteId);
if (typos.length === 0 || this.state.currentTypo >= typos.length) { if (typos.length === 0 || this.state.resolvedTypos.length >= typos.length) {
return TypoList._displayEmptyMessage(); return TypoList._displayEmptyMessage();
} }
const typoCards = typos.map((typo, index) => const typoCards = typos.map((typo, index) =>
<Typo key={typo.id} typo={typo} <Typo key={typo.id} typo={typo}
show={this.state.currentTypo === index} show={!this.state.resolvedTypos.includes(typo.id)}
acceptCallback={this.acceptCorrection.bind(this, typo.id)} acceptCallback={this.acceptCorrection.bind(this, typo.id)}
declineCallback={this.declineCorrection.bind(this, typo.id)}/> declineCallback={this.declineCorrection.bind(this, typo.id)}/>
); );
......
...@@ -26,7 +26,8 @@ body { ...@@ -26,7 +26,8 @@ body {
} }
.footer { .footer {
position: absolute; color: black;
position: fixed;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
text-align: center; text-align: center;
...@@ -34,6 +35,8 @@ body { ...@@ -34,6 +35,8 @@ body {
.footer .copyright { .footer .copyright {
font-size: 80%; font-size: 80%;
float: right;
margin-right: 10px;
} }
.typo { .typo {
...@@ -59,9 +62,14 @@ li.nav-item { ...@@ -59,9 +62,14 @@ li.nav-item {
border-radius: 0 !important; border-radius: 0 !important;
} }
li.nav-item:hover { li.nav-item > a.nav-link {
border-bottom: 1px solid #007bff; transition-property: background-color;
border-radius: 0 !important; transition-duration: 0.8s;
}
li.nav-item > a.nav-link:hover {
background-color: #ffd556;
border-radius: 0.25em;
} }
a.nav-link.active { a.nav-link.active {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment