Skip to content

Commit c0266c5

Browse files
feat: adicionar rotas para chat e upload, redirecionamento padrão e tratamento de rotas não encontradas
feat: implementar componente de chat com funcionalidade de envio de mensagens e histórico feat: implementar componente de upload com drag and drop e gerenciamento de arquivos style: adicionar estilos globais e específicos para componentes de header, footer, chat e upload chore: configurar GitHub Actions para deploy automático e gerenciamento de versões com semantic-release feat: criar serviços para comunicação com a API de chat e upload de documentos chore: adicionar arquivos de ambiente para desenvolvimento e produção
1 parent 4a6bf7a commit c0266c5

29 files changed

Lines changed: 1018 additions & 357 deletions
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Deploy React App to Nginx
2+
3+
# Gatilho: roda quando houver push na branch main
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest # Ambiente do GitHub Actions (Ubuntu)
12+
13+
steps:
14+
# 1️⃣ Baixar o código do repositório
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
# 2️⃣ Configurar Node.js
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '18' # Versão do Node.js
23+
cache: 'npm'
24+
25+
# 3️⃣ Instalar dependências
26+
- name: Install dependencies
27+
run: npm ci # npm ci garante build reproduzível no CI (mais rápido e confiável que npm install)
28+
29+
# 4️⃣ Build do projeto React/Vite em modo produção
30+
# Gera os arquivos otimizados na pasta dist/
31+
- name: Build React app
32+
run: npm run build
33+
34+
# 5️⃣ Deploy para o servidor Nginx via rsync
35+
# rsync é mais eficiente que SCP para sincronizar arquivos
36+
- name: Deploy to Nginx
37+
uses: burnett01/rsync-deployments@7.0.1
38+
with:
39+
# Switches do rsync:
40+
# -a = modo arquivo (preserva permissões, timestamps, etc)
41+
# -v = verbose (mostra o que está sendo copiado)
42+
# -z = comprime dados durante transferência
43+
# -r = recursivo (copia subpastas)
44+
# --delete = remove arquivos antigos do servidor que não existem mais no source
45+
switches: -avzr --delete
46+
47+
# IMPORTANTE: a barra / no final copia APENAS O CONTEÚDO da pasta dist
48+
# Sem a barra, copiaria a pasta "dist" inteira
49+
path: dist/
50+
51+
# Pasta de destino no servidor (onde o Nginx serve os arquivos)
52+
remote_path: /var/www/html/projetos_web/logbooks/
53+
54+
# Dados de conexão SSH (armazenados nos Secrets do GitHub)
55+
remote_host: ${{ secrets.SERVER_HOST }} # IP ou domínio do servidor
56+
remote_port: ${{ secrets.SERVER_PORT }} # Porta SSH (normalmente 22)
57+
remote_user: ${{ secrets.SERVER_USER }} # Usuário SSH
58+
remote_key: ${{ secrets.SSH_PRIVATE_KEY }} # Chave privada SSH
59+
60+
# 6️⃣ Mensagem de sucesso
61+
- name: Deployment complete
62+
run: echo "React frontend netmap deployed successfully to nginx"

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
issues: write
14+
pull-requests: write
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 'lts/*'
26+
27+
- name: Release
28+
uses: cycjimmy/semantic-release-action@v4
29+
with:
30+
extra_plugins: |
31+
@semantic-release/changelog
32+
@semantic-release/git
33+
conventional-changelog-conventionalcommits
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}

.releaserc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
["@semantic-release/commit-analyzer", {
5+
"preset": "conventionalcommits"
6+
}],
7+
["@semantic-release/release-notes-generator", {
8+
"preset": "conventionalcommits"
9+
}],
10+
["@semantic-release/changelog", {
11+
"changelogFile": "CHANGELOG.md"
12+
}],
13+
["@semantic-release/github"],
14+
["@semantic-release/git", {
15+
"assets": ["CHANGELOG.md", "package.json"],
16+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
17+
}]
18+
]
19+
}

angular.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,13 @@
7272
"development": {
7373
"optimization": false,
7474
"extractLicenses": false,
75-
"sourceMap": true
75+
"sourceMap": true,
76+
"fileReplacements": [
77+
{
78+
"replace": "src/environments/environment.ts",
79+
"with": "src/environments/environment.development.ts"
80+
}
81+
]
7682
}
7783
},
7884
"defaultConfiguration": "production"
@@ -113,5 +119,8 @@
113119
}
114120
}
115121
}
122+
},
123+
"cli": {
124+
"analytics": false
116125
}
117126
}

package-lock.json

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,19 @@
2828
"@angular/forms": "^20.3.0",
2929
"@angular/platform-browser": "^20.3.0",
3030
"@angular/router": "^20.3.0",
31+
"@fortawesome/fontawesome-free": "^7.2.0",
32+
"bootstrap": "^5.3.8",
3133
"rxjs": "~7.8.0",
3234
"tslib": "^2.3.0",
35+
"uuid": "^13.0.0",
3336
"zone.js": "~0.15.0"
3437
},
3538
"devDependencies": {
3639
"@angular/build": "^20.3.6",
3740
"@angular/cli": "^20.3.6",
3841
"@angular/compiler-cli": "^20.3.0",
3942
"@types/jasmine": "~5.1.0",
43+
"@types/uuid": "^10.0.0",
4044
"jasmine-core": "~5.9.0",
4145
"karma": "~6.4.0",
4246
"karma-chrome-launcher": "~3.2.0",
@@ -45,4 +49,4 @@
4549
"karma-jasmine-html-reporter": "~2.1.0",
4650
"typescript": "~5.9.2"
4751
}
48-
}
52+
}

src/app/app.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZoneChangeDetection } from '@angular/core';
1+
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
22
import { provideRouter } from '@angular/router';
3-
3+
import { provideHttpClient } from '@angular/common/http';
44
import { routes } from './app.routes';
55

66
export const appConfig: ApplicationConfig = {
77
providers: [
8-
provideBrowserGlobalErrorListeners(),
98
provideZoneChangeDetection({ eventCoalescing: true }),
10-
provideRouter(routes)
9+
provideRouter(routes),
10+
provideHttpClient()
1111
]
12-
};
12+
};

src/app/app.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.main-content {
2+
min-height: calc(100vh - 112px);
3+
padding: 24px 0;
4+
}

0 commit comments

Comments
 (0)