-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard): added profile and settings pages
also added app.state
- Loading branch information
Showing
26 changed files
with
556 additions
and
42 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
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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
export * from './lib/core.module'; | ||
export * from './lib/state/preference.state'; | ||
export * from './lib/state/app.state'; | ||
export { PageTitleService } from './lib/services/page-title.service'; | ||
export { ServiceWorkerService } from './lib/services/service-worker.service'; | ||
export { MediaQueryService } from './lib/services/media-query.service'; | ||
export { DeepLinkService } from './lib/services/deep-link.service'; | ||
export { RouterStateData} from './lib/state/custom-router-state.serializer'; | ||
export { FeatureService, BrowserFeatureKey, BrowserFeature } from './lib/services/feature.service'; | ||
export { GoogleAnalyticsService } from './lib/services/google-analytics.service'; | ||
export { PushNotificationService } from './lib/services/push-notification.service'; | ||
export { WINDOW } from './lib/services/window.token'; |
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
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
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,85 @@ | ||
import { Action, NgxsOnInit, Selector, State, StateContext } from '@ngxs/store'; | ||
import { Inject } from '@angular/core'; | ||
import { WINDOW } from '../services/window.token'; | ||
|
||
export interface BeforeInstallPromptEvent extends Event { | ||
readonly platforms: string[]; // ["web", "android", "windows"] | ||
readonly userChoice: Promise<'accepted' | 'dismissed'>; | ||
prompt(): void; | ||
} | ||
|
||
export class ChangeInstallStatus { | ||
static readonly type = '[App] Change Install Status'; | ||
constructor(public payload: boolean) {} | ||
} | ||
export class SetInstallPrompt { | ||
static readonly type = '[App] Set Install Prompt'; | ||
constructor(public payload: BeforeInstallPromptEvent) {} | ||
} | ||
export class Online { | ||
static readonly type = '[App] Network Online'; | ||
} | ||
export class Offline { | ||
static readonly type = '[App] Network Offline'; | ||
} | ||
|
||
export interface AppStateModel { | ||
online: boolean; | ||
installPrompt: BeforeInstallPromptEvent; | ||
installed: boolean; | ||
} | ||
|
||
@State<AppStateModel>({ | ||
name: 'app', | ||
defaults: { | ||
online: window.navigator.onLine, | ||
installPrompt: null, | ||
installed: false | ||
}, | ||
}) | ||
export class AppState { | ||
constructor() {} | ||
|
||
@Selector() | ||
static online(state: AppStateModel) { | ||
return state.online; | ||
} | ||
|
||
@Selector() | ||
static installPrompt(state: AppStateModel) { | ||
return state.installPrompt; | ||
} | ||
|
||
@Selector() | ||
static installed(state: AppStateModel) { | ||
return state.installed; | ||
} | ||
|
||
@Action(SetInstallPrompt) | ||
setInstallPrompt({ patchState }: StateContext<AppStateModel>, { payload }: SetInstallPrompt) { | ||
patchState({ | ||
installPrompt: payload, | ||
}); | ||
} | ||
|
||
@Action(ChangeInstallStatus) | ||
changeInstallStatus({ patchState }: StateContext<AppStateModel>, { payload }: ChangeInstallStatus) { | ||
patchState({ | ||
installed: payload, | ||
}); | ||
} | ||
|
||
@Action(Online) | ||
enableNotifications({ patchState }: StateContext<AppStateModel>) { | ||
patchState({ | ||
online: true, | ||
}); | ||
} | ||
|
||
@Action(Offline) | ||
disableNotifications({ patchState }: StateContext<AppStateModel>) { | ||
patchState({ | ||
online: false, | ||
}); | ||
} | ||
} |
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
Oops, something went wrong.