Skip to content

Commit

Permalink
Merge pull request #232 from Gateway-DAO/testnet
Browse files Browse the repository at this point in the history
Release - January 10th
  • Loading branch information
NMCarv authored Jan 10, 2024
2 parents eaa9b32 + 95e5c5e commit ba717de
Show file tree
Hide file tree
Showing 880 changed files with 51,606 additions and 7,429 deletions.
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SECURE_API_KEY=
NEXT_PUBLIC_API_ENDPOINT=
NEXTAUTH_SECRET=
NEXT_PUBLIC_API_ENV=
NEXT_PUBLIC_API_KEY=
NEXT_PUBLIC_PLAYGROUND_API_KEY=

# Irys
IRYS_NODE=https://devnet.irys.xyz
IRYS_CURRENCY=
IRYS_PROVIDER=
IRYS_KEY=
7 changes: 5 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"plugin:editorconfig/noconflict",
"plugin:@tanstack/eslint-plugin-query/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:storybook/recommended"
"plugin:storybook/recommended",
"plugin:testing-library/react",
"plugin:jest-dom/recommended"
],
"plugins": [
"editorconfig",
Expand All @@ -16,6 +18,7 @@
],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"react-hooks/exhaustive-deps": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
Expand Down Expand Up @@ -56,5 +59,5 @@
}
}
],
"ignorePatterns": ["./src/services/protocol/types.ts"]
"ignorePatterns": ["src/services/protocol/types.ts"]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ src/services/**/**/validation.ts
screenshots/
test-results/
storageState.json
.swc
playwright-report/

.next
.vscode/settings.json
src/pages/dev.tsx
TODO

storybook-static
10 changes: 5 additions & 5 deletions .graphqlrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module.exports = {
projects: {
protocol: {
schema: {
[`${process.env.NEXT_PUBLIC_API_ENDPOINT}`]: {
[`${process.env.NEXT_PUBLIC_API_ENDPOINT}/graphql`]: {
headers: {
'x-api-key': process.env.NEXT_PUBLIC_API_KEY,
},
},
},
documents: 'src/services/protocol/**/*.gql'
}
}
}
documents: 'src/services/protocol/**/*.gql',
},
},
};
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
}
19 changes: 10 additions & 9 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { StorybookConfig } from '@storybook/nextjs';
import path from 'path';
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
Expand All @@ -24,12 +24,13 @@ const config: StorybookConfig = {
docs: {
autodocs: 'tag',
},
webpackFinal: async (config) => { // 👈 and add this here
if(!config.resolve) config.resolve = {};
webpackFinal: async (config) => {
// 👈 and add this here
if (!config.resolve) config.resolve = {};
config.resolve.plugins = config.resolve.plugins || [];
config.resolve.plugins.push(
new TsconfigPathsPlugin({
configFile: path.resolve(__dirname, "../tsconfig.json"),
configFile: path.resolve(__dirname, '../tsconfig.json'),
})
);
return config;
Expand All @@ -39,7 +40,6 @@ const config: StorybookConfig = {
// checkOptions: {},
reactDocgen: 'react-docgen-typescript',
reactDocgenTypescriptOptions: {

compilerOptions: {
// speeds up storybook build time
allowSyntheticDefaultImports: false,
Expand All @@ -53,12 +53,13 @@ const config: StorybookConfig = {
shouldExtractLiteralValuesFromEnum: true,
// makes string and boolean types that can be undefined appear as inputs and switches
shouldRemoveUndefinedFromOptional: true,
// Filter out third-party props from node_modules except @mui packages
propFilter: (prop) =>{
console.log(prop)
// Filter out third-party props from node_modules except @mui packages
propFilter: (prop) => {
// console.log(prop)
return prop.parent
? !/node_modules\/(?!@mui)/.test(prop.parent.fileName)
: true},
: true;
},
},
},
};
Expand Down
12 changes: 9 additions & 3 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Preview } from '@storybook/react';

import { theme } from '../src/theme/theme';
import { lightTheme, darkTheme } from '../src/theme/theme';
import { ThemeProvider, CssBaseline } from '@mui/material';
import { withThemeFromJSXProvider } from '@storybook/addon-styling';

Expand All @@ -10,7 +10,8 @@ export const decorators = [
// Uncomment for theme switching
Provider: ThemeProvider,
themes: {
light: theme,
light: lightTheme,
dark: darkTheme,
},
defaultTheme: 'light',
}),
Expand All @@ -26,8 +27,13 @@ const preview: Preview = {
date: /Date$/,
},
},
nextjs: {
appDirectory: true,
navigation: {
pathname: '#',
},
},
},
};

