Procházet zdrojové kódy

ability panel is finished but input fields on proficiency

Christopher Giese před 1 rokem
rodič
revize
62d8fe95ae

+ 74 - 0
.nx/cache/d/daemon.log

@@ -459144,3 +459144,77 @@ To fix this, set a unique name for each project in a project.json inside the pro
 [NX Daemon Server] - 2023-11-13T15:27:01.808Z - Time taken for 'hash changed files from watcher' 111.19519996643066ms
 [NX Daemon Server] - 2023-11-13T15:27:01.809Z - [WATCHER]: Processing file changes in outputs
 [NX Daemon Server] - 2023-11-13T15:27:01.809Z - Done responding to the client null
+[NX Daemon Server] - 2023-11-14T06:17:56.371Z - Started listening on: \\.\pipe\nx\C:\Users\chris\AppData\Local\Temp\b99a3e5445b3962b8dd8\d.sock
+[NX Daemon Server] - 2023-11-14T06:17:56.379Z - [WATCHER]: Subscribed to changes within: c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools (native)
+[NX Daemon Server] - 2023-11-14T06:17:56.386Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-11-14T06:17:56.388Z - Closed a connection. Number of open connections: 0
+[NX Daemon Server] - 2023-11-14T06:17:56.388Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-11-14T06:17:56.390Z - [REQUEST]: Client Request for Project Graph Received
+[NX Daemon Server] - 2023-11-14T06:17:57.058Z - Error detected when recomputing project file map: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+[NX Daemon Server] - 2023-11-14T06:17:57.058Z - [REQUEST]: Responding to the client with an error. Error when preparing serialized project graph. The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+Error: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+    at readProjectConfigurationsFromRootMap (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:97:15)
+    at buildProjectsConfigurationsFromProjectPathsAndPlugins (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:70:19)
+    at createProjectConfigurations (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:131:129)
+    at WorkspaceContext.<anonymous> (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:82:39)
+    at getProjectConfigurationsFromContext (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\utils\workspace-context.js:26:29)
+    at _retrieveProjectConfigurations (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:81:72)
+    at retrieveProjectConfigurations (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:58:12)
+    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
+    at async processCollectedUpdatedAndDeletedFiles (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:102:34)
+    at async processFilesAndCreateAndSerializeProjectGraph (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:138:17)
+[NX Daemon Server] - 2023-11-14T06:17:57.060Z - Time taken for 'hash changed files from watcher' 101.8694999217987ms
+[NX Daemon Server] - 2023-11-14T06:17:57.060Z - [WATCHER]: Processing file changes in outputs
+[NX Daemon Server] - 2023-11-14T06:17:57.060Z - Done responding to the client null
+[NX Daemon Server] - 2023-11-14T06:20:33.840Z - Started listening on: \\.\pipe\nx\C:\Users\chris\AppData\Local\Temp\b99a3e5445b3962b8dd8\d.sock
+[NX Daemon Server] - 2023-11-14T06:20:33.842Z - [WATCHER]: Subscribed to changes within: c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools (native)
+[NX Daemon Server] - 2023-11-14T06:20:33.847Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-11-14T06:20:33.849Z - Closed a connection. Number of open connections: 0
+[NX Daemon Server] - 2023-11-14T06:20:33.849Z - Established a connection. Number of open connections: 1
+[NX Daemon Server] - 2023-11-14T06:20:33.851Z - [REQUEST]: Client Request for Project Graph Received
+[NX Daemon Server] - 2023-11-14T06:20:33.944Z - Error detected when recomputing project file map: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+[NX Daemon Server] - 2023-11-14T06:20:33.944Z - [REQUEST]: Responding to the client with an error. Error when preparing serialized project graph. The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+Error: The following projects are defined in multiple locations:
+- DnDTools: 
+  - 
+  - .
+
+To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.
+    at readProjectConfigurationsFromRootMap (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:97:15)
+    at buildProjectsConfigurationsFromProjectPathsAndPlugins (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\project-graph\utils\project-configuration-utils.js:70:19)
+    at createProjectConfigurations (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:131:129)
+    at WorkspaceContext.<anonymous> (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:82:39)
+    at getProjectConfigurationsFromContext (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\utils\workspace-context.js:26:29)
+    at _retrieveProjectConfigurations (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:81:72)
+    at retrieveProjectConfigurations (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\project-graph\utils\retrieve-workspace-files.js:58:12)
+    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
+    at async processCollectedUpdatedAndDeletedFiles (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:102:34)
+    at async processFilesAndCreateAndSerializeProjectGraph (c:\Users\chris\Softwareprojekte\CharacterJournal\DnDTools\node_modules\nx\src\daemon\server\project-graph-incremental-recomputation.js:138:17)
+[NX Daemon Server] - 2023-11-14T06:20:33.946Z - Time taken for 'hash changed files from watcher' 43.0271999835968ms
+[NX Daemon Server] - 2023-11-14T06:20:33.946Z - [WATCHER]: Processing file changes in outputs
+[NX Daemon Server] - 2023-11-14T06:20:33.946Z - Done responding to the client null

