-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from baloise-incubator/feat/draggable-inventory…
…-and-such make items draggable and support multiple items
- Loading branch information
Showing
34 changed files
with
399 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.inventories-container { | ||
display:flex; | ||
align-content: space-evenly; | ||
} | ||
|
||
.inventory-container { | ||
display:block; | ||
width:270px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
angular-frontend/src/app/components/inventory-item/inventory-item.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div class="inventory-item" (dragstart)="onDragStart($event)" draggable="true"> | ||
{{item.name}} | ||
</div> | ||
<div class="inventory-item" [ngClass]="item.userLock ? 'locked-item' : ''" [draggable]="item.userLock === currentUser" (dragstart)="onDragStart($event)"> | ||
<img [alt]="item" [src]="'assets/items/' + item.name + '.png'"/> | ||
</div> |
15 changes: 10 additions & 5 deletions
15
angular-frontend/src/app/components/inventory-item/inventory-item.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
.inventory-item { | ||
width:90px; | ||
height:90px; | ||
border-radius:3px; | ||
background-color: limegreen; | ||
margin:5px; | ||
width:50px; | ||
height:50px; | ||
border-radius:9px; | ||
background-color: white; | ||
margin:3px; | ||
box-shadow: 0 0 5px lightgray; | ||
} | ||
|
||
.locked-item { | ||
background-color:lightgray; | ||
} |
18 changes: 12 additions & 6 deletions
18
angular-frontend/src/app/components/inventory-item/inventory-item.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
import {Component, Input} from '@angular/core'; | ||
import {Component, Input, OnInit} from '@angular/core'; | ||
import {Item} from "../../../model"; | ||
import store from "../../../store"; | ||
|
||
@Component({ | ||
selector: 'app-inventory-item', | ||
templateUrl: './inventory-item.component.html', | ||
styleUrls: ['./inventory-item.component.scss'] | ||
}) | ||
export class InventoryItemComponent { | ||
export class InventoryItemComponent implements OnInit { | ||
@Input() | ||
item!: Item; | ||
item!: Item | ||
get currentUser(): string { | ||
return store.currentUser; | ||
} | ||
|
||
onDragStart(event: DragEvent) { | ||
event.dataTransfer?.clearData() | ||
event.dataTransfer?.setData("application/json", JSON.stringify( { | ||
target: this.item | ||
})) | ||
event.dataTransfer?.setData("application/json", JSON.stringify(this.item)) | ||
} | ||
|
||
ngOnInit(): void { | ||
console.log("hey?") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
angular-frontend/src/app/components/item-base-selection/item-base-selection.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div class="item-base-container"> | ||
<div *ngFor="let base of itemBases" class="item-base-group" (click)="onItemClicked(base)"> | ||
<div class="item-base"> | ||
<img [alt]="base.label" [src]="'assets/items/' + base.name + '.png'"/> | ||
</div> | ||
<div class="item-base-label">{{base.label}}</div> | ||
</div> | ||
</div> |
30 changes: 30 additions & 0 deletions
30
angular-frontend/src/app/components/item-base-selection/item-base-selection.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.item-base { | ||
width:50px; | ||
height:50px; | ||
border-radius:9px; | ||
background-color: white; | ||
margin:3px; | ||
box-shadow: 0 0 5px lightgray; | ||
} | ||
|
||
.item-base-container { | ||
display: flex; | ||
justify-content: space-evenly; | ||
flex-wrap:wrap; | ||
} | ||
|
||
.item-base-group { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
width: 150px; | ||
padding:10px; | ||
margin-bottom: 10px; | ||
border-radius:9px; | ||
cursor: grab; | ||
} | ||
|
||
.item-base-group:hover { | ||
background-color:lightgray; | ||
} |
22 changes: 22 additions & 0 deletions
22
angular-frontend/src/app/components/item-base-selection/item-base-selection.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {Component, Input} from '@angular/core'; | ||
import store from "../../../store"; | ||
import {ItemBase} from "../../../model"; | ||
|
||
@Component({ | ||
selector: 'app-item-base-selection', | ||
templateUrl: './item-base-selection.component.html', | ||
styleUrls: ['./item-base-selection.component.scss'] | ||
}) | ||
export class ItemBaseSelectionComponent { | ||
|
||
@Input() | ||
onSelected?: (base: ItemBase) => void; | ||
|
||
get itemBases() { | ||
return store.itemBases; | ||
} | ||
|
||
onItemClicked(base: ItemBase) { | ||
this.onSelected && this.onSelected(base); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.