Skip to content

Commit

Permalink
Add constants file (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ifropc authored Jul 14, 2023
1 parent 68c96a9 commit acaf2d3
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 39 deletions.
10 changes: 5 additions & 5 deletions docs/anchoring-assets/anchor-platform/getting_started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The easiest way to install the Anchor Platform is to pull the [docker image][anc
<CodeExample>

```bash
docker pull stellar/anchor-platform:2.0.1
docker pull stellar/anchor-platform:[platform_version]
```

</CodeExample>
Expand All @@ -30,7 +30,7 @@ Let's create a minimal compose file to get started.
version: "3.8"
services:
sep-server:
image: stellar/anchor-platform:2.0.1
image: stellar/anchor-platform:[platform_version]
command: --sep-server
ports:
- "8080:8080"
Expand All @@ -39,7 +39,7 @@ services:
volumes:
- ./config:/home
platform-server:
image: stellar/anchor-platform:2.0.1
image: stellar/anchor-platform:[platform_version]
command: --platform-server
ports:
- "8085:8085"
Expand Down Expand Up @@ -210,7 +210,7 @@ A database is only needed if using the Anchor Platform to facilitate transaction
version: "3.8"
services:
sep-server:
image: stellar/anchor-platform:2.0.1
image: stellar/anchor-platform:[platform_version]
command: --sep-server
env_file:
- ./dev.env
Expand All @@ -221,7 +221,7 @@ services:
depends_on:
- db
platform-server:
image: stellar/anchor-platform:2.0.1
image: stellar/anchor-platform:[platform_version]
command: --platform-server
env_file:
- ./dev.env
Expand Down
2 changes: 1 addition & 1 deletion docs/anchoring-assets/anchor-platform/sep24/example.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ First, let's configure the Anchor Platform to observe the Stellar network for in
# docker-compose.yml
---
stellar-observer:
image: stellar/anchor-platform:2.0.1
image: stellar/anchor-platform:[platform_version]
command: --stellar-observer
env_file:
- ./dev.env
Expand Down
6 changes: 3 additions & 3 deletions docs/anchoring-assets/anchor-platform/sep31/integration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ version: "3.8"

services:
sep-server:
image: stellar/anchor-platform:2.0.1
image: stellar/anchor-platform:[platform_version]
command: --sep-server
env_file:
- ./dev.env
Expand All @@ -40,7 +40,7 @@ services:
depends_on:
- db
platform-server:
image: stellar/anchor-platform:2.0.1
image: stellar/anchor-platform:[platform_version]
command: --platform-server
env_file:
- ./dev.env
Expand Down Expand Up @@ -193,7 +193,7 @@ The Stellar Observer monitors the Stellar ledger for payments made to your accou
services:
...
observer:
image: stellar/anchor-platform:2.0.1
image: stellar/anchor-platform:[platform_version]
command: --stellar-observer
env_file:
- ./dev.env
Expand Down
31 changes: 4 additions & 27 deletions src/components/CodeExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,7 @@ import React from 'react';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';

export const CODE_LANGS = {
bash: 'bash',
cpp: 'C++',
curl: 'cURL',
dart: 'Flutter',
flutter: 'Flutter',
docker: 'Dockerfile',
go: 'Go',
html: 'html',
kotlin: 'Kotlin',
kt: 'Kotlin',
java: 'Java',
javascript: 'JavaScript',
js: 'JavaScript',
json: 'JSON',
json5: 'JSON5',
python: 'Python',
scss: 'SCSS',
sql: 'SQL',
toml: 'TOML',
ts: 'TypeScript',
tsx: 'TSX',
typescript: 'TypeScript',
yaml: 'YAML',
};
import {CODE_LANGS, PLATFORM_VERSION} from "../constants";

export const CodeExample = ({ children }) => (
// console.log(children),
Expand All @@ -39,14 +14,16 @@ export const CodeExample = ({ children }) => (

const [, language] = className.split('-');

const platformReplace = codeProps.children.replaceAll('[platform_version]', PLATFORM_VERSION)

return (
<TabItem
key={language || index}
value={language || index}
label={CODE_LANGS[language] || 'Example'}
>
<CodeBlock language={language} showLineNumbers>
{codeProps.children}
{typeof (codeProps.children) === 'string' ? platformReplace : codeProps.children}
</CodeBlock>
</TabItem>
);
Expand Down
3 changes: 1 addition & 2 deletions src/components/WalletCodeExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
import {getCookie, walletDefaultLang} from "./LanguageSpecific";
import BrowserOnly from '@docusaurus/BrowserOnly';
import {CODE_LANGS} from "./CodeExample";
import {Exception} from "sass";
import {CODE_LANGS} from "../constants";

// TODO: when TS docs are ready set to false
const ALLOW_EMPTY_DOCS = true
Expand Down
2 changes: 1 addition & 1 deletion src/components/WalletGuideWarn.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";
import Admonition from '@theme/Admonition';
import {LanguageButtons} from "./LanguageButtons";
import {CODE_LANGS} from "./CodeExample";
import {LanguageSpecific} from "./LanguageSpecific";
import {CODE_LANGS} from "../constants";

type WalletGuideWarnProps = {
WIPLangs?: String[]
Expand Down
27 changes: 27 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export const PLATFORM_VERSION="2.1.1"

export const CODE_LANGS = {
bash: 'bash',
cpp: 'C++',
curl: 'cURL',
dart: 'Flutter',
flutter: 'Flutter',
docker: 'Dockerfile',
go: 'Go',
html: 'html',
kotlin: 'Kotlin',
kt: 'Kotlin',
java: 'Java',
javascript: 'JavaScript',
js: 'JavaScript',
json: 'JSON',
json5: 'JSON5',
python: 'Python',
scss: 'SCSS',
sql: 'SQL',
toml: 'TOML',
ts: 'TypeScript',
tsx: 'TSX',
typescript: 'TypeScript',
yaml: 'YAML',
};

0 comments on commit acaf2d3

Please sign in to comment.