Skip to content

Commit

Permalink
Merge pull request #424 from deltaDAO/features-alignment
Browse files Browse the repository at this point in the history
Features alignment
  • Loading branch information
moritzkirstein authored Sep 28, 2023
2 parents 6f08095 + aa57083 commit f8a4795
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 39 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The app is a React app built with [Next.js](https://nextjs.org) + TypeScript + C
Prerequisites:

- [Node.js](https://nodejs.org/en/) (required). Check the [.nvmrc](.nvmrc) file to make sure you are using the correct version of Node.js.
- [nvm](https://github.com/nvm-sh/nvm) (recommended). This is the recommend way to manage Node.js versions.
- [nvm](https://github.com/nvm-sh/nvm) (recommended). This is the recommended way to manage Node.js versions.
- [Git](https://git-scm.com/) is required to follow the instructions below.

To start local development:
Expand Down Expand Up @@ -80,7 +80,7 @@ Barge will deploy contracts to the local Ganache node which will take some time.
If you are using `macOS` operating system you should also make same changes to the provider url since the default barge ip can not be accessed due to some network constraints on `macOs`. So we should be using the `127.0.0.1:8030` (if you have changed the provider port please use that here as well) for each direct call from the market to provider, but we should keep the internal barge url `http://172.15.0.4:8030/` (this is the default ip:port for provider in barge, if changed please use the according url). So on inside `src/@utils/provider.ts` if on `macOS` you can hardcode this env variable `NEXT_PUBLIC_PROVIDER_URL` or set
`127.0.0.1:8030` as `providerUrl` on all the methods that call `ProviderInstance` methods. (eg: `getEncryptedFiles`, `getFileDidInfo`, `downloadFile` etc). You should use the same provider url for `src/@utils/nft.ts` inside `setNFTMetadataAndTokenURI` and `setNftMetadata` and `src/components/Publish/index.tsx` inisde `encrypt` method (if you set the env variable there's no need to do this). You also need to use local ip's for the subgraph (`127.0.0.1` instead of `172.15.0.15`) and the metadatacache (`127.0.0.1` instead of `172.15.0.5`).

Once you want to switch back to using the market agains remote networks you need to comment or remove the env vars that are set by `set-barge-env` script.
Once you want to switch back to using the market against remote networks you need to comment or remove the env vars that are set by `set-barge-env` script.

```bash
cd market
Expand Down Expand Up @@ -298,7 +298,7 @@ Test runs utilize [Jest](https://jestjs.io/) as test runner and [Testing Library

All created Storybook stories will automatically run as individual tests by using the [StoryShots Addon](https://storybook.js.org/addons/@storybook/addon-storyshots).

Creating Storybook stories for a component will provide good coverage of a component in many cases. Additional tests for dedicated component functionality which can't be done with Storybook are created as usual [Testing Library](https://testing-library.com/docs/react-testing-library/intro) tests, but you can also [import exisiting Storybook stories](https://storybook.js.org/docs/react/writing-tests/importing-stories-in-tests#example-with-testing-library) into those tests.
Creating Storybook stories for a component will provide good coverage of a component in many cases. Additional tests for dedicated component functionality which can't be done with Storybook are created as usual [Testing Library](https://testing-library.com/docs/react-testing-library/intro) tests, but you can also [import existing Storybook stories](https://storybook.js.org/docs/react/writing-tests/importing-stories-in-tests#example-with-testing-library) into those tests.

Executing linting, type checking, and full test run:

Expand Down
4 changes: 2 additions & 2 deletions content/gdpr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "Our use of cookies",
"text": "We use [cookies](/privacy/en#6-cookies-and-web-storage) to optimize and continuously improve our website. These cookies are only used to enable essential features on our website and do not track you in any third-party related context.",
"title": "Note on the use of cookies",
"text": "We use technically essential web storage on this website. Web storage has similar functionality to cookies. We do not use cookies or web storage for marketing, statistics, or tracking purposes. Read more in our [privacy policy](/privacy/en#6-cookies-and-web-storage).",
"close": "Acknowledge",
"accept": "Accept all",
"reject": "Only essential",
Expand Down
2 changes: 1 addition & 1 deletion content/pages/home/content.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"body": "The principle of decentralization is a perfect fit for **Distributed Ledger Technology**. [Ocean Protocol](https://oceanprotocol.com) is a fully open-source technology stack, leveraging DLT and decentralization, aiming to give control back to the owners of data services. Pontus-X is built on top of Ocean Protocol showcasing how the Gaia-X Web3 Ecosystem on DLT and Ocean Protocol can look like, already today.",
"cta": "Learn More",
"ctaTo": "https://docs.genx.minimal-gaia-x.eu/docs/Community/Introduction",
"image": "/images/genx_validators.png"
"image": "/images/genx_validators.webp"
},
{
"title": "Compute-to-Data and its benefits",
Expand Down
14 changes: 8 additions & 6 deletions content/pages/imprint.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ Katharinenstraße 30a (Contor)<br/>
20457 Hamburg<br/>
Germany<br/><br/>

E-Mail: [[email protected]](mailto:[email protected])<br/><br/>
**Phone**: +49 40 43281904<br/>
**E-Mail**: [[email protected]](mailto:[email protected])<br/><br/>

Company registered in Hamburg<br/>
Register court: Handelsregister Hamburg<br/>
Commercial Register No.: HRB 170364<br/><br/>
**Members of the Board**: Frederic Schwill, Kai Meinke, Albert Peci<br/>
**Chairman of the Supervisory Board**: Dr. Sven Hildebrandt<br/><br/>

Members of the Board: Frederic Schwill, Kai Meinke, Albert Peci<br/>
Chairman of the Supervisory Board: Dr. Sven Hildebrandt
**Commercial register**: Handelsregister B des Amtsgerichts Hamburg, HRB 170364<br/>
**USt – IdNr**: DE346013532<br/><br/>

The European Commission provides a platform for online dispute resolution, which you can find here: <https://ec.europa.eu/consumers/odr/>. We are not obliged or willing to participate in a dispute resolution procedure before a consumer arbitration board.
8 changes: 8 additions & 0 deletions content/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
"name": "Airbus",
"link": "https://airbus.pontus-x.eu/"
},
{
"name": "Berlin State Library",
"link": "https://sbb.pontus-x.eu/"
},
{
"name": "Clinical Insights Exchange",
"link": "https://cix.triall.io/"
Expand All @@ -52,6 +56,10 @@
"name": "GX4M moveID",
"link": "https://portal.moveid.eu/"
},
{
"name": "Service-Meister",
"link": "https://servicemeister.pontus-x.eu/"
},
{
"name": "UdL Research Data Space",
"link": "https://dataspace.angliru.udl.cat/"
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"@types/remove-markdown": "^0.3.1",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"@typescript-eslint/parser": "^5.57.0",
"@uiw/codemirror-themes": "^4.19.1",
"@uiw/codemirror-themes": "^4.21.12",
"apollo": "^2.34.0",
"cross-env": "^7.0.3",
"eslint": "^8.46.0",
Expand Down
Binary file removed public/images/genx_validators.png
Binary file not shown.
Binary file added public/images/genx_validators.webp
Binary file not shown.
23 changes: 19 additions & 4 deletions src/components/@shared/FormInput/InputElement/Provider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ export default function CustomProvider(props: InputProps): ReactElement {
// No way to detect a failed request with ProviderInstance.isValidProvider,
// making this error show up for multiple cases it shouldn't, like network
// down.
if (!isValid)
throw Error(
if (!isValid) {
setFieldError(
`${field.name}.url`,
'✗ No valid provider detected. Check your network, your URL and try again.'
)
LoggerInstance.error(
'[Custom Provider]:',
'✗ No valid provider detected. Check your network, your URL and try again.'
)
return
}

// Check if valid provider is for same chain user is on
const providerResponse = await axios.get(field.value.url, {
Expand All @@ -53,10 +60,18 @@ export default function CustomProvider(props: InputProps): ReactElement {
providerChain === userChainId
? true
: !!(providerChain.length > 0 && providerChain.includes(userChainId))
if (!isCompatible)
throw Error(

if (!isCompatible) {
setFieldError(
`${field.name}.url`,
'✗ This provider is incompatible with the network your wallet is connected to.'
)
LoggerInstance.error(
'[Custom Provider]:',
'✗ This provider is incompatible with the network your wallet is connected to.'
)
return
}

// if all good, add provider to formik state
helpers.setValue({ url: field.value.url, valid: isValid, custom: true })
Expand Down
33 changes: 20 additions & 13 deletions src/components/@shared/FormInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,21 @@ export interface InputProps {
accountId?: string
}

function checkError(form: any, field: FieldInputProps<any>) {
const touched = getObjectPropertyByPath(form?.touched, field?.name)
const errors = getObjectPropertyByPath(form?.errors, field?.name)

return (
touched &&
errors &&
!field.name.endsWith('.files') &&
!field.name.endsWith('.links') &&
!field.name.endsWith('consumerParameters')
)
function checkError(
form: any,
parsedFieldName: string[],
field: FieldInputProps<any>
) {
if (
(form?.touched?.[parsedFieldName[0]]?.[parsedFieldName[1]] &&
form?.errors?.[parsedFieldName[0]]?.[parsedFieldName[1]]) ||
(form?.touched[field?.name] &&
form?.errors[field?.name] &&
field.name !== 'files' &&
field.name !== 'links')
) {
return true
}
}

export default function Input(props: Partial<InputProps>): ReactElement {
Expand All @@ -105,10 +109,13 @@ export default function Input(props: Partial<InputProps>): ReactElement {
} = props

const isFormikField = typeof field !== 'undefined'
const isNestedField = field?.name?.includes('.')
// TODO: this feels hacky as it assumes nested `values` store. But we can't use the
// `useField()` hook in here to get `meta.error` so we have to match against form?.errors?
// handling flat and nested data at same time.
const hasFormikError = checkError(form, field)
const parsedFieldName =
isFormikField && (isNestedField ? field?.name.split('.') : [field?.name])
const hasFormikError = checkError(form, parsedFieldName, field)

const styleClasses = cx({
field: true,
Expand All @@ -123,7 +130,7 @@ export default function Input(props: Partial<InputProps>): ReactElement {
if (disclaimer && disclaimerValues) {
setDisclaimerVisible(
disclaimerValues.includes(
getObjectPropertyByPath(props.form?.values, field?.name)
props.form?.values[parsedFieldName[0]]?.[parsedFieldName[1]]
)
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Asset/AssetActions/Download/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default function Download({

async function handleOrderOrDownload(dataParams?: UserCustomParameters) {
setIsLoading(true)

setRetry(false)
try {
if (isOwned) {
setStatusText(
Expand Down
11 changes: 7 additions & 4 deletions src/components/Publish/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,13 @@ export function getPublisherFromServiceCredential(
? JSON.parse(serviceCredential)
: serviceCredential

const legalName =
parsedServiceCredential?.verifiableCredential?.[0]?.credentialSubject?.[
'gx:legalName'
]
const legalParticipant = parsedServiceCredential.verifiableCredential.find(
(credential) =>
credential?.credentialSubject?.type === 'gx:LegalParticipant'
)

const legalName = legalParticipant?.credentialSubject?.['gx:legalName']

const publisher =
typeof legalName === 'string' ? legalName : legalName?.['@value']

Expand Down

0 comments on commit f8a4795

Please sign in to comment.