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,173 @@
|
||||
<div class="ai-chat-input-wrapper" [class.voice-active]="isVoiceMode()">
|
||||
<div class="composer-layer" [class.layer-hidden]="isVoiceMode()">
|
||||
<div class="chat-composer" #composer>
|
||||
<button
|
||||
type="button"
|
||||
class="composer-btn plus-btn"
|
||||
(click)="toggleAttachmentMenu()"
|
||||
[attr.aria-expanded]="isAttachmentMenuOpen()"
|
||||
aria-label="افزودن پیوست"
|
||||
>
|
||||
<svg
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M12 5v14M5 12h14" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div class="composer-textarea-wrapper">
|
||||
<textarea
|
||||
#textarea
|
||||
class="composer-textarea"
|
||||
[placeholder]="placeholder()"
|
||||
[disabled]="disabled()"
|
||||
(input)="onTextareaInput()"
|
||||
(keydown)="onKeyDown($event)"
|
||||
rows="1"
|
||||
dir="rtl"
|
||||
aria-label="متن پیام"
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="composer-btn mic-btn"
|
||||
(click)="toggleVoiceMode()"
|
||||
aria-label="حالت صوتی"
|
||||
>
|
||||
<svg
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" />
|
||||
<path d="M19 10v2a7 7 0 0 1-14 0v-2" />
|
||||
<line x1="12" x2="12" y1="19" y2="22" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="composer-btn send-btn"
|
||||
[disabled]="!message().trim() || disabled()"
|
||||
(click)="sendMessage()"
|
||||
aria-label="ارسال پیام"
|
||||
>
|
||||
<svg
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M12 19V5M5 12l7-7 7 7" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
@if (isAttachmentMenuOpen()) {
|
||||
<div class="attachment-menu" role="menu">
|
||||
<button
|
||||
type="button"
|
||||
class="attachment-menu-item"
|
||||
role="menuitem"
|
||||
(click)="selectFile(); closeAttachmentMenu();"
|
||||
>
|
||||
<svg
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" />
|
||||
<polyline points="14 2 14 8 20 8" />
|
||||
</svg>
|
||||
<span>آپلود فایل</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="attachment-menu-item"
|
||||
role="menuitem"
|
||||
(click)="selectFile(); closeAttachmentMenu();"
|
||||
>
|
||||
<svg
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
|
||||
<circle cx="8.5" cy="8.5" r="1.5" />
|
||||
<polyline points="21 15 16 10 5 21" />
|
||||
</svg>
|
||||
<span>آپلود تصویر</span>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
<input
|
||||
#fileInput
|
||||
type="file"
|
||||
class="sr-only"
|
||||
(change)="onFileChange($event)"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="voice-layer" [class.layer-hidden]="!isVoiceMode()">
|
||||
<div class="voice-mode" #voiceContainer>
|
||||
<div class="orb-container" #orbContainer></div>
|
||||
<p class="voice-mode-text">در حال گوش دادن...</p>
|
||||
<button
|
||||
type="button"
|
||||
class="voice-stop-btn"
|
||||
(click)="exitVoiceMode()"
|
||||
aria-label="خروج از حالت صوتی"
|
||||
>
|
||||
<svg
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<line x1="18" x2="6" y1="6" y2="18" />
|
||||
<line x1="6" x2="18" y1="6" y2="18" />
|
||||
</svg>
|
||||
<span>پایان گفتگو</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user