Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [explorer/frontend] fix ci errors #1164

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e8710e6
[dependency]: Combine dependabot PRs
github-actions[bot] Jul 1, 2024
54aa45f
[dependency]: Combine dependabot PRs
github-actions[bot] Jul 9, 2024
6289b64
[dependency]: Combine dependabot PRs
github-actions[bot] Jul 15, 2024
75d451e
[dependency]: Combine dependabot PRs
github-actions[bot] Jul 23, 2024
05a05d2
[dependency]: Combine dependabot PRs
github-actions[bot] Jul 29, 2024
387a5e3
[dependency]: Combine dependabot PRs
github-actions[bot] Aug 5, 2024
36c80d3
[faucet/authenticator]: Added profileImageUrl (original dimension) in…
AnthonyLaw Aug 9, 2024
d816b93
[faucet/authenticator]: Release note 1.0.1
AnthonyLaw Aug 9, 2024
b6488da
[dependency]: Combine dependabot PRs
github-actions[bot] Aug 13, 2024
f8fadc4
[dependency]: Combine dependabot PRs
github-actions[bot] Aug 19, 2024
954d3a1
[dependency]: Combine dependabot PRs
github-actions[bot] Aug 27, 2024
c8d3ad8
[dependency]: Combine dependabot PRs
github-actions[bot] Sep 3, 2024
d030e97
[monorepo]: add .python-version to .gitignore
Jaguar0625 Sep 5, 2024
cc6270b
[tools/shoestring]: add support for advanced customization of rest.json
Jaguar0625 Sep 5, 2024
ad1fdfe
[dependency]: Combine dependabot PRs
github-actions[bot] Sep 9, 2024
8d8966c
[dependency]: Combine dependabot PRs
github-actions[bot] Sep 16, 2024
b836daf
[dependency]: Combine dependabot PRs
github-actions[bot] Sep 23, 2024
6769a38
[dependency]: Combine dependabot PRs
github-actions[bot] Sep 30, 2024
49be633
[dependency]: Combine dependabot PRs
github-actions[bot] Oct 8, 2024
fe2ab26
[explorer/nodewatch]: disable too many positional arguments
Wayonb Oct 8, 2024
8eae900
[tools/shoestring]: disable too many positional arguments
Wayonb Oct 8, 2024
b2ba264
[lightapi/python]: disable too many positional arguments
Wayonb Oct 8, 2024
e5426f6
[explorer/rest]: disable too many positional arguments
Wayonb Oct 8, 2024
44b5d50
[dependency]: Combine dependabot PRs
github-actions[bot] Oct 8, 2024
f291ba3
[dependency]: Combine dependabot PRs
github-actions[bot] Oct 14, 2024
a01b480
[dependency]: Combine dependabot PRs
github-actions[bot] Oct 22, 2024
56ef997
[dependency]: Combine dependabot PRs
github-actions[bot] Nov 4, 2024
e229d4c
[dependency]: Combine dependabot PRs
github-actions[bot] Nov 4, 2024
9f78b57
[explorer/frontend] task: initial project (#974)
OlegMakarenko Jul 5, 2024
de51d24
[explorer/frontend] fix: update readme
OlegMakarenko Sep 20, 2024
0abc17b
[explorer/frontend] feat: add extended footer for the home page
OlegMakarenko Sep 20, 2024
5462017
[explorer/frontend] feat: add harvesting and latest account filters
OlegMakarenko Sep 20, 2024
441f2c4
[explorer/frontend] feat: add jp locale, add missing text to en locale
OlegMakarenko Sep 20, 2024
3044a47
[explorer/frontend] fix: disable filter while loading
OlegMakarenko Sep 20, 2024
eb1f047
[explorer/frontend] fix: remove treasury field
OlegMakarenko Sep 20, 2024
8608090
[explorer/frontend] fix: missing locale in config
OlegMakarenko Sep 20, 2024
481f1d9
[explorer/frontend] feat: add known accounts to Avatar component
OlegMakarenko Sep 20, 2024
60ae27a
[explorer/frontend] feat: add filter mosaics by creator account
OlegMakarenko Sep 22, 2024
b170261
[explorer/frontend] feat: add Node List and Node Info pages
OlegMakarenko Sep 22, 2024
cbb5b01
[explorer/frontend] fix: circulating supply and market cap fields
OlegMakarenko Sep 22, 2024
56f3bfc
[explorer/frontend] fix: typo in localization files
OlegMakarenko Sep 22, 2024
144d98c
[explorer/frontend] fix: Account and Node page styles
OlegMakarenko Sep 22, 2024
4822f33
[explorer/frontend] fix: AccountMultisigTree wrong avatar links, add …
OlegMakarenko Sep 22, 2024
74e9c13
[explorer/frontend] feat: add more known addresses
OlegMakarenko Sep 22, 2024
6af1b0a
[explorer/frontend] style: add arrows to AccountMultisigTree
OlegMakarenko Sep 22, 2024
2dfbb24
[explorer/frontend] fix: balance presentation
OlegMakarenko Sep 23, 2024
e69ce1e
[explorer/frontend] fix: too long mosaic requests failed with timeout…
OlegMakarenko Sep 23, 2024
cd18973
[explorer/frontend] fix: number formatting functions
OlegMakarenko Sep 23, 2024
87f2002
[explorer/frontend] fix: lint
OlegMakarenko Sep 23, 2024
eeaf883
[explorer/frontend] fix: lint
OlegMakarenko Sep 23, 2024
3d8f265
[explorer/frontend] feat: show time in ItemBlockMobile
OlegMakarenko Sep 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .github/buildConfiguration.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
builds:
- name: Explorer Frontend
path: explorer/frontend

- name: Explorer Nodewatch
path: explorer/nodewatch

Expand Down
11 changes: 11 additions & 0 deletions .github/codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ coverage:
default:
target: 95% # overall project / repo coverage

explorer-frontend:
target: auto
threshold: 1%
flags:
- explorer-frontend

explorer-nodewatch:
target: auto
threshold: 1%
Expand Down Expand Up @@ -61,6 +67,11 @@ coverage:
# monorepo. This allows code coverage per package.

flags:
explorer-frontend:
paths:
- explorer/frontend
carryforward: true

explorer-nodewatch:
paths:
- explorer/nodewatch
Expand Down
18 changes: 18 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ updates:
- minor
- patch

- package-ecosystem: npm
directory: /explorer/frontend
schedule:
interval: weekly
day: sunday
target-branch: dev
labels: [Explorer Frontend]
versioning-strategy: increase-if-necessary
commit-message:
prefix: '[dependency]'
groups:
explorer-frontend-dependencies:
patterns:
- '*'
update-types:
- minor
- patch

- package-ecosystem: pip
directory: /explorer/nodewatch
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/combine-dependabot-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
steps:
- name: combine dependabot prs
id: combine-prs
uses: github/combine-prs@v5.0.0
uses: github/combine-prs@v5.2.0
with:
pr_title: '[dependency]: Combine dependabot PRs'
ci_required: true
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ _data/
.next/

# python
.python-version
__pycache__/
*.egg-info/
build/
Expand Down
3 changes: 3 additions & 0 deletions explorer/frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules

/build
4 changes: 4 additions & 0 deletions explorer/frontend/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
build/
coverage/
setupTests.js
21 changes: 21 additions & 0 deletions explorer/frontend/.eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
extends:
- ../../_symbol/linters/javascript/default.eslintrc
- eslint-config-next
- plugin:import/react

rules:
import/extensions:
- error
- always
- json: always
js: never
jsx: never
yoda: off

settings:
import/resolver:
jsconfig:
config: jsconfig.json

globals:
$t: false
23 changes: 23 additions & 0 deletions explorer/frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

# dependencies
node_modules/

# testing
coverage/

# production
build/
.next/

# sqlite3 database
data/

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
4 changes: 4 additions & 0 deletions explorer/frontend/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
build/
coverage/
setupTests.js
9 changes: 9 additions & 0 deletions explorer/frontend/.prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bracketSpacing: true
jsxBracketSameLine: false
singleQuote: true
trailingComma: none
tabWidth: 4
useTabs: true
arrowParens: avoid
semi: true
printWidth: 140
13 changes: 13 additions & 0 deletions explorer/frontend/.stylelintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extends:
- stylelint-config-standard-scss
- stylelint-config-rational-order

plugins:
- stylelint-order

rules:
font-family-no-missing-generic-family-keyword: null
font-family-name-quotes: always-unless-keyword
color-function-notation: legacy
selector-class-pattern: '([a-z]+([A-Z][a-z0-9]+)*)'
selector-id-pattern: '([a-z]+([A-Z][a-z0-9]+)*)'
52 changes: 52 additions & 0 deletions explorer/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM node:lts-alpine AS base

# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies using npm
COPY package.json package-lock.json* ./
RUN npm install

# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

ENV NEXT_TELEMETRY_DISABLED 1

RUN npm run build

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT 3000

# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD HOSTNAME="0.0.0.0" node server.js
14 changes: 14 additions & 0 deletions explorer/frontend/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
defaultCiPipeline {
operatingSystem = ['ubuntu']
instanceSize = 'medium'

environment = 'javascript'

packageId = 'explorer-frontend'

publisher = 'docker'
dockerImageName = 'symbolplatform/explorer-frontend'

codeCoverageTool = 'c8'
minimumCodeCoverage = 95
}
147 changes: 147 additions & 0 deletions explorer/frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# NEM Block Explorer

This project is a NEM blockchain explorer built using the Next.js framework. It provides a user-friendly interface to explore and interact with the NEM blockchain, including features such as transaction searches, block exploration, and statistic data visualization.

## Folder Structure

```plaintext
peregrine-partners/
├── api/ # Functions for interacting with internal and external APIs
├── components/ # Reusable React components
├── config/ # Configuration for the project
├── constants/ # Global constants used throughout the application
├── pages/ # Website pages .
├── public/ # Images, fonts and other static assets
├── styles/ # Global SCSS files
└── utils/ # Utility functions and helpers
```

## Environment Variables

All environment variables listed below are required for both development and production modes.

### Public Environment Variables

These variables are prefixed with `NEXT_PUBLIC_` and are exposed to the browser, meaning they can be accessed both on the server and in the client-side code.

- **`NEXT_PUBLIC_NATIVE_MOSAIC_ID`**: Native mosaic ID. Example: `nem.xem`.

- **`NEXT_PUBLIC_NATIVE_MOSAIC_TICKER`**: Native mosaic ticker. Example: `XEM`.

- **`NEXT_PUBLIC_NATIVE_MOSAIC_DIVISIBILITY`**: Native mosaic divisibility. Example: `6`.

- **`NEXT_PUBLIC_BLOCKCHAIN_UNWIND_LIMIT`**: Blockchain unwind limit. Example: `360`.

- **`NEXT_PUBLIC_REQUEST_TIMEOUT`**: The timeout duration (in milliseconds) for network requests made by the application. Example: `15000` (15 seconds).

- **`NEXT_PUBLIC_API_BASE_URL`**: Explorer REST API endpoint. Example: `http://explorer-backend.com:4000/api/nem`.

- **`NEXT_PUBLIC_SUPERNODE_API_URL`**: Supernodes API endpoint. Example: `https://nem.io/supernode/api/statistics`.

- **`NEXT_PUBLIC_NODELIST_URL`**: Node list endpoint. Example: `https://nodewatch.symbol.tools/api/nem/nodes`.

- **`NEXT_PUBLIC_MARKET_DATA_URL`**: Market data endpoint. Example: `https://marketdata.com/data/data?sym1=XEM&sym2=USD`.

- **`NEXT_PUBLIC_HISTORICAL_PRICE_URL`**: Historical coin price endpoint. Example: `https://marketdata.com/history/data?sym1=XEM`.

- **`NEXT_PUBLIC_SOCIAL_URL_TWITTER`**: The URL for the company's Twitter/X social profile. This can be used to display social media links in the application. Example: `https://twitter.com/company`.

- **`NEXT_PUBLIC_SOCIAL_URL_GITHUB`**: The URL for the company's GitHub organization. This can be used to display social media links in the application. Example: `https://github.com/company`.

- **`NEXT_PUBLIC_SOCIAL_URL_DISCORD`**: The URL for the company's Discord server. This can be used to display social media links in the application. Example: `https://discord.com/company`.

- **`NEXT_PUBLIC_FOOTER_URL_DOCS`**: The URL for the NEM documentation. Example: `https://website.com`.

- **`NEXT_PUBLIC_FOOTER_URL_TECHNICAL_REFERENCE`**: The URL for the NEM technical reference. Example: `https://website.com`.

- **`NEXT_PUBLIC_FOOTER_URL_FAUCET`**: The URL for the XEM Faucet. Example: `https://website.com`.

- **`NEXT_PUBLIC_FOOTER_URL_SUPERNODE_PROGRAM`**: The URL for the NEM Supernode Program. Example: `https://website.com`.

## Requirements

- Node.js v20.11.0

## Installation

This project is part of a Product monorepo. Follow the steps below to set up and run the project.

1. Clone the repository from GitHub:
```bash
git clone https://github.com/symbol/product.git
```

2. Initialize:
```bash
bash init.sh
```

3. Navigate to the project folder:
```bash
cd explorer/frontend
```

4. Install Node.js dependencies:
```bash
npm install
```

5. Setup environment variables (or create `.env` file in `frontend/` root directory).

## Building the Project

To build the project, run:
```bash
npm run build
```

## Running the Project

To run the built project, use:
```bash
npm run start
```

## Development Server

To run the development server, use:
```bash
npm run dev
```

## Running Tests

To run tests, use:
```bash
npm run test
```

## Linting

To run lint checks, use:
```bash
npm run lint
```

To fix lint issues, use:
```bash
npm run lint:fix
```

## Building the Docker Image

1. Make sure you are in the explorer/frontend directory.

2. Build the Docker image:
```bash
docker build -t symbolplatform/explorer-frontend .
```

## Running the Docker Container

Run the Docker container:
```bash
docker run -p 3000:3000 symbolplatform/explorer-frontend
```

This command will start the container and expose the application on port 3000.
2 changes: 2 additions & 0 deletions explorer/frontend/__mocks__/axios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import mockAxios from 'jest-mock-axios';
export default mockAxios;
2 changes: 2 additions & 0 deletions explorer/frontend/__mocks__/ethereum-blockies-base64.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const makeBlockie = address => `image-${address}`;
export default makeBlockie;
3 changes: 3 additions & 0 deletions explorer/frontend/__mocks__/next-i18next/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const useTranslation = () => ({
t: key => key
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const useTranslation = () => ({
t: key => key
});

export const serverSideTranslations = () => Promise.resolve({});
2 changes: 2 additions & 0 deletions explorer/frontend/__mocks__/react-apexcharts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const ReactApexChart = () => <div id="mocked-react-apexcharts">Mocked React ApexCharts</div>;
export default ReactApexChart;
Loading