Skip to content

Commit 4671871

Browse files
committed
chore(docs): Updated docs.
1 parent e4c204e commit 4671871

27 files changed

+621
-365
lines changed

docs/app/app.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ onMounted(() => {
1616
wantedLanguage = languageCode
1717
}
1818
}
19-
locale.value = wantedLanguage
19+
locale.value = wantedLanguage as string
2020
watch (locale, newLocale => i18nCookieValue.value = newLocale)
2121
})
2222
</script>

docs/app/assets/article.scss

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@import 'colors';
2+
3+
article {
4+
counter-reset: h2-counter;
5+
6+
h2 {
7+
counter-increment: h2-counter;
8+
counter-reset: h3-counter;
9+
10+
&::before {
11+
content: counter(h2-counter, upper-roman) ". ";
12+
color: darken($primary, 10%);
13+
}
14+
}
15+
16+
h3 {
17+
counter-increment: h3-counter;
18+
19+
&::before {
20+
content: counter(h2-counter, upper-roman) ". " counter(h3-counter, lower-latin) ". ";
21+
color: darken($primary, 10%);
22+
}
23+
}
24+
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<script setup lang="ts">
22
defineProps<{ article: string }>()
3+
const markdownT = useMarkdownT()
34
</script>
45

56
<template>
67
<div class="text-center mb-4">
7-
<h1 v-html="$t(`${article}.title`)" />
8+
<h1 v-html="markdownT(`${article}.title`)" />
89
<small>
9-
<em v-html="$t(`${article}.lastUpdated`)" />
10+
<em v-html="markdownT(`${article}.lastUpdated`)" />
1011
</small>
1112
</div>
1213
</template>
Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<script setup lang="ts">
22
const props = defineProps<{
3-
error: any,
3+
error: any
44
changeTitle?: boolean
55
}>()
66
77
const errorCode = computed(() => {
8-
if (/^-?\d+$/.test(props.error.toString())) {
9-
return parseInt(props.error.toString())
10-
}
11-
if (Object.prototype.hasOwnProperty.call(props.error, 'statusCode')) {
12-
return parseInt(props.error.statusCode)
8+
if (props.error) {
9+
if (typeof props.error.toString === 'function' && /^-?\d+$/.test(props.error.toString())) {
10+
return parseInt(props.error.toString())
11+
}
12+
if (props.error.statusCode && /^-?\d+$/.test(props.error.statusCode)) {
13+
return parseInt(props.error.statusCode)
14+
}
1315
}
1416
return null
1517
})
@@ -23,17 +25,35 @@ const title = computed(() => {
2325
}
2426
return 'Error'
2527
})
28+
29+
const goBack = () => window.history.back()
2630
</script>
2731

2832
<template>
2933
<div>
30-
<h1 class="text-center" v-text="title" />
34+
<h1
35+
class="text-center"
36+
v-text="title"
37+
/>
3138
<p>
32-
You can keep browsing by heading to the <a class="underline" href="javascript:history.back()">previous page</a> or
33-
or by going on the <nuxt-link class="underline" to="/">home page</nuxt-link>.
34-
<span v-if="errorCode === 404">
35-
If you think something should be here, please <nuxt-link class="underline" to="/contact/">contact me</nuxt-link>.
36-
</span>
39+
You can keep browsing by heading to the <a
40+
class="underline"
41+
href="#"
42+
@click.prevent="goBack"
43+
>previous page</a> or
44+
or by going on the <nuxt-link
45+
class="underline"
46+
to="/"
47+
>home page</nuxt-link>.
48+
</p>
49+
<p v-if="errorCode === 404">
50+
If you think something should be here, please <nuxt-link
51+
class="underline"
52+
to="/contact/"
53+
>contact me</nuxt-link>.
3754
</p>
55+
<details v-else>
56+
<pre>{{ error }}</pre>
57+
</details>
3858
</div>
3959
</template>

docs/app/components/MobilePhone.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ $md-width: 200px;
8484
width: $speaker-original-width;
8585
height: $speaker-original-height;
8686
position: absolute;
87-
top: calc(50% + $speaker-original-height);
87+
top: calc(50% + #{$speaker-original-height});
8888
left: 50%;
8989
transform: translate(-50%, -50%);
9090
background-color: black;

docs/app/components/Store/AutoDetectButton.vue

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,16 @@ const availableOs = computed<OS[]>(() => {
4040
<template>
4141
<client-only>
4242
<div v-if="os">
43-
<div class="store-buttons">
44-
<div
43+
<div class="store-buttons mb-3">
44+
<store-button
4545
v-for="store in stores[os]"
46-
:key="`button-container-${store}`"
47-
class="button-container"
48-
>
49-
<store-button
50-
:key="`button-${store.id}`"
51-
class="mb-4"
52-
:os="os"
53-
:store="store"
54-
:available-on-text="availableOnText"
55-
:available-soon-text="availableSoonText"
56-
/>
57-
</div>
46+
:key="`store-button-${store.id}`"
47+
class="store-button mb-3"
48+
:os="os"
49+
:store="store"
50+
:available-on-text="availableOnText"
51+
:available-soon-text="availableSoonText"
52+
/>
5853
</div>
5954
<b-accordion v-if="moreButton">
6055
<b-accordion-item
@@ -64,38 +59,33 @@ const availableOs = computed<OS[]>(() => {
6459
button-class="accordion-black-button bg-black text-white"
6560
>
6661
<div class="store-buttons">
67-
<div
68-
v-for="storeOs in availableOs"
69-
:key="`button-container-${storeOs}`"
70-
class="button-container"
71-
>
62+
<template v-for="storeOs in availableOs">
7263
<store-button
7364
v-for="store in stores[storeOs]"
74-
:key="'button-' + store.id"
65+
:key="`store-button-${store.id}`"
66+
class="store-button"
7567
:os="storeOs"
7668
:store="store"
7769
:available-on-text="availableOnText"
7870
:available-soon-text="availableSoonText"
7971
/>
80-
</div>
72+
</template>
8173
</div>
8274
</b-accordion-item>
8375
</b-accordion>
8476
</div>
8577
<div v-else>
86-
<div
87-
v-for="storeOs in availableOs"
88-
:key="`button-container-${storeOs}`"
89-
>
78+
<template v-for="storeOs in availableOs">
9079
<store-button
9180
v-for="store in stores[storeOs]"
92-
:key="'button-' + store.id"
81+
:key="'store-button-' + store.id"
82+
class="store-button"
9383
:os="storeOs"
9484
:store="store"
9585
:available-on-text="availableOnText"
9686
:available-soon-text="availableSoonText"
9787
/>
98-
</div>
88+
</template>
9989
</div>
10090
<template #fallback>
10191
<spinner />
@@ -119,17 +109,10 @@ const availableOs = computed<OS[]>(() => {
119109
@import 'assets/bootstrap-mixins';
120110
121111
.store-buttons {
122-
display: flex;
123-
justify-content: space-evenly;
124-
gap: 20px;
125-
126-
.button-container {
127-
flex: 1;
128-
text-align: center;
129-
}
112+
text-align: center;
130113
131-
@include media-breakpoint-down(lg) {
132-
flex-direction: column;
114+
.store-button {
115+
margin: 10px;
133116
}
134117
}
135118
</style>

docs/app/components/Store/Button.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const tip = computed(() => {
7373
@import 'assets/bootstrap-mixins';
7474
7575
.store-button-card {
76-
max-width: 300px;
76+
max-width: min(300px, 90%);
7777
width: 100%;
7878
display: inline-block;
7979

docs/app/components/Translation/Accordion.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
type TranslationFile,
99
type TranslationData,
1010
} from '~/components/Translation/Table.vue'
11-
import type { LanguageWithData } from '~/modules/get-info-from-parent'
11+
import type { LanguageWithData } from '~~/modules/get-info-from-parent'
1212
1313
interface RawTranslationFile {
1414
fileName: string
@@ -60,12 +60,12 @@ const {
6060
const originalLanguage = await fetchTranslationFiles(props.originalLanguage)
6161
const translation = await fetchTranslationFiles(props.language)
6262
for (const fileName in originalLanguage) {
63-
const rawTranslationFile = originalLanguage[fileName]
63+
const rawTranslationFile = originalLanguage[fileName]!
6464
const data: TranslationData = {}
6565
for (const key in rawTranslationFile.data) {
6666
data[key] = {
6767
key: key,
68-
originalValue: rawTranslationFile.data[key],
68+
originalValue: rawTranslationFile.data[key]!,
6969
translatedValue: translation[fileName]?.data[key] ?? '',
7070
}
7171
}
@@ -109,10 +109,10 @@ const load = (index: number) => {
109109
const content = event.target?.result?.toString()
110110
if (content && files.value) {
111111
try {
112-
const currentData = files.value[index].data
112+
const currentData = files.value[index]!.data
113113
const data = fromJson(content, (key: string) => currentData[key]?.originalValue)
114-
files.value[index].data = data
115-
files.value[index].complete = checkComplete(data)
114+
files.value[index]!.data = data
115+
files.value[index]!.complete = checkComplete(data)
116116
}
117117
catch (ex) {
118118
console.error(ex)
@@ -131,7 +131,7 @@ const download = (index: number) => {
131131
if (!files.value) {
132132
return
133133
}
134-
const translationFile = files.value[index]
134+
const translationFile = files.value[index]!
135135
const element = document.createElement('a')
136136
element.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(generateJson(translationFile.data)))
137137
element.setAttribute('download', translationFile.fileName)
@@ -191,7 +191,7 @@ const download = (index: number) => {
191191
<b-button
192192
class="w-100 w-md-auto"
193193
variant="primary"
194-
:disabled="!files[index].complete"
194+
:disabled="!files[index]!.complete"
195195
@click="openTranslationModal(files[index])"
196196
>
197197
<icon name="bi:check-lg" />

docs/app/components/Translation/LanguageCard.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import type { BaseColorVariant } from 'bootstrap-vue-next'
3-
import type { LanguageWithData } from '~/modules/get-info-from-parent'
3+
import type { LanguageWithData } from '~~/modules/get-info-from-parent'
44
55
const props = defineProps<{
66
language: LanguageWithData
@@ -12,6 +12,8 @@ onMounted(() => {
1212
setTimeout(() => progress.value = props.language.progress, 500)
1313
})
1414
15+
const flagCode = computed<string>(() => props.language.code === 'en' ? 'gb' : props.language.code)
16+
1517
const variant = computed<keyof BaseColorVariant>(() => {
1618
if (props.language.progress >= 0.75) {
1719
return 'success'
@@ -34,7 +36,7 @@ const animate = ref<boolean>(false)
3436
<b-card class="language-card">
3537
<img
3638
class="flag"
37-
:src="`https://flagcdn.com/${language.code}.svg`"
39+
:src="`https://flagcdn.com/${flagCode}.svg`"
3840
:alt="language.name"
3941
>
4042
<b-card-text>

docs/app/components/Translation/LanguagePicker.vue

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)