Skip to content

Commit 4e621e6

Browse files
committed
Merge branch 'feature/gearbuilder'
2 parents 5919809 + 304c374 commit 4e621e6

426 files changed

Lines changed: 8601 additions & 3891 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

angular.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,23 @@
6363
}
6464
]
6565
},
66-
"web": {
67-
"optimization": false,
68-
"outputHashing": "none",
69-
"sourceMap": true,
66+
"capacitor": {
67+
"optimization": true,
68+
"outputHashing": "all",
69+
"sourceMap": false,
7070
"namedChunks": false,
71-
"aot": false,
71+
"aot": true,
7272
"extractLicenses": true,
7373
"vendorChunk": false,
74-
"buildOptimizer": false,
74+
"buildOptimizer": true,
7575
"fileReplacements": [
7676
{
7777
"replace": "apps/web/environments/environment.ts",
78-
"with": "apps/web/environments/environment.web.ts"
78+
"with": "apps/web/environments/environment.capacitor.ts"
7979
}
8080
]
8181
},
82-
"production": {
82+
"electron": {
8383
"optimization": true,
8484
"outputHashing": "all",
8585
"sourceMap": false,
@@ -91,7 +91,7 @@
9191
"fileReplacements": [
9292
{
9393
"replace": "apps/web/environments/environment.ts",
94-
"with": "apps/web/environments/environment.prod.ts"
94+
"with": "apps/web/environments/environment.electron.ts"
9595
}
9696
]
9797
}

angular.webpack.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,11 @@ const env = require('./env')
77
* Custom angular webpack configuration
88
*/
99
module.exports = (config, options) => {
10-
config.target = 'electron-renderer'
11-
1210
if (options.fileReplacements) {
13-
for (let fileReplacement of options.fileReplacements) {
14-
if (fileReplacement.replace !== 'apps/web/environments/environment.ts') {
15-
continue
16-
}
17-
18-
let fileReplacementParts = fileReplacement['with'].split('.')
19-
if (fileReplacementParts.length > 1 && ['web'].indexOf(fileReplacementParts[1]) >= 0) {
20-
config.target = 'web'
11+
for (let replacement of options.fileReplacements) {
12+
let parts = replacement.with.split('.')
13+
if (parts.includes('electron')) {
14+
config.target = 'electron-renderer'
2115
}
2216
break
2317
}
@@ -34,5 +28,6 @@ module.exports = (config, options) => {
3428
})
3529
]
3630

31+
console.log('[WEBPACK] using target', config.target)
3732
return config
3833
}

apps/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
android
2+
ios

apps/web/app/app-routing.module.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

apps/web/app/app.component.html

Lines changed: 43 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,50 @@
11
<nwb-title-bar *ngIf="isElectron"></nwb-title-bar>
22

3-
<div class="navbar bg-base-100 z-50 rounded-md font-bold">
4-
<div class="px-2 flex-none">
5-
<a class="text-lg font-bold">
6-
<img src="assets/icons/favicon.png" class="w-12" />
7-
</a>
3+
<div class="layout-pad-x layout-pad-t">
4+
<div class="navbar bg-base-100 z-50 font-bold rounded-md shadow-xl">
5+
<div class="navbar-start w-auto flex-none">
6+
<button class="btn btn-square btn-ghost text-primary lg:hidden" [nwbScreenDrawerToggle]="'toggle'">
7+
<svg fill="none" viewBox="0 0 24 24" class="inline-block w-5 h-5 stroke-current">
8+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
9+
</svg>
10+
</button>
11+
<a class="hidden lg:inline-block text-lg font-bold">
12+
<img src="assets/icons/favicon.png" class="w-12" />
13+
</a>
14+
</div>
15+
<div class="navbar-center flex-1 items-center justify-center">
16+
<a class=" lg:hidden text-lg font-bold">
17+
<img src="assets/icons/favicon.png" class="w-12" />
18+
</a>
19+
</div>
20+
<div class="navbar-end w-auto flex-none">
21+
<select class="select select-bordered w-20" [(ngModel)]="language">
22+
<option *ngFor="let item of langOptions" [value]="item.value">{{ item.label }}</option>
23+
</select>
24+
</div>
825
</div>
9-
<div class="flex flex-1 px-2 overflow-x-overlay scrollable">
10-
<a #link class="btn btn-ghost" routerLinkActive="text-primary" routerLink="/items"> Items </a>
11-
<a #link class="btn btn-ghost" routerLinkActive="text-primary" routerLink="/housing"> Housing </a>
12-
<a #link class="btn btn-ghost" routerLinkActive="text-primary" routerLink="/crafting"> Crafting </a>
13-
14-
<div class="divider divider-horizontal"></div>
15-
<a #link class="btn btn-ghost" routerLinkActive="text-primary" routerLink="/perks"> Perks </a>
16-
<a #link class="btn btn-ghost" routerLinkActive="text-primary" routerLink="/abilities"> Abilities </a>
17-
<a #link class="btn btn-ghost" routerLinkActive="text-primary" routerLink="/status-effects"> Statuseffects </a>
18-
19-
<div class="divider divider-horizontal"></div>
20-
21-
<a #link class="btn btn-ghost" routerLinkActive="text-primary" routerLink="/armorsets">Armorsets</a>
22-
<a #link class="btn btn-ghost" routerLinkActive="text-primary" routerLink="/progression"> Progression </a>
23-
24-
<div class="divider divider-horizontal"></div>
26+
</div>
27+
<nwb-screen-drawer class="select-none">
28+
<nwb-screen-drawer-side class="rounded-md layout-pad-l layout-pad-b" [nwbScreenDrawerToggle]="'close'">
29+
<ng-container *ngFor="let group of mainMenu">
30+
<ul class="menu menu-compact w-60 bg-base-300 rounded-md flex-none">
31+
<li class="menu-title uppercase mt-2" *ngIf="group.category">
32+
<span>{{ group.category }}</span>
33+
</li>
34+
<ng-container *ngFor="let item of group.items">
35+
<li *ngIf="item.divider"></li>
36+
<li routerLinkActive="bordered">
37+
<a #link [routerLink]="item.path"> {{ item.label }} </a>
38+
</li>
39+
</ng-container>
2540

26-
<a #link class="btn btn-ghost" routerLinkActive="text-primary" routerLink="/territories"> Territories </a>
27-
<a #link class="btn btn-ghost" routerLinkActive="text-primary" routerLink="/dungeons">Dungeons</a>
28-
<a #link class="btn btn-ghost" routerLinkActive="text-primary" routerLink="/vitals"> Vitals </a>
29-
</div>
30-
<div class="flex flex-none px-2">
31-
<select class="select select-bordered w-20" [(ngModel)]="language">
32-
<option disabled selected>Pick one</option>
33-
<option value="de-de">DE</option>
34-
<option value="en-us">EN</option>
35-
<option value="es-es">ES</option>
36-
<option value="fr-fr">FR</option>
37-
<option value="it-it">IT</option>
38-
<option value="pl-pl">PL</option>
39-
<option value="pt-br">BR</option>
40-
</select>
41+
</ul>
42+
</ng-container>
4143

42-
<div class="dropdown dropdown-end">
43-
<label tabindex="0" class="btn btn-ghost btn-circle">
44-
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
45-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h7" />
46-
</svg>
47-
</label>
48-
<ul tabindex="0" class="menu menu-compact dropdown-content mt-3 p-2 shadow bg-base-100 rounded-md w-52">
49-
<li>
50-
<a routerLinkActive="text-primary" routerLink="/preferences"> Preferences </a>
51-
</li>
52-
<li>
53-
<a routerLinkActive="text-primary" routerLink="/about"> About </a>
54-
</li>
5544

56-
<li class="menu-title">
57-
<span>Tools on the web</span>
58-
</li>
5945

60-
<li *ngFor="let it of links">
61-
<a target="_blank" [href]="it.url">
62-
<svg viewBox="0 0 448 512" class="w-4 h-4">
63-
<path
64-
fill="currentColor"
65-
d="M288 32c-17.7 0-32 14.3-32 32s14.3 32 32 32h50.7L169.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L384 141.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V64c0-17.7-14.3-32-32-32H288zM80 64C35.8 64 0 99.8 0 144v256c0 44.2 35.8 80 80 80h256c44.2 0 80-35.8 80-80v-80c0-17.7-14.3-32-32-32s-32 14.3-32 32v80c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V144c0-8.8 7.2-16 16-16h80c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z"
66-
/>
67-
</svg>
68-
<span class="whitespace-nowrap">{{ it.label }}</span>
69-
</a>
70-
</li>
71-
</ul>
72-
</div>
73-
</div>
74-
</div>
75-
<router-outlet></router-outlet>
46+
</nwb-screen-drawer-side>
47+
<nwb-screen-drawer-content class="layout-row layout-gap layout-pad-x layout-pad-b">
48+
<router-outlet></router-outlet>
49+
</nwb-screen-drawer-content>
50+
</nwb-screen-drawer>

apps/web/app/app.component.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
:host {
2-
gap: 1rem;
3-
padding: 1rem;
42

53
.navbar {
64
-webkit-app-region: drag;

apps/web/app/app.component.ts

Lines changed: 12 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,47 @@
1-
import { Component, ElementRef, QueryList, ViewChildren } from '@angular/core'
1+
import { Component, HostBinding } from '@angular/core'
22
import { sortBy } from 'lodash'
3+
import { APP_CONFIG } from '../environments/environment'
34

45
import { ElectronService } from './electron'
56
import { TranslateService } from './i18n'
67

8+
import { LANG_OPTIONS, MAIN_MENU } from './menu'
79
import { AppPreferencesService } from './preferences'
8-
import { Hotkeys } from './utils'
910

1011
@Component({
1112
selector: 'app-root',
1213
templateUrl: './app.component.html',
1314
styleUrls: ['./app.component.scss'],
1415
host: {
15-
class: 'layout-frame layout-column',
16+
class: 'layout-frame layout-col layout-gap',
1617
},
1718
})
1819
export class AppComponent {
20+
@HostBinding('class.is-electron')
1921
public get isElectron() {
2022
return this.electron.isElectron
2123
}
2224

25+
@HostBinding('class.is-web')
26+
public get isWeb() {
27+
return APP_CONFIG.environment === 'WEB' || APP_CONFIG.environment === 'DEV'
28+
}
29+
2330
public get language() {
2431
return this.preferences.language.get()
2532
}
2633
public set language(value: string) {
2734
this.preferences.language.set(value)
2835
}
2936

30-
protected links = sortBy(
31-
[
32-
{
33-
url: 'https://nwdb.info/',
34-
label: 'nwdb.info',
35-
},
36-
{
37-
url: 'https://www.nw-tools.info/',
38-
label: 'www.nw-tools.info',
39-
},
40-
{
41-
url: 'https://gaming.tools/newworld/',
42-
label: 'gaming.tools',
43-
},
44-
{
45-
url: 'https://new-world.exchange/',
46-
label: 'new-world.exchange',
47-
},
48-
{
49-
url: 'https://nwmarketprices.com/',
50-
label: 'nwmarketprices.com',
51-
},
52-
{
53-
url: 'https://newworldfans.com/',
54-
label: 'newworldfans.com',
55-
},
56-
{
57-
url: 'https://www.newworld-map.com/',
58-
label: 'newworld-map.com',
59-
},
60-
{
61-
url: 'https://mapgenie.io/new-world',
62-
label: 'mapgenie.io',
63-
},
64-
{
65-
url: 'https://raidplan.io/newworld',
66-
label: 'raidplan.io'
67-
}
68-
],
69-
(it) => it.label
70-
)
71-
72-
@ViewChildren('link')
73-
public tabs: QueryList<ElementRef<HTMLAnchorElement>>
37+
protected mainMenu = MAIN_MENU
38+
protected langOptions = LANG_OPTIONS
7439

7540
constructor(
7641
private preferences: AppPreferencesService,
7742
private electron: ElectronService,
78-
private hotkeys: Hotkeys,
7943
translate: TranslateService
8044
) {
8145
preferences.language.observe().subscribe((locale) => translate.use(locale))
82-
83-
;[1, 2, 3, 4, 5, 6, 7, 8, 9, 0].forEach((i) => {
84-
this.hotkeys
85-
.addShortcut({
86-
keys: `control.${i}`,
87-
})
88-
.subscribe(() => {
89-
this.tabs.get((i || 10) - 1)?.nativeElement?.click()
90-
})
91-
})
9246
}
9347
}

apps/web/app/app.module.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,24 @@ import { HttpClientModule } from '@angular/common/http'
22
import { NgModule } from '@angular/core'
33
import { FormsModule } from '@angular/forms'
44
import { BrowserModule } from '@angular/platform-browser'
5+
import { RouterModule } from '@angular/router'
56

6-
import { AppRoutingModule } from './app-routing.module'
7+
import { ROUTES } from './app.routes'
78

89
import { AppComponent } from './app.component'
910
import { TranslateModule } from './i18n'
1011
import { NwDataService } from './nw'
1112
import { TitleBarComponent } from './title-bar.component'
13+
import { ScreenModule } from './ui/screen'
1214

1315
@NgModule({
1416
declarations: [AppComponent, TitleBarComponent],
1517
imports: [
18+
RouterModule.forRoot(ROUTES),
1619
BrowserModule,
1720
FormsModule,
1821
HttpClientModule,
19-
AppRoutingModule,
22+
ScreenModule,
2023
TranslateModule.forRoot({
2124
loader: NwDataService,
2225
}),

0 commit comments

Comments
 (0)