export default preview;

54 changes: 27 additions & 27 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev"
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"userDataDir": true,
"url": "http://localhost:4200"
},
{
"name": "Next.js: debug full stack",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev",
"serverReadyAction": {
"pattern": "started server on .+, url: (https?://.+)",
"uriFormat": "%s",
"action": "debugWithChrome",
}
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev"
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"userDataDir": true,
"url": "http://localhost:4200"
},
{
"name": "Next.js: debug full stack",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev",
"serverReadyAction": {
"pattern": "started server on .+, url: (https?://.+)",
"uriFormat": "%s",
"action": "debugWithChrome"
}
]
}
}
]
}
10 changes: 8 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"eslint.format.enable": true,
"editor.formatOnSave": true,
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"todo-tree.highlights.defaultHighlight": {
Expand Down
55 changes: 35 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,49 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
![Gateway Network - Web3 Private Data Protocol](/public/social.png)

## Getting Started
<a href="https://github.com/Gateway-DAO/network/stargazers"><img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/Gateway-DAO/network?style=flat-square"></a>
<a href="https://discord.gg/tgt3KjcHGs"><img alt="Discord" src="https://img.shields.io/discord/898513755456036925?style=flat-square&label=discord"></a>

First, run the development server:
# 🚪 Gateway Network - Source code

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
This repo contains the code for [Gateway dApp](https://gateway.network) website. Powered by [Next.js](https://nextjs.org).

# 🔧 Installation

Make sure you have [Git](https://git-scm.com/), [Node.js 16 LTS](https://nodejs.org/) and [pnpm](https://pnpm.io/) installed

1. Clone this repo

```sh
git clone https://github.com/Gateway-DAO/network-ui
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
2. Install dependencies using pnpm

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
```sh
pnpm i
```

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
3. Create the env file. Ask about it to your manager

## Learn More
4. Generate the typings

To learn more about Next.js, take a look at the following resources:
```sh
pnpm generate
```

5. Start the development server

```sh
pnpm dev
```

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
# 👍 Contribute

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
If you want to say thank you and/or support the active development of the `dApp`:

## Deploy on Vercel
1. Add a [GitHub Star](https://github.com/Gateway-DAO/network-ui/stargazers) to the project.
2. Talk to us on our [Discord](https://discord.gg/tgt3KjcHGs)

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
# E2E

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
Copy your `next-auth.session-token` and set the value in your dotenv file (`TEST_NEXT_AUTH_TOKEN`).
22 changes: 22 additions & 0 deletions __backup.jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import nextJest from 'next/jest.js';

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
});

// Add any custom config to be passed to Jest
/** @type {import('jest').Config} */
const config = {
// Add more setup options before each test is run
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testPathIgnorePatterns: ['<rootDir>/e2e/'],
testEnvironment: 'jest-environment-jsdom',
// preset: 'ts-jest',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
};

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(config);
2 changes: 1 addition & 1 deletion codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const config: CodegenConfig = {
generates: {
'./src/services/protocol/types.ts': {
schema: {
[`${process.env.NEXT_PUBLIC_API_ENDPOINT}`]: {
[`${process.env.NEXT_PUBLIC_API_ENDPOINT}/graphql`]: {
headers: {
'x-api-key': process.env.NEXT_PUBLIC_API_KEY as string,
},
Expand Down
17 changes: 17 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Development

## Remove lines on PRODUCTION

If you want to remove a number line on production, you can add a comment `#REMOVELINE {number}` to remove a specific number of lines

```ts
// #REMOVELINE
const test = '';
```

```gql
#REMOVELINE 3
query {
test
}
```
29 changes: 29 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Testing

## E2E Testing (Playwright)

According to [Next.js' Testing Documentation](https://nextjs.org/docs/pages/building-your-application/optimizing/testing#running-your-playwright-tests), you should have a running server before running your tests.

It can be either running a dev server (`pnpm dev`) or a built local server (`pnpm build && pnpm start`), pointing to `PORT` env (defaults to `4400`).

### Running tests

```bash
pnpm test:e2e
```

### Writing tests

E2E tests are located in `/e2e` folder.

## Unit Testing (Jest + React Testing Library)

### Running tests

```bash
pnpm test
```

### Writing tests

Unit tests are located in `**/__tests__` folder. Since we're using Next 13, we can put tests in the same folder as the pages and component, [because folders starting with underscore (`_`) are ignored by Next.js App Router](https://nextjs.org/docs/app/building-your-application/routing/colocation#private-folders).
Loading

0 comments on commit ba717de

Please sign in to comment.