+ 1 - 1
.nx/cache/d/server-process.json

@@ -1 +1 @@
-{"processId":196}
+{"processId":1920}

+ 1 - 1
src/app/journal/journal-stats/ability-panel/ability-panel.component.scss

@@ -1,5 +1,5 @@
 .ability-panel-container{
     border: 1px solid #525252;
     border-radius: 5px;
-    height: 60vh;
+    height: 85vh;
 }

+ 1 - 1
src/app/journal/journal-stats/ability-panel/ability-table/ability-details/ability-details.component.html

@@ -10,7 +10,7 @@
 
 <div class="vertical-button-wrapper">
   <ui-button
-    [type]="'update'"
+    [type]="'edit'"
     [size]="'xlarge'"
     [color]="'primary'"
     (click)="close('update')"

+ 9 - 1
src/app/journal/journal-stats/ability-panel/ability-table/ability-table.component.html

@@ -32,8 +32,16 @@
     </div>
   </div>
 
-  <button (click)="openAbilityModal()">+</button>
+  <!-- <button (click)="openAbilityModal()">+</button> -->
 </div>
+<ui-button
+  style="margin: 1rem"
+  [type]="'add'"
+  [size]="'xlarge'"
+  [color]="'primary'"
+  (click)="openAbilityModal()"
+>
+</ui-button>
 
 <ability-modal
   (abilityCreated)="addNewlyCreatedAbility($event)"

+ 11 - 6
src/app/journal/journal-stats/ability-panel/proficiencies-table/proficiencies-table.component.html

@@ -80,12 +80,17 @@
       {{ language }}
     </div>
   </div>
-  <button (click)="modifyToolsAndLanguages()">
+  <!-- <button (click)="modifyToolsAndLanguages()">
     <icon [size]="'xs'" [type]="'UI'" [icon]="'edit'"></icon>Anpassen
-  </button>
+  </button> -->
+  <ui-button
+    style="margin: 1rem"
+    [type]="'edit'"
+    [size]="'xlarge'"
+    [color]="'primary'"
+    (click)="modifyToolsAndLanguages()"
+  >
+  </ui-button>
 </div>
 
-<tools-modal
-  [proficiencies]="proficiencies"
-  (proficienciesUpdated)="updateProficiencies($event)"
-></tools-modal>
+<tools-modal (proficienciesUpdated)="updateProficiencies($event)"></tools-modal>

+ 7 - 3
src/app/journal/journal-stats/ability-panel/proficiencies-table/proficiencies-table.component.ts

