-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0770416
commit 479ff0b
Showing
72 changed files
with
892 additions
and
738 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...m/binding-action-list-item.component.html → ...m/binding-action-list-item.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
<span class="action-name"> | ||
<span class="action-name" | ||
libEllipsisTitle | ||
> | ||
{{ actionName() | async }}: | ||
</span> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,6 @@ | |
} | ||
|
||
.action-name { | ||
min-width: 100px; | ||
width: 150px; | ||
font-weight: 500; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions
37
modules/pages/control-scheme-view/src/lib/bindings-section/bindings-list.selectors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { createSelector } from '@ngrx/store'; | ||
import { | ||
ATTACHED_IO_MODES_SELECTORS, | ||
ATTACHED_IO_PORT_MODE_INFO_SELECTORS, | ||
ATTACHED_IO_SELECTORS, | ||
CONTROL_SCHEME_SELECTORS, | ||
ControlSchemeModel | ||
} from '@app/store'; | ||
import { areControllableIosPresent } from '@app/shared-control-schemes'; | ||
|
||
import { CONTROL_SCHEME_PAGE_SELECTORS } from '../control-scheme-page.selectors'; | ||
|
||
export const BINDING_LIST_SELECTORS = { | ||
selectSchemeHubsIds: createSelector( | ||
CONTROL_SCHEME_PAGE_SELECTORS.selectCurrentlyViewedScheme, | ||
( | ||
scheme: ControlSchemeModel | undefined, | ||
): string[] => { | ||
const hubIds = new Set<string>(); | ||
if (scheme) { | ||
for (const binding of scheme.bindings) { | ||
hubIds.add(binding.hubId); | ||
} | ||
} | ||
return [ ...hubIds ]; | ||
} | ||
), | ||
canAddBinding: createSelector( | ||
ATTACHED_IO_SELECTORS.selectAll, | ||
ATTACHED_IO_MODES_SELECTORS.selectEntities, | ||
ATTACHED_IO_PORT_MODE_INFO_SELECTORS.selectEntities, | ||
CONTROL_SCHEME_SELECTORS.selectIsAnySchemeRunning, | ||
(ios, ioSupportedModesEntities, portModeInfoEntities, isAnySchemeRunning) => { | ||
return !isAnySchemeRunning && areControllableIosPresent(ios, ioSupportedModesEntities, portModeInfoEntities); | ||
} | ||
), | ||
} as const; |
36 changes: 36 additions & 0 deletions
36
modules/pages/control-scheme-view/src/lib/bindings-section/bindings-section.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<section class="section" | ||
[class.section_running]="isSchemeRunning()" | ||
> | ||
<h3 class="section-title"> | ||
{{ 'controlScheme.bindingsSectionTitle' | transloco }} | ||
</h3> | ||
</section> | ||
|
||
<div class="bindings-container" | ||
[class.bindings-container_running]="isSchemeRunning()" | ||
> | ||
@if (controlSchemeName(); as schemeName) { | ||
@for (hubId of hubIds(); track hubId) { | ||
<page-control-scheme-view-hub-list-item class="hub-bindings" | ||
[hubId]="hubId" | ||
[controlSchemeName]="schemeName" | ||
></page-control-scheme-view-hub-list-item> | ||
} | ||
} | ||
|
||
<div class="add-binding-button-container" | ||
[class.add-binding-button-container_running]="!canAddBinding()" | ||
> | ||
<a mat-fab | ||
color="primary" | ||
class="add-binding-button" | ||
[class.add-binding-button_running]="!canAddBinding()" | ||
[disabled]="!canAddBinding()" | ||
[routerLink]="addBindingPath()" | ||
[title]="'controlScheme.addBindingButtonTitle' | transloco" | ||
> | ||
<mat-icon [fontIcon]="'add'"></mat-icon> | ||
</a> | ||
</div> | ||
</div> | ||
|
66 changes: 66 additions & 0 deletions
66
modules/pages/control-scheme-view/src/lib/bindings-section/bindings-section.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
.section { | ||
height: 48px; | ||
display: flex; | ||
align-items: center; | ||
|
||
transition: height 0.5s, opacity 0.5s; | ||
|
||
&-title { | ||
font-size: 22px; | ||
line-height: 22px; | ||
font-weight: 500; | ||
margin: 0; | ||
} | ||
|
||
&_running { | ||
height: 0; | ||
opacity: 0; | ||
overflow: hidden; | ||
} | ||
} | ||
|
||
.add-binding-button-container { | ||
display: flex; | ||
height: 60px; | ||
border-width: 3px; | ||
border-style: dashed; | ||
border-color: var(--app-well-color); | ||
border-radius: 10px; | ||
justify-content: center; | ||
align-items: center; | ||
margin-top: 5px; | ||
overflow: hidden; | ||
|
||
transition: height 0.5s, border-color 0.5s; | ||
|
||
&_running { | ||
height: 0; | ||
border-color: rgba(0,0,0,0); | ||
} | ||
} | ||
|
||
.hub-bindings + .hub-bindings { | ||
margin-top: 10px; | ||
} | ||
|
||
.bindings-container { | ||
border-width: 1px; | ||
border-style: solid; | ||
border-color: var(--app-well-color); | ||
border-radius: 5px; | ||
padding: 5px; | ||
|
||
transition: border-color 0.5s; | ||
|
||
&_running { | ||
border-color: rgba(0,0,0,0); | ||
} | ||
} | ||
|
||
.add-binding-button { | ||
transition: opacity 0.5s; | ||
|
||
&_running { | ||
opacity: 0; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
modules/pages/control-scheme-view/src/lib/bindings-section/bindings-section.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { ChangeDetectionStrategy, Component, computed } from '@angular/core'; | ||
import { MatCard, MatCardContent } from '@angular/material/card'; | ||
import { MatFabAnchor, MatFabButton } from '@angular/material/button'; | ||
import { MatIcon } from '@angular/material/icon'; | ||
import { TranslocoPipe } from '@ngneat/transloco'; | ||
import { RouterLink } from '@angular/router'; | ||
import { Store } from '@ngrx/store'; | ||
import { MatDivider } from '@angular/material/divider'; | ||
import { RoutesBuilderService } from '@app/shared-misc'; | ||
|
||
import { HubListItemComponent } from './hub-list-item'; | ||
import { BINDING_LIST_SELECTORS } from './bindings-list.selectors'; | ||
import { CONTROL_SCHEME_PAGE_SELECTORS } from '../control-scheme-page.selectors'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'page-control-scheme-view-bindings-section', | ||
templateUrl: './bindings-section.component.html', | ||
styleUrls: [ './bindings-section.component.scss' ], | ||
imports: [ | ||
HubListItemComponent, | ||
MatCard, | ||
MatCardContent, | ||
MatFabButton, | ||
MatIcon, | ||
TranslocoPipe, | ||
MatFabAnchor, | ||
RouterLink, | ||
MatDivider | ||
], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class BindingsSectionComponent { | ||
public readonly hubIds = this.store.selectSignal(BINDING_LIST_SELECTORS.selectSchemeHubsIds); | ||
|
||
public readonly canAddBinding = this.store.selectSignal(BINDING_LIST_SELECTORS.canAddBinding); | ||
|
||
public readonly controlSchemeName = computed(() => { | ||
const controlScheme = this.store.selectSignal(CONTROL_SCHEME_PAGE_SELECTORS.selectCurrentlyViewedScheme)(); | ||
return controlScheme ? controlScheme.name : ''; | ||
}); | ||
|
||
public readonly addBindingPath = computed(() => { | ||
const controlScheme = this.store.selectSignal(CONTROL_SCHEME_PAGE_SELECTORS.selectCurrentlyViewedScheme)(); | ||
return controlScheme ? this.routeBuilderService.bindingCreate(controlScheme.name) : []; | ||
}); | ||
|
||
public readonly isSchemeRunning = this.store.selectSignal(CONTROL_SCHEME_PAGE_SELECTORS.isCurrentControlSchemeRunning); | ||
|
||
constructor( | ||
private readonly store: Store, | ||
private readonly routeBuilderService: RoutesBuilderService | ||
) { | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...s/control-scheme-view/src/lib/bindings-section/hub-list-item/hub-list-item.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<mat-card class="hub__card"> | ||
<mat-card-content class="hub__card-content"> | ||
<lib-hub-inline-view [isHubKnown]="isHubKnown()" | ||
[name]="hubName()" | ||
[hubId]="hubId()" | ||
[batteryLevel]="batteryLevel()" | ||
[rssiLevel]="rssi()" | ||
[isButtonPressed]="buttonState()" | ||
[hasCommunication]="hasCommunication()" | ||
[isConnected]="isConnected()" | ||
[showControls]="false" | ||
></lib-hub-inline-view> | ||
</mat-card-content> | ||
</mat-card> | ||
|
||
@if (portIds().length) { | ||
<section class="hub-ports"> | ||
@for (portId of portIds(); track portId) { | ||
<mat-card class="hub-ports__card"> | ||
<mat-card-content class="hub-ports__card-content"> | ||
|
||
<page-control-scheme-view-hub-port-list-item [portId]="portId" | ||
[hubId]="hubId()" | ||
[controlSchemeName]="controlSchemeName()" | ||
></page-control-scheme-view-hub-port-list-item> | ||
</mat-card-content> | ||
</mat-card> | ||
} | ||
</section> | ||
} |
23 changes: 23 additions & 0 deletions
23
...s/control-scheme-view/src/lib/bindings-section/hub-list-item/hub-list-item.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
:host { | ||
display: block; | ||
} | ||
|
||
.hub__card { | ||
&-content { | ||
padding-top: 10px; | ||
padding-bottom: 10px; | ||
} | ||
} | ||
|
||
.hub-ports { | ||
margin-left: 20px; | ||
|
||
&__card { | ||
margin-top: 1px; | ||
|
||
&-content { | ||
padding-top: 8px; | ||
padding-bottom: 8px; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
modules/pages/control-scheme-view/src/lib/bindings-section/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './bindings-section.component'; | ||
export { IPortCommandTaskSummaryBuilder, PORT_COMMAND_TASK_SUMMARY_BUILDER } from './hub-port-list-item'; | ||
export { IBindingInputNameResolver, BINDING_INPUT_NAME_RESOLVER } from './binding-action-list-item'; |
Oops, something went wrong.