MOBILE-4560 colors: Use CoreIonicColorNames in missing places

main
Dani Palou 2024-04-30 15:53:36 +02:00
parent 1b154a4fb6
commit 1b71f69cfe
3 changed files with 12 additions and 9 deletions

View File

@ -17,6 +17,7 @@ import { CoreRoutedItemsManagerSource } from '@classes/items-management/routed-i
import { ADDON_COMPETENCY_COMPETENCIES_PAGE } from '../competency.module'; import { ADDON_COMPETENCY_COMPETENCIES_PAGE } from '../competency.module';
import { AddonCompetency, AddonCompetencyPlan, AddonCompetencyProvider } from '../services/competency'; import { AddonCompetency, AddonCompetencyPlan, AddonCompetencyProvider } from '../services/competency';
import { AddonCompetencyHelper } from '../services/competency-helper'; import { AddonCompetencyHelper } from '../services/competency-helper';
import { CoreIonicColorNames } from '@singletons/colors';
/** /**
* Provides a collection of learning plans. * Provides a collection of learning plans.
@ -73,13 +74,13 @@ export class AddonCompetencyPlansSource extends CoreRoutedItemsManagerSource<Add
plan.statusname = AddonCompetencyHelper.getPlanStatusName(plan.status); plan.statusname = AddonCompetencyHelper.getPlanStatusName(plan.status);
switch (plan.status) { switch (plan.status) {
case AddonCompetencyProvider.STATUS_ACTIVE: case AddonCompetencyProvider.STATUS_ACTIVE:
plan.statuscolor = 'success'; plan.statuscolor = CoreIonicColorNames.SUCCESS;
break; break;
case AddonCompetencyProvider.STATUS_COMPLETE: case AddonCompetencyProvider.STATUS_COMPLETE:
plan.statuscolor = 'danger'; plan.statuscolor = CoreIonicColorNames.DANGER;
break; break;
default: default:
plan.statuscolor = 'warning'; plan.statuscolor = CoreIonicColorNames.WARNING;
break; break;
} }
}); });

View File

@ -60,6 +60,7 @@ import { AddonModAssignModuleHandlerService } from '../../services/handlers/modu
import { CanLeave } from '@guards/can-leave'; import { CanLeave } from '@guards/can-leave';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { isSafeNumber, SafeNumber } from '@/core/utils/types'; import { isSafeNumber, SafeNumber } from '@/core/utils/types';
import { CoreIonicColorNames } from '@singletons/colors';
/** /**
* Component that displays an assignment submission. * Component that displays an assignment submission.
@ -815,7 +816,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
if (this.hasOffline || this.submittedOffline) { if (this.hasOffline || this.submittedOffline) {
// Offline data. // Offline data.
this.statusTranslated = Translate.instant('core.notsent'); this.statusTranslated = Translate.instant('core.notsent');
this.statusColor = 'warning'; this.statusColor = CoreIonicColorNames.WARNING;
} else if (!this.assign.teamsubmission) { } else if (!this.assign.teamsubmission) {
// Single submission. // Single submission.

View File

@ -29,6 +29,7 @@ import { CoreQuestionDelegate } from './question-delegate';
import { CoreIcons } from '@singletons/icons'; import { CoreIcons } from '@singletons/icons';
import { CoreUrlUtils } from '@services/utils/url'; import { CoreUrlUtils } from '@services/utils/url';
import { ContextLevel } from '@/core/constants'; import { ContextLevel } from '@/core/constants';
import { CoreIonicColorNames } from '@singletons/colors';
/** /**
* Service with some common functions to handle questions. * Service with some common functions to handle questions.
@ -806,21 +807,21 @@ export class CoreQuestionHelperProvider {
if ('src' in icon) { if ('src' in icon) {
if ((icon as HTMLImageElement).src.indexOf('correct') >= 0) { if ((icon as HTMLImageElement).src.indexOf('correct') >= 0) {
iconName = 'check'; iconName = 'check';
color = 'success'; color = CoreIonicColorNames.SUCCESS;
} else if ((icon as HTMLImageElement).src.indexOf('incorrect') >= 0 ) { } else if ((icon as HTMLImageElement).src.indexOf('incorrect') >= 0 ) {
iconName = 'xmark'; iconName = 'xmark';
color = 'danger'; color = CoreIonicColorNames.DANGER;
} }
} else { } else {
if (icon.classList.contains('fa-check-square')) { if (icon.classList.contains('fa-check-square')) {
iconName = 'square-check'; iconName = 'square-check';
color = 'warning'; color = CoreIonicColorNames.WARNING;
} else if (icon.classList.contains('fa-check')) { } else if (icon.classList.contains('fa-check')) {
iconName = 'check'; iconName = 'check';
color = 'success'; color = CoreIonicColorNames.SUCCESS;
} else if (icon.classList.contains('fa-xmark') || icon.classList.contains('fa-remove')) { } else if (icon.classList.contains('fa-xmark') || icon.classList.contains('fa-remove')) {
iconName = 'xmark'; iconName = 'xmark';
color = 'danger'; color = CoreIonicColorNames.DANGER;
} }
} }