mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
put channels behind feature switch
This commit is contained in:
parent
8f0988e1b0
commit
a7209f690d
11
README.md
11
README.md
@ -30,6 +30,7 @@ If you're a developer and want to contribute to, or want to utilize this marketp
|
|||||||
- [⛵️ Environment Variables](#️-environment-variables)
|
- [⛵️ Environment Variables](#️-environment-variables)
|
||||||
- [Client](#client)
|
- [Client](#client)
|
||||||
- [Server](#server)
|
- [Server](#server)
|
||||||
|
- [Feature Switches](#feature-switches)
|
||||||
- [👩🔬 Testing](#-testing)
|
- [👩🔬 Testing](#-testing)
|
||||||
- [Unit Tests](#unit-tests)
|
- [Unit Tests](#unit-tests)
|
||||||
- [End-to-End Integration Tests](#end-to-end-integration-tests)
|
- [End-to-End Integration Tests](#end-to-end-integration-tests)
|
||||||
@ -133,6 +134,16 @@ cp server/.env.example server/.env
|
|||||||
vi server/.env
|
vi server/.env
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Feature Switches
|
||||||
|
|
||||||
|
Beside configuring the network endpopints, the client allows to activate some features with environment variables in `client/.env.local`:
|
||||||
|
|
||||||
|
| Env Variable | Feature Description |
|
||||||
|
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
|
| `REACT_APP_SHOW_CHANNELS` | Show the channels feature which shows assets based on a certain tag in a prominent view. This is deeactivated by default and only activated in live Commons deployments. |
|
||||||
|
| `REACT_APP_SHOW_REQUEST_TOKENS_BUTTON` | Shows a second button on the `/faucet` route to request Ocean Tokens in addition to Ether. Will only work in Ocean testnets. |
|
||||||
|
| `REACT_APP_ALLOW_PRICING` | Activate pricing feature. Will show a price input during publish flow, and output prices for each data asset. |
|
||||||
|
|
||||||
## 👩🔬 Testing
|
## 👩🔬 Testing
|
||||||
|
|
||||||
Test suite is setup with [Jest](https://jestjs.io) and [react-testing-library](https://github.com/kentcdodds/react-testing-library) for unit testing, and [Cypress](https://www.cypress.io) for integration testing.
|
Test suite is setup with [Jest](https://jestjs.io) and [react-testing-library](https://github.com/kentcdodds/react-testing-library) for unit testing, and [Cypress](https://www.cypress.io) for integration testing.
|
||||||
|
@ -52,6 +52,10 @@ REACT_APP_BRIZO_ADDRESS="0x0474ed05ba757dde575dfaaaa267d9e7f3643abc"
|
|||||||
# REACT_APP_FAUCET_URI="http://localhost:3001"
|
# REACT_APP_FAUCET_URI="http://localhost:3001"
|
||||||
# REACT_APP_BRIZO_ADDRESS="0x068ed00cf0441e4829d9784fcbe7b9e26d4bd8d0"
|
# REACT_APP_BRIZO_ADDRESS="0x068ed00cf0441e4829d9784fcbe7b9e26d4bd8d0"
|
||||||
|
|
||||||
|
#
|
||||||
|
# APP CONFIG
|
||||||
|
#
|
||||||
REACT_APP_REPORT_EMAIL="test@example.com"
|
REACT_APP_REPORT_EMAIL="test@example.com"
|
||||||
|
# REACT_APP_SHOW_CHANNELS=true
|
||||||
# REACT_APP_ALLOW_PRICING=true
|
# REACT_APP_ALLOW_PRICING=true
|
||||||
# REACT_APP_SHOW_REQUEST_TOKENS_BUTTON=true
|
# REACT_APP_SHOW_REQUEST_TOKENS_BUTTON=true
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Route, Switch } from 'react-router-dom'
|
import { Route, Switch } from 'react-router-dom'
|
||||||
|
import { showChannels } from './config'
|
||||||
|
|
||||||
import About from './routes/About'
|
import About from './routes/About'
|
||||||
import Home from './routes/Home'
|
import Home from './routes/Home'
|
||||||
@ -24,8 +25,12 @@ const Routes = () => (
|
|||||||
<Route component={Asset} path="/asset/:did" />
|
<Route component={Asset} path="/asset/:did" />
|
||||||
<Route component={Faucet} path="/faucet" />
|
<Route component={Faucet} path="/faucet" />
|
||||||
<Route component={History} path="/history" />
|
<Route component={History} path="/history" />
|
||||||
<Route component={Channels} exact path="/channels" />
|
{showChannels && (
|
||||||
<Route component={Channel} path="/channels/:channel" />
|
<>
|
||||||
|
<Route component={Channels} exact path="/channels" />
|
||||||
|
<Route component={Channel} path="/channels/:channel" />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<Route component={NotFound} />
|
<Route component={NotFound} />
|
||||||
</Switch>
|
</Switch>
|
||||||
)
|
)
|
||||||
|
@ -4,7 +4,7 @@ import { ReactComponent as Logo } from '@oceanprotocol/art/logo/logo.svg'
|
|||||||
import AccountStatus from '../molecules/AccountStatus'
|
import AccountStatus from '../molecules/AccountStatus'
|
||||||
import styles from './Header.module.scss'
|
import styles from './Header.module.scss'
|
||||||
|
|
||||||
import menu from '../../data/menu.json'
|
import menu from '../../data/menu'
|
||||||
import meta from '../../data/meta.json'
|
import meta from '../../data/meta.json'
|
||||||
|
|
||||||
const MenuItem = ({ item }: { item: any }) => (
|
const MenuItem = ({ item }: { item: any }) => (
|
||||||
|
@ -7,7 +7,6 @@ import CategoryLink from '../../atoms/CategoryLink'
|
|||||||
import styles from './AssetDetails.module.scss'
|
import styles from './AssetDetails.module.scss'
|
||||||
import AssetFilesDetails from './AssetFilesDetails'
|
import AssetFilesDetails from './AssetFilesDetails'
|
||||||
import Report from './Report'
|
import Report from './Report'
|
||||||
import { allowPricing } from '../../../config'
|
|
||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
|
|
||||||
interface AssetDetailsProps {
|
interface AssetDetailsProps {
|
||||||
|
@ -28,6 +28,7 @@ export const faucetUri =
|
|||||||
//
|
//
|
||||||
export const verbose = true
|
export const verbose = true
|
||||||
export const analyticsId = 'UA-60614729-11'
|
export const analyticsId = 'UA-60614729-11'
|
||||||
|
export const showChannels = process.env.REACT_APP_SHOW_CHANNELS || false
|
||||||
export const allowPricing = process.env.REACT_APP_ALLOW_PRICING || false
|
export const allowPricing = process.env.REACT_APP_ALLOW_PRICING || false
|
||||||
export const showRequestTokens =
|
export const showRequestTokens =
|
||||||
process.env.REACT_APP_SHOW_REQUEST_TOKENS_BUTTON || false
|
process.env.REACT_APP_SHOW_REQUEST_TOKENS_BUTTON || false
|
||||||
|
28
client/src/data/menu.js
Normal file
28
client/src/data/menu.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { showChannels } from '../config'
|
||||||
|
|
||||||
|
const menu = [
|
||||||
|
{
|
||||||
|
title: 'Publish',
|
||||||
|
link: '/publish'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'History',
|
||||||
|
link: '/history'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Faucet',
|
||||||
|
link: '/faucet'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'About',
|
||||||
|
link: '/about'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
showChannels &&
|
||||||
|
menu.unshift({
|
||||||
|
title: 'Channels',
|
||||||
|
link: '/channels'
|
||||||
|
})
|
||||||
|
|
||||||
|
export default menu
|
@ -1,22 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"title": "Channels",
|
|
||||||
"link": "/channels"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Publish",
|
|
||||||
"link": "/publish"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "History",
|
|
||||||
"link": "/history"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Faucet",
|
|
||||||
"link": "/faucet"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "About",
|
|
||||||
"link": "/about"
|
|
||||||
}
|
|
||||||
]
|
|
@ -12,6 +12,7 @@ import AssetsLatest from '../../components/organisms/AssetsLatest'
|
|||||||
import ChannelTeaser from '../../components/organisms/ChannelTeaser'
|
import ChannelTeaser from '../../components/organisms/ChannelTeaser'
|
||||||
import Search from './Search'
|
import Search from './Search'
|
||||||
import withTracker from '../../hoc/withTracker'
|
import withTracker from '../../hoc/withTracker'
|
||||||
|
import { showChannels } from '../../config'
|
||||||
|
|
||||||
interface HomeProps {
|
interface HomeProps {
|
||||||
history: History
|
history: History
|
||||||
@ -44,8 +45,12 @@ class Home extends PureComponent<HomeProps, HomeState> {
|
|||||||
</Content>
|
</Content>
|
||||||
|
|
||||||
<Content wide>
|
<Content wide>
|
||||||
<h2 className={styles.title}>Featured Channel</h2>
|
{showChannels && (
|
||||||
<ChannelTeaser channel="ai-for-good" />
|
<>
|
||||||
|
<h2 className={styles.title}>Featured Channel</h2>
|
||||||
|
<ChannelTeaser channel="ai-for-good" />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<AssetsLatest />
|
<AssetsLatest />
|
||||||
</Content>
|
</Content>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user