|
1 | 1 | import { Component, OnInit } from '@angular/core'; |
2 | 2 | import { FormBuilder, FormGroup, FormArray, AbstractControl } from '@angular/forms'; |
3 | | -import { SettingsService } from '../../service/settings/settings.service'; |
| 3 | +import { SettingsService, LabelParts } from '../../service/settings/settings.service'; |
4 | 4 | import { GithubService, GithubReleaseInfo } from 'src/app/service/settings/github.service'; |
5 | 5 | import { LoaderService } from 'src/app/service/loader/data-loader.service'; |
6 | 6 | import { DataStore } from 'src/app/model/data-store'; |
@@ -62,7 +62,9 @@ export class SettingsComponent implements OnInit { |
62 | 62 | selectedDateFormat: string = this.BROWSER_LOCALE; |
63 | 63 |
|
64 | 64 | customTeamLabel: string = 'Team'; |
| 65 | + customTeamLabelPlural: string = ''; |
65 | 66 | customGroupLabel: string = 'Group'; |
| 67 | + customGroupLabelPlural: string = ''; |
66 | 68 |
|
67 | 69 | // GitHub release check state |
68 | 70 | checkingLatest: boolean = false; |
@@ -149,7 +151,9 @@ export class SettingsComponent implements OnInit { |
149 | 151 | initialize(): void { |
150 | 152 | this.selectedDateFormat = this.settings.getDateFormat() || this.BROWSER_LOCALE; |
151 | 153 | this.customTeamLabel = this.settings.getTeamLabel(); |
| 154 | + this.customTeamLabelPlural = this.settings.getTeamLabelPlural(); |
152 | 155 | this.customGroupLabel = this.settings.getGroupLabel(); |
| 156 | + this.customGroupLabelPlural = this.settings.getGroupLabelPlural(); |
153 | 157 |
|
154 | 158 | // Init dates |
155 | 159 | let date: Date = new Date(); |
@@ -185,11 +189,35 @@ export class SettingsComponent implements OnInit { |
185 | 189 | } |
186 | 190 |
|
187 | 191 | onTeamLabelChange(): void { |
188 | | - this.settings.setTeamLabel(this.customTeamLabel); |
| 192 | + this.settings.setTeamLabel(this.customTeamLabel, this.customTeamLabelPlural); |
| 193 | + // Update plural placeholder when singular changes |
| 194 | + if (!this.customTeamLabelPlural || this.customTeamLabelPlural === this.customTeamLabel + 's') { |
| 195 | + this.customTeamLabelPlural = ''; |
| 196 | + } |
| 197 | + } |
| 198 | + |
| 199 | + onTeamLabelPluralChange(): void { |
| 200 | + this.settings.setTeamLabel(this.customTeamLabel, this.customTeamLabelPlural); |
189 | 201 | } |
190 | 202 |
|
191 | 203 | onGroupLabelChange(): void { |
192 | | - this.settings.setGroupLabel(this.customGroupLabel); |
| 204 | + this.settings.setGroupLabel(this.customGroupLabel, this.customGroupLabelPlural); |
| 205 | + // Update plural placeholder when singular changes |
| 206 | + if (!this.customGroupLabelPlural || this.customGroupLabelPlural === this.customGroupLabel + 's') { |
| 207 | + this.customGroupLabelPlural = ''; |
| 208 | + } |
| 209 | + } |
| 210 | + |
| 211 | + onGroupLabelPluralChange(): void { |
| 212 | + this.settings.setGroupLabel(this.customGroupLabel, this.customGroupLabelPlural); |
| 213 | + } |
| 214 | + |
| 215 | + getTeamPluralPlaceholder(): string { |
| 216 | + return (this.customTeamLabel || 'Team') + 's'; |
| 217 | + } |
| 218 | + |
| 219 | + getGroupPluralPlaceholder(): string { |
| 220 | + return (this.customGroupLabel || 'Group') + 's'; |
193 | 221 | } |
194 | 222 |
|
195 | 223 | onMaxLevelChange(value: number | null): void { |
|
0 commit comments