Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mo4islona committed Apr 15, 2024
0 parents commit 44d63f1
Show file tree
Hide file tree
Showing 205 changed files with 29,121 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
WALLET_CONNECT_PROJECT_ID=b7b3d81af86feb2af54461f26b665ee4
SQUID_API_URL=https://squid.subsquid.io/subsquid-network-indexer/v/v7/graphql
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.yarn
build
dist
83 changes: 83 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
module.exports = {
root: true,
env: {
browser: true,
es2020: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
plugins: ['@typescript-eslint', 'react', 'prettier'],
extends: [
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'prettier',
'plugin:react-hooks/recommended',
],
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
rules: {
quotes: ['error', 'single', { allowTemplateLiterals: true }],
'prettier/prettier': 'error',
'react/no-unescaped-entities': 'off',
'react/jsx-curly-brace-presence': ['error', { props: "never", children: "never" }],
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
'import/order': [
'error',
{
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before',
},
{
pattern:
'{@{api,apps,components,hooks,contexts,layouts,pages,icons,models,network}/**,@apps}',
group: 'internal',
position: 'after',
},
],
'newlines-between': 'always',
alphabetize: {
/* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */
order: 'asc',
caseInsensitive: true /* ignore case. Options: [true, false] */,
},
pathGroupsExcludedImportTypes: ['builtin'],
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object'],
},
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'import/no-unresolved': 'off',
'import/namespace': 'off',
'import/no-duplicates': 'off',
'no-console': 'warn',
'guard-for-in': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'react/prop-types': 'off',
'react/display-name': 'off',
'import/default': 'off',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
},
};
92 changes: 92 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: build

on:
workflow_dispatch: {}
push:
branches: [ main, develop ]

env:
PROJECT_ID: bright-meridian-316511

jobs:
build:
runs-on: ubuntu-latest

steps:
# - name: cancel previous runs
# uses: styfle/[email protected]
# with:
# access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v2

- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install Yarn
run: corepack enable

# Yarn dependencies cannot be cached until yarn is installed
# WORKAROUND: https://github.com/actions/setup-node/issues/531
- name: Extract cached dependencies
uses: actions/setup-node@v4
with:
cache: yarn

- name: env
id: env
run: |
echo "::set-output name=tag::$(git rev-parse --short HEAD)"
if [ "$REF" = "refs/heads/main" ]; then
echo "::set-output name=app_env::prod"
echo "::set-output name=wc_project_id::475eff0658d0f3300ca18971418d261b"
echo "::set-output name=squid_api_url::https://subsquid.squids.live/subsquid-network-testnet/v/v1/graphql"
else
echo "::set-output name=app_env::dev"
echo "::set-output name=wc_project_id::ec2facac9eaaca7cc0584baadc935c01"
echo "::set-output name=squid_api_url::https://subsquid.squids.live/subsquid-network-testnet/v/v1/graphql"
fi
env:
REF: ${{ github.ref }}

- run: yarn install --immutable

- run: yarn build
env:
APP_ENV: ${{ steps.env.outputs.app_env }}
APP_VERSION: ${{ steps.env.outputs.tag }}
WALLET_CONNECT_PROJECT_ID: ${{ steps.env.outputs.wc_project_id }}
ENABLE_DEMO_FEATURES: ${{ steps.env.outputs.enable_demo_features }}
NETWORK: ${{ steps.env.outputs.network }}
SQUID_API_URL: ${{ steps.env.outputs.squid_api_url }}


# Build and push images to Google Container Registry
- name: Build image
run: docker build --progress=plain -t "gcr.io/${PROJECT_ID}/subsquid-network-app-${APP_ENV}:${TAG}" -t "gcr.io/${PROJECT_ID}/subsquid-network-app-${APP_ENV}:latest" .
env:
APP_ENV: ${{ steps.env.outputs.app_env }}
TAG: ${{ steps.env.outputs.tag }}

- id: auth
uses: google-github-actions/[email protected]
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

- name: Set up Cloud SDK
uses: google-github-actions/[email protected]

# steps for push images to gcr
- name: 'gcloud cli --> docker credential helper'
run: gcloud auth configure-docker -q

- name: Push image
run: |
docker push "gcr.io/${PROJECT_ID}/subsquid-network-app-${APP_ENV}:${TAG}"
docker push "gcr.io/${PROJECT_ID}/subsquid-network-app-${APP_ENV}:latest"
env:
APP_ENV: ${{ steps.env.outputs.app_env }}
TAG: ${{ steps.env.outputs.tag }}
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

.git

# dependencies
node_modules
.pnp
.pnp.*

# testing
coverage

# production
build
dist
storybook
.cache

# Optional eslint cache
.eslintcache

# IDE
.idea
/.idea
**/.idea
.vscode

# envs
.env
.env.local
.env.dev
.env.prod
.env.test
.env.development
.env.production
.env.development.local
.env.production.local
.env.test.local

# logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# typescript
*.tsbuildinfo

# misc
.DS_Store
*.pem
secrets.yaml
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
singleQuote: true,
trailingComma: "all",
printWidth: 100,
arrowParens: "avoid"
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM nginx

COPY nginx/default.conf /etc/nginx/conf.d/default.conf
COPY build/ /usr/share/nginx/html/
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Subsquid Cloud UI

## Run

1) Copy `.env.example` to `.env`
2) ```yarn install```
3) ```yarn start```
Loading

0 comments on commit 44d63f1

Please sign in to comment.