Skip to content

Commit e2c8959

Browse files
authored
Frontend - Block Production Pill
2 parents c53b4c5 + f033be5 commit e2c8959

28 files changed

+496
-170
lines changed

frontend/package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frontend",
3-
"version": "1.0.16",
3+
"version": "1.0.20",
44
"scripts": {
55
"install:deps": "npm install",
66
"start": "npm install && ng serve --configuration local --open",
@@ -42,7 +42,7 @@
4242
"@ngrx/router-store": "^17.2.0",
4343
"@ngrx/store": "^17.2.0",
4444
"@nguniversal/express-engine": "^7.0.2",
45-
"@openmina/shared": "^0.107.0",
45+
"@openmina/shared": "^0.108.0",
4646
"@sentry/angular": "^8.35.0",
4747
"@sentry/cli": "^2.38.2",
4848
"@sentry/tracing": "^7.114.0",

frontend/src/app/app.component.html

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,32 @@
77
<mat-sidenav-container [hasBackdrop]="false"
88
class="w-100 h-100"
99
*ngIf="menu$ | async as menu">
10-
<mat-sidenav [mode]="menu.isMobile ? 'over' : 'side'"
11-
[class.opened]="menu.open"
12-
[class.collapsed]="menu.collapsed"
13-
[class.mobile]="menu.isMobile">
14-
<mina-menu></mina-menu>
15-
<div class="backdrop" (click)="toggleMenu()"></div>
16-
</mat-sidenav>
10+
@if (isDesktop) {
11+
<mat-sidenav mode="side"
12+
[class.opened]="menu.open"
13+
[class.collapsed]="menu.collapsed"
14+
[class.mobile]="menu.isMobile">
15+
<mina-menu></mina-menu>
16+
<div class="backdrop" (click)="toggleMenu()"></div>
17+
</mat-sidenav>
18+
}
1719
<mat-sidenav-content class="flex-column"
1820
[style.margin-left.px]="menu.isMobile ? 0 : (menu.collapsed ? 44 : 160)">
19-
<mina-toolbar *ngIf="!hideToolbar"></mina-toolbar>
21+
@if (!hideToolbar) {
22+
<mina-toolbar></mina-toolbar>
23+
}
2024
<div class="mina-content"
2125
[class.no-toolbar]="hideToolbar"
2226
[class.no-submenus]="subMenusLength < 2"
2327
[class.mobile]="menu.isMobile">
2428
<router-outlet></router-outlet>
2529
</div>
26-
<mina-submenu-tabs *ngIf="menu.isMobile"
27-
[class.d-none]="subMenusLength < 2"
28-
class="mobile-menu border-top"
29-
(subMenusLength)="onSubmenusLengthChange($event)"></mina-submenu-tabs>
30+
@if (!isDesktop) {
31+
<mina-submenu-tabs [class.d-none]="subMenusLength < 2"
32+
class="mobile-menu border-top"
33+
(subMenusLength)="onSubmenusLengthChange($event)"></mina-submenu-tabs>
34+
<mina-menu-tabs></mina-menu-tabs>
35+
}
3036
</mat-sidenav-content>
3137
</mat-sidenav-container>
3238
}

frontend/src/app/app.component.scss

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ mat-sidenav {
4444
}
4545

4646
mat-sidenav-content {
47-
transition: 200ms ease-out !important;
47+
@media (min-width: 768px) {
48+
transition: 200ms ease-out !important;
49+
}
4850
overflow: hidden;
4951
}
5052

