Skip to content

Commit 7706c10

Browse files
authored
Merge pull request #68 from xpquiz/feature/#64
Feature/#64
2 parents 49e35bc + 3a2d284 commit 7706c10

36 files changed

+901
-120
lines changed

db.json

Lines changed: 147 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,106 @@
11
{
22
"theTriviaApi": [
33
{
4-
"category": "society_and_culture",
5-
"id": "622a1c367cc59eab6f950408",
6-
"correctAnswer": "Rosa Parks",
4+
"category": "sport_and_leisure",
5+
"id": "62417da50f96c4efe8d773db",
6+
"correctAnswer": "San Francisco 49ers",
77
"incorrectAnswers": [
8-
"Angela Davis",
9-
"Dorothy Cotton",
10-
"Fanny Lou Hamer"
8+
"San Francisco Jaguars",
9+
"San Francisco Pistons",
10+
"San Francisco Predators"
1111
],
1212
"question": {
13-
"text": "Which civil right activist is famous for refusing to give up her seat on a bus to make way for a white person?"
13+
"text": "Which of these is an American Football team based in San Francisco?"
1414
},
1515
"tags": [
16-
"general_knowledge",
17-
"people",
18-
"society_and_culture"
16+
"sport"
1917
],
2018
"type": "text_choice",
2119
"difficulty": "medium",
2220
"regions": [],
2321
"isNiche": false
22+
},
23+
{
24+
"category": "history",
25+
"id": "622a1c367cc59eab6f9503ac",
26+
"correctAnswer": "Germany",
27+
"incorrectAnswers": [
28+
"Switzerland",
29+
"Denmark",
30+
"France"
31+
],
32+
"question": {
33+
"text": "Which country was first to operate an old age pension scheme?"
34+
},
35+
"tags": [
36+
"history"
37+
],
38+
"type": "text_choice",
39+
"difficulty": "hard",
40+
"regions": [],
41+
"isNiche": false
42+
},
43+
{
44+
"category": "arts_and_literature",
45+
"id": "649b4f4f828109028d236251",
46+
"correctAnswer": "A Spider",
47+
"incorrectAnswers": [
48+
"A Pig",
49+
"A Sheep",
50+
"A Horse"
51+
],
52+
"question": {
53+
"text": "In E.B. White's classic children's book \"Charlotte's Web\", what kind of animal is Charlotte?"
54+
},
55+
"tags": [
56+
"animals",
57+
"childrens_literature",
58+
"arts_and_literature",
59+
"literature"
60+
],
61+
"type": "text_choice",
62+
"difficulty": "easy",
63+
"regions": [],
64+
"isNiche": false
2465
}
2566
],
2667
"openTriviaDb": {
2768
"response_code": 0,
2869
"results": [
2970
{
30-
"type": "Ym9vbGVhbg==",
71+
"type": "bXVsdGlwbGU=",
72+
"difficulty": "bWVkaXVt",
73+
"category": "SGlzdG9yeQ==",
74+
"question": "V2hlbiBkaWQgdGhlIENyaXNpcyBvZiB0aGUgVGhpcmQgQ2VudHVyeSBiZWdpbj8=",
75+
"correct_answer": "MjM1IEFE",
76+
"incorrect_answers": [
77+
"MjM1IEJD",
78+
"MjQyIEFE",
79+
"MjEwIEFE"
80+
]
81+
},
82+
{
83+
"type": "bXVsdGlwbGU=",
84+
"difficulty": "bWVkaXVt",
85+
"category": "RW50ZXJ0YWlubWVudDogVmlkZW8gR2FtZXM=",
86+
"question": "V2hpY2ggb2YgdGhlc2UgQ291bnRlci1TdHJpa2UgbWFwcyBpcyBhIGJvbWIgZGVmdXNlIHNjZW5hcmlvPw==",
87+
"correct_answer": "UHJvZGlneQ==",
88+
"incorrect_answers": [
89+
"NzQ3",
90+
"SGF2YW5h",
91+
"T2lscmln"
92+
]
93+
},
94+
{
95+
"type": "bXVsdGlwbGU=",
3196
"difficulty": "bWVkaXVt",
32-
"category": "RW50ZXJ0YWlubWVudDogSmFwYW5lc2UgQW5pbWUgJiBNYW5nYQ==",
33-
"question": "VGhlIGFuaW1hdGVkIGZpbG0gIlNwaXJpdGVkIEF3YXkiIHdvbiB0aGUgQWNhZGVteSBBd2FyZCBmb3IgQmVzdCBBbmltYXRlZCBGZWF0dXJlIGF0IHRoZSA3NXRoIEFjYWRlbXkgQXdhcmRzIGluIDIwMDMu",
34-
"correct_answer": "VHJ1ZQ==",
97+
"category": "RW50ZXJ0YWlubWVudDogVmlkZW8gR2FtZXM=",
98+
"question": "V2hhdCBpcyB0aGUgd29ybGQncyBmaXJzdCB2aWRlbyBnYW1lIGNvbnNvbGU/",
99+
"correct_answer": "TWFnbmF2b3ggT2R5c3NleQ==",
35100
"incorrect_answers": [
36-
"RmFsc2U="
101+
"Q29sZWNvIFRlbHN0YXI=",
102+
"TmludGVuZG8gQ29sb3IgVFYgR2FtZQ==",
103+
"QXRhcmkgMjYwMA=="
37104
]
38105
}
39106
]
@@ -70,6 +137,71 @@
70137
],
71138
"category": "Code",
72139
"difficulty": "Easy"
140+
},
141+
{
142+
"id": 1,
143+
"question": "How to delete a directory in Linux?",
144+
"description": "delete folder",
145+
"answers": {
146+
"answer_a": "ls",
147+
"answer_b": "delete",
148+
"answer_c": "remove",
149+
"answer_d": "rmdir",
150+
"answer_e": null,
151+
"answer_f": null
152+
},
153+
"multiple_correct_answers": "false",
154+
"correct_answers": {
155+
"answer_a_correct": "false",
156+
"answer_b_correct": "false",
157+
"answer_c_correct": "false",
158+
"answer_d_correct": "true",
159+
"answer_e_correct": "false",
160+
"answer_f_correct": "false"
161+
},
162+
"explanation": "rmdir deletes an empty directory",
163+
"tip": null,
164+
"tags": [],
165+
"category": "linux",
166+
"difficulty": "Easy"
167+
},
168+
{
169+
"id": 3,
170+
"question": "How to check the current disk usage on Linux?",
171+
"description": "check current disk usage",
172+
"answers": {
173+
"answer_a": "df",
174+
"answer_b": "usage",
175+
"answer_c": "uptime",
176+
"answer_d": "free",
177+
"answer_e": null,
178+
"answer_f": null
179+
},
180+
"multiple_correct_answers": "false",
181+
"correct_answers": {
182+
"answer_a_correct": "true",
183+
"answer_b_correct": "false",
184+
"answer_c_correct": "false",
185+
"answer_d_correct": "false",
186+
"answer_e_correct": "false",
187+
"answer_f_correct": "false"
188+
},
189+
"correct_answer": "answer_a",
190+
"explanation": "df shows you the current disk usage",
191+
"tip": "df",
192+
"tags": [
193+
{
194+
"name": "Linux"
195+
},
196+
{
197+
"name": "BASH"
198+
},
199+
{
200+
"name": "cmd"
201+
}
202+
],
203+
"category": "uncategorized",
204+
"difficulty": "easy"
73205
}
74206
]
75207
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xpquiz.github.io",
3-
"version": "1.4.1",
3+
"version": "1.5.0",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",

