Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect users to correct installation tab based on OS #3676

Merged
merged 10 commits into from
Dec 5, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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 |
Expand Down
8 changes: 4 additions & 4 deletions website/content/sdk/showcase.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>

---
Expand Down
42 changes: 35 additions & 7 deletions website/src/theme/Tabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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,
Expand Down Expand Up @@ -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();
Expand Down
7 changes: 1 addition & 6 deletions website/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down