-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(DialogGuidance): Create DialogGuidanceComponent class (#936)
- Refactor DialogGuidanceFeedbackService.getFeedbackText() to take in the new DialogGuidanceComponent instead of DialogGuidanceStudentComponent - Lower-case variable names
- Loading branch information
1 parent
8e34d8b
commit 1246829
Showing
10 changed files
with
125 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/assets/wise5/components/dialogGuidance/DialogGuidanceComponent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Component } from '../../common/Component'; | ||
import { FeedbackRule } from '../common/feedbackRule/FeedbackRule'; | ||
import { DialogGuidanceContent } from './DialogGuidanceContent'; | ||
|
||
export class DialogGuidanceComponent extends Component { | ||
content: DialogGuidanceContent; | ||
|
||
getFeedbackRules(): FeedbackRule[] { | ||
return this.content.feedbackRules; | ||
} | ||
|
||
getComputerAvatarInitialResponse(): string { | ||
return this.content.computerAvatarSettings.initialResponse; | ||
} | ||
|
||
isComputerAvatarEnabled(): boolean { | ||
return this.content.isComputerAvatarEnabled; | ||
} | ||
|
||
getItemId(): string { | ||
return this.content.itemId; | ||
} | ||
|
||
isComputerAvatarPromptAvailable(): boolean { | ||
const computerAvatarPrompt = this.content.computerAvatarSettings.prompt; | ||
return computerAvatarPrompt != null && computerAvatarPrompt !== ''; | ||
} | ||
|
||
isMultipleFeedbackTextsForSameRuleAllowed(): boolean { | ||
return !this.isVersion1(); | ||
} | ||
|
||
isOnlyOneComputerAvatarAvailable(): boolean { | ||
return this.content.computerAvatarSettings.ids.length === 1; | ||
} | ||
|
||
isUseGlobalComputerAvatar(): boolean { | ||
return this.content.computerAvatarSettings.useGlobalComputerAvatar; | ||
} | ||
|
||
isVersion1(): boolean { | ||
return this.content.version == null; | ||
} | ||
|
||
isVersion2(): boolean { | ||
return this.content.version === 2; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/assets/wise5/components/dialogGuidance/DialogGuidanceContent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ComponentContent } from '../../common/ComponentContent'; | ||
import { FeedbackRule } from '../common/feedbackRule/FeedbackRule'; | ||
import { ComputerAvatarSettings } from './ComputerAvatarSettings'; | ||
|
||
export interface DialogGuidanceContent extends ComponentContent { | ||
computerAvatarSettings?: ComputerAvatarSettings; | ||
feedbackRules: FeedbackRule[]; | ||
isComputerAvatarEnabled?: boolean; | ||
itemId: string; | ||
version?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.