src/app/about-window/about-window.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="window">
22
<app-window-title-bar iconPath="about.png" title="About XPQuiz"></app-window-title-bar>
33
<div class="window-body">
4-
<label><b>XPQuiz</b>&nbsp;- Version 1.4.2</label>
4+
<label><b>XPQuiz</b>&nbsp;- Version 1.5.0</label>
55
<label class="main">Created by&nbsp;<b><a href="https://isahann.github.io">Isahann Hanacleto</a></b></label>
66

77
<label>Source code at&nbsp;<b><a href="https://github.com/xpquiz/xpquiz.github.io">GitHub</a></b></label>

src/app/app-routing.module.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {PathsEnum} from "../model/enums/PathsEnum";
77
import {CorrectAnswerWindowComponent} from "./correct-answer-window/correct-answer-window.component";
88
import {WrongAnswerWindowComponent} from "./wrong-answer-window/wrong-answer-window.component";
99
import {AboutWindowComponent} from "./about-window/about-window.component";
10+
import {GameModeWindowComponent} from "./game-mode-window/game-mode-window.component";
11+
import {QuestionTrifectaWindowComponent} from "./question-trifecta-window/question-trifecta-window.component";
1012

1113
const routes: Routes = [
1214
{
@@ -27,15 +29,23 @@ const routes: Routes = [
2729
component: ScoreWindowComponent
2830
},
2931
{
30-
path: PathsEnum.QUIZ,
32+
path: PathsEnum.GAME_MODE,
33+
component: GameModeWindowComponent,
34+
},
35+
{
36+
path: `${PathsEnum.QUIZ_NORMAL}`,
3137
component: QuestionWindowComponent,
3238
},
3339
{
34-
path: `${PathsEnum.CORRECT_ANSWER}/:result`,
40+
path: `${PathsEnum.QUIZ_TRIFECTA}`,
41+
component: QuestionTrifectaWindowComponent,
42+
},
43+
{
44+
path: `${PathsEnum.CORRECT_ANSWER}/:mode/:result`,
3545
component: CorrectAnswerWindowComponent,
3646
},
3747
{
38-
path: `${PathsEnum.WRONG_ANSWER}/:result`,
48+
path: `${PathsEnum.WRONG_ANSWER}/:mode/:result`,
3949
component: WrongAnswerWindowComponent
4050
}
4151
]

src/app/app.module.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import { CorrectAnswerWindowComponent } from './correct-answer-window/correct-an
1414
import { WrongAnswerWindowComponent } from './wrong-answer-window/wrong-answer-window.component';
1515
import { AboutWindowComponent } from './about-window/about-window.component';
1616
import {CopyClipboardDirective} from "./directives/CopyClipboardDirective";
17+
import { GameModeWindowComponent } from './game-mode-window/game-mode-window.component';
18+
import { IconTextButtonComponent } from './common/icon-text-button/icon-text-button.component';
19+
import { QuestionTrifectaWindowComponent } from './question-trifecta-window/question-trifecta-window.component';
1720

1821
@NgModule({
1922
declarations: [
@@ -26,7 +29,10 @@ import {CopyClipboardDirective} from "./directives/CopyClipboardDirective";
2629
CorrectAnswerWindowComponent,
2730
WrongAnswerWindowComponent,
2831
AboutWindowComponent,
29-
CopyClipboardDirective
32+
CopyClipboardDirective,
33+
GameModeWindowComponent,
34+
IconTextButtonComponent,
35+
QuestionTrifectaWindowComponent
3036
],
3137
imports: [
3238
BrowserModule,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<button (click)="this.onClick()" [disabled]="this.disabled">
2+
<img
3+
[ngSrc]="'assets/icons/30x30/' + this.iconPath"
4+
alt="" [height]="this.iconSize" [width]="this.iconSize"/>
5+
<label>{{this.title}}</label>
6+
<p>{{this.description}}</p>
7+
</button>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
button
2+
display: flex
3+
flex-direction: column
4+
align-items: center
5+
justify-content: center
6+
height: 130px
7+
width: 170px
8+
9+
img
10+
margin: 5px
11+
12+
label
13+
font-weight: bold
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { IconTextButtonComponent } from './icon-text-button.component';
4+
5+
describe('IconTextButtonComponent', () => {
6+
let component: IconTextButtonComponent;
7+
let fixture: ComponentFixture<IconTextButtonComponent>;
8+
9+
beforeEach(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [IconTextButtonComponent]
12+
});
13+
fixture = TestBed.createComponent(IconTextButtonComponent);
14+
component = fixture.componentInstance;
15+
fixture.detectChanges();
16+
});
17+
18+
it('should create', () => {
19+
expect(component).toBeTruthy();
20+
});
21+
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {Component, EventEmitter, Input, Output} from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-icon-text-button',
5+
templateUrl: './icon-text-button.component.html',
6+
styleUrls: ['./icon-text-button.component.sass']
7+
})
8+
export class IconTextButtonComponent {
9+
10+
@Input()
11+
public iconPath: string = '';
12+
@Input()
13+
public title: string = '';
14+
@Input()
15+
public description: string = '';
16+
@Input()
17+
public disabled: boolean = false;
18+
@Output()
19+
public onButtonClick: EventEmitter<void> = new EventEmitter<void>();
20+
21+
public readonly iconSize: number = 30;
22+
23+
public onClick(): void {
24+
this.onButtonClick.emit();
25+
}
26+
27+
}

src/app/correct-answer-window/correct-answer-window.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="window-body">
44
<div class="window-body_title">
55
<label><b>Congratulations!</b></label>
6-
<label>You earned {{this.questionScore}} points!</label>
6+
<label>You earned {{ this.questionScore }} points!</label>
77
<label>Come back in 3 hours for another question!</label>
88
</div>
99
<div class="window-body_buttons">

0 commit comments

Comments
 (0)