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

V1.0.0 #5

Merged
merged 46 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b0dd6f5
feat: add DividendsChart
eliasrosa Jul 31, 2023
bb78200
feat: init priceHistory
eliasrosa Aug 1, 2023
ba3d3ec
refactor: components
eliasrosa Aug 1, 2023
ec9ccd8
feat: add toCurrency helper
eliasrosa Aug 1, 2023
15ba1fa
refactor: organize components
eliasrosa Aug 5, 2023
d5b463d
refactor app
eliasrosa Aug 5, 2023
2c33711
refactor: change full app
eliasrosa Aug 11, 2023
22e9e07
fix: eslint
eliasrosa Aug 11, 2023
23deee7
fix: eslint
eliasrosa Aug 11, 2023
57abf16
feat: change api to hgbrasil
eliasrosa Sep 7, 2023
cf10b69
feat(sidebar): add hide/show menu
eliasrosa Sep 9, 2023
6117c9e
add SWR
eliasrosa Sep 10, 2023
3869811
add route APi
eliasrosa Sep 10, 2023
c03ac24
rename TickerService
eliasrosa Sep 10, 2023
71a9743
fix title component
eliasrosa Sep 10, 2023
67b348d
add revalidate config to env
eliasrosa Sep 10, 2023
2a0ad3b
fix cards e initials history components
eliasrosa Sep 10, 2023
c4bee96
add history chats
eliasrosa Sep 14, 2023
cceb29b
add toastify
eliasrosa Sep 18, 2023
410f338
fix remove sab and dom
eliasrosa Sep 18, 2023
2770efd
add modal with helper buttom
eliasrosa Sep 20, 2023
76a4f0c
feat: add layout improvements
eliasrosa Nov 13, 2023
a2ab2cd
fix: add throw error from API data
eliasrosa Nov 13, 2023
4942cc8
test: config vitest and mock-server
eliasrosa Nov 22, 2023
586d6eb
feat: add unit tests
eliasrosa Nov 22, 2023
e0dd5c3
test: add vitest/coverage-v8
eliasrosa Nov 22, 2023
8f0b334
fix: lint remove vars defined but never used
eliasrosa Nov 22, 2023
d1acb4c
feat: add package @testing-library
eliasrosa Nov 22, 2023
ca1e885
feat: add tests common componets
eliasrosa Nov 23, 2023
cfac122
fix: add types for build
eliasrosa Nov 23, 2023
fb4ad1a
feat: add tests layout components
eliasrosa Nov 23, 2023
d7412e1
feat: install cypress and add tests
eliasrosa Nov 24, 2023
dee2ca4
docs: update readme
eliasrosa Nov 24, 2023
4e39d95
feat: add cookie on close terms
eliasrosa Nov 24, 2023
b6d0d58
feat: add simulator page
eliasrosa Nov 24, 2023
a1679de
feat: add e2e tests
eliasrosa Nov 25, 2023
7c5efd0
fix: test simulator
eliasrosa Nov 25, 2023
95f6b53
fix: Update closeModal prop in ModalConfig interface
eliasrosa Nov 25, 2023
a0ba2e8
fix: sidebar overlay button
eliasrosa Nov 25, 2023
95494ed
fix: add toggleSidebar onClick menu
eliasrosa Nov 25, 2023
6e92ee5
fix: charts components
eliasrosa Nov 25, 2023
0145ac1
fix: fix sidebar overlay
eliasrosa Nov 25, 2023
5fae312
fix: rename label input
eliasrosa Nov 25, 2023
4ac0a2a
fix: errors in texts
eliasrosa Nov 25, 2023
891479e
fix: duplicate tooltip
eliasrosa Nov 26, 2023
3c26310
refactor: change tickersInitialState
eliasrosa Nov 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NEXT_PUBLIC_API_KEY=
NEXT_PUBLIC_API_URL=https://api.hgbrasil.com
NEXT_PUBLIC_API_CACHE=force-cache
NEXT_PUBLIC_API_REVALIDATE=3600
8 changes: 7 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"extends": ["next/core-web-vitals", "@rocketseat/eslint-config/react"]
"extends": ["@rocketseat/eslint-config/react", "plugin:@next/next/recommended", "plugin:cypress/recommended"],
"rules" : {
"@typescript-eslint/no-explicit-any": "off"
},
"globals": {
"cy": true
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

src/styles/output.css
.env
32 changes: 0 additions & 32 deletions .old/Card.tsx

This file was deleted.

43 changes: 0 additions & 43 deletions .old/HistoryChart.tsx

This file was deleted.

54 changes: 0 additions & 54 deletions .old/ResultsProviders.tsx

This file was deleted.

46 changes: 0 additions & 46 deletions .old/fiis/[ticket]/page.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions .old/getPVP.ts

This file was deleted.

9 changes: 0 additions & 9 deletions .old/getQuote.ts

This file was deleted.

19 changes: 0 additions & 19 deletions .old/selic/page.tsx

This file was deleted.

46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,50 @@
## Getting Started
## Requisitos
Para executar este projeto, você precisará ter instalado:
- [Node.js - v18](https://nodejs.org/en/)
- [Docker - v24](https://www.docker.com/)

First, run the development server:
## Primeiros Passos

Para começar, instale as dependências e execute o servidor de desenvolvimento:

```bash
npm install
npm run dev
```
Isso iniciará o servidor de desenvolvimento, permitindo que você trabalhe no projeto.

## Executar o Servidor Mock
Para executar o servidor mock, que estará disponível em http://localhost:1080, utilize o seguinte comando:

```bash
docker compose up
```

## Testes Unitários
Para executar os testes unitários, use os comandos a seguir:

```bash
npm run test
npm run test:watch
```

## Testes End-to-End (e2e)
Execute os testes end-to-end com o comando:

```bash
npm run test:e2e
```

## Build da Aplicação
Para gerar o build da aplicação, utilize o seguinte comando:

```bash
npm run build
```

## Análise de Código (Lint)
Para realizar a análise de código e garantir conformidade com as práticas recomendadas, execute:

```bash
npm run lint
```
16 changes: 16 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineConfig } from 'cypress'
import { readFile } from 'fs/promises'

export default defineConfig({
screenshotOnRunFailure: false,
chromeWebSecurity: false,
video: false,

e2e: {
baseUrl: 'http://localhost:3000',
viewportWidth: 1200,
viewportHeight: 800,
},

env: {},
})
23 changes: 23 additions & 0 deletions cypress/e2e/sidebar.spec.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
describe('sidebar', () => {
it('test menu link to home', () => {
cy.visit('/simulator')
cy.acceptTermsOfUse()

cy.get('[href="/"][data-testid="sidebar-menu-item"]')
.should('be.visible')
.click()

cy.url().should('eq', Cypress.config().baseUrl + '/')
})

it('test menu link to simulator', () => {
cy.visit('/')
cy.acceptTermsOfUse()

cy.get('[href="/simulator"][data-testid="sidebar-menu-item"]')
.should('be.visible')
.click()

cy.url().should('eq', Cypress.config().baseUrl + '/simulator')
})
})
20 changes: 20 additions & 0 deletions cypress/e2e/simulator.spec.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe('simulator', () => {
it('execute simulation with successfully', () => {
cy.visit('/simulator')
cy.acceptTermsOfUse()

cy.simulate()

cy.get('[data-testid="simulator-total-invested"]')
.should('be.visible')
.should('contain', 'R$ 185.000,00')

cy.get('[data-testid="simulator-total-received"]')
.should('be.visible')
.should('contain', 'R$ 569.588,58')

cy.get('[data-testid="simulator-total-accumulated"]')
.should('be.visible')
.should('contain', 'R$ 754.588,58')
})
})
8 changes: 8 additions & 0 deletions cypress/e2e/suggestions.spec.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// describe('suggestions', () => {
// it('add ticker from suggestions card', () => {
// cy.visit('/')
// cy.acceptTermsOfUse()

// cy.get('[data-testid="suggestions-card"] > :nth-child(1) > button').click()
// })
// })
12 changes: 12 additions & 0 deletions cypress/e2e/term.spec.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe('terms of use', () => {
it('show modal', () => {
cy.visit('/')
cy.contains('Termos de uso').should('be.visible')
cy.contains('Aceitar e continuar navegando').should('be.visible')
})

it('accept and close modal', () => {
cy.visit('/')
cy.acceptTermsOfUse()
})
})
Loading