Skip to content

Commit

Permalink
Merge pull request #95 from paulmojicatech/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
paulmojicatech authored May 14, 2023
2 parents 6d5501a + f88fec7 commit 44e345f
Show file tree
Hide file tree
Showing 71 changed files with 37,498 additions and 6,713 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
8 changes: 4 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"plugins": ["@nx"],
"rules": {
"semi": ["error"],
"quotes": ["error", "single"]
Expand All @@ -10,7 +10,7 @@
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
Expand All @@ -27,12 +27,12 @@
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
}
]
Expand Down
4 changes: 2 additions & 2 deletions apps/fantalytic-mobile-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/fantalytic-mobile-e2e/cypress.json",
"devServerTarget": "fantalytic-mobile:serve:development",
Expand All @@ -18,7 +18,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/fantalytic-mobile-e2e/**/*.{js,ts}"]
Expand Down
4 changes: 2 additions & 2 deletions apps/fantalytic-mobile/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/fantalytic-mobile/src/**/*.ts",
Expand All @@ -96,7 +96,7 @@
}
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/apps/fantalytic-mobile"],
"options": {
"jestConfig": "apps/fantalytic-mobile/jest.config.js",
Expand Down
24 changes: 24 additions & 0 deletions apps/fantalytic-mobile/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ApplicationConfig } from '@angular/core';
import { enableProdMode, importProvidersFrom } from '@angular/core';
import { Route, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { StoreModule } from '@ngrx/store';
import { sharedReducer } from './app/ngrx/reducers/shared.reducer';
import { EffectsModule } from '@ngrx/effects';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
export const appConfig: ApplicationConfig = {
providers: [
importProvidersFrom(
RouterModule.forRoot(routes),
IonicModule.forRoot(),
StoreModule.forRoot({}),
StoreModule.forFeature('shared', sharedReducer),
EffectsModule.forRoot([]),
StoreDevtoolsModule.instrument({}),
HttpClientModule,
BrowserAnimationsModule
),
],
};
51 changes: 17 additions & 34 deletions apps/fantalytic-mobile/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import {HttpClientModule} from '@angular/common/http';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import { enableProdMode, importProvidersFrom } from '@angular/core';
import { appConfig } from './app/app.config';

import { bootstrapApplication } from '@angular/platform-browser';
import { Route, RouterModule } from '@angular/router';
import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';

import { AppComponent } from './app/app.component';
import { TopicEffects } from './app/topics/ngrx/effects/topics.effects';
import { topicsReducer } from './app/topics/ngrx/reducer/topics.reducer';
import { environment } from './environments/environment';
import { IonicModule } from '@ionic/angular';
import { sharedReducer } from './app/ngrx/reducers/shared.reducer';

if (environment.production) {
enableProdMode();
Expand All @@ -21,45 +14,35 @@ if (environment.production) {
const routes: Route[] = [
{
path: 'tabs',
loadComponent: () => import('./app/tabs/tabs.page').then(p => p.TabsPage),
loadComponent: () => import('./app/tabs/tabs.page').then((p) => p.TabsPage),
children: [
{
path: 'topics',
loadComponent: () => import('./app/topics/topics.component').then(c => c.TopicsComponent),
loadComponent: () =>
import('./app/topics/topics.component').then(
(c) => c.TopicsComponent
),
providers: [
importProvidersFrom(
StoreModule.forFeature('topics', topicsReducer),
EffectsModule.forFeature([TopicEffects])
)
]
),
],
},
{
path: 'fantasy-football',
loadChildren: () => import('./app/fantasy-football/const/fantasy-football-routes.const').then(m => m.fantasyFootballRoutes)
}
]
loadChildren: () =>
import(
'./app/fantasy-football/const/fantasy-football-routes.const'
).then((m) => m.fantasyFootballRoutes),
},
],
},
{
path: '',
pathMatch: 'full',
redirectTo: 'tabs/topics'
redirectTo: 'tabs/topics',
},
];

