diff --git a/rn/html-mods/ipfs-upload-file/info.json b/rn/html-mods/ipfs-upload-file/info.json index 7cbab0f1..da47b531 100644 --- a/rn/html-mods/ipfs-upload-file/info.json +++ b/rn/html-mods/ipfs-upload-file/info.json @@ -2,5 +2,6 @@ "displayName": "IPFS File Upload", "shortDescription": "Upload a file to IPFS", "iconKind": 1, - "iconData": "4qyG77iP" + "iconData": "4qyG77iP", + "preamble": "Author: Harlan T Wood \n\nhttps://github.com/ipfs-examples/js-ipfs-http-client-upload-file" } \ No newline at end of file diff --git a/rn/html-mods/ipns-publish/info.json b/rn/html-mods/ipns-publish/info.json index 53ae9613..260e298b 100644 --- a/rn/html-mods/ipns-publish/info.json +++ b/rn/html-mods/ipns-publish/info.json @@ -2,5 +2,6 @@ "displayName": "IPNS Publish", "shortDescription": "Publish to IPNS using JS and Go", "iconKind": 1, - "iconData": "8J+TsA==" + "iconData": "8J+TsA==", + "preamble": "Author: Doug Anderson\n\nhttps://github.com/ipfs-examples/js-ipfs-browser-ipns-publish" } \ No newline at end of file diff --git a/rn/package.json b/rn/package.json index eb1a5dda..65b88380 100644 --- a/rn/package.json +++ b/rn/package.json @@ -24,6 +24,7 @@ "google-protobuf": "^3.19.4", "react": "17.0.2", "react-native": "0.67.2", + "react-native-hyperlink": "^0.0.19", "react-native-labs-bridge": "./react-native-labs-bridge", "react-native-safe-area-context": "^3.3.2", "react-native-screens": "^3.11.1", diff --git a/rn/src/navigation/types.ts b/rn/src/navigation/types.ts index 0e5f0f6f..83f0e5ac 100644 --- a/rn/src/navigation/types.ts +++ b/rn/src/navigation/types.ts @@ -11,10 +11,11 @@ export type ScreensParams = { ArtCollection: undefined NodeManager: undefined NodeConfig: { name: string } - GoModule: { name: string; displayName: string } + GoModule: { name: string; displayName?: string; preamble?: string } HTMLModule: { name: string displayName?: string + preamble?: string } IPFSLogs: undefined Browser: undefined diff --git a/rn/src/screens/GoModule.tsx b/rn/src/screens/GoModule.tsx index b4ca3fdb..9986901c 100644 --- a/rn/src/screens/GoModule.tsx +++ b/rn/src/screens/GoModule.tsx @@ -31,8 +31,8 @@ export const GoModule: ScreenFC<'GoModule'> = ({ }) => { const { setOptions } = useAppNavigation() React.useEffect(() => { - setOptions({ title: displayName }) - }, [setOptions, displayName]) + setOptions({ title: displayName || name }) + }, [setOptions, displayName, name]) const { state, text, error, args } = useAppSelector(state => selectModuleState(state, name)) const running = state === 'running' const dispatch = useAppDispatch() diff --git a/rn/src/screens/HTMLModule.tsx b/rn/src/screens/HTMLModule.tsx index a386ddd4..fd09419d 100644 --- a/rn/src/screens/HTMLModule.tsx +++ b/rn/src/screens/HTMLModule.tsx @@ -1,15 +1,18 @@ import React from 'react' import { Text } from 'react-native' import { WebView } from 'react-native-webview' +import Hyperlink from 'react-native-hyperlink' import { ScreenFC, useAppNavigation } from '@berty-labs/navigation' import { defaultColors } from '@berty-labs/styles' -import { AppScreenContainer, LoaderScreen } from '@berty-labs/components' +import { AppScreenContainer, Card, LoaderScreen } from '@berty-labs/components' import { useGomobileIPFS } from '@berty-labs/react-redux' +const space = 15 + export const HTMLModule: ScreenFC<'HTMLModule'> = ({ route: { - params: { name, displayName }, + params: { name, displayName, preamble }, }, }) => { const nav = useAppNavigation() @@ -17,11 +20,8 @@ export const HTMLModule: ScreenFC<'HTMLModule'> = ({ const [localError, setLocalError] = React.useState() React.useEffect(() => { - if (!displayName) { - return - } - nav.setOptions({ title: displayName }) - }, [nav, displayName]) + nav.setOptions({ title: displayName || name }) + }, [nav, displayName, name]) if (mobileIPFS.status !== 'up') { return @@ -35,6 +35,15 @@ export const HTMLModule: ScreenFC<'HTMLModule'> = ({ } return ( + {!!preamble && ( + + + + {preamble.trim()} + + + + )}