Skip to content

Commit

Permalink
Merge pull request #184 from Telegram-Mini-Apps/feature/split-docs
Browse files Browse the repository at this point in the history
Feature/split docs
  • Loading branch information
heyqbnk authored Nov 17, 2023
2 parents 969e837 + 3a59bfc commit 833ebff
Show file tree
Hide file tree
Showing 58 changed files with 2,007 additions and 257 deletions.
197 changes: 13 additions & 184 deletions apps/docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { defineConfig } from 'vitepress';

import { packagesNavItem, packagesSidebar } from './packages';
import { platformNavItem, platformSidebar } from './platform';

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: 'Telegram Mini Apps',
Expand All @@ -12,17 +15,6 @@ export default defineConfig({
label: 'English',
lang: 'en',
},
// ru: {
// label: 'Русский',
// lang: 'ru',
// description: 'Документация, покрывающая все аспекты платформы Telegram - Telegram Mini Apps.',
// themeConfig: {
// editLink: {
// text: 'Редактировать эту страницу на GitHub',
// pattern: 'https://github.com/telegram-mini-apps/tma.js/edit/master/apps/docs/src/:path',
// },
// },
// },
},

// Show when each page content was last updated.
Expand Down Expand Up @@ -64,187 +56,24 @@ export default defineConfig({
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'Documentation', link: '/about-platform' },
platformNavItem,
packagesNavItem,
],

// https://vitepress.dev/reference/default-theme-sidebar
sidebar: [
{
text: 'Common information',
items: [
{ text: 'About platform', link: '/about-platform' },
{ text: 'Test environment', link: '/test-environment' },
],
},

{
text: 'Apps communication',
items: [
{ text: 'Flow definition', link: '/apps-communication/flow-definition' },
{ text: 'Methods', link: '/apps-communication/methods' },
{ text: 'Events', link: '/apps-communication/events' },
],
},

{
text: 'Launch parameters',
items: [
{ text: 'Common information', link: '/launch-parameters/common-information' },
{ text: 'Init data', link: '/launch-parameters/init-data' },
],
},

{
text: 'Functionality',
items: [
{ text: 'Closing behavior', link: '/functionality/closing-behavior' },
{ text: 'Haptic feedback', link: '/functionality/haptic-feedback' },
{ text: 'Theming', link: '/functionality/theming' },
{ text: 'Viewport', link: '/functionality/viewport' },
],
},

{
text: 'UI',
items: [
{ text: 'Back Button', link: '/ui/back-button' },
{ text: 'Main Button', link: '/ui/main-button' },
{ text: 'Popup', link: '/ui/popup' },
{ text: 'Settings Button', link: '/ui/settings-button' },
],
},

{
text: 'Packages',
items: [
{
text: 'TypeScript',
collapsed: true,
items: [
{ text: '@tma.js/bridge', link: '/packages/typescript/tma-js-bridge' },
{
text: '@tma.js/init-data',
collapsed: true,
items: [
{ text: 'About', link: '/packages/typescript/tma-js-init-data/about' },
{ text: 'InitData', link: '/packages/typescript/tma-js-init-data/init-data' },
{ text: 'Chat', link: '/packages/typescript/tma-js-init-data/chat' },
{ text: 'User', link: '/packages/typescript/tma-js-init-data/user' },
],
},
{
text: '@tma.js/init-data-node',
link: '/packages/typescript/tma-js-init-data-node',
},
{ text: '@tma.js/launch-params', link: '/packages/typescript/tma-js-launch-params' },
{ text: '@tma.js/theme-params', link: '/packages/typescript/tma-js-theme-params' },
{ text: '@tma.js/navigation', link: '/packages/typescript/tma-js-navigation' },
{
text: '@tma.js/sdk',
collapsed: true,
items: [
{ text: 'About', link: '/packages/typescript/tma-js-sdk/about' },
{
text: 'Components',
collapsed: true,
items: [
{
text: 'BackButton',
link: '/packages/typescript/tma-js-sdk/components/back-button',
},
{
text: 'ClosingBehavior',
link: '/packages/typescript/tma-js-sdk/components/closing-behaviour',
},
{
text: 'HapticFeedback',
link: '/packages/typescript/tma-js-sdk/components/haptic-feedback',
},
{
text: 'InitData',
link: '/packages/typescript/tma-js-sdk/components/init-data',
},
{
text: 'MainButton',
link: '/packages/typescript/tma-js-sdk/components/main-button',
},
{
text: 'Popup',
link: '/packages/typescript/tma-js-sdk/components/popup',
},
{
text: 'QRScanner',
link: '/packages/typescript/tma-js-sdk/components/qr-scanner',
},
{
text: 'ThemeParams',
link: '/packages/typescript/tma-js-sdk/components/theme-params',
},
{
text: 'Viewport',
link: '/packages/typescript/tma-js-sdk/components/viewport',
},
// TODO: Rename?
{
text: 'WebApp',
link: '/packages/typescript/tma-js-sdk/components/web-app',
},
],
},
],
},
{ text: '@tma.js/sdk-react', link: '/packages/typescript/tma-js-sdk-react' },
{ text: '@tma.js/sdk-solid', link: '/packages/typescript/tma-js-sdk-solid' },
],
},
{
text: 'GoLang',
collapsed: true,
items: [
{ text: 'init-data-golang', link: '/packages/golang/init-data-golang' },
],
},
],
},

{
text: 'Guides',
items: [
{ text: 'Creating new app', link: '/guides/creating-new-app' },
],
},
],
sidebar: {
...packagesSidebar,
...platformSidebar,
},

