+
diff --git a/jambotron-ui/src/app/main-module/main.component/main.component.scss b/jambotron-ui/src/app/main-module/main.component/main.component.scss
index 91d9aa8..fe0674f 100644
--- a/jambotron-ui/src/app/main-module/main.component/main.component.scss
+++ b/jambotron-ui/src/app/main-module/main.component/main.component.scss
@@ -12,9 +12,18 @@ mat-toolbar{
right: 0;
left: 0;
z-index: 1000; // Ensure toolbar stays above other content
+ height: 65px;
}
.mat-mdc-raised-button:not(:disabled){
color: rgba(24, 255, 255, 0.96);
background-color: rgba(24,255,255,0.04);
}
+.mat-mdc-mini-fab{
+ margin: 5px;
+}
+
+.router_outlet{
+ margin-top: 65px;
+ height: 100%;
+}
diff --git a/jambotron-ui/src/app/main-module/main.component/main.component.ts b/jambotron-ui/src/app/main-module/main.component/main.component.ts
index 1608610..4ea4697 100644
--- a/jambotron-ui/src/app/main-module/main.component/main.component.ts
+++ b/jambotron-ui/src/app/main-module/main.component/main.component.ts
@@ -3,7 +3,7 @@ import {Component, CUSTOM_ELEMENTS_SCHEMA, inject, OnInit} from '@angular/core';
import {Router, RouterLink, RouterOutlet} from '@angular/router';
import {MatToolbar} from '@angular/material/toolbar';
-import {MatButton} from '@angular/material/button';
+import {MatButton, MatFabButton, MatMiniFabButton} from '@angular/material/button';
import {IconDirective, IconService} from '@ant-design/icons-angular';
import {MatDialog} from '@angular/material/dialog';
import {Subscription} from 'rxjs';
@@ -11,16 +11,13 @@ import {TokenStorageService} from '../../services/token-storage.service';
import {AuthService} from '../../services/auth.service';
import {EventBusService} from '../../_shared/event-bus.service';
import {DialogComponent} from '../../components/dialog/dialog.component';
-import {
- ArrowRightOutline, BellOutline,
- CheckCircleOutline, CommentOutline, EditOutline,
- GiftOutline, GithubOutline, LockOutline, LogoutOutline,
- MessageOutline,
- PhoneOutline, ProfileOutline, QuestionCircleOutline,
- SettingOutline, UnorderedListOutline, UserOutline, WalletOutline
-} from '@ant-design/icons-angular/icons';
-import {BrowserModule} from '@angular/platform-browser';
+
import {CommonModule} from '@angular/common';
+import {MatIcon} from '@angular/material/icon';
+import {MatMenu, MatMenuItem, MatMenuTrigger} from '@angular/material/menu';
+import {MatTooltip} from '@angular/material/tooltip';
+import {DialogSignupComponent} from '../../components/dialog-signup.component/dialog-signup.component';
+import {MatLabel} from '@angular/material/input';
@Component({
selector: 'app-main.component',
@@ -31,7 +28,15 @@ import {CommonModule} from '@angular/common';
RouterLink,
IconDirective,
RouterOutlet,
- CommonModule
+ CommonModule,
+ MatIcon,
+ MatMiniFabButton,
+ MatMenuTrigger,
+ MatMenu,
+ MatMenuItem,
+ MatTooltip,
+ MatLabel,
+ MatFabButton
],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
@@ -45,7 +50,9 @@ export class MainComponent implements OnInit{
readonly dialog = inject(MatDialog);
//private authService = new AuthService(provideHttpClient())
- public dialogData : DialogData = {password: "", username: ""};
+ public dialogLoginData : DialogLoginData = {password: "", username: ""};
+ public dialogSignupData : DialogSignupData = {password: "", username: "", email: "", confirmPassword: ""};
+
private roles: string[] = [];
isLoggedIn = false;
@@ -54,38 +61,14 @@ export class MainComponent implements OnInit{
username?: string;
eventBusSub?: Subscription;
- private errorMessage: any;
- private isLoginFailed: boolean = false;
+
private storageService: TokenStorageService = inject(TokenStorageService);
private authService: AuthService = inject(AuthService);
private eventBusService: EventBusService = inject(EventBusService);
- private iconService = inject(IconService);
-
-
constructor(private router: Router) {
- this.iconService.addIcon(
- ...[
- CheckCircleOutline,
- GiftOutline,
- MessageOutline,
- SettingOutline,
- PhoneOutline,
- LogoutOutline,
- UserOutline,
- EditOutline,
- ProfileOutline,
- QuestionCircleOutline,
- LockOutline,
- CommentOutline,
- UnorderedListOutline,
- ArrowRightOutline,
- BellOutline,
- GithubOutline,
- WalletOutline
- ]
- );
+
}
goToHome() {
this.router.navigate(['main/home']);
@@ -161,49 +144,99 @@ export class MainComponent implements OnInit{
});
}
- openDialog(enterAnimationDuration: string, exitAnimationDuration: string) {
+ openLoginDialog(enterAnimationDuration: string, exitAnimationDuration: string) {
- let dialogRef = this.dialog.open(DialogComponent, {
+ let dialogLoginRef = this.dialog.open(DialogComponent, {
width: '350px',
enterAnimationDuration,
exitAnimationDuration,
- data: {username: this.dialogData.username, password: this.dialogData.password}
+ data: {username: this.dialogLoginData.username, password: this.dialogLoginData.password}
});
+ dialogLoginRef.componentInstance.signupClicked.subscribe(result => {
+ dialogLoginRef.close();
+ this.openSignupDialog(enterAnimationDuration, exitAnimationDuration);
+ })
- dialogRef.afterClosed().subscribe(result => {
- console.log('The dialog was closed');
- if(result== null){
- return;
- }
- this.dialogData = result;
+ const dialogSubmitSubscription = dialogLoginRef.componentInstance.loginClicked
+ .subscribe(result => {
+ console.log('Got the data!', result);
- this.authService.login(this.dialogData.username, this.dialogData.password).subscribe(
- data => {
- this.storageService.saveToken(data.accessToken);
- this.storageService.saveUser(data);
-
- this.isLoginFailed = false;
- this.isLoggedIn = true;
- let user = this.storageService.getUser();
- this.roles = user.roles;
- //this.username = user.username;
- //this.reloadPage();
- this.refreshToolbar();
- },
- err => {
- this.errorMessage = err.error.message;
- this.isLoginFailed = true;
+ if(result== null){
+ return;
}
- );
+ this.dialogLoginData = result;
+
+ this.authService.login(this.dialogLoginData.username, this.dialogLoginData.password).subscribe(
+ data => {
+ this.storageService.saveToken(data.accessToken);
+ this.storageService.saveUser(data);
+
+ this.isLoggedIn = true;
+ let user = this.storageService.getUser();
+ this.roles = user.roles;
+
+ this.refreshToolbar();
+ dialogLoginRef.close()
+ this.router.navigate(['main/user/user-welcome']);
+ },
+ err => {
+ dialogLoginRef.componentInstance.openLoginFailedSnackBar(err.error.message);
+ }
+ );
+
+ // do something here with the data
+ dialogSubmitSubscription.unsubscribe();
+ });
+ }
+
+ openSignupDialog(enterAnimationDuration: string, exitAnimationDuration: string) {
+
+ let dialogSignupRef = this.dialog.open(DialogSignupComponent, {
+ width: '350px',
+ enterAnimationDuration,
+ exitAnimationDuration,
+ data: {username: this.dialogLoginData.username, password: this.dialogLoginData.password}
});
- }
- reloadPage(): void {
- window.location.reload();
- }
+ const dialogloginSubscription = dialogSignupRef.componentInstance.loginClicked.subscribe(result => {
+ dialogSignupRef.close();
+ this.openLoginDialog(enterAnimationDuration, exitAnimationDuration);
+ })
+ const dialogSubmitSubscription = dialogSignupRef.componentInstance.signupClicked
+ .subscribe(result => {
+ console.log('Got the data!', result);
+
+ if (result == null) {
+ return;
+ }
+ this.dialogSignupData = result;
+
+ this.authService.register(this.dialogSignupData.username, this.dialogSignupData.email, this.dialogSignupData.password).subscribe(
+ data => {
+ console.log(data);
+ dialogSignupRef.componentInstance.openSignupSuccessSnackBar(data.message)
+ dialogSignupRef.close();
+ },
+ err => {
+ dialogSignupRef.componentInstance.openSignupFailedSnackBar(err.error.message);
+ }
+ );
+
+ // do something here with the data
+ dialogloginSubscription.unsubscribe();
+ dialogSubmitSubscription.unsubscribe();
+ });
+ }
}
-export interface DialogData {
+export interface DialogLoginData {
username: string;
password: string;
}
+
+export interface DialogSignupData {
+ email: string;
+ username: string;
+ password: string;
+ confirmPassword: string;
+}
diff --git a/jambotron-ui/src/app/main-module/main.routing.ts b/jambotron-ui/src/app/main-module/main.routing.ts
index 205d592..9059cc4 100644
--- a/jambotron-ui/src/app/main-module/main.routing.ts
+++ b/jambotron-ui/src/app/main-module/main.routing.ts
@@ -18,6 +18,11 @@ const MAIN_ROUTES: Routes =[
loadChildren: () =>
import('../admin-module/admin.module').then((m) => m.AdminModule),
},
+ {
+ path: 'user',
+ loadChildren: () =>
+ import('../user-module/user.module').then((m) => m.UserModule),
+ },
{
path: 'home',
component: HomeComponent
diff --git a/jambotron-ui/src/app/user-module/ai-models.component/ai-models.component.html b/jambotron-ui/src/app/user-module/ai-models.component/ai-models.component.html
new file mode 100644
index 0000000..d8e693e
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/ai-models.component/ai-models.component.html
@@ -0,0 +1 @@
+
ai-models.component works!
diff --git a/jambotron-ui/src/app/user-module/ai-models.component/ai-models.component.scss b/jambotron-ui/src/app/user-module/ai-models.component/ai-models.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/jambotron-ui/src/app/user-module/ai-models.component/ai-models.component.spec.ts b/jambotron-ui/src/app/user-module/ai-models.component/ai-models.component.spec.ts
new file mode 100644
index 0000000..86b422c
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/ai-models.component/ai-models.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { AiModelsComponent } from './ai-models.component';
+
+describe('AiModelsComponent', () => {
+ let component: AiModelsComponent;
+ let fixture: ComponentFixture
;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [AiModelsComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(AiModelsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/jambotron-ui/src/app/user-module/ai-models.component/ai-models.component.ts b/jambotron-ui/src/app/user-module/ai-models.component/ai-models.component.ts
new file mode 100644
index 0000000..31bd190
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/ai-models.component/ai-models.component.ts
@@ -0,0 +1,11 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'app-ai-models.component',
+ imports: [],
+ templateUrl: './ai-models.component.html',
+ styleUrl: './ai-models.component.scss'
+})
+export class AiModelsComponent {
+
+}
diff --git a/jambotron-ui/src/app/user-module/tutorials-list.component/tutorials-list.component.html b/jambotron-ui/src/app/user-module/tutorials-list.component/tutorials-list.component.html
new file mode 100644
index 0000000..088d130
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/tutorials-list.component/tutorials-list.component.html
@@ -0,0 +1,6 @@
+tutorials-list.component works!
+
+ Item 1
+ Item 2
+ Item 3
+
diff --git a/jambotron-ui/src/app/user-module/tutorials-list.component/tutorials-list.component.scss b/jambotron-ui/src/app/user-module/tutorials-list.component/tutorials-list.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/jambotron-ui/src/app/user-module/tutorials-list.component/tutorials-list.component.spec.ts b/jambotron-ui/src/app/user-module/tutorials-list.component/tutorials-list.component.spec.ts
new file mode 100644
index 0000000..c8453de
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/tutorials-list.component/tutorials-list.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { TutorialsListComponent } from './tutorials-list.component';
+
+describe('TutorialsListComponent', () => {
+ let component: TutorialsListComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [TutorialsListComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(TutorialsListComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/jambotron-ui/src/app/user-module/tutorials-list.component/tutorials-list.component.ts b/jambotron-ui/src/app/user-module/tutorials-list.component/tutorials-list.component.ts
new file mode 100644
index 0000000..6b34a98
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/tutorials-list.component/tutorials-list.component.ts
@@ -0,0 +1,15 @@
+import { Component } from '@angular/core';
+import {MatList, MatListItem} from '@angular/material/list';
+
+@Component({
+ selector: 'app-tutorials-list.component',
+ imports: [
+ MatList,
+ MatListItem
+ ],
+ templateUrl: './tutorials-list.component.html',
+ styleUrl: './tutorials-list.component.scss'
+})
+export class TutorialsListComponent {
+
+}
diff --git a/jambotron-ui/src/app/user-module/user-welcome.component/user-welcome.component.html b/jambotron-ui/src/app/user-module/user-welcome.component/user-welcome.component.html
new file mode 100644
index 0000000..1148657
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/user-welcome.component/user-welcome.component.html
@@ -0,0 +1 @@
+user-welcome.component works!
diff --git a/jambotron-ui/src/app/user-module/user-welcome.component/user-welcome.component.scss b/jambotron-ui/src/app/user-module/user-welcome.component/user-welcome.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/jambotron-ui/src/app/user-module/user-welcome.component/user-welcome.component.spec.ts b/jambotron-ui/src/app/user-module/user-welcome.component/user-welcome.component.spec.ts
new file mode 100644
index 0000000..5843210
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/user-welcome.component/user-welcome.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { UserWelcomeComponent } from './user-welcome.component';
+
+describe('UserWelcomeComponent', () => {
+ let component: UserWelcomeComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [UserWelcomeComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(UserWelcomeComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/jambotron-ui/src/app/user-module/user-welcome.component/user-welcome.component.ts b/jambotron-ui/src/app/user-module/user-welcome.component/user-welcome.component.ts
new file mode 100644
index 0000000..a80cd89
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/user-welcome.component/user-welcome.component.ts
@@ -0,0 +1,11 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'app-user-welcome.component',
+ imports: [],
+ templateUrl: './user-welcome.component.html',
+ styleUrl: './user-welcome.component.scss'
+})
+export class UserWelcomeComponent {
+
+}
diff --git a/jambotron-ui/src/app/user-module/user.component/user.component.html b/jambotron-ui/src/app/user-module/user.component/user.component.html
new file mode 100644
index 0000000..9467823
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/user.component/user.component.html
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jambotron-ui/src/app/user-module/user.component/user.component.scss b/jambotron-ui/src/app/user-module/user.component/user.component.scss
new file mode 100644
index 0000000..070126d
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/user.component/user.component.scss
@@ -0,0 +1,50 @@
+
+mat-toolbar{
+ position:fixed;
+ top:0;
+ z-index: 2;
+}
+
+mat-sidenav-container {
+ height:100%;
+}
+
+// Move the content down so that it won't be hidden by the toolbar
+mat-sidenav {
+ padding-top: 3.5rem;
+ transition: width 0.3s ease;
+ @media screen and (min-width: 600px) {
+ padding-top: 4rem;
+ }
+
+ .entry{
+ display: flex;
+ align-items: center;
+ gap: 1rem;
+ padding:0.75rem;
+ }
+
+}
+
+// Move the content down so that it won't be hidden by the toolbar
+mat-sidenav-content{
+ padding-top: 3.5rem;
+ @media screen and (min-width: 600px) {
+ padding-top: 4rem;
+ }
+}
+
+
+
+.expanded {
+ width: 250px;
+}
+
+//---------------
+.pc-sidebar{
+ top: 65px;
+ overflow-y: auto;
+}
+.pc-container{
+ top: 0px;
+}
diff --git a/jambotron-ui/src/app/user-module/user.component/user.component.spec.ts b/jambotron-ui/src/app/user-module/user.component/user.component.spec.ts
new file mode 100644
index 0000000..31806fe
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/user.component/user.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { UserComponent } from './user.component';
+
+describe('UserComponent', () => {
+ let component: UserComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [UserComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(UserComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/jambotron-ui/src/app/user-module/user.component/user.component.ts b/jambotron-ui/src/app/user-module/user.component/user.component.ts
new file mode 100644
index 0000000..b45bdb2
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/user.component/user.component.ts
@@ -0,0 +1,55 @@
+import {Component, CUSTOM_ELEMENTS_SCHEMA, OnInit, ViewChild} from '@angular/core';
+import {RouterOutlet} from '@angular/router';
+import {SideBarComponent} from '../../components/side-bar.component/side-bar.component';
+import {MatSidenav, MatSidenavContainer} from '@angular/material/sidenav';
+import {NgClass} from '@angular/common';
+import {MatListItem, MatNavList} from '@angular/material/list';
+import {MatIcon} from '@angular/material/icon';
+import {BreakpointObserver} from '@angular/cdk/layout';
+import {MatToolbar} from '@angular/material/toolbar';
+import {MatIconButton} from '@angular/material/button';
+
+@Component({
+ selector: 'app-user.component',
+ imports: [
+ RouterOutlet,
+ SideBarComponent,
+ MatSidenavContainer,
+ NgClass,
+ MatNavList,
+ MatSidenav,
+ MatListItem,
+ MatIcon,
+ MatToolbar,
+ MatIconButton
+ ],
+ templateUrl: './user.component.html',
+ styleUrl: './user.component.scss',
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
+})
+export class UserComponent implements OnInit {
+ @ViewChild(MatSidenav)
+ sidenav!: MatSidenav;
+ isMobile= true;
+ isCollapsed = true;
+
+
+ constructor(private observer: BreakpointObserver) {
+
+ }
+
+ ngOnInit(): void {
+ this.observer.observe(['(max-width: 800px)']).subscribe((screenSize) => {
+ this.isMobile = screenSize.matches;
+ });
+ }
+ toggleMenu() {
+ if(this.isMobile){
+ this.sidenav.toggle();
+ this.isCollapsed = false;
+ } else {
+ this.sidenav.open();
+ this.isCollapsed = !this.isCollapsed;
+ }
+ }
+}
diff --git a/jambotron-ui/src/app/user-module/user.module.ts b/jambotron-ui/src/app/user-module/user.module.ts
new file mode 100644
index 0000000..7255d3c
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/user.module.ts
@@ -0,0 +1,16 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import {userRouting} from './user.routing';
+import {UserComponent} from './user.component/user.component';
+
+
+
+@NgModule({
+ declarations: [],
+ imports: [
+ userRouting,
+ UserComponent,
+ CommonModule
+ ]
+})
+export class UserModule { }
diff --git a/jambotron-ui/src/app/user-module/user.routing.spec.ts b/jambotron-ui/src/app/user-module/user.routing.spec.ts
new file mode 100644
index 0000000..a1455bd
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/user.routing.spec.ts
@@ -0,0 +1,7 @@
+import { UserRouting } from './user.routing';
+
+describe('UserRouting', () => {
+ it('should create an instance', () => {
+ expect(new UserRouting()).toBeTruthy();
+ });
+});
diff --git a/jambotron-ui/src/app/user-module/user.routing.ts b/jambotron-ui/src/app/user-module/user.routing.ts
new file mode 100644
index 0000000..c9f7228
--- /dev/null
+++ b/jambotron-ui/src/app/user-module/user.routing.ts
@@ -0,0 +1,27 @@
+import {RouterModule, Routes} from '@angular/router';
+
+import {UserComponent} from './user.component/user.component';
+
+const USER_ROUTES: Routes = [
+ {
+ path: '',
+ component: UserComponent,
+
+ children: [
+ {
+ path: 'user-welcome',
+ loadComponent: () => import('../user-module/user-welcome.component/user-welcome.component').then((c) => c.UserWelcomeComponent),
+ },
+ {
+ path: 'tutorials-list',
+ loadComponent: () => import('../user-module/tutorials-list.component/tutorials-list.component').then((c) => c.TutorialsListComponent)
+ },
+ {
+ path: 'ai-models',
+ loadComponent: () => import('../user-module/ai-models.component/ai-models.component').then((c) => c.AiModelsComponent)
+ }
+ ]
+ }
+];
+
+export const userRouting = RouterModule.forChild(USER_ROUTES);
diff --git a/jambotron-ui/src/styles.scss b/jambotron-ui/src/styles.scss
index 7a0592a..0421915 100644
--- a/jambotron-ui/src/styles.scss
+++ b/jambotron-ui/src/styles.scss
@@ -38,6 +38,18 @@ File: style.css
@import 'scss/themes/preset-style.scss';
+//markdown styles
+@import 'bootstrap/dist/css/bootstrap.min.css';
+@import 'prismjs/themes/prism-okaidia.css';
+@import 'prismjs/plugins/line-numbers/prism-line-numbers.css';
+@import 'prismjs/plugins/line-highlight/prism-line-highlight.css';
+blockquote {
+ border-left: 3px solid rgba(0,0,0,0.21);
+ padding-left: 12px;
+ color: rgba(0,0,0,0.54);
+}
+//--------------------------
+//
html, body { height: 100%; }
body {
background-image: url('../public/Firefly_jambo tron 118290.jpg');