Skip to content

Commit

Permalink
feat: simple logic
Browse files Browse the repository at this point in the history
  • Loading branch information
romanrostislavovich committed Dec 5, 2020
1 parent 35bfd8c commit 3e1b9d6
Show file tree
Hide file tree
Showing 26 changed files with 376 additions and 80 deletions.
6 changes: 4 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"src/favicon.512x512.png"
],
"styles": [
"src/styles.scss"
"src/styles.scss",
"node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
],
"scripts": [],
"customWebpackConfig": {
Expand Down Expand Up @@ -118,7 +119,8 @@
"karmaConfig": "src/karma.conf.js",
"scripts": [],
"styles": [
"src/styles.scss"
"src/styles.scss",
"node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
],
"assets": [
"src/assets",
Expand Down
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,13 @@
},
"engines": {
"node": ">=10.9.0"
},
"dependencies": {
"@angular/animations": "^8.0.0 || ^9.0.0-0",
"@angular/cdk": "~8.2.3",
"@angular/forms": "^8.0.0 || ^9.0.0-0",
"@angular/material": "8.2.3",
"hammerjs": "^2.0.8",
"ngx-translate-lint": "1.9.4"
}
}
2 changes: 1 addition & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PageNotFoundComponent } from './shared/components';
const routes: Routes = [
{
path: '',
redirectTo: 'home',
redirectTo: 'project-list',
pathMatch: 'full'
},
{
Expand Down
5 changes: 3 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import { AppRoutingModule } from './app-routing.module';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';

import { HomeModule } from './modules/home/home.module';

import { AppComponent } from './app.component';
import { ProjectModule } from 'app/modules/project/project.module';
import { MatSliderModule, MatTabsModule } from '@angular/material';

// AoT requires an exported function for factories
export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
Expand All @@ -32,8 +32,9 @@ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
HttpClientModule,
CoreModule,
SharedModule,
HomeModule,
ProjectModule,
MatTabsModule,
MatSliderModule,
AppRoutingModule,
TranslateModule.forRoot({
loader: {
Expand Down
6 changes: 6 additions & 0 deletions src/app/core/models/project.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export class ProjectModel {
public name?: string;
public path?: string;
public viewPath?: string;
public languagesPath?: string;
}
30 changes: 30 additions & 0 deletions src/app/core/services/electron/dialog.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Injectable } from '@angular/core';

// If you import a module but never use any of the imported values other than as TypeScript types,
// the resulting javascript file will look as if you never imported the module at all.

import { ElectronService } from 'app/core/services';
import { remote } from 'electron';

@Injectable({
providedIn: 'root'
})
export class DialogService {
remote: typeof remote;


constructor(
private electronService: ElectronService
) {
// Conditional imports
this.remote = this.electronService.remote;
}

public readFolder() {

}

public readFile() {

}
}
29 changes: 29 additions & 0 deletions src/app/core/services/electron/fs.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Injectable } from '@angular/core';

// If you import a module but never use any of the imported values other than as TypeScript types,
// the resulting javascript file will look as if you never imported the module at all.
import * as fs from 'fs';
import { ElectronService } from 'app/core/services';

@Injectable({
providedIn: 'root'
})
export class FsService {
fs: typeof fs;


constructor(
private electronService: ElectronService
) {
// Conditional imports
this.fs = this.electronService.fs;
}

public readFolder() {

}

public readFile() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Injectable } from '@angular/core';
import { NgxTranslateLint, IRulesConfig, ResultCliModel, ErrorTypes } from 'ngx-translate-lint';
import * as NodePath from 'path';

@Injectable({
providedIn: 'root'
})
export class NgxTranslateLintService {
public viewPath: string;
public languagesPath: string;

constructor() {}

public run(viewsPath: string, languagesPath: string) {
/* const viewsPathCorrect: string = './src/app/!**!/!*.{html,ts}';
const languagesPathCorrect: string = './src/assets/i18n/!*.json';*/
const ignoredLanguagesPath: string = "";
const ruleConfig: IRulesConfig = {
keysOnViews: ErrorTypes.error,
zombieKeys: ErrorTypes.warning,
misprint: ErrorTypes.warning,
maxWarning: 0,
misprintCoefficient: 0.9,
ignoredKeys: []
};

const ngxTranslateLint = new NgxTranslateLint(viewsPath, languagesPath, ignoredLanguagesPath, ruleConfig)
const resultLint: ResultCliModel = ngxTranslateLint.lint();
console.log(resultLint);
return resultLint;
}
}
18 changes: 0 additions & 18 deletions src/app/modules/home/home-routing.module.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/app/modules/home/home.component.html

This file was deleted.

16 changes: 0 additions & 16 deletions src/app/modules/home/home.component.scss

This file was deleted.

14 changes: 0 additions & 14 deletions src/app/modules/home/home.component.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/app/modules/home/home.module.ts

This file was deleted.

12 changes: 12 additions & 0 deletions src/app/modules/project/project-add/project-add.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<h1 mat-dialog-title>Hi {{data.name}}</h1>
<div mat-dialog-content>
<p>What's your favorite animal?</p>
<mat-form-field>
<mat-label>Favorite Animal</mat-label>
<input matInput [(ngModel)]="data.animal">
</mat-form-field>
</div>
<div mat-dialog-actions>
<button mat-button (click)="onNoClick()">No Thanks</button>
<button mat-button [mat-dialog-close]="data.animal" cdkFocusInitial>Ok</button>
</div>
Empty file.
25 changes: 25 additions & 0 deletions src/app/modules/project/project-add/project-add.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { ProjectAddComponent } from './project-add.component';

describe('ProjectAddComponent', () => {
let component: ProjectAddComponent;
let fixture: ComponentFixture<ProjectAddComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ProjectAddComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(ProjectAddComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
28 changes: 28 additions & 0 deletions src/app/modules/project/project-add/project-add.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

export interface DialogData {
animal: string;
name: string;
}

@Component({
selector: 'app-project-add',
templateUrl: './project-add.component.html',
styleUrls: ['./project-add.component.scss']
})
export class ProjectAddComponent implements OnInit {

constructor(
public dialogRef: MatDialogRef<ProjectAddComponent>,
@Inject(MAT_DIALOG_DATA) public data: DialogData
) { }

ngOnInit() {
}

onNoClick(): void {
this.dialogRef.close();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>project-edit works!</p>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { ProjectEditComponent } from './project-edit.component';

describe('ProjectEditComponent', () => {
let component: ProjectEditComponent;
let fixture: ComponentFixture<ProjectEditComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ProjectEditComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(ProjectEditComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions src/app/modules/project/project-edit/project-edit.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-project-edit',
templateUrl: './project-edit.component.html',
styleUrls: ['./project-edit.component.scss']
})
export class ProjectEditComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}
23 changes: 22 additions & 1 deletion src/app/modules/project/project-item/project-item.component.html
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
<p>project-item works!</p>
<mat-card>
{{ project.name }}
{{ project.path }}
{{ project.viewPath }}
{{ project.languagesPath }}
<button mat-raised-button
(click)="OpenLanguagesFolder()"
class="example-add-tab-button">
Open Languages Folder
</button>
<button mat-raised-button
(click)="OpenViewsFolder()"
class="example-add-tab-button">
Open Views Folder
</button>
<button mat-raised-button
(click)="RunLint()"
class="example-add-tab-button">
Run Lint
</button>
</mat-card>

Loading

0 comments on commit 3e1b9d6

Please sign in to comment.