Redirect users to correct installation tab based on OS (#3676)

* feat: fixes on docs website

* fix: tab

* fix: andrew issue

Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com>
This commit is contained in:
jose-donato
2022-12-05 15:15:57 +00:00
committed by GitHub
parent 9add3e60df
commit 389ecc5927
4 changed files with 42 additions and 19 deletions

View File

@@ -284,7 +284,7 @@ openbb.stocks.fa.cash(symbol = 'COST')
| Other non-cash items | 453000000 | 453000000 | 371000000 | 236000000 | 9000000 |
| Net cash provided by operating activities | 7392000000 | 7392000000 | 8958000000 | 8861000000 | 6356000000 |
| Investments in property, plant and equipment | -3891000000 | -3891000000 | -3588000000 | -2810000000 | -2998000000 |
| Acquisitions, net | 0 | 0 | 0 | -1163000000 | <NA> |
| Acquisitions, net | 0 | 0 | 0 | -1163000000 | `<NA>` |
| Purchases of investments | -1121000000 | -1121000000 | -1331000000 | -1626000000 | -1094000000 |
| Sales/maturities of investments | 1145000000 | 1145000000 | 1446000000 | 1678000000 | 1231000000 |
| Other investing activities | -48000000 | -48000000 | -62000000 | 30000000 | -4000000 |
@@ -322,7 +322,7 @@ openbb.stocks.fa.income('COST')
| Other non-cash items | 453000000 | 453000000 | 371000000 | 236000000 | 9000000 |
| Net cash provided by operating activities | 7392000000 | 7392000000 | 8958000000 | 8861000000 | 6356000000 |
| Investments in property, plant and equipment | -3891000000 | -3891000000 | -3588000000 | -2810000000 | -2998000000 |
| Acquisitions, net | 0 | 0 | 0 | -1163000000 | <NA> |
| Acquisitions, net | 0 | 0 | 0 | -1163000000 | `<NA>` |
| Purchases of investments | -1121000000 | -1121000000 | -1331000000 | -1626000000 | -1094000000 |
| Sales/maturities of investments | 1145000000 | 1145000000 | 1446000000 | 1678000000 | 1231000000 |
| Other investing activities | -48000000 | -48000000 | -62000000 | 30000000 | -4000000 |

View File

@@ -12,12 +12,12 @@ This page contains a list of projects that use the OpenBB SDK. If you have a pro
<ShowcaseItem
categories={['Crypto', 'NFTs']}
title="Cryptodash"
description="Cryptodash is a cryptocurrency dashboard that allows you get an overview of the current state of the cryptocurrency market."
url="https://cryptodash.deno.dev">
title="AI1 Crypto"
description="AI1 Crypto is a cryptocurrency dashboard that allows you get an overview of the current state of the cryptocurrency market."
url="https://ai1crypto.vercel.app/">
<iframe style={{height: 400}} className="w-full rounded"
src="https://cryptodash.deno.dev/" title="Cryptodash"></iframe>
src="https://ai1crypto.vercel.app/" title="AI1 Crypto"></iframe>
</ShowcaseItem>
---

View File

@@ -13,11 +13,10 @@ function getQueryVariable(query, variable) {
// substring query
const vars = query.substring(1).split('&');
for (let i = 0; i < vars.length; i++) {
let pair = vars[i].split('=');
console.log(decodeURIComponent(pair[0]), variable)
if (decodeURIComponent(pair[0]) == variable) {
return decodeURIComponent(pair[1]);
}
let pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == variable) {
return decodeURIComponent(pair[1]);
}
}
return null;
}
@@ -27,6 +26,34 @@ function getQueryVariable(query, variable) {
function isTabItem(comp) {
return 'value' in comp.props;
}
function getOSName() {
const userAgent = navigator.userAgent;
if (userAgent.indexOf('Windows') > -1) {
return 'Windows';
} else if (userAgent.indexOf('Mac') > -1) {
return 'Mac';
} else if (userAgent.indexOf('X11') > -1) {
return 'UNIX';
} else if (userAgent.indexOf('Linux') > -1) {
return 'Linux';
} else {
return 'Other';
}
}
function getInstallationTabType() {
const osName = getOSName();
if (osName === 'Windows') {
return 'windows';
} else if (osName === 'Mac') {
return 'mac';
} else if(osName === 'Linux' || osName === 'UNIX') {
return 'python';
}
return 'windows';
}
function TabsComponent(props) {
const {
lazy,
@@ -82,10 +109,11 @@ function TabsComponent(props) {
);
}
const { tabGroupChoices, setTabGroupChoices } = useTabGroupChoice();
const { pathname, search } = useLocation()
const value = getQueryVariable(search, 'tab')
const [selectedValue, setSelectedValue] = useState(value ? value : defaultValue);
const osTabValue = getInstallationTabType()
const [selectedValue, setSelectedValue] = useState(pathname.startsWith("/terminal/quickstart/installation") ? value ? ['mac', 'windows', 'python', 'docker'].includes(value) ? value : osTabValue : osTabValue : defaultValue);
const tabRefs = [];
const { blockElementScrollPositionUntilNextRender } =
useScrollPositionBlocker();

7
website/yarn.lock vendored
View File

@@ -1390,7 +1390,7 @@
"fs-extra" "^10.1.0"
"lodash" "^4.17.21"
"tslib" "^2.4.0"
"@docusaurus/plugin-content-blog@2.2.0":
"integrity" "sha512-0mWBinEh0a5J2+8ZJXJXbrCk1tSTNf7Nm4tYAl5h2/xx+PvH/Bnu0V+7mMljYm/1QlDYALNIIaT/JcoZQFUN3w=="
"resolved" "https://registry.npmjs.org/@docusaurus/plugin-content-blog/-/plugin-content-blog-2.2.0.tgz"
@@ -4299,11 +4299,6 @@
"resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
"version" "1.0.0"
"fsevents@~2.3.2":
"integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
"resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
"version" "2.3.2"
"function-bind@^1.1.1":
"integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
"resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"