first commit

This commit is contained in:
girik24 2024-03-15 16:12:58 -07:00
parent 06776d15c4
commit bd8eba9de1
15 changed files with 30470 additions and 480 deletions

View file

@ -187,5 +187,8 @@
"@angular-eslint/schematics:library": { "@angular-eslint/schematics:library": {
"setParserOptionsProject": true "setParserOptionsProject": true
} }
},
"cli": {
"analytics": false
} }
} }

30725
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -35,6 +35,7 @@
"@angular/common": "^15.2.10", "@angular/common": "^15.2.10",
"@angular/compiler": "^15.2.10", "@angular/compiler": "^15.2.10",
"@angular/core": "^15.2.10", "@angular/core": "^15.2.10",
"@angular/fire": "^7.6.1",
"@angular/forms": "^15.2.10", "@angular/forms": "^15.2.10",
"@angular/google-maps": "^12.2.13", "@angular/google-maps": "^12.2.13",
"@angular/platform-browser": "^15.2.10", "@angular/platform-browser": "^15.2.10",
@ -62,12 +63,12 @@
"ng2-completer": "^9.0.1", "ng2-completer": "^9.0.1",
"ng2-smart-table": "^1.6.0", "ng2-smart-table": "^1.6.0",
"ngx-echarts": "^4.2.2", "ngx-echarts": "^4.2.2",
"node-sass": "^4.14.1",
"normalize.css": "6.0.0", "normalize.css": "6.0.0",
"pace-js": "1.0.2", "pace-js": "1.0.2",
"roboto-fontface": "0.8.0", "roboto-fontface": "0.8.0",
"rxjs": "6.6.2", "rxjs": "6.6.2",
"rxjs-compat": "6.3.0", "rxjs-compat": "6.3.0",
"sass": "^1.49.0",
"socicon": "3.0.5", "socicon": "3.0.5",
"style-loader": "^1.3.0", "style-loader": "^1.3.0",
"tinymce": "4.5.7", "tinymce": "4.5.7",

View file

