Skip to content

Commit 6726565

Browse files
Merge branch 'master' into alexey/reo-dev
2 parents c382de9 + 49e0d08 commit 6726565

File tree

41 files changed

+546
-1567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+546
-1567
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,3 +344,7 @@ generated-versions.json
344344
docs/.vuepress/.temp/
345345
docs/.vuepress/.cache/
346346
docs/.vuepress/dist/
347+
348+
config.ts.*.mjs
349+
350+
docs/clients/grpc/**/*

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Configuration for sidebars can be found in the `/docs/.vuepress/configs/sidebar.
164164

165165
```typescript
166166
export const sidebarEn: EsSidebarOptions = {
167-
"/clients/grpc/": "structure",
167+
"/clients/": "structure",
168168
"/cloud/": "structure",
169169
}
170170
```

docs/.vuepress/client.ts

Lines changed: 61 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
1-
import {defineClientConfig, useRoute} from 'vuepress/client';
21
import "iconify-icon";
32
import {onMounted} from "vue";
4-
import type {RouteLocationNormalized, Router} from "vue-router";
3+
import type {RouteLocationNormalized} from "vue-router";
4+
import {defineClientConfig, useRoute} from 'vuepress/client';
55
import CloudBanner from "./components/CloudBanner.vue";
6+
import ClientsGrid from "./components/ClientsGrid.vue";
67
import KapaWidget from './components/KapaWidget.vue';
78
import UserFeedback from './components/TocWithFeedback';
8-
import {usePostHog} from "./lib/usePosthog";
99
import SidebarLayout from "./layouts/SidebarLayout.vue";
10+
import {usePostHog} from "./lib/usePosthog";
1011

11-
declare const __VERSIONS__: { latest: string, selected: string, all: string[] }
12+
declare const __VERSIONS__: {
13+
latest: string,
14+
selected: string,
15+
all: {
16+
id: string,
17+
group: string,
18+
basePath: string,
19+
versions: {
20+
version: string,
21+
path: string,
22+
startPage: string,
23+
preview?: boolean,
24+
deprecated?: boolean,
25+
hide?: boolean
26+
}[]
27+
}[]
28+
}
1229

1330
const storageKey = "VUEPRESS_TAB_STORE";
1431

32+
const clients = ":lang(dotnet|golang|java|node|python|rust)"
33+
1534
const findMetaKey = (record: any[], key: string) => {
1635
if (record[0] !== "meta") return null;
1736
const data = record[1];
@@ -31,15 +50,6 @@ const findEsMeta = (route) => {
3150
}
3251
}
3352

34-
// interface ClientConfig {
35-
// enhance?: (context: {
36-
// app: any;
37-
// router: Router;
38-
// siteData: any;
39-
// }) => void | Promise<void>;
40-
// setup?: () => void;
41-
// }
42-
4353
const removeHtml = (path: string) => path.replace(".html", "");
4454

4555
const reload = () => {
@@ -64,9 +74,9 @@ export default defineClientConfig({
6474
},
6575
enhance({app, router, _}) {
6676
app.component("CloudBanner", CloudBanner);
77+
app.component("ClientsGrid", ClientsGrid);
6778
app.component("KapaWidget", KapaWidget);
6879
app.component("UserFeedback", UserFeedback);
69-
const apiPath = __VERSIONS__.latest.replace("server", "http-api");
7080
const addFixedRoute = (from: string, to: string) => router.addRoute({
7181
path: from, redirect: _ => {
7282
reload();
@@ -83,7 +93,7 @@ export default defineClientConfig({
8393
});
8494

8595
// Router configuration
86-
addFixedRoute("/http-api/", `${apiPath}/introduction`);
96+
addFixedRoute("/server/http-api/", `/${__VERSIONS__.latest}/http-api/introduction`);
8797
addFixedRoute("/cloud/", `/cloud/introduction.html`);
8898
router.afterEach(() => {
8999
setTimeout(() => { // to ensure this runs after DOM updates
@@ -102,18 +112,46 @@ export default defineClientConfig({
102112
}
103113
}, 0);
104114
});
105-
const operatorLatest = __VERSIONS__.all.filter(x => x.id == 'kubernetes-operator')[0].versions[0].version;
115+
const operatorLatest = __VERSIONS__.all.filter(x => x.id === 'kubernetes-operator')[0].versions[0].version;
106116
addDynamicRoute("/server/kubernetes-operator", to => `/server/kubernetes-operator/${operatorLatest}/getting-started/`);
107117
addDynamicRoute("/server/kubernetes-operator/:version", to => `/server/kubernetes-operator/${to.params.version}/getting-started/`);
108118

119+
// Clients routes
120+
addFixedRoute(`/clients/grpc/:pathMatch(.*)*`, "/clients/");
121+
122+
addDynamicRoute(`/clients/${clients}/latest/:pathMatch(.*)*`, to => {
123+
const latestVersion = __VERSIONS__.all.find(x => x.id === `${to.params.lang}-client`)?.versions[0]
124+
return `/clients/${to.params.lang}/${latestVersion?.version}/${to.params.pathMatch}`;
125+
});
126+
addDynamicRoute(`/clients/${clients}/latest`, to => {
127+
const latestVersion = __VERSIONS__.all.find(x => x.id === `${to.params.lang}-client`)?.versions[0]
128+
return `/clients/${to.params.lang}/${latestVersion?.version}/${latestVersion?.startPage}`;
129+
});
130+
addDynamicRoute(`/clients/${clients}/legacy/:version`, to => {
131+
const version = to.params.version;
132+
const latestVersion = __VERSIONS__.all.find(x => x.id === `${to.params.lang}-client`)?.versions.find(v => v.path === `legacy/${version}`)
133+
return `/clients/${to.params.lang}/legacy/${to.params.version}/${latestVersion?.startPage}`;
134+
});
135+
addDynamicRoute(`/clients/${clients}/legacy`, to => {
136+
const latestVersion = __VERSIONS__.all.find(x => x.id === `${to.params.lang}-client`)?.versions.find(v => v.path.startsWith('legacy/'))
137+
return `/clients/${to.params.lang}/${latestVersion?.path}/${latestVersion?.startPage}`;
138+
})
139+
addDynamicRoute(`/clients/${clients}/:version`, to => {
140+
const version = to.params.version;
141+
const latestVersion = __VERSIONS__.all.find(x => x.id === `${to.params.lang}-client`)?.versions.find(v => v.path === version)
142+
return `/clients/${to.params.lang}/${version}/${latestVersion?.startPage}`;
143+
});
144+
addDynamicRoute(`/clients/${clients}`, to => {
145+
const latestVersion = __VERSIONS__.all.find(x => x.id === `${to.params.lang}-client`)?.versions[0]
146+
return `/clients/${to.params.lang}/${latestVersion?.path}/${latestVersion?.startPage}`;
147+
})
148+
149+
150+
// Add fixed routes for server versions because they don't use the same sidebar structure as the other versions
151+
addFixedRoute("/server/v22.10", "/server/v22.10/introduction.html");
152+
addFixedRoute("/server/v5", "/server/v5/introduction.html");
153+
109154
addDynamicRoute("/server/:version", to => `/server/${to.params.version}/quick-start/`);
110-
addDynamicRoute('/client/:lang',
111-
to => {
112-
const lang = to.params.lang === "csharp" ? "C#" : to.params.lang;
113-
const stored = JSON.parse(localStorage.getItem(storageKey) ?? "{}");
114-
localStorage.setItem(storageKey, JSON.stringify({...stored, code: lang}));
115-
return '/clients/grpc/getting-started.html';
116-
});
117155
addDynamicRoute('/latest/:pathMatch(.*)*', to => to.path.replace(/^\/latest/, `/${__VERSIONS__.latest}`));
118156
addFixedRoute("/server/latest", `/${__VERSIONS__.latest}/quick-start/`);
119157
addFixedRoute("/latest", `/${__VERSIONS__.latest}/quick-start/`);
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<script setup lang="ts">
2+
import { useRouter } from 'vue-router'
3+
4+
interface Client {
5+
id: string
6+
name: string
7+
icon: string
8+
path: string
9+
}
10+
11+
const router = useRouter()
12+
13+
const clients: Client[] = [
14+
{
15+
id: 'dotnet-client',
16+
name: '.NET',
17+
icon: 'dotnet',
18+
path: '/clients/dotnet/latest'
19+
},
20+
{
21+
id: 'java-client',
22+
name: 'Java',
23+
icon: 'java',
24+
path: '/clients/java/latest'
25+
},
26+
{
27+
id: 'node-client',
28+
name: 'Node.js',
29+
icon: 'nodejs',
30+
path: '/clients/node/latest'
31+
},
32+
{
33+
id: 'python-client',
34+
name: 'Python',
35+
icon: 'python',
36+
path: '/clients/python/latest'
37+
},
38+
{
39+
id: 'golang-client',
40+
name: 'Go',
41+
icon: 'go',
42+
path: '/clients/golang/latest'
43+
},
44+
{
45+
id: 'rust-client',
46+
name: 'Rust',
47+
icon: 'rust',
48+
path: '/clients/rust/latest'
49+
}
50+
]
51+
52+
const navigate = (client: Client): void => {
53+
router.push(client.path)
54+
}
55+
</script>
56+
57+
<template>
58+
<div class="clients-grid">
59+
<div class="grid">
60+
<div
61+
v-for="client in clients"
62+
:key="client.id"
63+
class="client-card"
64+
@click="navigate(client)"
65+
>
66+
<div class="client-icon">
67+
<img
68+
:src="`https://skillicons.dev/icons?i=${client.icon}`"
69+
:alt="client.name"
70+
class="skill-icon"
71+
/>
72+
</div>
73+
<p>{{ client.name }}</p>
74+
</div>
75+
</div>
76+
</div>
77+
</template>
78+
79+
<style lang="scss" scoped>
80+
.clients-grid {
81+
padding: 2rem 0;
82+
}
83+
84+
.grid {
85+
display: grid;
86+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
87+
gap: 1.5rem;
88+
max-width: 1200px;
89+
}
90+
91+
.client-card {
92+
background: var(--vp-c-bg-soft);
93+
border: 1px solid var(--vp-c-border);
94+
border-radius: 12px;
95+
padding: 2rem;
96+
text-align: center;
97+
cursor: pointer;
98+
position: relative;
99+
overflow: hidden;
100+
101+
p {
102+
margin: 0;
103+
color: var(--vp-c-text-2);
104+
font-size: 0.95rem;
105+
line-height: 1.5;
106+
text-align: center;
107+
}
108+
}
109+
110+
.client-icon {
111+
margin-bottom: 1.5rem;
112+
display: flex;
113+
justify-content: center;
114+
align-items: center;
115+
}
116+
117+
.skill-icon {
118+
width: 48px;
119+
height: 48px;
120+
pointer-events: none;
121+
}
122+
123+
.dark .client-card {
124+
background: var(--vp-c-bg-alt);
125+
}
126+
127+
@media (max-width: 768px) {
128+
.grid {
129+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
130+
gap: 1.5rem;
131+
padding: 0 0.5rem;
132+
}
133+
134+
.client-card {
135+
padding: 1.5rem;
136+
}
137+
}
138+
139+
@media (max-width: 480px) {
140+
.grid {
141+
grid-template-columns: 1fr;
142+
}
143+
}
144+
</style>

