Add new components for AI and tutorials, update routing, and enhance file upload functionality

This commit is contained in:
liosha84
2025-08-04 10:38:46 +03:00
parent 18c6906637
commit 483d029952
206 changed files with 2362 additions and 1199 deletions
@@ -0,0 +1,26 @@
<h1 mat-dialog-title>Hi </h1>
<div mat-dialog-content >
<mat-dialog-content class="mat-typography">
<!-- <mat-nav-list>-->
@for (fileInfo of fileInfos; track fileInfo){
<a mat-list-item (click)="select(fileInfo)">
<img style="width: 120px; height: 120px" src="{{fileInfo.url}}" alt="">
<span class="entry">
<!-- @if (!isCollapsed) {-->
<span >{{fileInfo.name}}</span>
<!-- }-->
</span>
</a>
}
<!-- </mat-nav-list>-->
</mat-dialog-content>
</div>
<div mat-dialog-actions>
<button mat-button (click)="upload()">Upload</button>
<span class="menu-spacer"></span>
<button mat-button mat-dialog-close (click)="onNoClick()">No Thanks</button>
<!-- <button mat-button cdkFocusInitial (click)="select()">Ok</button>-->
</div>
@@ -0,0 +1,28 @@
.menu-spacer {
flex: 1 1 auto;
}
.mat-dialog-content{
min-height: 300px;
min-width: 300px;
height: 75%;
width: 75%;
}
.mdc-dialog--open .mat-mdc-dialog-inner-container
{
opacity: 1;
width: 600px;
}
.mat-mdc-dialog-container {
width: 600px;
height: 500px;
display: block;
box-sizing: border-box;
max-height: inherit;
min-height: inherit;
min-width: inherit;
max-width: inherit;
outline: 0;
}
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DialogSelectImageComponent } from './dialog-select-image.component';
describe('DialogSelectImageComponent', () => {
let component: DialogSelectImageComponent;
let fixture: ComponentFixture<DialogSelectImageComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [DialogSelectImageComponent]
})
.compileComponents();
fixture = TestBed.createComponent(DialogSelectImageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,58 @@
import {Component, EventEmitter, inject, Output} from '@angular/core';
import {
MatDialogActions,
MatDialogClose,
MatDialogContent,
MatDialogRef,
MatDialogTitle
} from '@angular/material/dialog';
import {MatButton} from '@angular/material/button';
import {MatListItem, MatNavList} from '@angular/material/list';
import {RouterLink} from '@angular/router';
import {FileInfo} from '../../../models/file-info';
import {UserApiService} from '../user-api.service';
@Component({
selector: 'app-dialog-select-image.component',
imports: [
MatDialogContent,
MatDialogTitle,
MatButton,
MatDialogActions,
MatDialogClose,
MatListItem,
MatNavList,
],
templateUrl: './dialog-select-image.component.html',
styleUrl: './dialog-select-image.component.scss'
})
export class DialogSelectImageComponent {
fileInfos?: FileInfo[] = [];
@Output() uploadClicked = new EventEmitter<any>();
@Output() selectClicked = new EventEmitter<any>();
readonly dialogRef = inject(MatDialogRef<DialogSelectImageComponent>);
constructor(private userApiService: UserApiService) {
this.userApiService.getImages().subscribe(data => {
this.fileInfos = data;
console.log(data);
});
}
upload() {
this.uploadClicked.emit();
}
onNoClick() {
this.dialogRef.close();
}
select(fileInfo:FileInfo) {
this.selectClicked.emit(fileInfo);
}
}