fixed suggestion

This commit is contained in:
Timo Bejan 2020-11-06 21:10:42 +02:00
parent 00ab0252e9
commit 5f95429427
8 changed files with 20 additions and 19 deletions

View File

@ -1,9 +1,8 @@
<div
[class.hint]="typeValue?.hint"
[class.request]="typeValue?.type === 'request'"
[class.request]="typeValue?.type === 'suggestion'"
[style.background-color]="typeValue?.hexColor"
class="icon"
>
<span>{{ (typeValue?.type)[0] }}</span>
<!-- {{typeValue | json }}-->
</div>

View File

@ -9,10 +9,12 @@ import { TypeValue } from '@redaction/red-ui-http';
export class AnnotationIconComponent implements OnInit {
@Input() typeValue: TypeValue;
label: string;
constructor() {}
ngOnInit(): void {
if (this.typeValue?.type === 'request') {
if (this.typeValue?.type === 'suggestion') {
const styleSheet = document.styleSheets[0];
styleSheet.insertRule(
`.request:after { border-top-color: ${this.typeValue.hexColor} !important; }`,

View File

@ -9,6 +9,6 @@
></redaction-annotation-icon>
<redaction-annotation-icon
*ngIf="needsWorkInput.hasRequests"
[typeValue]="appStateService.getDictionaryTypeValue('request')"
[typeValue]="appStateService.getDictionaryTypeValue('suggestion')"
></redaction-annotation-icon>
</div>

View File

@ -210,8 +210,8 @@
(click)="openAcceptSuggestionMenu($event, annotation)"
*ngIf="
appStateService.isActiveProjectOwnerAndManager &&
(annotation.superType === 'request' ||
annotation.superType === 'request-remove')
(annotation.superType === 'suggestion' ||
annotation.superType === 'suggestion-remove')
"
[class.active]="isAnnotationMenuOpen(annotation)"
[matMenuTriggerFor]="menu"
@ -253,8 +253,8 @@
<button
(click)="rejectSuggestion($event, annotation)"
*ngIf="
annotation.superType === 'request' ||
annotation.superType === 'request-remove'
annotation.superType === 'suggestion' ||
annotation.superType === 'suggestion-remove'
"
mat-icon-button
>

View File

@ -16,7 +16,7 @@ export const SuperTypeSorter = {
};
export class AnnotationWrapper {
superType: 'request' | 'redaction' | 'hint' | 'ignore' | 'request-remove';
superType: 'suggestion' | 'redaction' | 'hint' | 'ignore' | 'suggestion-remove';
dictionary: string;
color: string;
comments: Comment[] = [];
@ -93,7 +93,7 @@ export class AnnotationWrapper {
// change super-type based on toRemove
annotationWrapper.superType = toRemove
? toRemove.status === 'REQUESTED'
? 'request-remove'
? 'suggestion-remove'
: toRemove.status === 'APPROVED'
? 'ignore'
: annotationWrapper.superType
@ -106,7 +106,7 @@ export class AnnotationWrapper {
) {
const dictionary = dictionaryData[manualRedactionEntry.type];
return manualRedactionEntry.status === 'REQUESTED'
? 'request'
? 'suggestion'
: dictionary.hint
? 'hint'
: 'redaction';

View File

@ -38,7 +38,7 @@ export class AnnotationDrawService {
this._appStateService.dictionaryData
);
const color =
superType === 'request'
superType === 'suggestion'
? this._appStateService.getDictionaryColor(superType)
: this._appStateService.getDictionaryColor(manualRedactionEntry.type);

View File

@ -84,7 +84,7 @@
</div>
<div>
<redaction-annotation-icon
[typeValue]="appStateService.getDictionaryTypeValue('request')"
[typeValue]="appStateService.getDictionaryTypeValue('suggestion')"
></redaction-annotation-icon>
{{ 'project-overview.legend.contains-suggestions' | translate }}
</div>

View File

@ -495,14 +495,14 @@ export class AppStateService {
);
const colorsObs = this._dictionaryControllerService.getColors().pipe(
tap((colors) => {
this._dictionaryData['request'] = {
this._dictionaryData['suggestion'] = {
hexColor: colors.requestAdd,
type: 'request',
type: 'suggestion',
virtual: true
};
this._dictionaryData['request-remove'] = {
this._dictionaryData['suggestion-remove'] = {
hexColor: colors.requestRemove,
type: 'request-remove',
type: 'suggestion-remove',
virtual: true
};
this._dictionaryData['ignore'] = {
@ -553,9 +553,9 @@ export class AppStateService {
getDictionaryTypeValueForAnnotation(annotation: AnnotationWrapper) {
if (
annotation.superType === 'request' ||
annotation.superType === 'suggestion' ||
annotation.superType === 'ignore' ||
annotation.superType === 'request-remove'
annotation.superType === 'suggestion-remove'
) {
return this._dictionaryData[annotation.superType];
}