docs/.vuepress/components/VersionDropdown.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ const latestVersion = computed(() => props.versions[0]?.version);
2121
const currentVersions = computed(() => props.versions.filter(v => !v.deprecated && !v.hide));
2222
const deprecatedVersions = computed(() => props.versions.filter(v => v.deprecated && !v.hide));
2323
24-
watch(() => props.current, (newCurrent) => selectedVersion.value = newCurrent);
24+
watch(() => props.current, (newCurrent) => {
25+
selectedVersion.value = newCurrent;
26+
});
2527
2628
const toggleDropdown = (): void => {
2729
isOpen.value = !isOpen.value;
@@ -32,8 +34,13 @@ const closeDropdown = (): void => {
3234
}
3335
3436
const handleVersionSelect = (version: VersionDetail): void => {
35-
const base = route.path.split('/').filter(seg => seg)[0];
36-
router.replace(`/${base}/${version.path}/${version.startPage}`);
37+
const currentVersionPath = `/${props.current.path}/`;
38+
const newVersionPath = `/${version.path}/`;
39+
40+
if (route.path.includes(currentVersionPath)) {
41+
const basePart = route.path.split(currentVersionPath)[0];
42+
router.replace(`${basePart}${newVersionPath}${version.startPage}`);
43+
}
3744
3845
closeDropdown();
3946
}

docs/.vuepress/config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,10 @@ export default defineUserConfig({
4949
extendsMarkdown: md => {
5050
md.use(replaceLinkPlugin, {
5151
replaceLink: (link: string, _) => link
52-
.replace("@server/", "/server/{version}/")
52+
.replace("@server/", `/${ver.latest}/`)
5353
.replace("@clients/grpc/", "/clients/grpc/")
5454
.replace("@client/dotnet/5.0/", "/clients/tcp/dotnet/21.2/")
5555
.replace("@httpapi/data/", projectionSamplesPath)
56-
.replace("@httpapi/", "/server/v5/http-api/")
5756
// Add tutorial and use case redirects
5857
.replace(/^\/tutorials\/(.*)/, "/dev-center/tutorials/$1")
5958
.replace(/^\/getting-started\/use-cases\/(.*)\/tutorial-([1-5])\.(md|html)/, "/dev-center/use-cases/$1/tutorial/tutorial-$2.$3")

docs/.vuepress/configs/navbar.ts

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@ import type {NavbarOptions} from "vuepress-theme-hope";
22
import {instance as ver} from "../lib/versioning";
33

44
export const navbarEn: NavbarOptions = [
5-
{
6-
text: "Getting Started",
7-
link: "/getting-started/introduction.html",
8-
},
9-
{
10-
text: "Kurrent Cloud",
11-
link: "/cloud/introduction",
12-
},
5+
{text: "Getting Started", link: "/getting-started/introduction.html"},
6+
{text: "Kurrent Cloud", link: "/cloud/introduction"},
137
{
148
text: "KurrentDB",
159
children: [
@@ -23,28 +17,30 @@ export const navbarEn: NavbarOptions = [
2317
{
2418
text: "Clients",
2519
children: [
26-
{text: "KurrentDB clients", link: "/clients/grpc/getting-started"},
27-
],
20+
{text: ".NET", link: "/clients/dotnet/"},
21+
{text: "Python", link: "/clients/python/"},
22+
{text: "Node.js", link: "/clients/node/"},
23+
{text: "Java", link: "/clients/java/"},
24+
{text: "Go", link: "/clients/golang/"},
25+
{text: "Rust", link: "/clients/rust/"},
26+
]
2827
},
2928
{
3029
text: "Deprecated",
3130
children: [{text: "Legacy TCP clients", link: "/clients/tcp/"}],
32-
},
31+
}
3332
],
3433
},
35-
3634
{
3735
text: "Developer Resources",
38-
children: [
39-
{
40-
text: "Tutorials & Use cases",
41-
link: "/dev-center/",
42-
},
43-
{text: "Community forum", link: "https://discuss.kurrent.io/"},
44-
{text: "Community Discord ", link: "https://discord.gg/Phn9pmCw3t"},
45-
{text: "Blogs", link: "https://www.kurrent.io/blog"},
46-
{text: "Webinars", link: "https://www.kurrent.io/webinars"},
47-
{text: "Kurrent Academy", link: "https://academy.kurrent.io"},
48-
],
49-
},
36+
children:
37+
[
38+
{text: "Tutorials & Use cases", link: "/dev-center/"},
39+
{text: "Community forum", link: "https://discuss.kurrent.io/"},
40+
{text: "Community Discord ", link: "https://discord.gg/Phn9pmCw3t"},
41+
{text: "Blogs", link: "https://www.kurrent.io/blog"},
42+
{text: "Webinars", link: "https://www.kurrent.io/webinars"},
43+
{text: "Kurrent Academy", link: "https://academy.kurrent.io"},
44+
],
45+
}
5046
];

0 commit comments

Comments
 (0)