Skip to content

Commit

Permalink
add copy icon to userId (#4404)
Browse files Browse the repository at this point in the history
  • Loading branch information
julianjelfs authored Sep 20, 2023
1 parent 6fca9c2 commit 770e6b8
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 10 deletions.
23 changes: 22 additions & 1 deletion frontend/app/src/components/home/profile/UserProfile.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
ModerationFlags,
} from "openchat-client";
import Close from "svelte-material-icons/Close.svelte";
import CopyIcon from "svelte-material-icons/ContentCopy.svelte";
import HoverIcon from "../../HoverIcon.svelte";
import StorageUsage from "../../StorageUsage.svelte";
import EditableAvatar from "../../EditableAvatar.svelte";
Expand Down Expand Up @@ -211,6 +212,12 @@
function closeProfile() {
dispatch("closeProfile");
}
function onCopy() {
navigator.clipboard.writeText(user.userId).then(() => {
toastStore.showSuccessToast("userIdCopiedToClipboard");
});
}
</script>

<SectionHeader border={false} flush shadow>
Expand Down Expand Up @@ -434,7 +441,12 @@
headerText={$_("advanced")}>
<div class="userid">
<Legend label={$_("userId")} rules={$_("alsoCanisterId")} />
<div>{user.userId}</div>
<div class="userid-txt">
<div>{user.userId}</div>
<div role="button" tabindex="0" on:click={onCopy} class="copy">
<CopyIcon size={$iconSize} color={"var(--icon-txt)"} />
</div>
</div>
</div>
<div>
<Legend label={$_("version")} rules={$_("websiteVersion")} />
Expand Down Expand Up @@ -473,6 +485,15 @@
.userid {
margin-bottom: $sp4;
.userid-txt {
display: flex;
gap: $sp3;
align-items: center;
.copy {
cursor: pointer;
}
}
}
.para {
Expand Down
3 changes: 2 additions & 1 deletion frontend/app/src/i18n/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -1008,5 +1008,6 @@
"makeGroupPublicFailed": "未能公开 {level}",
"displayNameRules": "选修的",
"displayName": "显示名称",
"communityDisplayNameRules": "只在这个社区内"
"communityDisplayNameRules": "只在这个社区内",
"userIdCopiedToClipboard": "用户 ID 已复制到剪贴板"
}
3 changes: 2 additions & 1 deletion frontend/app/src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1009,5 +1009,6 @@
"makeGroupPublicFailed": "{level} konnte nicht veröffentlicht werden",
"displayNameRules": "Optional",
"displayName": "Anzeigename",
"communityDisplayNameRules": "nur innerhalb dieser Gemeinschaft"
"communityDisplayNameRules": "nur innerhalb dieser Gemeinschaft",
"userIdCopiedToClipboard": "Benutzer-ID in die Zwischenablage kopiert"
}
1 change: 1 addition & 0 deletions frontend/app/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@
"previewFailure": "Unable to load thread previews"
},
"linkCopiedToClipboard": "Link copied to clipboard",
"userIdCopiedToClipboard": "User Id copied to clipboard",
"failedToCopyLinkToClipboard": "Unable to copy link to clipboard",
"referralHeader": "Invite friends/family",
"userReferralMessage": "Share this link to OpenChat with friends and family. As long as you are a Diamond member yourself, for each person who registers with your link and goes on to become a Diamond member, you will receive half of the membership payments they make during their first year.",
Expand Down
3 changes: 2 additions & 1 deletion frontend/app/src/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1009,5 +1009,6 @@
"makeGroupPublicFailed": "No se pudo hacer público {level}",
"displayNameRules": "opcional",
"displayName": "Nombre para mostrar",
"communityDisplayNameRules": "solo dentro de esta comunidad"
"communityDisplayNameRules": "solo dentro de esta comunidad",
"userIdCopiedToClipboard": "ID de usuario copiado al portapapeles"
}
3 changes: 2 additions & 1 deletion frontend/app/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1007,5 +1007,6 @@
"makeGroupPublicFailed": "Échec de la publication de {level}",
"displayNameRules": "facultatif",
"displayName": "Afficher un nom",
"communityDisplayNameRules": "seulement au sein de cette communauté"
"communityDisplayNameRules": "seulement au sein de cette communauté",
"userIdCopiedToClipboard": "ID utilisateur copié dans le presse-papiers"
}
3 changes: 2 additions & 1 deletion frontend/app/src/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -1007,5 +1007,6 @@
"makeGroupPublicFailed": "Impossibile rendere pubblico {level}",
"displayNameRules": "opzionale",
"displayName": "Nome da visualizzare",
"communityDisplayNameRules": "solo all'interno di questa comunità"
"communityDisplayNameRules": "solo all'interno di questa comunità",
"userIdCopiedToClipboard": "ID utente copiato negli appunti"
}
3 changes: 2 additions & 1 deletion frontend/app/src/i18n/iw.json
Original file line number Diff line number Diff line change
Expand Up @@ -1005,5 +1005,6 @@
"makeGroupPublicFailed": "הפיכת {level} לציבורי נכשלה",
"displayNameRules": "אופציונאלי",
"displayName": "הצג שם",
"communityDisplayNameRules": "רק בתוך הקהילה הזו"
"communityDisplayNameRules": "רק בתוך הקהילה הזו",
"userIdCopiedToClipboard": "זיהוי המשתמש הועתק ללוח"
}
3 changes: 2 additions & 1 deletion frontend/app/src/i18n/jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -1008,5 +1008,6 @@
"makeGroupPublicFailed": "{level} を公開できませんでした",
"displayNameRules": "オプション",
"displayName": "表示名",
"communityDisplayNameRules": "このコミュニティ内だけで"
"communityDisplayNameRules": "このコミュニティ内だけで",
"userIdCopiedToClipboard": "ユーザーIDがクリップボードにコピーされました"
}
3 changes: 2 additions & 1 deletion frontend/app/src/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1007,5 +1007,6 @@
"makeGroupPublicFailed": "Не удалось сделать {level} общедоступным.",
"displayNameRules": "необязательный",
"displayName": "Отображаемое имя",
"communityDisplayNameRules": "только в этом сообществе"
"communityDisplayNameRules": "только в этом сообществе",
"userIdCopiedToClipboard": "Идентификатор пользователя скопирован в буфер обмена."
}
3 changes: 2 additions & 1 deletion frontend/app/src/i18n/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1008,5 +1008,6 @@
"makeGroupPublicFailed": "Không công khai được {level}",
"displayNameRules": "không bắt buộc",
"displayName": "Tên hiển thị",
"communityDisplayNameRules": "chỉ trong cộng đồng này"
"communityDisplayNameRules": "chỉ trong cộng đồng này",
"userIdCopiedToClipboard": "Đã sao chép Id người dùng vào bảng nhớ tạm"
}

0 comments on commit 770e6b8

Please sign in to comment.