Skip to content

Commit 1fe2a67

Browse files
committed
Merge branch 'service-update' into 392-draft-config-reference
Signed-off-by: Dmitry Balashov <a.marcius26@gmail.com>
2 parents e2ecaa7 + cd0cede commit 1fe2a67

32 files changed

+1471
-465
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
VITE_FEEDBACK_URL=https://164.92.190.45/feedback/form
2+
VITE_COMPAT_MATRIX_URL=https://docs-compat.iroha2.tachi.soramitsu.co.jp/compat-matrix

.github/workflows/gh-pages-deploy.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ jobs:
4949
run: pnpm test
5050

5151
- name: Build VitePress
52-
run: pnpm build
52+
run: |
53+
pnpm build
54+
pnpm cli validate-links .vitepress/dist --public-path $PUBLIC_PATH
5355
env:
5456
PUBLIC_PATH: /iroha-2-docs/
57+
# chalk has a color detection bug
58+
FORCE_COLOR: 2
5559

5660
- name: Push static content into master:gh-pages
5761
working-directory: .vitepress/dist
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Label the documentation issues
2+
on:
3+
issues:
4+
types: [opened]
5+
jobs:
6+
label_issues:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
issues: write
10+
steps:
11+
- uses: actions/github-script@v6
12+
with:
13+
script: |
14+
github.rest.issues.addLabels({
15+
issue_number: context.issue.number,
16+
owner: context.repo.owner,
17+
repo: context.repo.repo,
18+
labels: ["iroha2", "documentation"]
19+
})

.github/workflows/pull-request-ci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,9 @@ jobs:
5050

5151
- name: Build
5252
run: pnpm build
53+
54+
- name: Validate links
55+
run: pnpm cli validate-links .vitepress/dist
56+
env:
57+
# chalk has a color detection bug
58+
FORCE_COLOR: 2

.vitepress/config.mts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { resolve } from 'path'
66
import ViteSvgLoader from 'vite-svg-loader'
77
import ViteUnoCSS from 'unocss/vite'
88
import { mermaid } from './md-mermaid'
9+
import { katex } from '@mdit/plugin-katex'
910

