Skip to content

Commit

Permalink
Added support to collapse trade notifications when clicking a trade b…
Browse files Browse the repository at this point in the history
…utton
  • Loading branch information
WhiteFang5 committed Feb 5, 2024
1 parent 4e223e6 commit 198d7be
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,15 @@
</mat-slide-toggle>
</div>
</div>
<div class="row">
<div class="col-4">
<mat-slide-toggle [checked]="tradeOption.collapseNotification" (change)="tradeOption.collapseNotification = $event.checked">
{{ 'trade-companion.trade-option.collapse' | translate }}
</mat-slide-toggle>
</div>
<div class="col-8 text-right">
</div>
</div>
</mat-card>
</div>
<div class="col-md-6 col-lg-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class TradeCompanionSettingsComponent implements UserSettingsComponent {
whisperMessage: '1 minute please',
kickAfterWhisper: false,
dismissNotification: false,
collapseNotification: false,
})
}

Expand All @@ -73,6 +74,7 @@ export class TradeCompanionSettingsComponent implements UserSettingsComponent {
whisperMessage: 'Thank you very much!',
kickAfterWhisper: false,
dismissNotification: false,
collapseNotification: false,
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,14 @@ export class TradeNotificationComponent implements OnInit, OnDestroy, OnChanges
}
if (tradeOption.dismissNotification) {
this.dismiss()
} else if (tradeOption.collapseNotification) {
this.collapse()
}
})
} else if (tradeOption.dismissNotification) {
this.dismiss()
} else if (tradeOption.collapseNotification) {
this.collapse()
}
}

Expand All @@ -269,6 +273,11 @@ export class TradeNotificationComponent implements OnInit, OnDestroy, OnChanges
return Math.floor(n * div) / div
}

private collapse(): void {
this.notification.userCollapsed = true
this.collapseClick.emit(this.notification)
}

private dismiss(): void {
this.dismissNotification.emit(this.notification)
}
Expand Down
4 changes: 4 additions & 0 deletions src/app/modules/trade-companion/trade-companion.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,21 @@ export class TradeCompanionModule implements FeatureModule {
whisperMessage: '1 minute please.',
kickAfterWhisper: false,
dismissNotification: false,
collapseNotification: false,
},
{
buttonLabel: 'thx',
whisperMessage: 'Thank you very much.',
kickAfterWhisper: true,
dismissNotification: true,
collapseNotification: false,
},
{
buttonLabel: 'sold',
whisperMessage: 'Sorry, already sold.',
kickAfterWhisper: true,
dismissNotification: true,
collapseNotification: false,
},
],
outgoingTradeOptions: [
Expand All @@ -54,6 +57,7 @@ export class TradeCompanionModule implements FeatureModule {
whisperMessage: 'Thank you very much.',
kickAfterWhisper: true,
dismissNotification: true,
collapseNotification: false,
},
],
showStashGridOnInvite: true,
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/module/poe/type/trade-companion.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface TradeCompanionButtonOption {
whisperMessage: string
kickAfterWhisper: boolean
dismissNotification: boolean
collapseNotification: boolean
keybinding?: string
}

Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
"trade-option": {
"add": "Add Trade Option",
"button": "Button Label",
"collapse": "Collapse",
"dismiss": "Dismiss Notification",
"shortcut": "Shortcut",
"shortcut-description": "Keybinding to send this whisper message to the player (of the active Trade Notification)",
Expand Down

0 comments on commit 198d7be

Please sign in to comment.