@@ -53,13 +53,17 @@ export class ProficienciesTableComponent {
       if (panel.style.maxHeight) {
         panel.style.maxHeight = null;
       } else {
-        panel.style.maxHeight = panel.scrollHeight + 'px';
+        panel.style.maxHeight = '100svh'; //Hier ansetzen um es später scrollable zu machen
       }
     }
   }
 
   public modifyToolsAndLanguages(): void {
-    this.ngxSmartModalService.getModal('modifyToolsAndLanguages').open();
+    this.ngxSmartModalService.setModalData(
+      this.proficiencies,
+      'toolsAndLanguagesModal'
+    );
+    this.ngxSmartModalService.getModal('toolsAndLanguagesModal').open();
   }
 
   public updateDatabase(): void {
@@ -68,7 +72,7 @@ export class ProficienciesTableComponent {
 
   public updateProficiencies(data: any): void {
     this.proficiencies = data;
-    this.ngxSmartModalService.getModal('modifyToolsAndLanguages').close();
+    this.ngxSmartModalService.getModal('toolsAndLanguagesModal').close();
     this.updateDatabase();
   }
 }

+ 35 - 33
src/app/journal/journal-stats/ability-panel/proficiencies-table/tools-modal/tools-modal.component.html

@@ -1,23 +1,24 @@
-<ngx-smart-modal #modifyToolsAndLanguages identifier="modifyToolsAndLanguages">
+<ngx-smart-modal
+  #toolsAndLanguagesModal
+  identifier="toolsAndLanguagesModal"
+  (onOpenFinished)="loadData()"
+>
   <h4>Werkzeuge</h4>
-  <div
-    cdkDropList
-    class="example-list"
-    (cdkDropListDropped)="dropTools($event)"
-  >
-    <div
-      class="example-box"
+  <div style="display: flex; flex-direction: column; gap: 0.5rem">
+    <ng-container
       *ngFor="let tool of proficiencies.tools; let toolIndex = index"
-      cdkDrag
     >
-      <input type="text" [(ngModel)]="proficiencies.tools[toolIndex]" /><icon
-        [size]="'s'"
-        [type]="'UI'"
-        [icon]="'remove'"
-        [class]="'pointer'"
-        (click)="deleteTool(toolIndex)"
-      ></icon>
-    </div>
+      <div>
+        <input type="text" [(ngModel)]="proficiencies.tools[toolIndex]" />
+        <icon
+          [size]="'s'"
+          [type]="'UI'"
+          [icon]="'remove'"
+          [class]="'pointer'"
+          (click)="deleteTool(toolIndex)"
+        ></icon>
+      </div>
+    </ng-container>
     <icon
       [size]="'s'"
       [type]="'UI'"
@@ -26,28 +27,29 @@
       (click)="addTool()"
     ></icon>
   </div>
+
   <br />
   <br />
   <h4>Sprachen</h4>
-  <div
-    cdkDropList
-    class="example-list"
-    (cdkDropListDropped)="dropLanguages($event)"
-  >
-    <div
+  <div style="display: flex; flex-direction: column; gap: 0.5rem">
+    <ng-container
       class="example-box"
       *ngFor="let tool of proficiencies.languages; let languageIndex = index"
-      cdkDrag
     >
-      <input type="text" [(ngModel)]="proficiencies.languages[languageIndex]" />
-      <icon
-        [size]="'s'"
-        [type]="'UI'"
-        [icon]="'remove'"
-        [class]="'pointer'"
-        (click)="deleteLanguage(languageIndex)"
-      ></icon>
-    </div>
+      <div>
+        <input
+          type="text"
+          [(ngModel)]="proficiencies.languages[languageIndex]"
+        />
+        <icon
+          [size]="'s'"
+          [type]="'UI'"
+          [icon]="'remove'"
+          [class]="'pointer'"
+          (click)="deleteLanguage(languageIndex)"
+        ></icon>
+      </div>
+    </ng-container>
     <icon
       [size]="'s'"
       [type]="'UI'"

+ 13 - 3
src/app/journal/journal-stats/ability-panel/proficiencies-table/tools-modal/tools-modal.component.ts

@@ -5,6 +5,7 @@ import {
   CdkDrag,
   moveItemInArray,
 } from '@angular/cdk/drag-drop';
+import { NgxSmartModalService } from 'ngx-smart-modal';
 
 @Component({
   selector: 'tools-modal',
@@ -12,11 +13,20 @@ import {
   styleUrls: ['./tools-modal.component.scss'],
 })
 export class ToolsModalComponent {
-  @Input() public proficiencies: any;
+  public constructor(public ngxSmartModalService: NgxSmartModalService) {}
+
+  public proficiencies: any = { tools: [], languages: [] };
   @Output() public proficienciesUpdated = new EventEmitter<any>();
 
-  public ngOnInit(): void {
-    this.proficiencies = JSON.parse(JSON.stringify(this.proficiencies));
+  public loadData(): void {
+    this.proficiencies = JSON.parse(
+      JSON.stringify(
+        this.ngxSmartModalService.getModalData('toolsAndLanguagesModal')
+      )
+    );
+    this.ngxSmartModalService.resetModalData('toolsAndLanguagesModal');
+
+    console.log('Proficiencies: ', this.proficiencies);
   }
 
   public dropTools(event: CdkDragDrop<string[]>): void {

+ 12 - 1
src/app/journal/journal-stats/ability-panel/spellslots/spellslots.component.ts

@@ -130,7 +130,10 @@ export class SpellslotsComponent {
   }
 
   public updateSpellslotDatabase(): void {
-    this.dataAccessor.setSpellslots(this.spellslots);
+    this.dataAccessor.setSpellslots({
+      spellslots: this.spellslots,
+      showSpellslots: this.showSpellslots,
+    });
   }
 
   public updateKiPointsDatabase(): void {
@@ -142,10 +145,18 @@ export class SpellslotsComponent {
   }
 
   public updateSlotsAndPoints(data: any): void {
+    console.log(data.spellslots.spellslots);
     this.spellslots = data.spellslots.spellslots;
     this.showSpellslots = data.spellslots.showSpellslots;
     this.kiPoints = data.kiPoints.kiPoints;
 
+    setTimeout(() => {
+      this.spellslots.forEach((_, levelIndex) => {
+        this.correctSpellslotsView(levelIndex);
+      });
+      this.correctKiPointsView();
+    }, 200);
+
     this.updateSpellslotDatabase();
     this.updateKiPointsDatabase();
   }

+ 1 - 1
src/app/journal/journal-stats/ability-panel/trait-table/trait-details/trait-details.component.html

@@ -4,7 +4,7 @@
 
 <div class="vertical-button-wrapper">
   <ui-button
-    [type]="'update'"
+    [type]="'edit'"
     [size]="'xlarge'"
     [color]="'primary'"
     (click)="close('update')"

+ 8 - 3
src/app/journal/journal-stats/ability-panel/trait-table/trait-table.component.html

@@ -11,10 +11,15 @@
 
     <p>{{ trait.shortDescription }}</p>
   </div>
-
-  <button (click)="openTraitModal()">+</button>
-  <!-- <button (click)="openDetails()">+</button> -->
 </div>
+<ui-button
+  style="margin: 1rem"
+  [type]="'add'"
+  [size]="'xlarge'"
+  [color]="'primary'"
+  (click)="openTraitModal()"
+>
+</ui-button>
 
 <trait-modal
   (traitCreated)="addNewlyCreatedTrait($event)"

+ 1 - 1
src/app/shared-components/ui-button/ui-button.component.ts

@@ -14,7 +14,7 @@ export class UiButtonComponent {
 
   public textArray: any = {
     add: 'Hinzufügen',
-    update: 'Aktualisieren',
+    edit: 'Anpassen',
     delete: 'Löschen',
     dismiss: 'Abbrechen',
   };