@ -1,5 +1,5 @@
import { of as observableOf, Observable } from 'rxjs';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable, of as observableOf } from 'rxjs';
import { Contacts, RecentUsers, UserData } from '../data/users'; import { Contacts, RecentUsers, UserData } from '../data/users';
@Injectable() @Injectable()
@ -8,7 +8,7 @@ export class UserService extends UserData {
private time: Date = new Date; private time: Date = new Date;
private users = { private users = {
nick: { name: 'Nick Jones', picture: 'assets/images/nick.png' }, nick: { name: 'Users', picture: 'assets/images/nick.png' },
eva: { name: 'Eva Moor', picture: 'assets/images/eva.png' }, eva: { name: 'Eva Moor', picture: 'assets/images/eva.png' },
jack: { name: 'Jack Williams', picture: 'assets/images/jack.png' }, jack: { name: 'Jack Williams', picture: 'assets/images/jack.png' },
lee: { name: 'Lee Wong', picture: 'assets/images/lee.png' }, lee: { name: 'Lee Wong', picture: 'assets/images/lee.png' },

View file

@ -3,7 +3,7 @@
<a (click)="toggleSidebar()" href="#" class="sidebar-toggle"> <a (click)="toggleSidebar()" href="#" class="sidebar-toggle">
<nb-icon icon="menu-2-outline"></nb-icon> <nb-icon icon="menu-2-outline"></nb-icon>
</a> </a>
<a class="logo" href="#" (click)="navigateHome()">ngx-<span>admin</span></a> <a class="logo" href="#" (click)="navigateHome()">T<span>Resume</span></a>
</div> </div>
<nb-select [selected]="currentTheme" (selectedChange)="changeTheme($event)" status="primary"> <nb-select [selected]="currentTheme" (selectedChange)="changeTheme($event)" status="primary">
<nb-option *ngFor="let theme of themes" [value]="theme.value"> {{ theme.name }}</nb-option> <nb-option *ngFor="let theme of themes" [value]="theme.value"> {{ theme.name }}</nb-option>
@ -18,11 +18,8 @@
</nb-action> </nb-action>
<nb-action class="control-item" icon="email-outline"></nb-action> <nb-action class="control-item" icon="email-outline"></nb-action>
<nb-action class="control-item" icon="bell-outline"></nb-action> <nb-action class="control-item" icon="bell-outline"></nb-action>
<nb-action class="user-action" *nbIsGranted="['view', 'user']" > <nb-action class="user-action" *nbIsGranted="['view', 'user']">
<nb-user [nbContextMenu]="userMenu" <nb-user [nbContextMenu]="userMenu" [onlyPicture]="userPictureOnly" [name]="user?.name" [picture]="user?.picture">
[onlyPicture]="userPictureOnly"
[name]="user?.name"
[picture]="user?.picture">
</nb-user> </nb-user>
</nb-action> </nb-action>
</nb-actions> </nb-actions>

View file

@ -1,5 +1,5 @@
import { ExtraOptions, RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { ExtraOptions, RouterModule, Routes } from '@angular/router';
import { import {
NbAuthComponent, NbAuthComponent,
NbLoginComponent, NbLoginComponent,
@ -9,6 +9,7 @@ import {
NbResetPasswordComponent, NbResetPasswordComponent,
} from '@nebular/auth'; } from '@nebular/auth';
export const routes: Routes = [ export const routes: Routes = [
{ {
path: 'pages', path: 'pages',
@ -21,7 +22,8 @@ export const routes: Routes = [
children: [ children: [
{ {
path: '', path: '',
component: NbLoginComponent, redirectTo: 'login', // Redirect to login by default
pathMatch: 'full',
}, },
{ {
path: 'login', path: 'login',
@ -45,7 +47,7 @@ export const routes: Routes = [
}, },
], ],
}, },
{ path: '', redirectTo: 'pages', pathMatch: 'full' }, { path: '', redirectTo: 'auth', pathMatch: 'full' },
{ path: '**', redirectTo: 'pages' }, { path: '**', redirectTo: 'pages' },
]; ];

View file

@ -3,14 +3,11 @@
* Copyright Akveo. All Rights Reserved. * Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*/ */
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { AngularFireModule } from '@angular/fire/compat';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { CoreModule } from './@core/core.module';
import { ThemeModule } from './@theme/theme.module';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { import {
NbChatModule, NbChatModule,
NbDatepickerModule, NbDatepickerModule,
@ -20,6 +17,11 @@ import {
NbToastrModule, NbToastrModule,
NbWindowModule, NbWindowModule,
} from '@nebular/theme'; } from '@nebular/theme';
import { environment } from '../environments/environment';
import { CoreModule } from './@core/core.module';
import { ThemeModule } from './@theme/theme.module';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({ @NgModule({
declarations: [AppComponent], declarations: [AppComponent],
@ -28,6 +30,7 @@ import {
BrowserAnimationsModule, BrowserAnimationsModule,
HttpClientModule, HttpClientModule,
AppRoutingModule, AppRoutingModule,
AngularFireModule.initializeApp(environment.firebase),
NbSidebarModule.forRoot(), NbSidebarModule.forRoot(),
NbMenuModule.forRoot(), NbMenuModule.forRoot(),
NbDatepickerModule.forRoot(), NbDatepickerModule.forRoot(),

View file

@ -0,0 +1 @@
<p>login works!</p>

View file

View file

@ -0,0 +1,27 @@
import { Component } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/compat/auth';
import { Router } from '@angular/router';
@Component({
selector: 'ngx-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
export class LoginComponent {
email: string = '';
password: string = '';
errorMessage: string = '';
constructor(private afAuth: AngularFireAuth, private router: Router) {}
async login() {
try {
const userCredential = await this.afAuth.signInWithEmailAndPassword(this.email, this.password);
// If login successful, navigate to the home page or any other desired route
this.router.navigate(['/home']);
} catch (error) {
// Handle authentication errors
this.errorMessage = error.message;
}
}
}

View file

@ -2,15 +2,11 @@ import { NbMenuItem } from '@nebular/theme';
export const MENU_ITEMS: NbMenuItem[] = [ export const MENU_ITEMS: NbMenuItem[] = [
{ {
title: 'E-commerce', title: 'Home',
icon: 'shopping-cart-outline', icon: 'home-outline',
link: '/pages/dashboard', link: '/pages/dashboard',
home: true, home: true,
}, hidden: true
{
title: 'IoT Dashboard',
icon: 'home-outline',
link: '/pages/iot-dashboard',
}, },
{ {
title: 'FEATURES', title: 'FEATURES',
@ -144,74 +140,7 @@ export const MENU_ITEMS: NbMenuItem[] = [
}, },
], ],
}, },
{
title: 'Maps',
icon: 'map-outline',
children: [
{
title: 'Google Maps',
link: '/pages/maps/gmaps',
},
{
title: 'Leaflet Maps',
link: '/pages/maps/leaflet',
},
{
title: 'Bubble Maps',
link: '/pages/maps/bubble',
},
{
title: 'Search Maps',
link: '/pages/maps/searchmap',
},
],
},
{
title: 'Charts',
icon: 'pie-chart-outline',
children: [
{
title: 'Echarts',
link: '/pages/charts/echarts',
},
{
title: 'Charts.js',
link: '/pages/charts/chartjs',
},
{
title: 'D3',
link: '/pages/charts/d3',
},
],
},
{
title: 'Editors',
icon: 'text-outline',
children: [
{
title: 'TinyMCE',
link: '/pages/editors/tinymce',
},
{
title: 'CKEditor',
link: '/pages/editors/ckeditor',
},
],
},
{
title: 'Tables & Data',
icon: 'grid-outline',
children: [
{
title: 'Smart Table',
link: '/pages/tables/smart-table',
},
{
title: 'Tree Grid',
link: '/pages/tables/tree-grid',
},
],
},
{ {
title: 'Miscellaneous', title: 'Miscellaneous',
icon: 'shuffle-2-outline', icon: 'shuffle-2-outline',
@ -234,14 +163,7 @@ export const MENU_ITEMS: NbMenuItem[] = [
title: 'Register', title: 'Register',
link: '/auth/register', link: '/auth/register',
}, },
{
title: 'Request Password',
link: '/auth/request-password',
},
{
title: 'Reset Password',
link: '/auth/reset-password',
},
], ],
}, },
]; ];

View file

@ -7,6 +7,7 @@ import { DashboardModule } from './dashboard/dashboard.module';
import { ECommerceModule } from './e-commerce/e-commerce.module'; import { ECommerceModule } from './e-commerce/e-commerce.module';
import { PagesRoutingModule } from './pages-routing.module'; import { PagesRoutingModule } from './pages-routing.module';
import { MiscellaneousModule } from './miscellaneous/miscellaneous.module'; import { MiscellaneousModule } from './miscellaneous/miscellaneous.module';
import { LoginComponent } from './login/login.component';
@NgModule({ @NgModule({
imports: [ imports: [
@ -19,6 +20,7 @@ import { MiscellaneousModule } from './miscellaneous/miscellaneous.module';
], ],
declarations: [ declarations: [
PagesComponent, PagesComponent,
LoginComponent,
], ],
}) })
export class PagesModule { export class PagesModule {

View file

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { AuthService } from './auth.service';
describe('AuthService', () => {
let service: AuthService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(AuthService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View file

@ -0,0 +1,41 @@
import { Injectable } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/compat/auth';
import { Router } from '@angular/router';
@Injectable({
providedIn: 'root'
})
export class AuthService {
constructor(private fireauth: AngularFireAuth, private router: Router) { }
login(email: string, password: string) {
this.fireauth.signInWithEmailAndPassword(email, password).then(() => {
localStorage.setItem('token', 'true');
this.router.navigate(['/home']);
}, err => {
alert('Login Again')
this.router.navigate(['/login'])
})
}
//register
register(email: string, password: string) {
this.fireauth.createUserWithEmailAndPassword(email, password).then(() => {
alert('Registration Successful')
this.router.navigate(['/login']);
}, err => {
alert("Error Registering")
this.router.navigate(['/register'])
})
}
logout() {
this.fireauth.signOut().then( () => {
localStorage.removeItem('token');
this.router.navigate(['/login']);
}, err => {
alert(err.message)
})
}
}

View file

@ -10,4 +10,12 @@
export const environment = { export const environment = {
production: false, production: false,
firebase: {
apiKey: "AIzaSyCPFCMSkeRtJJhiu_yWLIggkRpFL_OM88M",
authDomain: "test-app-133d0.firebaseapp.com",
projectId: "test-app-133d0",
storageBucket: "test-app-133d0.appspot.com",
messagingSenderId: "166874967658",
appId: "1:166874967658:web:53ef3ec2bb8456d9e2a413"
}
}; };