diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 68b4402..912bfa1 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -59,11 +59,12 @@ import {MatDialogModule} from '@angular/material/dialog';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatExpansionModule} from '@angular/material/expansion';
import {MatDatepickerModule} from '@angular/material/datepicker';
-import {MatNativeDateModule, MatProgressBarModule} from '@angular/material/';
+import {MatGridListModule, MatNativeDateModule, MatProgressBarModule} from '@angular/material/';
import {MatSnackBarModule} from '@angular/material/snack-bar';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
import {LightboxModule} from 'ngx-lightbox';
+import { AdminpageComponent } from './components/adminpage/adminpage.component';
const config: SocketIoConfig = {url: 'http://localhost:4444', options: {}};
@@ -76,6 +77,7 @@ const appRoutes: Routes = [
{path: 'register', component: RegisterComponent},
{path: 'about', component: AboutComponent},
{path: 'imprint', component: ImprintComponent},
+ {path: 'admin', component: AdminpageComponent},
];
@NgModule({
@@ -104,6 +106,7 @@ const appRoutes: Routes = [
UserlistComponent,
DialogFileUploadComponent,
DialogGroupFileUploadComponent,
+ AdminpageComponent,
],
imports: [
BrowserModule,
@@ -149,7 +152,8 @@ const appRoutes: Routes = [
MatSnackBarModule,
MatProgressBarModule,
LightboxModule,
- ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
+ ServiceWorkerModule.register('ngsw-worker.js', {enabled: environment.production}),
+ MatGridListModule,
],
entryComponents: [
DialogCreateGroupComponent,
diff --git a/src/app/components/adminpage/adminpage.component.html b/src/app/components/adminpage/adminpage.component.html
new file mode 100644
index 0000000..6f2ff41
--- /dev/null
+++ b/src/app/components/adminpage/adminpage.component.html
@@ -0,0 +1,46 @@
+
+
Administration
+
+
+
+
+
Activities
+
+
+
+
+
+
+
+ points |
+ {{action.points}} |
+
+
+
+
+ action |
+ {{action.name}} |
+
+
+
+
+ description |
+ {{action.description}} |
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/components/adminpage/adminpage.component.sass b/src/app/components/adminpage/adminpage.component.sass
new file mode 100644
index 0000000..fb7ad91
--- /dev/null
+++ b/src/app/components/adminpage/adminpage.component.sass
@@ -0,0 +1,18 @@
+@import "../../../styles/mixins.sass"
+
+#adminpage
+ margin: 1em
+
+ .grid
+ display: grid
+ grid-template: 100% / 33% 33% 33%
+ .column-header
+ text-align: center
+
+ .column
+ &:nth-child(1)
+ @include gridPosition(1, 2, 1, 2)
+ &:nth-child(2)
+ @include gridPosition(1, 2, 2, 3)
+ &:nth-child(3)
+ @include gridPosition(1, 2, 3, 4)
diff --git a/src/app/components/adminpage/adminpage.component.spec.ts b/src/app/components/adminpage/adminpage.component.spec.ts
new file mode 100644
index 0000000..e4057f9
--- /dev/null
+++ b/src/app/components/adminpage/adminpage.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { AdminpageComponent } from './adminpage.component';
+
+describe('AdminpageComponent', () => {
+ let component: AdminpageComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ AdminpageComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(AdminpageComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/components/adminpage/adminpage.component.ts b/src/app/components/adminpage/adminpage.component.ts
new file mode 100644
index 0000000..11b046e
--- /dev/null
+++ b/src/app/components/adminpage/adminpage.component.ts
@@ -0,0 +1,31 @@
+import {Component, OnInit, ViewChild} from '@angular/core';
+import {Levellist} from '../../models/levellist';
+import {ActivityService} from '../../services/activity/activity.service';
+import {Activitylist} from '../../models/activity';
+import {MatTableDataSource} from '@angular/material/table';
+import {MatSort} from '@angular/material/sort';
+
+@Component({
+ selector: 'app-adminpage',
+ templateUrl: './adminpage.component.html',
+ styleUrls: ['./adminpage.component.sass']
+})
+export class AdminpageComponent implements OnInit {
+
+ public activitySource: MatTableDataSource;
+ public displayedActivityColumns = ['points', 'name', 'description'];
+
+ @ViewChild(MatSort, {static: true}) activitySort: MatSort;
+
+ constructor(private activityService: ActivityService) {
+ }
+
+ ngOnInit() {
+ this.activityService.getActivities();
+ this.activityService.activitylist.subscribe(response => {
+ this.activitySource = new MatTableDataSource(response.Actions);
+ this.activitySource.sort = this.activitySort;
+ });
+ }
+
+}
diff --git a/src/app/components/main-navigation/main-navigation.component.html b/src/app/components/main-navigation/main-navigation.component.html
index 3572788..53fee01 100644
--- a/src/app/components/main-navigation/main-navigation.component.html
+++ b/src/app/components/main-navigation/main-navigation.component.html
@@ -125,7 +125,13 @@
+
+
+
diff --git a/src/app/models/interfaces/IUser.ts b/src/app/models/interfaces/IUser.ts
index 7f23010..4ead778 100644
--- a/src/app/models/interfaces/IUser.ts
+++ b/src/app/models/interfaces/IUser.ts
@@ -45,4 +45,6 @@ export interface IUser {
eventCount: number;
events: any[];
+
+ isAdmin?: boolean;
}
diff --git a/src/app/models/user.ts b/src/app/models/user.ts
index 6836d10..ab1d208 100644
--- a/src/app/models/user.ts
+++ b/src/app/models/user.ts
@@ -18,6 +18,7 @@ export class User {
joinedAt: string;
friendCount: number;
groupCount: number;
+ isAdmin: boolean = false;
darkmode = false;
@@ -79,6 +80,9 @@ export class User {
this.receivedRequests = userDataResponse.receivedRequests
.map(request => new FriendRequest(request.id, request.sender.id, request.sender.handle, request.sender.name));
}
+ if (userDataResponse.isAdmin) {
+ this.isAdmin = true;
+ }
return this;
}
diff --git a/src/app/services/login/login.service.ts b/src/app/services/login/login.service.ts
index b22002f..d151a75 100644
--- a/src/app/services/login/login.service.ts
+++ b/src/app/services/login/login.service.ts
@@ -47,6 +47,7 @@ const graphqlQuery = `mutation($email: String!, $pwHash: String!) {
id
},
settings
+ isAdmin
}
}`;