diff --git a/package.json b/package.json index 1129dddb..3fdb1d70 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "ng": "ng", "conventional-changelog": "conventional-changelog", "start": "ng serve", - "build": "ng build", + "build": "ng build --base-href \"/SEO/\"", "build:prod": "npm run build -- --configuration production --aot", "test": "ng test", "test:coverage": "rimraf coverage && npm run test -- --code-coverage", diff --git a/src/app/pages/pages-menu.ts b/src/app/pages/pages-menu.ts index 43e6ec5e..47b1d5fa 100644 --- a/src/app/pages/pages-menu.ts +++ b/src/app/pages/pages-menu.ts @@ -37,7 +37,7 @@ export const MENU_ITEMS: NbMenuItem[] = [ { title: 'Keywords Dictionary', icon: 'book-outline', - link: '', + link: '/pages/settings/keywordsdictionary', }, { title: 'Image Similarity', diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index 376cc4fa..24b360a4 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -3,7 +3,7 @@ import { NgModule } from '@angular/core'; import { PagesComponent } from './pages.component'; import { DashboardComponent } from './dashboard/dashboard.component'; -import { ECommerceComponent } from './e-commerce/e-commerce.component'; +import { SettingsComponent } from './settings/settings.component'; import { NotFoundComponent } from './miscellaneous/not-found/not-found.component'; const routes: Routes = [{ @@ -12,11 +12,12 @@ const routes: Routes = [{ children: [ { path: 'dashboard', - component: ECommerceComponent, + component: DashboardComponent, }, { - path: 'iot-dashboard', - component: DashboardComponent, + path: 'settings', + loadChildren: () => import('./settings/settings.module') + .then(m => m.SettingsModule), }, { path: 'layout', diff --git a/src/app/pages/settings/keywordsdictionary/keywordsdictionary.component.html b/src/app/pages/settings/keywordsdictionary/keywordsdictionary.component.html new file mode 100644 index 00000000..8e339f90 --- /dev/null +++ b/src/app/pages/settings/keywordsdictionary/keywordsdictionary.component.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + +
+ {{customColumn}} + + + {{row.data[customColumn]}} + + {{column}} + {{row.data[column] || '-'}}
+ +
+
diff --git a/src/app/pages/settings/keywordsdictionary/keywordsdictionary.component.scss b/src/app/pages/settings/keywordsdictionary/keywordsdictionary.component.scss new file mode 100644 index 00000000..755b885b --- /dev/null +++ b/src/app/pages/settings/keywordsdictionary/keywordsdictionary.component.scss @@ -0,0 +1,55 @@ +@import '../../../@theme/styles/themes'; + +@include nb-install-component() { + button[nbTreeGridRowToggle] { + background: transparent; + border: none; + padding: 0; + } + + .search-label { + display: block; + } + .search-input { + margin-bottom: 1rem; + } + + .nb-column-name { + width: 100%; + } + + ::ng-deep .row-toggle-button { + color: nb-theme(text-basic-color); + } + + .nb-tree-grid-header-cell, + .nb-tree-grid-header-cell button { + text-transform: capitalize; + } + + @media screen and (min-width: 400px) { + .nb-column-name, + .nb-column-size { + width: 50%; + } + } + + @media screen and (min-width: 500px) { + .nb-column-name, + .nb-column-size, + .nb-column-kind { + width: 33.333%; + } + } + + @media screen and (min-width: 600px) { + .nb-column-name { + width: 31%; + } + .nb-column-size, + .nb-column-kind, + .nb-column-items { + width: 23%; + } + } +} diff --git a/src/app/pages/settings/keywordsdictionary/keywordsdictionary.component.ts b/src/app/pages/settings/keywordsdictionary/keywordsdictionary.component.ts new file mode 100644 index 00000000..df730eb1 --- /dev/null +++ b/src/app/pages/settings/keywordsdictionary/keywordsdictionary.component.ts @@ -0,0 +1,98 @@ +import { Component, Input } from '@angular/core'; +import { NbSortDirection, NbSortRequest, NbTreeGridDataSource, NbTreeGridDataSourceBuilder } from '@nebular/theme'; + +interface TreeNode { + data: T; + children?: TreeNode[]; + expanded?: boolean; +} + +interface FSEntry { + name: string; + size: string; + kind: string; + items?: number; +} + +@Component({ + selector: 'ngx-tree-grid', + templateUrl: './keywordsdictionary.component.html', + styleUrls: ['./keywordsdictionary.component.scss'], +}) +export class KeywordsDictionaryComponent { + customColumn = 'name'; + defaultColumns = [ 'size', 'kind', 'items' ]; + allColumns = [ this.customColumn, ...this.defaultColumns ]; + + dataSource: NbTreeGridDataSource; + + sortColumn: string; + sortDirection: NbSortDirection = NbSortDirection.NONE; + + constructor(private dataSourceBuilder: NbTreeGridDataSourceBuilder) { + this.dataSource = this.dataSourceBuilder.create(this.data); + } + + updateSort(sortRequest: NbSortRequest): void { + this.sortColumn = sortRequest.column; + this.sortDirection = sortRequest.direction; + } + + getSortDirection(column: string): NbSortDirection { + if (this.sortColumn === column) { + return this.sortDirection; + } + return NbSortDirection.NONE; + } + + private data: TreeNode[] = [ + { + data: { name: 'Projects', size: '1.8 MB', items: 5, kind: 'dir' }, + children: [ + { data: { name: 'project-1.doc', kind: 'doc', size: '240 KB' } }, + { data: { name: 'project-2.doc', kind: 'doc', size: '290 KB' } }, + { data: { name: 'project-3', kind: 'txt', size: '466 KB' } }, + { data: { name: 'project-4.docx', kind: 'docx', size: '900 KB' } }, + ], + }, + { + data: { name: 'Reports', kind: 'dir', size: '400 KB', items: 2 }, + children: [ + { data: { name: 'Report 1', kind: 'doc', size: '100 KB' } }, + { data: { name: 'Report 2', kind: 'doc', size: '300 KB' } }, + ], + }, + { + data: { name: 'Other', kind: 'dir', size: '109 MB', items: 2 }, + children: [ + { data: { name: 'backup.bkp', kind: 'bkp', size: '107 MB' } }, + { data: { name: 'secret-note.txt', kind: 'txt', size: '2 MB' } }, + ], + }, + ]; + + getShowOn(index: number) { + const minWithForMultipleColumns = 400; + const nextColumnStep = 100; + return minWithForMultipleColumns + (nextColumnStep * index); + } +} + +@Component({ + selector: 'ngx-fs-icon', + template: ` + + + + + + `, +}) +export class FsIconComponent { + @Input() kind: string; + @Input() expanded: boolean; + + isDir(): boolean { + return this.kind === 'dir'; + } +} diff --git a/src/app/pages/settings/settings-routing.module.ts b/src/app/pages/settings/settings-routing.module.ts new file mode 100644 index 00000000..28a179f4 --- /dev/null +++ b/src/app/pages/settings/settings-routing.module.ts @@ -0,0 +1,27 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { SettingsComponent } from './settings.component'; +import { KeywordsDictionaryComponent } from './keywordsdictionary/keywordsdictionary.component'; + +const routes: Routes = [{ + path: '', + component: SettingsComponent, + children: [ + { + path: 'keywordsdictionary', + component: KeywordsDictionaryComponent, + }, + ], +}]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class SettingsRoutingModule { } + +export const routedComponents = [ + SettingsComponent, + KeywordsDictionaryComponent, +]; diff --git a/src/app/pages/settings/settings.component.ts b/src/app/pages/settings/settings.component.ts new file mode 100644 index 00000000..002ecb3e --- /dev/null +++ b/src/app/pages/settings/settings.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'ngx-tables', + template: ``, +}) +export class SettingsComponent { +} diff --git a/src/app/pages/settings/settings.module.ts b/src/app/pages/settings/settings.module.ts new file mode 100644 index 00000000..f7617230 --- /dev/null +++ b/src/app/pages/settings/settings.module.ts @@ -0,0 +1,24 @@ +import { NgModule } from '@angular/core'; +import { NbCardModule, NbIconModule, NbInputModule, NbTreeGridModule } from '@nebular/theme'; +import { Ng2SmartTableModule } from 'ng2-smart-table'; + +import { ThemeModule } from '../../@theme/theme.module'; +import { SettingsRoutingModule, routedComponents } from './settings-routing.module'; +import { FsIconComponent } from './keywordsdictionary/keywordsdictionary.component'; + +@NgModule({ + imports: [ + NbCardModule, + NbTreeGridModule, + NbIconModule, + NbInputModule, + ThemeModule, + SettingsRoutingModule, + Ng2SmartTableModule, + ], + declarations: [ + ...routedComponents, + FsIconComponent, + ], +}) +export class SettingsModule { } diff --git a/src/index.html b/src/index.html index 75002dce..eb0925ad 100644 --- a/src/index.html +++ b/src/index.html @@ -4,7 +4,8 @@ Klikx SEO Admin Portal - + +