feat(ui): implement home page and ai chat input with voice orb
Implement the core user interface components including the home page, a sophisticated AI chat input component, and a 3D voice visualization service using Three.js. - Add `HomePage` component with responsive layout and theme integration. - Add `AiChatInputComponent` supporting text, file attachments, and voice mode transitions. - Implement `VoiceOrbService` using Three.js to provide a reactive 3D animated orb for voice interaction. - Update routing to include the new home page. - Refactor `SettingsPage` to clean up unused RTL logic and improve UI styling. - Adjust Angular build budgets in `angular.json` to accommodate increased bundle size from Three.js.
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
.home-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100%;
|
||||
padding: 2rem 1rem;
|
||||
}
|
||||
|
||||
.home-content {
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.home-header {
|
||||
text-align: center;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.home-icon-wrapper {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
margin-bottom: 1.5rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.home-logo {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.home-title {
|
||||
font-size: 1.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0 0 0.5rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.home-subtitle {
|
||||
font-size: 0.9375rem;
|
||||
color: var(--text-muted);
|
||||
margin: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.home-page {
|
||||
padding: 1.25rem 0.75rem;
|
||||
}
|
||||
|
||||
.home-header {
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
.home-icon-wrapper {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
margin-bottom: 1.25rem;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.home-logo {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.home-title {
|
||||
font-size: 1.375rem;
|
||||
}
|
||||
|
||||
.home-subtitle {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.home-page,
|
||||
.home-header,
|
||||
.home-icon-wrapper {
|
||||
transition: none !important;
|
||||
animation: none !important;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<div class="home-page">
|
||||
<div class="home-content">
|
||||
<div class="home-header">
|
||||
<div class="home-icon-wrapper">
|
||||
<img
|
||||
class="home-logo"
|
||||
[src]="logoSrc()"
|
||||
alt="Raymand"
|
||||
/>
|
||||
</div>
|
||||
<h1 class="home-title">دستیار هوشمند</h1>
|
||||
<p class="home-subtitle">سوال خود را بپرسید، من اینجا هستم</p>
|
||||
</div>
|
||||
|
||||
<app-ai-chat-input
|
||||
placeholder="پیام خود را بنویسید..."
|
||||
(messageSent)="onMessageSent($event)"
|
||||
(fileSelected)="onFileSelected($event)"
|
||||
(voiceToggled)="onVoiceToggled($event)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,32 @@
|
||||
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { AiChatInputComponent } from '../../shared/ui/ai-chat-input/ai-chat-input.component';
|
||||
import { ThemeService } from '../../services/theme/theme.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
standalone: true,
|
||||
imports: [CommonModule, AiChatInputComponent],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
templateUrl: './home.page.html',
|
||||
styleUrl: './home.page.css',
|
||||
})
|
||||
export class HomePage {
|
||||
private readonly themeService = inject(ThemeService);
|
||||
|
||||
readonly isDarkMode = this.themeService.isDarkMode;
|
||||
|
||||
readonly logoSrc = () => this.isDarkMode() ? 'assets/images/RaymandLogo.png' : 'assets/images/login.png';
|
||||
|
||||
onMessageSent(message: string): void {
|
||||
console.log('Message sent:', message);
|
||||
}
|
||||
|
||||
onFileSelected(file: File): void {
|
||||
console.log('File selected:', file.name);
|
||||
}
|
||||
|
||||
onVoiceToggled(active: boolean): void {
|
||||
console.log('Voice mode:', active ? 'active' : 'inactive');
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,14 @@
|
||||
|
||||
.settings-tabs {
|
||||
position: relative;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.tab-divider {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
flex-shrink: 0;
|
||||
margin: 0.75rem 0;
|
||||
}
|
||||
|
||||
.tab-btn {
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
}
|
||||
</button>
|
||||
|
||||
<div class="tab-divider w-px h-6 bg-black/25"></div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="tab-btn flex-1 flex items-center justify-center gap-2 px-4 py-3 text-sm font-medium text-[var(--text-muted)] transition-all duration-200 hover:text-[var(--text-primary)] relative"
|
||||
@@ -96,7 +98,7 @@
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="dropzone relative flex flex-col items-center justify-center gap-3 p-8 border-2 border-dashed border-[var(--text-muted)]/20 rounded-xl bg-[var(--dropzone-bg)] cursor-pointer transition-all duration-300 hover:border-primary/50 hover:bg-primary/5 hover:shadow-[0_10px_30px_rgba(59,130,246,0.15)]"
|
||||
class="dropzone relative flex flex-col items-center justify-center gap-3 p-8 border-2 border-dashed border-[rgba(148,163,184,0.25)] rounded-xl bg-[var(--dropzone-bg)] cursor-pointer transition-all duration-300 hover:border-primary/50 hover:bg-primary/5 hover:shadow-[0_10px_30px_rgba(59,130,246,0.15)]"
|
||||
[class.dropzone-active]="isDragging()"
|
||||
(dragover)="onDragOver($event)"
|
||||
(dragleave)="onDragLeave()"
|
||||
@@ -302,23 +304,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="setting-item flex items-center justify-between gap-4 p-4 bg-[var(--card-bg)] rounded-xl shadow-[0_2px_8px_rgba(0,0,0,0.04)] transition-all duration-200 hover:shadow-[0_4px_16px_rgba(0,0,0,0.08)] hover:-translate-y-0.5"
|
||||
>
|
||||
<div class="setting-info flex flex-col gap-1 min-w-0">
|
||||
<span class="text-sm font-medium text-[var(--text-secondary)]">حالت RTL</span>
|
||||
<span class="text-xs text-[var(--text-muted)]"
|
||||
>جهت متن راستبهچپ (فارسی/عربی)</span
|
||||
>
|
||||
</div>
|
||||
<div class="setting-control shrink-0">
|
||||
<label class="toggle-switch" [class.toggle-active]="isRTL()">
|
||||
<input type="checkbox" [checked]="isRTL()" (change)="toggleRTL()" />
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component, signal, inject, computed, effect } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, signal, inject } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { ThemeService } from '../../services/theme/theme.service';
|
||||
@@ -29,7 +29,6 @@ export class SettingsPage {
|
||||
readonly language = signal('fa');
|
||||
readonly notificationsEnabled = signal(true);
|
||||
readonly isDarkMode = this.themeService.isDarkMode;
|
||||
readonly isRTL = signal(true);
|
||||
|
||||
selectTab(id: TabId): void {
|
||||
this.activeTab.set(id);
|
||||
@@ -77,12 +76,6 @@ export class SettingsPage {
|
||||
this.themeService.toggleDarkMode();
|
||||
}
|
||||
|
||||
toggleRTL(): void {
|
||||
this.isRTL.update(val => !val);
|
||||
document.documentElement.dir = this.isRTL() ? 'rtl' : 'ltr';
|
||||
document.body.style.direction = this.isRTL() ? 'rtl' : 'ltr';
|
||||
}
|
||||
|
||||
get fileCount(): number {
|
||||
return this.uploadedFiles().length;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user