Skip to content

Commit

Permalink
add warnings when archiving unfinished section
Browse files Browse the repository at this point in the history
  • Loading branch information
ChlodAlejandro committed Oct 31, 2022
1 parent 0052eb9 commit 5f97f34
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions i18n/core/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"deputy.session.section.close": "Archive section",
"deputy.session.section.closeComments": "Archiving comments",
"deputy.session.section.closeHelp": "Your signature will automatically be included.",
"deputy.session.section.closeWarning": "Some revisions remain unassessed. You may want to mark these revisions as assessed before archiving this section.",
"deputy.session.section.closeWarn": "You have unsaved changes. Close the section without saving?",

"deputy.session.section.stop": "Stop session",
Expand Down
4 changes: 4 additions & 0 deletions src/css/deputy.css
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ body.mediawiki.rtl .dp-cs-row-head > :not(:first-child):not(:last-child) {
margin-bottom: 8px;
}

.dp-cs-section-unfinishedWarning {
margin-top: 8px;
}

.dp-cs-row-closeComments {
font-family: monospace, monospace;
font-size: small;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/root/DeputyContributionSurveyRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ export default class DeputyContributionSurveyRow implements DeputyUIElement {

this.unfinishedMessageBox = new OO.ui.MessageWidget( {
classes: [ 'dp-cs-row-unfinishedWarning' ],
type: 'warn',
type: 'warning',
label: mw.msg( 'deputy.session.row.unfinishedWarning' )
} );
this.unfinishedMessageBox.toggle( false );
Expand Down
10 changes: 10 additions & 0 deletions src/ui/root/DeputyContributionSurveySection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
ContributionSurveyRowSigningBehavior
} from '../../models/ContributionSurveyRowSigningBehavior';
import { generateTrace } from '../../models/DeputyTrace';
import DeputyMessageWidget from '../shared/DeputyMessageWidget';

/**
* The contribution survey section UI element. This includes a list of revisions
Expand Down Expand Up @@ -519,6 +520,13 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
this.setDisabled( false );
} );

const closingWarning = DeputyMessageWidget( {
classes: [ 'dp-cs-section-unfinishedWarning' ],
type: 'warning',
label: mw.msg( 'deputy.session.section.closeWarning' )
} );
closingWarning.toggle( false );

const closingCommentsField = new OO.ui.FieldLayout( this.closingComments, {
align: 'top',
label: 'Closing comments',
Expand All @@ -537,6 +545,7 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
this.closingCheckbox.on( 'change', ( v: boolean ) => {
this.closed = v;
closingCommentsField.toggle( v );
closingWarning.toggle( v && this.rows.some( ( row ) => !row.completed ) );
this.toggleClosingComments( v );
} );
this.closingComments.on( 'change', ( v: string ) => {
Expand All @@ -561,6 +570,7 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
align: 'inline',
label: mw.msg( 'deputy.session.section.close' )
} ) ) }
{ unwrapWidget( closingWarning ) }
{ unwrapWidget( closingCommentsField ) }
</div>
<div style={{ display: 'flex', alignItems: 'end' }}>
Expand Down

0 comments on commit 5f97f34

Please sign in to comment.