Skip to content

Commit

Permalink
feat(ME): adapt save status labels in top-toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow committed Jun 10, 2024
1 parent 6e10265 commit c7c8211
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@
class="grow flex flex-row items-center justify-center gap-1 text-[14px]"
[ngSwitch]="saveStatus$ | async"
>
<ng-container *ngSwitchCase="'saved_not_published'">
<ng-container *ngSwitchCase="'draft_only'">
<mat-icon
class="material-symbols-outlined text-slate-400"
style="font-variation-settings: 'FILL' 1"
>check_circle</mat-icon
>
<span translate>editor.record.saveStatus.notPublishedYet</span>
<span translate>editor.record.saveStatus.asDraftOnly</span>
</ng-container>
<ng-container *ngSwitchCase="'saved_published_up_to_date'">
<ng-container *ngSwitchCase="'record_up_to_date'">
<mat-icon
class="material-symbols-outlined text-lime-400"
style="font-variation-settings: 'FILL' 1"
>check_circle</mat-icon
>
<span translate>editor.record.saveStatus.publishedUpToDate</span>
<span translate>editor.record.saveStatus.recordUpToDate</span>
</ng-container>
<ng-container *ngSwitchCase="'saved_published_changes_pending'">
<ng-container *ngSwitchCase="'draft_changes_pending'">
<mat-icon class="material-symbols-outlined text-sky-300"
>pending</mat-icon
>
<span translate>editor.record.saveStatus.publishedChangesPending</span>
<span translate>editor.record.saveStatus.draftWithChangesPending</span>
</ng-container>
</div>
<gn-ui-button type="light">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('TopToolbarComponent', () => {
editorFacade.changedSinceSave$.next(true)
})
it('sets the correct status', () => {
expect(saveStatus).toBe('saved_not_published')
expect(saveStatus).toBe('draft_only')
})
})
describe('saved, published and up to date', () => {
Expand All @@ -75,7 +75,7 @@ describe('TopToolbarComponent', () => {
editorFacade.changedSinceSave$.next(false)
})
it('sets the correct status', () => {
expect(saveStatus).toBe('saved_published_up_to_date')
expect(saveStatus).toBe('record_up_to_date')
})
})
describe('saved, published, pending changes', () => {
Expand All @@ -84,7 +84,7 @@ describe('TopToolbarComponent', () => {
editorFacade.changedSinceSave$.next(true)
})
it('sets the correct status', () => {
expect(saveStatus).toBe('saved_published_changes_pending')
expect(saveStatus).toBe('draft_changes_pending')
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import { TranslateModule } from '@ngx-translate/core'
})
export class TopToolbarComponent {
protected SaveStatus = [
'saved_not_published',
'saved_published_up_to_date',
'saved_published_changes_pending',
// these are not used since the draft is saved locally
'draft_only', // => when creating a record
'record_up_to_date', // => when the record was just published (ie saved on the server)
'draft_changes_pending', // => when the record was modified and not yet published
// these are not used since the draft is saved locally in a synchronous way
// TODO: use these states when the draft is saved on the server
// 'saving',
// 'saving_failed',
// 'draft_saving',
// 'draft_saving_failed',
] as const

protected saveStatus$: Observable<typeof this.SaveStatus[number]> =
Expand All @@ -40,11 +40,9 @@ export class TopToolbarComponent {
]).pipe(
map(([alreadySavedOnce, changedSinceSave]) => {
if (!alreadySavedOnce) {
return 'saved_not_published'
return 'draft_only'
}
return changedSinceSave
? 'saved_published_changes_pending'
: 'saved_published_up_to_date'
return changedSinceSave ? 'draft_changes_pending' : 'record_up_to_date'
})
)

Expand Down
6 changes: 3 additions & 3 deletions translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
"editor.record.publishError.title": "",
"editor.record.publishSuccess.body": "",
"editor.record.publishSuccess.title": "",
"editor.record.saveStatus.notPublishedYet": "",
"editor.record.saveStatus.publishedChangesPending": "",
"editor.record.saveStatus.publishedUpToDate": "",
"editor.record.saveStatus.asDraftOnly": "",
"editor.record.saveStatus.draftWithChangesPending": "",
"editor.record.saveStatus.recordUpToDate": "",
"editor.record.upToDate": "",
"externalviewer.dataset.unnamed": "Datensatz aus dem Datahub",
"facets.block.title.OrgForResource": "Organisation",
Expand Down
6 changes: 3 additions & 3 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
"editor.record.publishError.title": "Error publishing record",
"editor.record.publishSuccess.body": "The record was successfully published!",
"editor.record.publishSuccess.title": "Publish success",
"editor.record.saveStatus.notPublishedYet": "Saved automatically - not published yet",
"editor.record.saveStatus.publishedChangesPending": "Saved automatically - changes are pending",
"editor.record.saveStatus.publishedUpToDate": "Saved automatically - up to date",
"editor.record.saveStatus.asDraftOnly": "Saved as draft only - not published yet",
"editor.record.saveStatus.draftWithChangesPending": "Saved as draft - changes are pending",
"editor.record.saveStatus.recordUpToDate": "Record is up to date",
"editor.record.upToDate": "This record is up to date",
"externalviewer.dataset.unnamed": "Datahub layer",
"facets.block.title.OrgForResource": "Organisation",
Expand Down
6 changes: 3 additions & 3 deletions translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
"editor.record.publishError.title": "",
"editor.record.publishSuccess.body": "",
"editor.record.publishSuccess.title": "",
"editor.record.saveStatus.notPublishedYet": "",
"editor.record.saveStatus.publishedChangesPending": "",
"editor.record.saveStatus.publishedUpToDate": "",
"editor.record.saveStatus.asDraftOnly": "",
"editor.record.saveStatus.draftWithChangesPending": "",
"editor.record.saveStatus.recordUpToDate": "",
"editor.record.upToDate": "",
"externalviewer.dataset.unnamed": "",
"facets.block.title.OrgForResource": "",
Expand Down
6 changes: 3 additions & 3 deletions translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
"editor.record.publishError.title": "",
"editor.record.publishSuccess.body": "",
"editor.record.publishSuccess.title": "",
"editor.record.saveStatus.notPublishedYet": "Enregistrement automatique - non publiée",
"editor.record.saveStatus.publishedChangesPending": "Enregistrement automatique - publiée, modifications en cours",
"editor.record.saveStatus.publishedUpToDate": "Enregistrement automatique - publiée et à jour",
"editor.record.saveStatus.asDraftOnly": "Brouillon enregistré - fiche non publiée",
"editor.record.saveStatus.draftWithChangesPending": "Brouillon enregistré - modifications en cours",
"editor.record.saveStatus.recordUpToDate": "La fiche publiée est à jour",
"editor.record.upToDate": "",
"externalviewer.dataset.unnamed": "Couche du datahub",
"facets.block.title.OrgForResource": "Organisation",
Expand Down
6 changes: 3 additions & 3 deletions translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
"editor.record.publishError.title": "",
"editor.record.publishSuccess.body": "",
"editor.record.publishSuccess.title": "",
"editor.record.saveStatus.notPublishedYet": "",
"editor.record.saveStatus.publishedChangesPending": "",
"editor.record.saveStatus.publishedUpToDate": "",
"editor.record.saveStatus.asDraftOnly": "",
"editor.record.saveStatus.draftWithChangesPending": "",
"editor.record.saveStatus.recordUpToDate": "",
"editor.record.upToDate": "",
"externalviewer.dataset.unnamed": "Layer del datahub",
"facets.block.title.OrgForResource": "Organizzazione",
Expand Down
6 changes: 3 additions & 3 deletions translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
"editor.record.publishError.title": "",
"editor.record.publishSuccess.body": "",
"editor.record.publishSuccess.title": "",
"editor.record.saveStatus.notPublishedYet": "",
"editor.record.saveStatus.publishedChangesPending": "",
"editor.record.saveStatus.publishedUpToDate": "",
"editor.record.saveStatus.asDraftOnly": "",
"editor.record.saveStatus.draftWithChangesPending": "",
"editor.record.saveStatus.recordUpToDate": "",
"editor.record.upToDate": "",
"externalviewer.dataset.unnamed": "",
"facets.block.title.OrgForResource": "",
Expand Down
6 changes: 3 additions & 3 deletions translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
"editor.record.publishError.title": "",
"editor.record.publishSuccess.body": "",
"editor.record.publishSuccess.title": "",
"editor.record.saveStatus.notPublishedYet": "",
"editor.record.saveStatus.publishedChangesPending": "",
"editor.record.saveStatus.publishedUpToDate": "",
"editor.record.saveStatus.asDraftOnly": "",
"editor.record.saveStatus.draftWithChangesPending": "",
"editor.record.saveStatus.recordUpToDate": "",
"editor.record.upToDate": "",
"externalviewer.dataset.unnamed": "",
"facets.block.title.OrgForResource": "",
Expand Down
6 changes: 3 additions & 3 deletions translations/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
"editor.record.publishError.title": "",
"editor.record.publishSuccess.body": "",
"editor.record.publishSuccess.title": "",
"editor.record.saveStatus.notPublishedYet": "",
"editor.record.saveStatus.publishedChangesPending": "",
"editor.record.saveStatus.publishedUpToDate": "",
"editor.record.saveStatus.asDraftOnly": "",
"editor.record.saveStatus.draftWithChangesPending": "",
"editor.record.saveStatus.recordUpToDate": "",
"editor.record.upToDate": "",
"externalviewer.dataset.unnamed": "",
"facets.block.title.OrgForResource": "Organizácia",
Expand Down

0 comments on commit c7c8211

Please sign in to comment.