socialLinks: [
{ icon: 'github', link: 'https://github.com/telegram-mini-apps' },
],
socialLinks: [{
icon: 'github',
link: 'https://github.com/telegram-mini-apps',
}],

search: {
// TODO: Probably replace with Algolia.
provider: 'local',
// options: {
// locales: {
// ru: {
// translations: {
// button: {
// buttonText: 'Поиск',
// buttonAriaLabel: 'Поиск',
// },
// modal: {
// noResultsText: 'Не удалось ничего найти по запросу',
// backButtonTitle: 'закрыть',
// displayDetails: 'Отобразить подробные данные',
// resetButtonTitle: 'Сбросить',
// footer: {
// selectText: 'выбрать',
// navigateText: 'для навигации',
// closeText: 'закрыть',
// },
// },
// },
// },
// },
// },
},
},
});
103 changes: 103 additions & 0 deletions apps/docs/.vitepress/packages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
function prefixed(value: string): string {
return `/packages${value}`;
}

export const packagesNavItem = {
text: 'Packages',
link: prefixed('/typescript/tma-js-bridge'),
};

export const packagesSidebar = {
[prefixed('/')]: [
{
text: 'TypeScript',
items: [
{ text: '@tma.js/bridge', link: prefixed('/typescript/tma-js-bridge') },
{
text: '@tma.js/init-data',
collapsed: true,
items: [
{ text: 'About', link: prefixed('/typescript/tma-js-init-data/about') },
{ text: 'InitData', link: prefixed('/typescript/tma-js-init-data/init-data') },
{ text: 'Chat', link: prefixed('/typescript/tma-js-init-data/chat') },
{ text: 'User', link: prefixed('/typescript/tma-js-init-data/user') },
],
},
{
text: '@tma.js/launch-params',
link: prefixed('/typescript/tma-js-launch-params'),
},
{ text: '@tma.js/theme-params', link: prefixed('/typescript/tma-js-theme-params') },
{ text: '@tma.js/navigation', link: prefixed('/typescript/tma-js-navigation') },
{
text: '@tma.js/sdk',
collapsed: true,
items: [
{ text: 'About', link: prefixed('/typescript/tma-js-sdk/about') },
{
text: 'Components',
collapsed: true,
items: [
{
text: 'BackButton',
link: prefixed('/typescript/tma-js-sdk/components/back-button'),
},
{
text: 'ClosingBehavior',
link: prefixed('/typescript/tma-js-sdk/components/closing-behaviour'),
},
{
text: 'HapticFeedback',
link: prefixed('/typescript/tma-js-sdk/components/haptic-feedback'),
},
{
text: 'InitData',
link: prefixed('/typescript/tma-js-sdk/components/init-data'),
},
{
text: 'MainButton',
link: prefixed('/typescript/tma-js-sdk/components/main-button'),
},
{
text: 'Popup',
link: prefixed('/typescript/tma-js-sdk/components/popup'),
},
{
text: 'QRScanner',
link: prefixed('/typescript/tma-js-sdk/components/qr-scanner'),
},
{
text: 'ThemeParams',
link: prefixed('/typescript/tma-js-sdk/components/theme-params'),
},
{
text: 'Viewport',
link: prefixed('/typescript/tma-js-sdk/components/viewport'),
},
// TODO: Rename?
{
text: 'WebApp',
link: prefixed('/typescript/tma-js-sdk/components/web-app'),
},
],
},
],
},
{ text: '@tma.js/sdk-react', link: prefixed('/typescript/tma-js-sdk-react') },
{ text: '@tma.js/sdk-solid', link: prefixed('/typescript/tma-js-sdk-solid') },
],
},
{
text: 'Node',
items: [
{ text: '@tma.js/init-data-node', link: prefixed('/node/tma-js-init-data-node') },
],
},
{
text: 'GoLang',
items: [
{ text: 'init-data-golang', link: prefixed('/golang/init-data-golang') },
],
},
],
};
64 changes: 64 additions & 0 deletions apps/docs/.vitepress/platform.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
function prefixed(value: string): string {
return `/platform${value}`;
}

export const platformNavItem = {
text: 'Platform',
link: prefixed('/about-platform'),
};

export const platformSidebar = {
[prefixed('/')]: [
{
text: 'Common information',
items: [
{ text: 'About platform', link: prefixed('/about-platform') },
{ text: 'Test environment', link: prefixed('/test-environment') },
],
},

{
text: 'Apps communication',
items: [
{ text: 'Flow definition', link: prefixed('/apps-communication/flow-definition') },
{ text: 'Methods', link: prefixed('/apps-communication/methods') },
{ text: 'Events', link: prefixed('/apps-communication/events') },
],
},

{
text: 'Launch parameters',
items: [
{ text: 'Common information', link: prefixed('/launch-parameters/common-information') },
{ text: 'Init data', link: prefixed('/launch-parameters/init-data') },
],
},

{
text: 'Functionality',
items: [
{ text: 'Closing behavior', link: prefixed('/functionality/closing-behavior') },
{ text: 'Haptic feedback', link: prefixed('/functionality/haptic-feedback') },
{ text: 'Theming', link: prefixed('/functionality/theming') },
{ text: 'Viewport', link: prefixed('/functionality/viewport') },
],
},

{
text: 'UI',
items: [
{ text: 'Back Button', link: prefixed('/ui/back-button') },
{ text: 'Main Button', link: prefixed('/ui/main-button') },
{ text: 'Popup', link: prefixed('/ui/popup') },
{ text: 'Settings Button', link: prefixed('/ui/settings-button') },
],
},

{
text: 'Guides',
items: [
{ text: 'Creating new app', link: prefixed('/guides/creating-new-app') },
],
},
],
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 833ebff

Please sign in to comment.