Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added a busy overlay to the root component.
- Loading branch information
Showing
11 changed files
with
254 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
<div *ngIf="busy" | ||
class="cx-busy-overlay cx-width-100 cx-height-100"> | ||
<div class="cx-centered"> | ||
<mat-progress-spinner diameter="100" | ||
mode="indeterminate" | ||
color="accent"></mat-progress-spinner> | ||
</div> | ||
</div> | ||
<cx-navigation-bar [user]="user"></cx-navigation-bar> | ||
<router-outlet></router-outlet> |
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,9 @@ | ||
.cx-busy-overlay { | ||
height: 100vh; | ||
width: 100%; | ||
background-color: rgba(0, 0, 0, 0.286); | ||
z-index: 10; | ||
top: 0; | ||
left: 0; | ||
position: fixed; | ||
} |
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
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
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,24 @@ | ||
/* | ||
* ComiXed - A digital comic book library management application. | ||
* Copyright (C) 2020, The ComiXed Project | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
import { createAction, props } from '@ngrx/store'; | ||
|
||
export const setBusyState = createAction( | ||
'[Busy] Set the busy state', | ||
props<{ enabled: boolean }>() | ||
); |
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
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
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,64 @@ | ||
/* | ||
* ComiXed - A digital comic book library management application. | ||
* Copyright (C) 2020, The ComiXed Project | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
import { BusyState, initialState, reducer } from './busy.reducer'; | ||
import { setBusyState } from '@app/core/actions/busy.actions'; | ||
|
||
describe('Busy Reducer', () => { | ||
let state: BusyState; | ||
|
||
beforeEach(() => { | ||
state = { ...initialState }; | ||
}); | ||
|
||
describe('the initial state', () => { | ||
beforeEach(() => { | ||
state = reducer({ ...state }, {} as any); | ||
}); | ||
|
||
it('clears the enabled flag', () => { | ||
expect(state.enabled).toBeFalsy(); | ||
}); | ||
}); | ||
|
||
describe('enabling busy mode', () => { | ||
beforeEach(() => { | ||
state = reducer( | ||
{ ...state, enabled: false }, | ||
setBusyState({ enabled: true }) | ||
); | ||
}); | ||
|
||
it('sets the enabled flag', () => { | ||
expect(state.enabled).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
describe('disabling busy mode', () => { | ||
beforeEach(() => { | ||
state = reducer( | ||
{ ...state, enabled: true }, | ||
setBusyState({ enabled: false }) | ||
); | ||
}); | ||
|
||
it('clears the enabled flag', () => { | ||
expect(state.enabled).toBeFalsy(); | ||
}); | ||
}); | ||
}); |
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 @@ | ||
/* | ||
* ComiXed - A digital comic book library management application. | ||
* Copyright (C) 2020, The ComiXed Project | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
import { createReducer, on } from '@ngrx/store'; | ||
import { setBusyState } from '../actions/busy.actions'; | ||
|
||
export const BUSY_FEATURE_KEY = 'busy_state'; | ||
|
||
export interface BusyState { | ||
enabled: boolean; | ||
} | ||
|
||
export const initialState: BusyState = { | ||
enabled: false | ||
}; | ||
|
||
export const reducer = createReducer( | ||
initialState, | ||
|
||
on(setBusyState, (state, action) => ({ ...state, enabled: action.enabled })) | ||
); |
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 @@ | ||
/* | ||
* ComiXed - A digital comic book library management application. | ||
* Copyright (C) 2020, The ComiXed Project | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
import { BUSY_FEATURE_KEY, BusyState } from '../reducers/busy.reducer'; | ||
import { selectBusyState } from './busy.selectors'; | ||
|
||
describe('Busy Selectors', () => { | ||
let state: BusyState; | ||
|
||
beforeEach(() => { | ||
state = { enabled: Math.random() > 0.5 }; | ||
}); | ||
|
||
it('should select the feature state', () => { | ||
expect( | ||
selectBusyState({ | ||
[BUSY_FEATURE_KEY]: state | ||
}) | ||
).toEqual(state); | ||
}); | ||
}); |
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,24 @@ | ||
/* | ||
* ComiXed - A digital comic book library management application. | ||
* Copyright (C) 2020, The ComiXed Project | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
import { createFeatureSelector } from '@ngrx/store'; | ||
import { BUSY_FEATURE_KEY, BusyState } from '../reducers/busy.reducer'; | ||
|
||
export const selectBusyState = createFeatureSelector<BusyState>( | ||
BUSY_FEATURE_KEY | ||
); |