Skip to content

Commit

Permalink
feat(connect-explorer): hiding beta-only content
Browse files Browse the repository at this point in the history
  • Loading branch information
martykan committed Oct 15, 2024
1 parent f2a5f74 commit 21e0d42
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
11 changes: 11 additions & 0 deletions packages/connect-explorer/src/components/BetaOnly.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const isBetaOnly = !process.env.CONNECT_EXPLORER_FULL_URL?.startsWith(
'https://connect.trezor.io/9/',
);

export const BetaOnly = (props: React.PropsWithChildren) => {
if (isBetaOnly) {
return <>{props.children}</>;
}

return null;
};
5 changes: 5 additions & 0 deletions packages/connect-explorer/src/pages/details/deeplinking.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { Callout } from 'nextra/components';
import { BetaOnly } from '../../components/BetaOnly';

# Deep linking specification

<BetaOnly>

To support connecting to Trezor devices from 3rd party apps on mobile devices, Trezor Suite Lite provides a communication interface via deep linking.

<Callout type="info">
Expand Down Expand Up @@ -64,3 +67,5 @@ trezorsuitelite://connect?method=getAddress&params=%7B%22coin%22%3A%22btc%22%2C%
```

When the user returns to the app, the callback URL is called with the result of the method call.

</BetaOnly>
9 changes: 8 additions & 1 deletion packages/connect-explorer/src/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import IconWeb from '../components/icons/IconWeb';
import IconExtension from '../components/icons/IconExtension';
import IconMobile from '../components/icons/IconMobile';
import ZoomableIllustration from '../components/ZoomableIllustration';
import { BetaOnly } from '../components/BetaOnly';

export const SectionCard = ({ children }) => (
<TrezorCard margin={{ bottom: spacings.xl }}>{children}</TrezorCard>
Expand Down Expand Up @@ -111,7 +112,9 @@ export const ExampleHeading = styled.h3`
<Card icon={<IconNode />} title="Node.js" href="#nodejs" />
<Card icon={<IconWeb />} title="Web" href="#web" />
<Card icon={<IconExtension />} title="Web extension" href="#web-extension" />
<Card icon={<IconMobile />} title="Mobile" href="#mobile" />
<BetaOnly>
<Card icon={<IconMobile />} title="Mobile" href="#mobile" />
</BetaOnly>
</Cards>

<CollapsibleBox heading="Still unsure?" margin={{ top: spacings.md }}>
Expand Down Expand Up @@ -501,6 +504,8 @@ export const ExampleHeading = styled.h3`

</SectionCard>

<BetaOnly>

<HiddenNextraHeading>

### Mobile
Expand Down Expand Up @@ -632,3 +637,5 @@ export const ExampleHeading = styled.h3`
</CollapsibleBox>
</SectionCard>
</BetaOnly>
7 changes: 6 additions & 1 deletion packages/connect-explorer/src/pages/readme/[name].mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ import { RemoteContent } from 'nextra/data';
import { buildDynamicMDX, buildDynamicMeta } from 'nextra/remote';
import rehypeSectionize from '@hbsnow/rehype-sectionize';
import remarkGemoji from 'remark-gemoji';
import { isBetaOnly } from '../../components/BetaOnly';

export const getStaticPaths = () => {
const packages = ["connect", "connect-web", "connect-webextension", "connect-mobile"]
const packages = ["connect", "connect-web", "connect-webextension"];
if(isBetaOnly) {
packages.push("connect-mobile");
}

const paths = packages.map((name) => ({
params: {
name,
Expand Down
5 changes: 3 additions & 2 deletions packages/connect-explorer/src/pages/settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Callout } from 'nextra/components';
import * as trezorConnectActions from '../actions/trezorConnectActions';
import { useSelector, useActions } from '../hooks';
import { getField } from '../components/Method';
import { isBetaOnly } from '../components/BetaOnly';

export const SettingsContent = styled.section`
flex: 1;
Expand Down Expand Up @@ -65,12 +66,12 @@ export const Settings = () => {
key: 'connectSrc',
value: connectOptions?.connectSrc || '',
},
{
...(isBetaOnly ? [{
name: 'mobile deeplink',
type: 'checkbox',
key: 'deeplink',
value: connectOptions?.deeplink || false
}
}] : [])
];

return (
Expand Down

0 comments on commit 21e0d42

Please sign in to comment.