File size: 6,606 Bytes
e4ab6d0 768d897 0a2fc2b e4ab6d0 cdc8731 e4ab6d0 cdc8731 e4ab6d0 768d897 e4ab6d0 cdc8731 e4ab6d0 cdc8731 e4ab6d0 cdc8731 e4ab6d0 cdc8731 e4ab6d0 cdc8731 e4ab6d0 cdc8731 768d897 cdc8731 768d897 9db5bb0 cdc8731 768d897 e4ab6d0 768d897 cdc8731 9dcf30d cdc8731 9dcf30d cdc8731 9dcf30d cdc8731 9dcf30d 9db5bb0 cdc8731 9dcf30d e4ab6d0 768d897 9dcf30d e4ab6d0 cdc8731 e4ab6d0 cdc8731 e4ab6d0 cdc8731 e4ab6d0 cdc8731 e4ab6d0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
<div class="app-container">
<div *ngIf="isLoading" class="loading-overlay">
<span class="loader"></span>
</div>
<app-header [title]="'Grammar Questions'"></app-header>
<img src="assets/images/grammar-bg.png" alt="Chat Background" class="grammar-bg" />
<div class="header-section">
<div class="input-section">
<!-- Input Field & Suggestions -->
<div class="input-wrapper">
<input [(ngModel)]="topic"
(input)="onTopicChange()"
[readonly]="isTopicLocked"
placeholder="Enter a Topic..."
class="input-box topic-input"
(focus)="showSuggestions = true"
(click)="showSuggestions = true"
(blur)="hideSuggestions()" />
<!-- Suggestions Dropdown -->
<div *ngIf="showSuggestions && !isDropdownDisabled" class="suggestions-container">
<div class="suggestions-list">
<div *ngFor="let suggestion of hardcodedTopics"
(click)="selectTopic(suggestion)"
class="suggestion-item">
{{ suggestion }}
</div>
</div>
</div>
</div>
<app-button [disabled]="isGenerateDisabled" (click)="generateQuestions()">π Generate</app-button>
<app-button [disabled]="!topic || isResetDisabled" (click)="resetTopic()">Reset</app-button>
</div>
<!-- Difficulty Indicator -->
<div *ngIf="isQuestionsGenerated" class="difficulty-container">
<div class="progress-bar-fill" [style.width]="getProgressWidth()"></div>
<div class="level-dots">
<div *ngFor="let level of difficultyLevels"
class="level-dot"
[class.active]="activateLevelDot && currentDifficulty === level">
<div class="level-tooltip" *ngIf="showLevelTooltip && currentDifficulty === level">
{{ level | titlecase }}
</div>
</div>
</div>
</div>
<div *ngIf="error" class="error-popup">
<div class="error-popup-content">
<p>{{ error }}</p>
<app-button class="close-popup-btn" (click)="closeErrorPopup()">Close</app-button>
</div>
</div>
</div>
<!-- Main Content Section -->
<div *ngIf="!isAllLevelsCompleted" class="full-content">
<div class="questions-container" *ngIf="questions.length > 0">
<div class="quesHintbtn">
<h2 class="section-title">π Questions</h2>
</div>
<ul class="questions-list">
<li *ngFor="let question of questions" class="question-item">
<div class="question-wrapper">
<div class="question-text-wrapper">
<!-- Sentence + Answer Box -->
<span class="question-text" *ngFor="let part of question.parts; let i = index">
{{ part }}
<!-- Inline answer slot -->
<span class="answer-slot" *ngIf="i < question.parts.length - 1">
<input [(ngModel)]="userAnswers[question.index]"
[readonly]="isValidationInProgress || readonlyAnswers[question.index]"
placeholder=""
class="answer-input"
pattern="[A-Za-z]*"
(input)="onInput($event, question.index); onAnswerChange(question.index)"
[ngClass]="{
'correct-answer': answerStatuses[question.index] === 'correct',
'wrong-answer': answerStatuses[question.index] === 'incorrect'
}" />
</span>
</span>
</div>
</div>
</li>
</ul>
<!-- Hints Section -->
<ng-container *ngIf="isFirstAttemptDone && hints?.length">
<div class="hint-anchor" (click)="$event.stopPropagation()">
<button type="button" class="hint-toggle-btn"
aria-haspopup="dialog"
[attr.aria-expanded]="isHintMenuVisible ? 'true' : 'false'"
aria-controls="hintsPanel"
(click)="toggleHintMenu()">
π‘
</button>
<section *ngIf="isHintMenuVisible"
id="hintsPanel"
class="hint-popover"
role="dialog"
aria-modal="true"
aria-label="Hints"
(click)="$event.stopPropagation()">
<button type="button"
class="user-guide-close-icon"
aria-label="Close hints"
(click)="closeHints()">
Γ
</button>
<h3 class="hint-title">Hints</h3>
<ul class="hint-list" role="list">
<ng-container *ngFor="let hint of hints; let i = index">
<li *ngIf="hint && hint.trim() !== ''"
class="hint-item">
<strong>Hint for Question {{ i + 1 }}:</strong> {{ hint }}
</li>
</ng-container>
</ul>
</section>
</div>
<div *ngIf="isHintMenuVisible" class="hint-backdrop" (click)="closeHints()"></div>
</ng-container>
</div>
</div>
<!-- Validate Button -->
<div class="submit-container"
*ngIf="isQuestionsGenerated && !isAllLevelsCompleted">
<app-button [disabled]="!areAllAnswersFilled() || isChecked"
(click)="checkAllAnswers()">
Validate Answers
</app-button>
</div>
<!-- Global Countdown Overlay (ONLY ONCE) -->
<div *ngIf="showGlobalCountdown"
class="global-countdown-overlay"
role="status"
aria-live="assertive">
<div class="overlay-card">
<div class="ring">
<svg class="ring-svg" viewBox="0 0 220 220" aria-hidden="true">
<circle class="ring-track" cx="110" cy="110" r="90"></circle>
<circle class="ring-progress"
cx="110" cy="110" r="90"
[attr.stroke-dasharray]="ringCircumference"
[attr.stroke-dashoffset]="ringDashoffset"></circle>
</svg>
<div class="ring-number">{{ globalCountdown }}</div>
</div>
<div class="caption-pill">
{{ overlayCaption }} {{ globalCountdown }}s
</div>
</div>
</div>
<!-- Completion Message -->
<div *ngIf="isAllLevelsCompleted" class="congratulation-message">
<h2>π Congratulations! You have completed all levels! π</h2>
<p>Ready to start over and improve even more?</p>
<app-button (click)="stopConfettiAndReset()">Start Over</app-button>
</div>
</div>
|