Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
b3d0981
huh
TheBlckbird May 11, 2022
717106d
some adjustments
TheBlckbird May 12, 2022
26c0765
icons
TheBlckbird May 12, 2022
3607864
.
TheBlckbird May 13, 2022
376aae4
icon stuff and other things
TheBlckbird May 13, 2022
1e70158
new background
TheBlckbird May 13, 2022
0c3feb5
account
TheBlckbird May 13, 2022
4e570da
control center lettering and other font things
TheBlckbird May 14, 2022
ac1266b
some styling stuff
TheBlckbird May 14, 2022
d96f98d
mhm
TheBlckbird May 15, 2022
4907259
redone header
TheBlckbird May 16, 2022
4ae4d63
added the remaining pages
TheBlckbird May 16, 2022
4608b9f
fixed the network page
TheBlckbird May 16, 2022
901ce3b
removed the imprint link
TheBlckbird May 16, 2022
b71afb8
switched some things
TheBlckbird May 16, 2022
4f47324
logout and profile picture stuff
TheBlckbird May 17, 2022
52fce20
header and footer dont scroll
TheBlckbird May 17, 2022
2dc175b
removed scrollbars
TheBlckbird May 17, 2022
bcfac58
bugfix
TheBlckbird May 17, 2022
3467845
generated the computer-menu component
TheBlckbird May 18, 2022
0cc0b36
hm
TheBlckbird May 19, 2022
de714aa
beginning of computer menu
TheBlckbird May 20, 2022
20406d8
base somputer-menu
TheBlckbird Aug 15, 2022
1385d66
go back to the old state (animation)
TheBlckbird Aug 15, 2022
3a0a7e9
many things
TheBlckbird Aug 15, 2022
087ed48
false
TheBlckbird Aug 15, 2022
202b559
many
TheBlckbird Aug 15, 2022
7c81cc4
Merge branch 'cryptic-game:issue/260-base-components' into issue/260-…
TheBlckbird Aug 16, 2022
8819c7f
small bugfix
TheBlckbird Aug 16, 2022
4edeb02
clickaway and some other stuff (still has bugs)
TheBlckbird Aug 16, 2022
26d71f9
remade the change
TheBlckbird Aug 30, 2022
854ac93
it annoying
TheBlckbird Aug 30, 2022
521b487
TheBlckbird Aug 30, 2022
f1ab28e
...
TheBlckbird Aug 30, 2022
33ae08f
fixed a linting error
TheBlckbird Aug 30, 2022
f7d985a
bugfixing
TheBlckbird Aug 30, 2022
9f7c5ec
Router for testing
TheBlckbird Aug 30, 2022
ff8d420
trying to fix a test error
TheBlckbird Aug 30, 2022
c3e31dc
uff
TheBlckbird Aug 30, 2022
212572f
trtying sth
TheBlckbird Aug 30, 2022
8efc1de
fixed ComputerMenu active
TheBlckbird Aug 31, 2022
32a8097
tweaked sth for Computer is Active
TheBlckbird Aug 31, 2022
60dd6f6
removed a comment
TheBlckbird Aug 31, 2022
e6518ae
beginning of showing the right power state
TheBlckbird Aug 31, 2022
57a0e3c
just commiting so nothing could get lost when my os breaks
TheBlckbird Sep 2, 2022
7f24da6
online/offline
TheBlckbird Sep 8, 2022
48495a2
Merge pull request #372 from 1Spinne/issue/260-base-components
TheBlckbird Sep 8, 2022
41a14dd
Merge issue/260-base-components issue/284-sidebar
TheBlckbird Sep 8, 2022
2ae06a5
removed ability to select some things (copy+paste)
TheBlckbird Sep 8, 2022
b626b3c
fix for test fail
TheBlckbird Sep 8, 2022
97f9de1
fixng test fail & changes to ngIf in computer-menu
TheBlckbird Sep 8, 2022
fec4fc0
fixed changelog page bug and removed unused code
TheBlckbird Sep 9, 2022
d7e44d2
fixing weird scrollbar behavior
TheBlckbird Sep 9, 2022
505037b
Fix ComputerMenu Scoll Bug && Remove unnused Code
TheBlckbird Nov 19, 2022
5a17d35
Fix test failing
TheBlckbird Nov 19, 2022
07581b1
Fix scroll ComputerMenu
TheBlckbird Nov 19, 2022
1bfa01d
Add ComputerState enum
TheBlckbird Nov 22, 2022
68f3044
Fix switch case and rename Enum
TheBlckbird Nov 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
377 changes: 301 additions & 76 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
"@angular/platform-browser-dynamic": "~13.2.5",
"@angular/router": "~13.2.5",
"@fontsource/jost": "^4.5.4",
"@fontsource/nothing-you-could-do": "^4.5.8",
"@sentry/angular": "^6.18.2",
"@tabler/icons": "^1.109.0",
"angular-tabler-icons": "^1.112.0",
"ng-particles": "^2.40.2",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/devices/device.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DeviceService {
constructor(private webSocket: WebsocketService) {
}

getDeviceInfo(deviceUUID: string | null): Observable<DeviceWithHardware> {
getDeviceInfo(deviceUUID: string | null): Observable<DeviceWithHardware> {
return this.deviceRequest(['device', 'info'], {device_uuid: deviceUUID});
}

Expand Down
56 changes: 56 additions & 0 deletions src/app/control-center/_control-center-style.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import "variables";
@import "theme-colors";

$header-background: #384044;
$sidebar-background: #1e2529;
Expand All @@ -11,3 +12,58 @@ $button-border-color: $gray;
$button-hover-color: #21292d;

$table-header-color: #7d7d7d;

// mixins \\

@mixin sidebar-menu-item {
width: 100%;

.title {
display: flex;
align-items: center;

width: 250px;
height: 40px;

margin: 0 auto;

border-radius: 8px;

font-size: 20px;
vertical-align: middle;

cursor: pointer;
user-select: none;
outline: none;

&:hover, &.active {
background-color: $primary-default;
color: $input-background;
font-weight: 500;
}

.icon {
flex: 0 0 auto;
width: 24px;
height: 24px;
margin-left: 20px;
}

span {
flex: 1 1 auto;
margin-left: 15px;
}

.arrow {
flex: 0 0 auto;
margin-right: 15px;
}
}

.children {
position: absolute;
left: 350px;
top: 0;
height: 100%;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<div class="computer-menu">
<div class="title-bar">
<div class="title">Computer</div>
<div class="add-computer" (click)="newPcClicked()">
<i-tabler name="plus" alt="" class="add-computer-icon"></i-tabler>
</div>
</div>

<div *ngIf="menu.items.length === 0; else itemsThere">
<div class="no-items">
<div class="new-pc-indicator">
<div class="arrow">

<svg width="115" height="126" xmlns="http://www.w3.org/2000/svg">
<path d="M0 126 C50 117, 96 60, 105 0" stroke="white" fill="transparent"/>
<path d="M105 0 L115 30" stroke="white" fill="transparent"/>
<path d="M105 0 L82 27" stroke="white" fill="transparent"/>
</svg>

</div>
<div class="text">Create new<br>Computer</div>
</div>
<div class="no-pcs">You own no Computer</div>
</div>
</div>

<ng-template #itemsThere>
<div *ngFor="let item of menu.items; let i = index" (click)="itemClicked(item)" [class.active]="isItemActive(item)" class="item">
<div class="name">{{item.title}}</div>
<i-tabler name="power" alt="" class="power-icon"></i-tabler>
<div class="state" [ngSwitch]="states[i].state">
<span *ngSwitchCase="computerState.Offline" class="offline">Offline</span>
<span *ngSwitchCase="computerState.Online" class="online">Online</span>
<!-- <span *ngSwitchCase="computerState.Stopping" class="stopping">at Shutdown</span>
<span *ngSwitchCase="computerState.Starting" class="starting">at Startup</span> -->
<span *ngSwitchDefault class="unknown">Unknown State</span>
</div>
</div>
</ng-template>

</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
@import "../control-center-style";

.computer-menu {
background-color: #2a2a31;

padding: 50px;

overflow: auto;

width: 500px;
height: 100vh;
box-sizing: border-box;

.title-bar {
display: flex;
align-items: center;

.title {
font-weight: 500;
font-size: 40px;
}

.add-computer {
margin-left: auto;
width: 50px;
height: 50px;
background-color: $input-background;
cursor: pointer;
border-radius: 16px;

&:hover {
background-color: $primary-default;
color: $input-background;
}

&-icon {
width: 24px;
height: 24px;
padding: 25% 0 0 25%;
}

}
}

.no-items {
.new-pc-indicator {
.arrow {
text-align: right;
position: relative;
right: 15px;
}
.text {
font-family: "Nothing You Could Do";
text-align: center;
position: relative;
left: 50px;
}
}
.no-pcs {
text-align: center;
margin: 233px 0 0;
}
}

.item {
cursor: pointer;
box-sizing: content-box;
padding: 13px 20px;
background-color: $input-background;
margin-top: 40px;
border-radius: 16px;
display: grid;
grid-template-areas:
"title icon"
"state state";

&:hover, &.active {
background-color: $primary-default;
color: $input-background;

.state {
.online, .offline, .stopping, .starting, .unknown {
color: $input-background;
}
}
}

.name {
grid-area: title;
justify-self: start;
margin-bottom: 1px;
}

.state {
grid-area: state;
justify-self: start;
font-weight: 500;

.online {
color: $primary-default;
}

.offline {
color: $danger-default;
}

.at_startup, .at_shutdown, .unknown {
color: $warning-default;
}

.unknown {
font-style: italic;
}

}

.power-icon {
grid-area: icon;
justify-self: end;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { SidebarMenu } from '../control-center-sidebar-menu/control-center-sidebar-menu.component';

import { ControlCenterComputerMenuComponent } from './control-center-computer-menu.component';

describe('ControlCenterComputerMenuComponent', () => {
let component: ControlCenterComputerMenuComponent;
let fixture: ComponentFixture<ControlCenterComputerMenuComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ControlCenterComputerMenuComponent ],
imports: [RouterTestingModule]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(ControlCenterComputerMenuComponent);
component = fixture.componentInstance;
component.menu = new SidebarMenu('', '');
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { SidebarMenu, SidebarMenuItem } from '../control-center-sidebar-menu/control-center-sidebar-menu.component';
import {Router} from '@angular/router';
import {Device} from 'src/app/api/devices/device';

@Component({
selector: 'app-control-center-computer-menu',
templateUrl: './control-center-computer-menu.component.html',
styleUrls: ['./control-center-computer-menu.component.scss']
})
export class ControlCenterComputerMenuComponent implements OnInit {

@Input() menu: SidebarMenu;
@Input() expanded!: boolean;
@Output() expandChange = new EventEmitter<boolean>();

@Input() devices: Device[];

states: any[] = [];
computerState = ComputerStateEnum;

constructor(private router: Router) {
}

ngOnInit(): void {
this.updatePcState();
}

updatePcState() {

if (this.devices != undefined) {
this.devices.forEach(device => {

switch (device.powered_on) {

case true:
this.states.push({uuid: device.uuid, state: ComputerStateEnum.Online});
break;

case false:
this.states.push({uuid: device.uuid, state: ComputerStateEnum.Offline});
break;

default:
this.states.push({uuid: device.uuid, state: ComputerStateEnum.Unknown});
break;
}

});

}

}

itemClicked(item: SidebarMenuItem) {
this.router.navigate([item.routerLink], {queryParams: item.queryParams}).then();
this.expanded = false;
this.expandChange.emit(this.expanded);
}

newPcClicked() {
this.router.navigate(['/create-device']).then();
this.expanded = false;
this.expandChange.emit(this.expanded);
}

isItemActive(item: SidebarMenuItem) {
// had to do this without routerLinkActive because of the lack of https://github.com/angular/angular/issues/31154
if (!item.routerLink) {
return false;
}
if (this.router.isActive(this.router.createUrlTree([item.routerLink], {queryParams: item.queryParams}), false)) {
return true;
}
return false;
}

}

enum ComputerStateEnum {
Online,
Offline,
Stopping,
Starting,
Unknown
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1>Build a new device</h1>

<span (click)="buildStarterDevice()" *ngIf="controlCenterService.deviceSidebarMenuItems.length === 1"
<span (click)="buildStarterDevice()" *ngIf="controlCenterService.deviceSidebarMenuItems.length === 0"
class="button starter-device" i18n>Build your first device</span>

<form [formGroup]="form">
Expand Down
Loading