@@ -69,14 +71,15 @@ mat-sidenav-content {
6971
&.mobile {
7072
$toolbar: 56px;
7173
$subMenus: 56px;
72-
height: calc(100% - #{$toolbar} - #{$subMenus});
74+
$tabs: 56px;
75+
height: calc(100% - #{$toolbar} - #{$subMenus} - #{$tabs});
7376

7477
&.no-toolbar {
75-
height: calc(100% - #{$subMenus});
78+
height: calc(100% - #{$subMenus} - #{$tabs});
7679
}
7780

7881
&.no-submenus {
79-
height: calc(100% - #{$toolbar});
82+
height: calc(100% - #{$toolbar} - #{$tabs});
8083

8184
&.no-toolbar {
8285
height: 100%;

frontend/src/app/app.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
2-
import { any, getMergedRoute, getWindow, isBrowser, MAX_WIDTH_700, MergedRoute, safelyExecuteInBrowser } from '@openmina/shared';
2+
import { any, getMergedRoute, getWindow, isBrowser, isDesktop, MAX_WIDTH_700, MergedRoute, safelyExecuteInBrowser } from '@openmina/shared';
33
import { AppMenu } from '@shared/types/app/app-menu.type';
44
import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout';
55
import { AppSelectors } from '@app/app.state';
@@ -26,6 +26,7 @@ export class AppComponent extends StoreDispatcher implements OnInit {
2626
subMenusLength: number = 0;
2727
hideToolbar: boolean = CONFIG.hideToolbar;
2828
loaded: boolean;
29+
isDesktop: boolean = isDesktop();
2930

3031
private nodeUpdateSubscription: Subscription | null = null;
3132

frontend/src/app/app.module.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { initializeApp, provideFirebaseApp } from '@angular/fire/app';
4040
import { getAnalytics, provideAnalytics, ScreenTrackingService } from '@angular/fire/analytics';
4141
import { getPerformance, providePerformance } from '@angular/fire/performance';
4242
import { BlockProductionPillComponent } from '@app/layout/block-production-pill/block-production-pill.component';
43+
import { MenuTabsComponent } from '@app/layout/menu-tabs/menu-tabs.component';
4344

4445
registerLocaleData(localeFr, 'fr');
4546
registerLocaleData(localeEn, 'en');
@@ -161,6 +162,7 @@ export class AppGlobalErrorhandler implements ErrorHandler {
161162
CopyComponent,
162163
WebNodeLandingPageComponent,
163164
BlockProductionPillComponent,
165+
MenuTabsComponent,
164166
],
165167
providers: [
166168
THEME_PROVIDER,
@@ -195,5 +197,8 @@ export class AppGlobalErrorhandler implements ErrorHandler {
195197
providePerformance(() => getPerformance()),
196198
],
197199
bootstrap: [AppComponent],
200+
exports: [
201+
MenuComponent,
202+
],
198203
})
199204
export class AppModule {}

frontend/src/app/features/block-production/won-slots/block-production-won-slots.actions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const getSlotsSuccess = createAction(type('Get Slots Success'), props<{
2626
}>());
2727
const changeFilters = createAction(type('Change Filters'), props<{ filters: BlockProductionWonSlotsFilters }>());
2828
const setActiveSlot = createAction(type('Set Active Slot'), props<{ slot: BlockProductionWonSlotsSlot }>());
29+
const setActiveSlotNumber = createAction(type('Set Active Slot Number'), props<{ slotNumber: number }>());
2930
const sort = createAction(type('Sort'), props<{ sort: TableSort<BlockProductionWonSlotsSlot> }>());
3031
const toggleSidePanel = createAction(type('Toggle Side Panel'));
3132

@@ -36,6 +37,7 @@ export const BlockProductionWonSlotsActions = {
3637
getSlotsSuccess,
3738
changeFilters,
3839
setActiveSlot,
40+
setActiveSlotNumber,
3941
sort,
4042
toggleSidePanel,
4143
};

frontend/src/app/features/block-production/won-slots/block-production-won-slots.effects.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export class BlockProductionWonSlotsEffects extends BaseEffect {
2727

2828
readonly init$: Effect;
2929
readonly getSlots$: Effect;
30+
readonly setActiveSlotNumber$: Effect;
3031

3132
constructor(private router: Router,
3233
private actions$: Actions,
@@ -79,5 +80,13 @@ export class BlockProductionWonSlotsEffects extends BaseEffect {
7980
activeSlot: undefined,
8081
})),
8182
));
83+
84+
this.setActiveSlotNumber$ = createEffect(() => this.actions$.pipe(
85+
ofType(BlockProductionWonSlotsActions.setActiveSlotNumber),
86+
this.latestActionState(),
87+
map(({ action, state }) => BlockProductionWonSlotsActions.setActiveSlot({
88+
slot: state.blockProduction[BLOCK_PRODUCTION_WON_SLOTS_KEY].slots.find(s => s.globalSlot === action.slotNumber),
89+
})),
90+
));
8291
}
8392
}

frontend/src/app/features/dashboard/dashboard.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { DashboardBlocksSyncComponent } from './dashboard-blocks-sync/dashboard-
1616
import {
1717
DashboardPeersMinimalTableComponent,
1818
} from './dashboard-peers-minimal-table/dashboard-peers-minimal-table.component';
19+
import { BlockProductionPillComponent } from '@app/layout/block-production-pill/block-production-pill.component';
1920

2021

2122
@NgModule({
@@ -33,6 +34,7 @@ import {
3334
EffectsModule.forFeature(DashboardEffects),
3435
LoadingSpinnerComponent,
3536
CopyComponent,
37+
BlockProductionPillComponent,
3638
],
3739
})
3840
export class DashboardModule {}

frontend/src/app/features/webnode/web-node-initialization/web-node-initialization.component.scss

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,18 @@ $white: #000000;
6363
button {
6464
width: 158px;
6565
height: 48px !important;
66-
background-color: $cta-container;
67-
color: $base-background;
66+
background-color: $base-background;
67+
color: $base-primary;
68+
filter: invert(1);
6869

6970
&.disabled {
7071
opacity: 0.25;
7172
pointer-events: none;
7273
}
73-
74-
&:hover:not(.disabled) {
75-
background-color: $selected-primary;
76-
}
7774
}
7875

7976
@media (max-width: 768px) {
77+
border: none !important;
8078
> div {
8179
display: none;
8280
}

0 commit comments

Comments
 (0)