Skip to content

Commit

Permalink
Long email addresses cause incorrect formatting of the left sidebar c…
Browse files Browse the repository at this point in the history
…hange history - resolved (#254)

* issue resolved

* comments removed

* Overworked - now the email address gets copied and the log service shows a toast to inform the user that the email address was copied.

* margin is not 0px - just 0
  • Loading branch information
aiAdrian authored Aug 20, 2024
1 parent 9e5e2fd commit dd0fda5
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@
display: flex;
flex-direction: row;
}

div {
user-select: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
<div class="info-field title-field" *ngIf="getTitle(); let title">
{{ title }}
</div>
<div class="info-field title-field" *ngIf="getUserId(); let userId">
<div class="info-field title-field user-id"
*ngIf="getUserId(); let userId"
[attr.title]="getUserId()"
(click)="copyUserId()">
{{ userId }}
</div>
<div class="info-field date-field">
Expand All @@ -19,7 +22,9 @@
<div
class="info-field comment-field"
*ngIf="commentField && commentField !== ''"
(click)="copyComment()"
>
<br>
«{{ commentField }}»
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
}
}

.comment {
font-style: italic;
.comment-field {
cursor: pointer;
}

.title-field {
Expand All @@ -41,6 +41,7 @@
grid-column-start: 1;
grid-column-end: span 2;
grid-row: 2;
margin-right: 0;
}

.in-conflict {
Expand Down Expand Up @@ -70,3 +71,13 @@
border: none;
}
}


.user-id {
width: 140px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
user-select: none;
cursor: pointer;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Component, Input} from "@angular/core";
import {LogService} from "../../../../../logger/log.service";

@Component({
selector: "sbb-version-entry-layout",
Expand All @@ -13,6 +14,9 @@ export class VersionEntryLayoutComponent {
@Input() dateField: Date;
@Input() commentField?: string;

constructor(private readonly logService: LogService) {
}

isInConflictState(): boolean {
return this.state === "conflict";
}
Expand All @@ -35,6 +39,26 @@ export class VersionEntryLayoutComponent {
return undefined;
}

copyComment() {
const comment = this.commentField;
if (!comment) {
return;
}
navigator.clipboard.writeText(comment);
const msg = $localize`:@@app.view.variant.variant-view.variant-history.version-entry-layout.user-id-copied:copied ${comment}:msg:`;
this.logService.info(msg);
}

copyUserId() {
const userId = this.getUserId();
if (!userId) {
return;
}
navigator.clipboard.writeText(userId);
const msg = $localize`:@@app.view.variant.variant-view.variant-history.version-entry-layout.user-id-copied:copied ${userId}:msg:`;
this.logService.info(msg);
}

getTitle(): string | undefined {
if (typeof this.titleField === "string") {
return this.titleField;
Expand All @@ -44,5 +68,6 @@ export class VersionEntryLayoutComponent {
}

export class UserId {
constructor(readonly value: string) {}
constructor(readonly value: string) {
}
}
3 changes: 3 additions & 0 deletions src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@
"version-already-available": "Version bereits vorhanden",
"successfully-published": "Erfolgreich publiziert"
},
"version-entry-layout": {
"user-id-copied": "In die Zwischenablage kopiert: {$msg}"
},
"snapshot-entry": {
"download": "Herunterladen",
"restore": "Wiederherstellen",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@
"version-already-available": "Version already available",
"successfully-published": "Successfully published"
},
"version-entry-layout": {
"user-id-copied": "Copied to clipboard: {$msg}"
},
"snapshot-entry": {
"download": "Download",
"restore": "Restore",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@
"version-already-available": "Version already available",
"successfully-published": "Successfully published"
},
"version-entry-layout": {
"user-id-copied": "Copied to clipboard: {$msg}"
},
"snapshot-entry": {
"download": "Download",
"restore": "Restore",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@
"version-already-available": "Version already available",
"successfully-published": "Successfully published"
},
"version-entry-layout": {
"user-id-copied": "Copied to clipboard: {$msg}"
},
"snapshot-entry": {
"download": "Download",
"restore": "Restore",
Expand Down

0 comments on commit dd0fda5

Please sign in to comment.