Add new components for AI and tutorials, update routing, and enhance file upload functionality
This commit is contained in:
+26
@@ -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>
|
||||
|
||||
+28
@@ -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;
|
||||
}
|
||||
+23
@@ -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();
|
||||
});
|
||||
});
|
||||
+58
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user