-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.ts
149 lines (121 loc) · 2.92 KB
/
types.ts
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
import { ReactNode } from "react"
import { IGatsbyImageData } from "gatsby-plugin-image"
import type { Messages } from "./interfaces"
import type { Lang } from "./utils/languages"
import { TranslationKey } from "./utils/translations"
export type ChildOnlyProp = { children: ReactNode }
export type Intl = {
language: Lang
languages: Array<Lang>
defaultLanguage: Lang
messages: Messages
routed: boolean
originalPath: string
redirect: boolean
}
export type I18NextContext = {
language: string
routed: boolean
languages: string[]
defaultLanguage: string
generateDefaultLanguagePage: boolean
originalPath: string
path: string
siteUrl?: string
}
export type Context = {
slug: string
relativePath?: string
language: Lang
languagesToFetch?: Array<Lang>
ignoreTranslationBanner?: boolean
isOutdated: boolean
isLegal?: boolean
isDefaultLang: boolean
isContentEnglish?: boolean
i18n: I18NextContext
}
export interface DeveloperDocsLink {
id: TranslationKey
to: string
path: string
description: TranslationKey
items: Array<DeveloperDocsLink>
}
export type Direction = "rtl" | "ltr" | "auto"
export type ForbidOptional<T = {}> = {
[P in keyof T]?: never
}
type OptionalImageProp = {
image: IGatsbyImageData
alt: string
}
type ForbidOptionalImageProp = ForbidOptional<OptionalImageProp>
export type ImageProp = OptionalImageProp | ForbidOptionalImageProp
export interface LearningTool {
name: string
description: string
url: string
image: IGatsbyImageData | string
alt: string
background: string
subjects: Array<string>
locales?: Array<Lang>
}
export interface LearningToolsCardGridProps {
category: Array<LearningTool>
}
/**
* Quiz data types
*/
export interface AnswerChoice {
answerId: string
isCorrect: boolean
}
export interface Answer {
id: string
label: TranslationKey
explanation: TranslationKey
moreInfoLabel?: string
moreInfoUrl?: string
}
export interface RawQuestion {
prompt: TranslationKey
answers: Array<Answer>
correctAnswerId: string
}
export interface Question extends RawQuestion {
id: string
}
export interface QuestionBank {
[key: string]: RawQuestion
}
export interface RawQuiz {
title: TranslationKey
questions: Array<string> // TODO: Force to be an array of questionID's
}
export interface Quiz {
title: string
questions: Array<Question>
}
export interface RawQuizzes {
[key: string]: RawQuiz
}
type QuizLevel = "beginner" | "intermediate"
export type QuizzesSection = {
id: string
level: QuizLevel
next?: string
}
export type QuizzesListItem = QuizzesSection & {
quizHandler: (id: string) => void
modalHandler: (isModalOpen: boolean) => void
}
export type QuizStatus = "neutral" | "success" | "error"
export type CompletedQuizzes = { [key: string]: [boolean, number] }
export type UserStats = {
score: number
average: number[]
completed: string
}
export type QuizShareStats = { score: number; total: number }