bootstrapApplication(
AppComponent,
{
providers: [
importProvidersFrom(
RouterModule.forRoot(routes),
IonicModule.forRoot(),
StoreModule.forRoot({}),
StoreModule.forFeature('shared', sharedReducer),
EffectsModule.forRoot([]),
StoreDevtoolsModule.instrument({}),
HttpClientModule,
BrowserAnimationsModule
)
]
}
);
bootstrapApplication(AppComponent, appConfig);
4 changes: 2 additions & 2 deletions apps/fantalytic-public-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/fantalytic-public-e2e/cypress.json",
"devServerTarget": "fantalytic-public:serve:development",
Expand All @@ -18,7 +18,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/fantalytic-public-e2e/**/*.{js,ts}"]
Expand Down
4 changes: 2 additions & 2 deletions apps/fantalytic-public/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
Expand All @@ -29,7 +29,7 @@
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
Expand Down
15 changes: 8 additions & 7 deletions apps/fantalytic-public/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ export default {
displayName: 'fantalytic-public',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
globals: {},
coverageDirectory: '../../coverage/apps/fantalytic-public',
transform: {
'^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
Expand Down
5 changes: 3 additions & 2 deletions apps/fantalytic-public/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "fantalytic-public",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/fantalytic-public/src",
"prefix": "pmt",
Expand Down Expand Up @@ -79,7 +80,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/fantalytic-public/**/*.ts",
Expand All @@ -88,7 +89,7 @@
}
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/apps/fantalytic-public"],
"options": {
"jestConfig": "apps/fantalytic-public/jest.config.ts",
Expand Down
59 changes: 59 additions & 0 deletions apps/fantalytic-public/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { HttpClientModule } from '@angular/common/http';
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { Route, RouterModule } from '@angular/router';
import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { FantasyFootballEffects } from './fantasy-football/ngrx/effects/fantasy-football.effects';
import { fantasyFootballReducer } from './fantasy-football/ngrx/reducer/fantasy-football.reducer';
import { MobileCheckerService } from './fantasy-football/services/mobile-checker.service';
import { TopicEffects } from './topics/ngrx/effects/topics.effects';
import { topicsReducer } from './topics/ngrx/reducer/topics.reducer';

const routes: Route[] = [
{
path: 'topics',
loadComponent: () =>
import('../app/topics/topics.component').then((a) => a.TopicsComponent),
providers: [
importProvidersFrom(
StoreModule.forFeature('topics', topicsReducer),
EffectsModule.forFeature([TopicEffects])
)
],
},
{
path: 'fantasy-football',
loadChildren: () =>
import('../app/fantasy-football/const/fantasy-football-routes.const').then(
(m) => m.FANTASY_FOOTBALL_ROUTES
),
canActivate: [MobileCheckerService],
providers: [
importProvidersFrom(
StoreModule.forFeature('fantasyFootball', fantasyFootballReducer),
EffectsModule.forFeature([FantasyFootballEffects]),
)
],
},
{
path: '',
redirectTo: 'topics',
pathMatch: 'full',
},
];


export const appConfig: ApplicationConfig = {
providers: [
importProvidersFrom(
RouterModule.forRoot(routes),
StoreModule.forRoot({}),
EffectsModule.forRoot([]),
StoreDevtoolsModule.instrument({}),
HttpClientModule,
BrowserAnimationsModule
),
],
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';


@Injectable({
providedIn: 'root'
})
export class MobileCheckerService implements CanActivate {
export class MobileCheckerService {

canActivate(): boolean {
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
Expand Down
10 changes: 5 additions & 5 deletions apps/fantalytic-public/src/app/topics/topics.component.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<main class="topics-container">
<section class="topics-text-container">
<main class="w-[100vw]">
<section class="flex flex-col m-2">
<h3>RSS Feeds:</h3>
<select (change)="updateRssFeed($event)">
<select class="w-[25%]" (change)="updateRssFeed($event)">
<option *ngFor="let rss of rssFeeds | keyvalue" [value]="rss.value">{{rss.value}}</option>
</select>
</section>
<section class="topics-card-container">
<mat-card *ngFor="let topic of topics$ | async">
<section class="w-full flex flex-wrap">
<mat-card class="lg:w-[30%] sm:w-full m-2" *ngFor="let topic of topics$ | async">
<mat-card-header>
<mat-card-title>{{topic.title}}</mat-card-title>
</mat-card-header>
Expand Down
Loading

0 comments on commit 44e345f

Please sign in to comment.