1011
function getNav(): DefaultTheme.NavItem[] {
1112
return [
@@ -93,6 +94,10 @@ function getGuideSidebar(): DefaultTheme.SidebarItem[] {
9394
text: 'JavaScript',
9495
link: '/guide/javascript',
9596
},
97+
{
98+
text: 'Compatibility Matrix',
99+
link: '/guide/compatibility-matrix',
100+
},
96101
],
97102
},
98103
],
@@ -348,11 +353,18 @@ export default defineConfig({
348353
gtag('config', 'G-D6ETK9TN47');
349354
`,
350355
],
356+
// KaTeX stylesheet
357+
['link', { rel: 'stylesheet', href: 'https://esm.sh/katex@0.16.8/dist/katex.min.css' }],
351358
],
352359

353360
markdown: {
354361
async config(md) {
355-
md.use(footnote).use(mermaid)
362+
md.use(footnote)
363+
.use(mermaid)
364+
// Note: Since vitepress@1.0.0-rc.14, it supports MathJax natively with `markdown.math = true`:
365+
// https://github.com/vuejs/vitepress/pull/2977
366+
// Although KaTeX is more efficient, we might consider removing it in the future.
367+
.use(katex)
356368
},
357369
},
358370

@@ -379,7 +391,9 @@ export default defineConfig({
379391
text: 'Edit this page on GitHub',
380392
},
381393

382-
// lastUpdatedText: 'Last Updated',
394+
lastUpdated: {
395+
text: 'Last Updated',
396+
},
383397

384398
sidebar: {
385399
'/guide/': getGuideSidebar(),
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<script setup lang="ts">
2+
import { useTask } from '@vue-kakuyaku/core'
3+
import { computed } from 'vue'
4+
import CompatibilityMatrixTableIcon, { type Status } from './CompatibilityMatrixTableIcon.vue'
5+
6+
interface Matrix {
7+
included_sdks: MatrixSdkDeclaration[]
8+
stories: MatrixStory[]
9+
}
10+
11+
interface MatrixSdkDeclaration {
12+
name: string
13+
}
14+
15+
interface MatrixStory {
16+
name: string
17+
results: MatrixStoryResult[]
18+
}
19+
20+
interface MatrixStoryResult {
21+
status: Status
22+
}
23+
24+
const COMPAT_MATRIX_URL: string = import.meta.env.VITE_COMPAT_MATRIX_URL
25+
26+
const task = useTask<Matrix>(
27+
() => {
28+
return fetch(COMPAT_MATRIX_URL, {}).then((x) => x.json())
29+
},
30+
{ immediate: true },
31+
)
32+
33+
const table = computed(() => {
34+
if (!task.state.fulfilled) return null
35+
const data = task.state.fulfilled.value
36+
37+
const headers = ['Story', ...data.included_sdks.map((x) => x.name)]
38+
const rows = data.stories.map((story) => {
39+
return { story: story.name, results: story.results.map((x) => x.status) }
40+
})
41+
42+
return { headers, rows }
43+
})
44+
</script>
45+
46+
<template>
47+
<table v-if="table">
48+
<thead>
49+
<th
50+
v-for="name in table.headers"
51+
:key="name"
52+
>
53+
{{ name }}
54+
</th>
55+
</thead>
56+
<tbody>
57+
<tr
58+
v-for="(row, i) in table.rows"
59+
:key="i"
60+
>
61+
<td>{{ row.story }}</td>
62+
<td
63+
v-for="(status, j) in row.results"
64+
:key="j"
65+
class="status-cell"
66+
:title="`Status: ${status}`"
67+
>
68+
<CompatibilityMatrixTableIcon :status="status" />
69+
</td>
70+
</tr>
71+
</tbody>
72+
</table>
73+
74+
<div
75+
v-else
76+
class="border rounded p-2 my-4"
77+
>
78+
<div
79+
v-if="task.state.pending"
80+
class="flex space-x-2 items-center"
81+
>
82+
<span>Loading data...</span>
83+
</div>
84+
<div v-else-if="task.state.rejected">
85+
Failed to load compatibility matrix data: {{ task.state.rejected.reason }}
86+
</div>
87+
</div>
88+
</template>
89+
90+
<style lang="scss" scoped>
91+
.border {
92+
border-color: var(--vp-c-border);
93+
}
94+
95+
td.status-cell {
96+
font-size: 1.3em;
97+
padding: 0;
98+
99+
svg {
100+
margin-left: auto;
101+
margin-right: auto;
102+
}
103+
}
104+
</style>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<script setup lang="ts">
2+
import IconCheck from './icons/IconCheck.vue'
3+
import IconCancelOutlineRounded from './icons/IconCancelOutlineRounded.vue'
4+
import IconQuestionMarkRounded from './icons/IconQuestionMarkRounded.vue'
5+
import { computed } from 'vue'
6+
7+
export type Status = 'ok' | 'failed' | 'no-data'
8+
9+
const props = defineProps<{
10+
status: Status
11+
}>()
12+
13+
// eslint-disable-next-line vue/return-in-computed-property
14+
const chosenComponent = computed(() => {
15+
switch (props.status) {
16+
case 'ok':
17+
return IconCheck
18+
case 'failed':
19+
return IconCancelOutlineRounded
20+
case 'no-data':
21+
return IconQuestionMarkRounded
22+
}
23+
})
24+
</script>
25+
26+
<template>
27+
<component
28+
:is="chosenComponent"
29+
:data-status="status"
30+
class="compat-matrix-table-icon"
31+
/>
32+
</template>
33+
34+
<style lang="scss">
35+
svg.compat-matrix-table-icon {
36+
&[data-status='ok'] {
37+
color: var(--vp-c-green);
38+
}
39+
40+
&[data-status='failed'] {
41+
color: var(--vp-c-red);
42+
}
43+
44+
&[data-status='no-data'] {
45+
color: var(--vp-c-yellow);
46+
}
47+
}
48+
</style>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<svg
3+
xmlns="http://www.w3.org/2000/svg"
4+
width="1em"
5+
height="1em"
6+
viewBox="0 0 24 24"
7+
>
8+
<path
9+
fill="currentColor"
10+
d="m12 13.4l2.9 2.9q.275.275.7.275t.7-.275q.275-.275.275-.7t-.275-.7L13.4 12l2.9-2.9q.275-.275.275-.7t-.275-.7q-.275-.275-.7-.275t-.7.275L12 10.6L9.1 7.7q-.275-.275-.7-.275t-.7.275q-.275.275-.275.7t.275.7l2.9 2.9l-2.9 2.9q-.275.275-.275.7t.275.7q.275.275.7.275t.7-.275l2.9-2.9Zm0 8.6q-2.075 0-3.9-.788t-3.175-2.137q-1.35-1.35-2.137-3.175T2 12q0-2.075.788-3.9t2.137-3.175q1.35-1.35 3.175-2.137T12 2q2.075 0 3.9.788t3.175 2.137q1.35 1.35 2.138 3.175T22 12q0 2.075-.788 3.9t-2.137 3.175q-1.35 1.35-3.175 2.138T12 22Zm0-2q3.35 0 5.675-2.325T20 12q0-3.35-2.325-5.675T12 4Q8.65 4 6.325 6.325T4 12q0 3.35 2.325 5.675T12 20Zm0-8Z"
11+
/>
12+
</svg>
13+
</template>
14+
15+
<script lang="ts">
16+
export default {
17+
name: 'MaterialSymbolsCancelOutlineRounded',
18+
}
19+
</script>

.vitepress/theme/components/icons/IconCheck.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
>
88
<path
99
fill="currentColor"
10-
d="m10.6 16.6l7.05-7.05l-1.4-1.4l-5.65 5.65l-2.85-2.85l-1.4 1.4l4.25 4.25ZM12 22q-2.075 0-3.9-.788t-3.175-2.137q-1.35-1.35-2.137-3.175T2 12q0-2.075.788-3.9t2.137-3.175q1.35-1.35 3.175-2.137T12 2q2.075 0 3.9.788t3.175 2.137q1.35 1.35 2.138 3.175T22 12q0 2.075-.788 3.9t-2.137 3.175q-1.35 1.35-3.175 2.138T12 22Zm0-2q3.35 0 5.675-2.325T20 12q0-3.35-2.325-5.675T12 4Q8.65 4 6.325 6.325T4 12q0 3.35 2.325 5.675T12 20Zm0-8Z"
10+
d="m10.6 13.8l-2.15-2.15q-.275-.275-.7-.275t-.7.275q-.275.275-.275.7t.275.7L9.9 15.9q.3.3.7.3t.7-.3l5.65-5.65q.275-.275.275-.7t-.275-.7q-.275-.275-.7-.275t-.7.275L10.6 13.8ZM12 22q-2.075 0-3.9-.788t-3.175-2.137q-1.35-1.35-2.137-3.175T2 12q0-2.075.788-3.9t2.137-3.175q1.35-1.35 3.175-2.137T12 2q2.075 0 3.9.788t3.175 2.137q1.35 1.35 2.138 3.175T22 12q0 2.075-.788 3.9t-2.137 3.175q-1.35 1.35-3.175 2.138T12 22Zm0-2q3.35 0 5.675-2.325T20 12q0-3.35-2.325-5.675T12 4Q8.65 4 6.325 6.325T4 12q0 3.35 2.325 5.675T12 20Zm0-8Z"
1111
/>
1212
</svg>
1313
</template>
1414

15-
<script>
15+
<script lang="ts">
1616
export default {
17-
name: 'MaterialSymbolsCheckCircleOutline',
17+
name: 'MaterialSymbolsCheckCircleOutlineRounded',
1818
}
1919
</script>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<svg
3+
xmlns="http://www.w3.org/2000/svg"
4+
width="1em"
5+
height="1em"
6+
viewBox="0 0 24 24"
7+
>
8+
<path
9+
fill="currentColor"
10+
d="M12.025 16q-.6 0-1.012-.425t-.363-1q.075-1.05.5-1.825t1.35-1.6q1.025-.9 1.563-1.563t.537-1.512q0-1.025-.687-1.7T12 5.7q-.8 0-1.363.338t-.912.837q-.35.5-.862.675t-.988-.025q-.575-.25-.787-.825t.087-1.075Q7.9 4.5 9.125 3.75T12 3q2.625 0 4.038 1.462t1.412 3.513q0 1.25-.537 2.138t-1.688 2.012q-.85.8-1.2 1.3t-.475 1.15q-.1.625-.525 1.025t-1 .4ZM12 22q-.825 0-1.413-.588T10 20q0-.825.588-1.413T12 18q.825 0 1.413.588T14 20q0 .825-.588 1.413T12 22Z"
11+
/>
12+
</svg>
13+
</template>
14+
15+
<script lang="ts">
16+
export default {
17+
name: 'MaterialSymbolsQuestionMarkRounded',
18+
}
19+
</script>

0 commit comments

Comments
 (0)