Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long email addresses cause incorrect formatting of the left sidebar change history - resolved #254

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Comment on lines +57 to +59
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change: use await navigator.clipboard.writeText() to only show the info message once the text has successfully been copied to the clipboard. (In some cases it can take a while or fail.)

}

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