last
This commit is contained in:
@@ -7,6 +7,8 @@ import { LoginPageComponent } from './login-page/login-page';
|
||||
import { PaginaPrincipalComponent } from './pagina-principal/pagina-principal';
|
||||
import { VitoriaAiPageComponent } from './vitoria-ai-page/vitoria-ai-page';
|
||||
import { ConversorExtratosPageComponent } from './conversor-extratos-page/conversor-extratos-page';
|
||||
import { TradutorPageComponent } from './tradutor/tradutor';
|
||||
import { ReportCreatorPageComponent } from './report-creator-page/report-creator-page';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
@@ -33,6 +35,16 @@ export const routes: Routes = [
|
||||
canActivate: [authGuard],
|
||||
component: ConversorExtratosPageComponent
|
||||
},
|
||||
{
|
||||
path: 'tradutor',
|
||||
canActivate: [authGuard],
|
||||
component: TradutorPageComponent
|
||||
},
|
||||
{
|
||||
path: 'report-creator',
|
||||
canActivate: [authGuard],
|
||||
component: ReportCreatorPageComponent
|
||||
},
|
||||
{
|
||||
path: 'cursos/:slug',
|
||||
canActivate: [authGuard],
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
.hero-logo-badge {
|
||||
position: absolute;
|
||||
top: 24px;
|
||||
right: 24px;
|
||||
left: 24px;
|
||||
z-index: 1;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<div class="min-h-screen bg-slate-50 text-slate-900">
|
||||
<app-hub-page-actions />
|
||||
<input
|
||||
#pdfInput
|
||||
type="file"
|
||||
@@ -10,7 +11,6 @@
|
||||
<section class="relative overflow-hidden bg-slate-950">
|
||||
<div class="absolute inset-0 bg-gradient-to-r from-indigo-700/20 via-cyan-500/10 to-purple-700/20"></div>
|
||||
<div class="hero-logo-badge">
|
||||
<button type="button" class="logout-button" (click)="logout()">Sair</button>
|
||||
<a href="https://www.metacase.pt" target="_blank" rel="noopener">
|
||||
<img
|
||||
src="/logo-metacase-cor.svg"
|
||||
@@ -34,7 +34,6 @@
|
||||
Area dedicada a conversao de extratos bancarios a partir de PDF com exportacao final para Excel.
|
||||
</p>
|
||||
|
||||
<a routerLink="/pagina-principal" class="back-link"><br><br>Voltar ao menu do Multipurpose Hub</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
|
||||
import { Component, ElementRef, ViewChild, inject } from '@angular/core';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { Router } from '@angular/router';
|
||||
import { finalize } from 'rxjs';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
import { ConversorExtratosService } from './conversor-extratos.service';
|
||||
import { HubPageActionsComponent } from '../shared/hub-page-actions/hub-page-actions';
|
||||
|
||||
interface ConverterCard {
|
||||
bankKey: string;
|
||||
@@ -17,7 +18,7 @@ interface ConverterCard {
|
||||
@Component({
|
||||
selector: 'app-conversor-extratos-page',
|
||||
standalone: true,
|
||||
imports: [CommonModule, RouterLink],
|
||||
imports: [CommonModule, HubPageActionsComponent],
|
||||
templateUrl: './conversor-extratos-page.html',
|
||||
styleUrl: './conversor-extratos-page.css'
|
||||
})
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<ng-container *ngIf="course() as course; else notfound">
|
||||
<app-hub-page-actions />
|
||||
<div class="course-detail-page">
|
||||
<section class="course-intro">
|
||||
<div class="course-intro__inner">
|
||||
|
||||
@@ -3,11 +3,12 @@ import { Component, computed, inject } from '@angular/core';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||
import { getCourseBySlug } from '../data/courses';
|
||||
import { HubPageActionsComponent } from '../shared/hub-page-actions/hub-page-actions';
|
||||
|
||||
@Component({
|
||||
selector: 'app-course-detail-page',
|
||||
standalone: true,
|
||||
imports: [CommonModule, RouterLink],
|
||||
imports: [CommonModule, RouterLink, HubPageActionsComponent],
|
||||
templateUrl: './course-detail-page.html',
|
||||
styleUrl: './course-detail-page.css'
|
||||
})
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<ng-container *ngIf="course() as course; else notfound">
|
||||
<app-hub-page-actions />
|
||||
<div class="learning-page">
|
||||
<header class="learning-header">
|
||||
<div class="learning-header__inner">
|
||||
|
||||
@@ -3,11 +3,12 @@ import { Component, HostListener, computed, effect, inject, signal } from '@angu
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||
import { CourseQuestion, getCourseBySlug } from '../data/courses';
|
||||
import { HubPageActionsComponent } from '../shared/hub-page-actions/hub-page-actions';
|
||||
|
||||
@Component({
|
||||
selector: 'app-course-learning-page',
|
||||
standalone: true,
|
||||
imports: [CommonModule, RouterLink],
|
||||
imports: [CommonModule, RouterLink, HubPageActionsComponent],
|
||||
templateUrl: './course-learning-page.html',
|
||||
styleUrl: './course-learning-page.css'
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.hero-logo-badge {
|
||||
position: absolute;
|
||||
top: 24px;
|
||||
right: 24px;
|
||||
left: 24px;
|
||||
z-index: 1;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="min-h-screen bg-slate-50 text-slate-900">
|
||||
<app-hub-page-actions />
|
||||
<section class="relative overflow-hidden bg-slate-950">
|
||||
<div class="absolute inset-0 bg-gradient-to-r from-indigo-700/20 via-cyan-500/10 to-purple-700/20"></div>
|
||||
<div class="hero-logo-badge">
|
||||
<button type="button" class="logout-button" (click)="logout()">Sair</button>
|
||||
<a href="https://www.metacase.pt" target="_blank" rel="noopener">
|
||||
<img
|
||||
src="/logo-metacase-cor.svg"
|
||||
@@ -25,7 +25,6 @@
|
||||
<p class="mt-6 text-lg leading-8 text-slate-300">
|
||||
Formações práticas e atualizadas para a utilização da plataforma TargetOne <br>Aprendizagem orientada para a ferramenta com formações teóricas e práticas
|
||||
</p>
|
||||
<a routerLink="/pagina-principal" class="back-link"><br><br>Voltar ao menu do Multipurpose Hub</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -3,11 +3,12 @@ import { CommonModule } from '@angular/common';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
import { COURSES, type Course } from '../data/courses';
|
||||
import { HubPageActionsComponent } from '../shared/hub-page-actions/hub-page-actions';
|
||||
|
||||
@Component({
|
||||
selector: 'app-formacaometacase',
|
||||
standalone: true,
|
||||
imports: [CommonModule, RouterLink],
|
||||
imports: [CommonModule, RouterLink, HubPageActionsComponent],
|
||||
templateUrl: './formacaometacase.html',
|
||||
styleUrl: './formacaometacase.css'
|
||||
})
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<div class="login-header">
|
||||
<span>Multipurpose hub</span>
|
||||
<h1 id="login-title">Iniciar sessao</h1>
|
||||
<p>Entre para aceder as formacoes TargetOne.</p>
|
||||
</div>
|
||||
|
||||
<form class="login-form" (ngSubmit)="login()" novalidate>
|
||||
|
||||
@@ -55,14 +55,14 @@ export class PaginaPrincipalComponent {
|
||||
label: 'Tradutor',
|
||||
caption: 'Tradutor de textos',
|
||||
image: '/imagenscursos/Reportcreator.png',
|
||||
route: '/cursos/formacao-plataforma',
|
||||
route: '/tradutor',
|
||||
angle: '90deg'
|
||||
},
|
||||
{
|
||||
label: 'Report Creator',
|
||||
caption: 'Report digitalization',
|
||||
image: '/imagenscursos/Digitalizationreport.png',
|
||||
route: '/cursos/formacao-plataforma',
|
||||
route: '/report-creator',
|
||||
angle: '180deg'
|
||||
}
|
||||
];
|
||||
|
||||
@@ -0,0 +1,293 @@
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.report-page {
|
||||
min-height: 100vh;
|
||||
padding: 32px;
|
||||
color: #0f172a;
|
||||
background:
|
||||
radial-gradient(circle at 12% 0%, rgba(250, 204, 21, .2), transparent 28%),
|
||||
radial-gradient(circle at 88% 4%, rgba(59, 130, 246, .15), transparent 25%),
|
||||
linear-gradient(180deg, #fbfdff 0%, #eef4ff 48%, #f8fafc 100%);
|
||||
}
|
||||
|
||||
.report-header {
|
||||
display: flex;
|
||||
max-width: 1500px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.report-header__brand {
|
||||
display: inline-flex;
|
||||
padding: 14px 18px;
|
||||
border: 1px solid rgba(191, 219, 254, .7);
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, .88);
|
||||
box-shadow: 0 20px 48px rgba(15, 23, 42, .08);
|
||||
}
|
||||
|
||||
.report-header__brand img {
|
||||
width: clamp(170px, 18vw, 260px);
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.report-hero {
|
||||
max-width: 820px;
|
||||
margin: 38px auto 28px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.report-hero__eyebrow,
|
||||
.report-toolbar__label {
|
||||
color: #1d4ed8;
|
||||
font-size: .78rem;
|
||||
font-weight: 900;
|
||||
letter-spacing: .12em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.report-hero__eyebrow {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 34px;
|
||||
padding: 0 14px;
|
||||
border-radius: 999px;
|
||||
background: rgba(37, 99, 235, .1);
|
||||
}
|
||||
|
||||
.report-hero h1 {
|
||||
margin: 16px 0 0;
|
||||
font-size: clamp(2.35rem, 4vw, 4rem);
|
||||
line-height: 1.05;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.report-hero p {
|
||||
margin: 14px auto 0;
|
||||
color: #64748b;
|
||||
font-size: 1.05rem;
|
||||
}
|
||||
|
||||
.report-workspace {
|
||||
max-width: 1500px;
|
||||
margin: 0 auto;
|
||||
padding: 24px;
|
||||
border: 1px solid rgba(148, 163, 184, .22);
|
||||
border-radius: 30px;
|
||||
background: rgba(255, 255, 255, .95);
|
||||
box-shadow: 0 28px 70px rgba(15, 23, 42, .11);
|
||||
}
|
||||
|
||||
.report-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.report-toolbar h2 {
|
||||
margin: 5px 0 0;
|
||||
font-size: clamp(1.35rem, 2vw, 1.8rem);
|
||||
}
|
||||
|
||||
.report-toolbar__actions,
|
||||
.connection-panel__actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.connection-panel {
|
||||
max-width: 900px;
|
||||
margin: 30px auto 20px;
|
||||
padding: clamp(22px, 4vw, 38px);
|
||||
border: 1px solid #dbeafe;
|
||||
border-radius: 24px;
|
||||
background: linear-gradient(145deg, #f8fbff, #fff);
|
||||
}
|
||||
|
||||
.connection-panel__copy {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.connection-panel__copy strong {
|
||||
font-size: 1.08rem;
|
||||
}
|
||||
|
||||
.connection-panel__copy p {
|
||||
margin: 6px 0 0;
|
||||
color: #64748b;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.connection-panel__icon {
|
||||
display: grid;
|
||||
flex: 0 0 48px;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
place-items: center;
|
||||
border-radius: 13px;
|
||||
background: linear-gradient(135deg, #facc15, #f59e0b);
|
||||
color: #422006;
|
||||
font-weight: 950;
|
||||
box-shadow: 0 12px 26px rgba(245, 158, 11, .22);
|
||||
}
|
||||
|
||||
.url-field {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
margin-top: 26px;
|
||||
color: #475569;
|
||||
font-size: .78rem;
|
||||
font-weight: 900;
|
||||
letter-spacing: .08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.url-field input {
|
||||
width: 100%;
|
||||
min-height: 52px;
|
||||
padding: 0 16px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 14px;
|
||||
outline: none;
|
||||
background: #fff;
|
||||
color: #0f172a;
|
||||
font: inherit;
|
||||
font-weight: 500;
|
||||
letter-spacing: normal;
|
||||
text-transform: none;
|
||||
transition: border-color .2s, box-shadow .2s;
|
||||
}
|
||||
|
||||
.url-field input:focus {
|
||||
border-color: #3b82f6;
|
||||
box-shadow: 0 0 0 4px rgba(59, 130, 246, .12);
|
||||
}
|
||||
|
||||
.connection-panel__actions {
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.connect-button,
|
||||
.clear-button,
|
||||
.primary-button,
|
||||
.secondary-button {
|
||||
min-height: 44px;
|
||||
padding: 0 18px;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
font-weight: 850;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.connect-button,
|
||||
.primary-button {
|
||||
background: linear-gradient(135deg, #1d4ed8, #2563eb);
|
||||
color: #fff;
|
||||
box-shadow: 0 12px 26px rgba(37, 99, 235, .22);
|
||||
}
|
||||
|
||||
.clear-button,
|
||||
.secondary-button {
|
||||
background: #eaf1fb;
|
||||
color: #1e3a5f;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
opacity: .55;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
margin: 14px 0 0;
|
||||
padding: 12px 15px;
|
||||
border-radius: 12px;
|
||||
background: #fef2f2;
|
||||
color: #b91c1c;
|
||||
font-weight: 750;
|
||||
}
|
||||
|
||||
.viewer-shell {
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
min-height: 560px;
|
||||
border: 1px solid #dbe3ee;
|
||||
border-radius: 20px;
|
||||
background: #eef2f7;
|
||||
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6);
|
||||
}
|
||||
|
||||
.viewer-shell iframe {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
display: grid;
|
||||
min-height: 420px;
|
||||
place-content: center;
|
||||
text-align: center;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.empty-state strong {
|
||||
color: #1e293b;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.empty-state p {
|
||||
margin: 8px 0 0;
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.report-page {
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.report-header__brand {
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.report-hero {
|
||||
margin-top: 34px;
|
||||
}
|
||||
|
||||
.report-workspace {
|
||||
padding: 16px;
|
||||
border-radius: 22px;
|
||||
}
|
||||
|
||||
.report-toolbar {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.report-toolbar__actions,
|
||||
.connection-panel__actions {
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.report-toolbar__actions button,
|
||||
.connection-panel__actions button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.connection-panel__copy {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.viewer-shell {
|
||||
min-height: 65vh;
|
||||
aspect-ratio: auto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<main class="report-page">
|
||||
<app-hub-page-actions />
|
||||
|
||||
<header class="report-header">
|
||||
<div class="report-header__brand">
|
||||
<img src="/logo-metacase-cor.svg" alt="Metacase" />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="report-hero">
|
||||
<span class="report-hero__eyebrow">Operational Framework</span>
|
||||
<h1>Report Creator</h1>
|
||||
<p>Consulte relatórios e dashboards do Power BI Service dentro do portal.</p>
|
||||
</section>
|
||||
|
||||
<section class="report-workspace" aria-labelledby="power-bi-title">
|
||||
<div class="report-toolbar">
|
||||
<div>
|
||||
<span class="report-toolbar__label">Power BI Service</span>
|
||||
<h2 id="power-bi-title">Dashboard Metacase</h2>
|
||||
</div>
|
||||
|
||||
<div class="report-toolbar__actions">
|
||||
<button type="button" class="primary-button" (click)="openInPowerBi()">
|
||||
Abrir no Power BI
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="viewer-shell">
|
||||
<iframe
|
||||
[src]="embeddedUrl"
|
||||
title="Dashboard do Power BI"
|
||||
allowfullscreen
|
||||
loading="eager"
|
||||
referrerpolicy="strict-origin-when-cross-origin"
|
||||
></iframe>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
||||
import { HubPageActionsComponent } from '../shared/hub-page-actions/hub-page-actions';
|
||||
|
||||
@Component({
|
||||
selector: 'app-report-creator-page',
|
||||
standalone: true,
|
||||
imports: [HubPageActionsComponent],
|
||||
templateUrl: './report-creator-page.html',
|
||||
styleUrl: './report-creator-page.css'
|
||||
})
|
||||
export class ReportCreatorPageComponent {
|
||||
private readonly sanitizer = inject(DomSanitizer);
|
||||
|
||||
readonly powerBiUrl =
|
||||
'https://app.powerbi.com/reportEmbed?reportId=252462b6-8ba5-460d-b9b7-b22e9d6475cc&autoAuth=true&ctid=536b85ad-a448-4186-a9af-e3ccad3302c5';
|
||||
readonly embeddedUrl: SafeResourceUrl =
|
||||
this.sanitizer.bypassSecurityTrustResourceUrl(this.powerBiUrl);
|
||||
|
||||
openInPowerBi(): void {
|
||||
window.open(this.powerBiUrl, '_blank', 'noopener,noreferrer');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
:host { position: fixed; top: 24px; right: 24px; z-index: 1000; }
|
||||
.page-actions { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid rgba(191, 219, 254, .7); border-radius: 999px; background: rgba(255, 255, 255, .9); box-shadow: 0 16px 34px rgba(15, 23, 42, .14); backdrop-filter: blur(12px); }
|
||||
.back-button, .hub-topbar__logout { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; font-weight: 800; cursor: pointer; }
|
||||
.back-button { gap: 8px; color: #1d4ed8; text-decoration: none; }
|
||||
.hub-topbar__logout { background: linear-gradient(135deg, #1d4ed8, #2563eb); color: #fff; box-shadow: 0 12px 26px rgba(37, 99, 235, .24); }
|
||||
@media (max-width: 640px) { :host { top: 12px; right: 12px; left: 12px; } .page-actions { justify-content: space-between; } .back-button, .hub-topbar__logout { min-height: 40px; padding: 0 14px; font-size: .84rem; } }
|
||||
@@ -0,0 +1,6 @@
|
||||
<nav class="page-actions" aria-label="Ações da página">
|
||||
<a routerLink="/pagina-principal" class="back-button" aria-label="Voltar à página principal">
|
||||
<span aria-hidden="true">←</span> Página principal
|
||||
</a>
|
||||
<button type="button" class="hub-topbar__logout" (click)="logout()">Sair</button>
|
||||
</nav>
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { AuthService } from '../../auth/auth.service';
|
||||
|
||||
@Component({ selector: 'app-hub-page-actions', standalone: true, imports: [RouterLink], templateUrl: './hub-page-actions.html', styleUrl: './hub-page-actions.css' })
|
||||
export class HubPageActionsComponent {
|
||||
private readonly authService = inject(AuthService);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
logout(): void {
|
||||
this.authService.logout();
|
||||
void this.router.navigateByUrl('/');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
:host { display: block; }
|
||||
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
|
||||
.translator-page { min-height: 100vh; padding: 32px; color: #0f172a; background: radial-gradient(circle at top left, rgba(59,130,246,.16), transparent 28%), radial-gradient(circle at top right, rgba(56,189,248,.18), transparent 26%), linear-gradient(180deg,#f8fbff 0%,#eef4ff 44%,#f8fafc 100%); }
|
||||
.translator-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1240px; margin: 0 auto; }
|
||||
.translator-header__brand { display: inline-flex; padding: 14px 18px; border: 1px solid rgba(191,219,254,.7); border-radius: 999px; background: rgba(255,255,255,.84); box-shadow: 0 20px 48px rgba(15,23,42,.08); }
|
||||
.translator-header__brand img { width: clamp(170px,18vw,260px); height: auto; }
|
||||
.back-button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; background: linear-gradient(135deg,#1d4ed8,#2563eb); color: #fff; text-decoration: none; font-weight: 800; box-shadow: 0 16px 34px rgba(37,99,235,.24); }
|
||||
.translator-hero { max-width: 760px; margin: 44px auto 32px; text-align: center; }
|
||||
.translator-hero__eyebrow { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 999px; background: rgba(37,99,235,.1); color: #1d4ed8; font-size: .82rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
|
||||
.translator-hero h1 { margin: 18px 0 0; font-size: clamp(2.4rem,4vw,4rem); line-height: 1.05; font-weight: 900; }
|
||||
.translator-hero p { margin: 16px auto 0; color: #64748b; font-size: 1.05rem; line-height: 1.7; }
|
||||
.translator-card { max-width: 1240px; margin: 0 auto; padding: 28px; border: 1px solid rgba(148,163,184,.2); border-radius: 32px; background: rgba(255,255,255,.94); box-shadow: 0 28px 70px rgba(15,23,42,.1); }
|
||||
.language-bar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: end; }
|
||||
.language-bar label { display: grid; gap: 8px; color: #475569; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
|
||||
.language-bar select { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #cbd5e1; border-radius: 14px; background: #fff; color: #0f172a; font: inherit; text-transform: none; letter-spacing: normal; }
|
||||
.swap-button { width: 48px; height: 48px; border: 0; border-radius: 50%; background: #eff6ff; color: #1d4ed8; font-size: 1.5rem; font-weight: 900; cursor: pointer; }
|
||||
.text-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; margin-top: 24px; }
|
||||
.text-panel { overflow: hidden; border: 1px solid #e2e8f0; border-radius: 22px; background: #fff; }
|
||||
.text-panel--result { background: #f8fbff; }
|
||||
.text-panel__heading { display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: 0 18px; border-bottom: 1px solid #e2e8f0; }
|
||||
.text-panel__heading span { color: #94a3b8; font-size: .78rem; }
|
||||
.text-panel textarea, .translation-output { width: 100%; min-height: 300px; padding: 20px; border: 0; outline: 0; resize: vertical; color: #0f172a; background: transparent; font: inherit; line-height: 1.7; }
|
||||
.translation-output { white-space: pre-wrap; }
|
||||
.translation-output--empty { color: #94a3b8; }
|
||||
.copy-button { border: 0; background: transparent; color: #2563eb; font-weight: 800; cursor: pointer; }
|
||||
.copy-button:disabled { color: #94a3b8; cursor: not-allowed; }
|
||||
.error-message { margin: 18px 0 0; padding: 12px 16px; border-radius: 14px; background: #fef2f2; color: #b91c1c; font-weight: 700; }
|
||||
.translator-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; }
|
||||
.clear-button, .translate-button { min-height: 46px; padding: 0 22px; border: 0; border-radius: 999px; font-weight: 800; cursor: pointer; }
|
||||
.clear-button { background: #e2e8f0; color: #334155; }
|
||||
.translate-button { background: linear-gradient(135deg,#2563eb,#4f46e5); color: #fff; box-shadow: 0 16px 36px rgba(37,99,235,.22); }
|
||||
button:disabled { opacity: .55; cursor: not-allowed; }
|
||||
@media (max-width: 768px) { .translator-page { padding: 18px; } .translator-header { flex-direction: column; align-items: stretch; } .translator-header__brand { justify-content: center; } .back-button { justify-content: center; } .language-bar, .text-grid { grid-template-columns: 1fr; } .swap-button { justify-self: center; transform: rotate(90deg); } .translator-card { padding: 18px; } .translator-actions { flex-direction: column-reverse; } .clear-button, .translate-button { width: 100%; } }
|
||||
@@ -0,0 +1,103 @@
|
||||
<main class="translator-page">
|
||||
<app-hub-page-actions />
|
||||
<header class="translator-header">
|
||||
<div class="translator-header__brand">
|
||||
<img src="/logo-metacase-cor.svg" alt="Metacase" />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="translator-hero">
|
||||
<span class="translator-hero__eyebrow">Operational Framework</span>
|
||||
<h1>Tradutor</h1>
|
||||
</section>
|
||||
|
||||
<section class="translator-card" aria-labelledby="translator-title">
|
||||
<h2 id="translator-title" class="sr-only">Área de tradução</h2>
|
||||
|
||||
<div class="language-bar">
|
||||
<label>
|
||||
<span>Idioma de origem</span>
|
||||
<select [(ngModel)]="sourceLanguage" [disabled]="isLoading">
|
||||
<option *ngFor="let language of languages" [value]="language.code">
|
||||
{{ language.label }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="swap-button"
|
||||
(click)="swapLanguages()"
|
||||
[disabled]="isLoading"
|
||||
aria-label="Trocar idiomas"
|
||||
>
|
||||
⇄
|
||||
</button>
|
||||
|
||||
<label>
|
||||
<span>Idioma de destino</span>
|
||||
<select [(ngModel)]="targetLanguage" [disabled]="isLoading">
|
||||
<option *ngFor="let language of languages" [value]="language.code">
|
||||
{{ language.label }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="text-grid">
|
||||
<div class="text-panel">
|
||||
<div class="text-panel__heading">
|
||||
<strong>Texto original</strong>
|
||||
<span>{{ sourceText.length }} caracteres</span>
|
||||
</div>
|
||||
|
||||
<textarea
|
||||
[(ngModel)]="sourceText"
|
||||
maxlength="5000"
|
||||
placeholder="Escreva ou cole aqui o texto que pretende traduzir..."
|
||||
[disabled]="isLoading"
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<div class="text-panel text-panel--result">
|
||||
<div class="text-panel__heading">
|
||||
<strong>Tradução</strong>
|
||||
<button
|
||||
type="button"
|
||||
class="copy-button"
|
||||
(click)="copyTranslation()"
|
||||
[disabled]="!translatedText"
|
||||
>
|
||||
{{ copied ? 'Copiado!' : 'Copiar' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="translation-output" [class.translation-output--empty]="!translatedText">
|
||||
{{ translatedText || (isLoading ? 'A traduzir...' : 'A tradução será apresentada aqui.') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p *ngIf="errorMessage" class="error-message" role="alert">{{ errorMessage }}</p>
|
||||
|
||||
<div class="translator-actions">
|
||||
<button
|
||||
type="button"
|
||||
class="clear-button"
|
||||
(click)="clear()"
|
||||
[disabled]="isLoading || (!sourceText && !translatedText)"
|
||||
>
|
||||
Limpar
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="translate-button"
|
||||
(click)="translate()"
|
||||
[disabled]="isLoading || !sourceText.trim() || sourceLanguage === targetLanguage"
|
||||
>
|
||||
{{ isLoading ? 'A traduzir...' : 'Traduzir texto' }}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
@@ -0,0 +1,29 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface TranslationResponse {
|
||||
translation: string;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TradutorService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
translate(
|
||||
text: string,
|
||||
source: string,
|
||||
target: string
|
||||
): Observable<TranslationResponse> {
|
||||
return this.http.post<TranslationResponse>(
|
||||
'/api/tradutor/traduzir',
|
||||
{
|
||||
text,
|
||||
source,
|
||||
target
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { finalize } from 'rxjs';
|
||||
import { HubPageActionsComponent } from '../shared/hub-page-actions/hub-page-actions';
|
||||
import { TradutorService } from './tradutor.service';
|
||||
import { ChangeDetectorRef, Component, inject } from '@angular/core';
|
||||
|
||||
interface Language { code: string; label: string; }
|
||||
|
||||
@Component({
|
||||
selector: 'app-tradutor-page',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, HubPageActionsComponent],
|
||||
templateUrl: './tradutor.html',
|
||||
styleUrl: './tradutor.css'
|
||||
})
|
||||
export class TradutorPageComponent {
|
||||
private readonly tradutorService = inject(TradutorService);
|
||||
private readonly cdr = inject(ChangeDetectorRef);
|
||||
|
||||
readonly languages: Language[] = [
|
||||
{ code: 'pt', label: 'Português' },
|
||||
{ code: 'en', label: 'Inglês' },
|
||||
{ code: 'es', label: 'Espanhol' },
|
||||
{ code: 'fr', label: 'Francês' },
|
||||
{ code: 'de', label: 'Alemão' },
|
||||
{ code: 'it', label: 'Italiano' }
|
||||
];
|
||||
|
||||
sourceText = '';
|
||||
translatedText = '';
|
||||
sourceLanguage = 'pt';
|
||||
targetLanguage = 'en';
|
||||
isLoading = false;
|
||||
errorMessage = '';
|
||||
copied = false;
|
||||
|
||||
translate(): void {
|
||||
const text = this.sourceText.trim();
|
||||
|
||||
if (!text || this.isLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isLoading = true;
|
||||
this.errorMessage = '';
|
||||
this.copied = false;
|
||||
|
||||
console.log('[TRADUTOR FRONTEND] Pedido iniciado');
|
||||
|
||||
this.tradutorService
|
||||
.translate(text, this.sourceLanguage, this.targetLanguage)
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
console.log('[TRADUTOR FRONTEND] Finalizado');
|
||||
|
||||
this.isLoading = false;
|
||||
|
||||
// força atualização da interface
|
||||
this.cdr.detectChanges();
|
||||
})
|
||||
)
|
||||
.subscribe({
|
||||
next: (response) => {
|
||||
console.log('[TRADUTOR FRONTEND] Resposta:', response);
|
||||
console.log('[TRADUTOR FRONTEND] Tradução:', response.translation);
|
||||
|
||||
this.translatedText = response.translation ?? '';
|
||||
|
||||
if (!this.translatedText) {
|
||||
this.errorMessage =
|
||||
'O serviço não devolveu uma tradução.';
|
||||
}
|
||||
|
||||
// força apresentação imediata do texto
|
||||
this.cdr.detectChanges();
|
||||
},
|
||||
|
||||
error: (error) => {
|
||||
console.error('[TRADUTOR FRONTEND] ERRO:', error);
|
||||
|
||||
this.errorMessage =
|
||||
'Não foi possível efetuar a tradução.';
|
||||
|
||||
this.cdr.detectChanges();
|
||||
}
|
||||
});
|
||||
}
|
||||
swapLanguages(): void {
|
||||
[this.sourceLanguage, this.targetLanguage] = [this.targetLanguage, this.sourceLanguage];
|
||||
[this.sourceText, this.translatedText] = [this.translatedText, this.sourceText];
|
||||
this.errorMessage = '';
|
||||
this.copied = false;
|
||||
}
|
||||
|
||||
async copyTranslation(): Promise<void> {
|
||||
if (!this.translatedText) return;
|
||||
try {
|
||||
await navigator.clipboard.writeText(this.translatedText);
|
||||
this.copied = true;
|
||||
window.setTimeout(() => (this.copied = false), 1800);
|
||||
} catch {
|
||||
this.errorMessage = 'Não foi possível copiar o texto.';
|
||||
}
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.sourceText = '';
|
||||
this.translatedText = '';
|
||||
this.errorMessage = '';
|
||||
this.copied = false;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
<div class="ai-page">
|
||||
<app-hub-page-actions />
|
||||
<header class="ai-header">
|
||||
<div>
|
||||
<span class="ai-header__badge">{{ badge }}</span>
|
||||
@@ -7,7 +8,6 @@
|
||||
</div>
|
||||
|
||||
<div class="ai-header__actions">
|
||||
<a routerLink="/pagina-principal" class="nav-link">Pagina principal</a>
|
||||
<button type="button" class="new-chat-button" (click)="newChat()">Nova conversa</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Component, ElementRef, ViewChild, inject } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { finalize } from 'rxjs';
|
||||
import { ChatMessage, VitoriaAiService } from './vitoria-ai.service';
|
||||
import { HubPageActionsComponent } from '../shared/hub-page-actions/hub-page-actions';
|
||||
|
||||
@Component({
|
||||
selector: 'app-vitoria-ai-page',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, RouterLink],
|
||||
imports: [CommonModule, FormsModule, HubPageActionsComponent],
|
||||
templateUrl: './vitoria-ai-page.html',
|
||||
styleUrl: './vitoria-ai-page.css'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user