From 770e6b822f315a7a96caa93dacaf7c49ebe878f8 Mon Sep 17 00:00:00 2001 From: Julian Jelfs Date: Wed, 20 Sep 2023 09:47:12 +0100 Subject: [PATCH] add copy icon to userId (#4404) --- .../home/profile/UserProfile.svelte | 23 ++++++++++++++++++- frontend/app/src/i18n/cn.json | 3 ++- frontend/app/src/i18n/de.json | 3 ++- frontend/app/src/i18n/en.json | 1 + frontend/app/src/i18n/es.json | 3 ++- frontend/app/src/i18n/fr.json | 3 ++- frontend/app/src/i18n/it.json | 3 ++- frontend/app/src/i18n/iw.json | 3 ++- frontend/app/src/i18n/jp.json | 3 ++- frontend/app/src/i18n/ru.json | 3 ++- frontend/app/src/i18n/vi.json | 3 ++- 11 files changed, 41 insertions(+), 10 deletions(-) diff --git a/frontend/app/src/components/home/profile/UserProfile.svelte b/frontend/app/src/components/home/profile/UserProfile.svelte index f5b278be1d..b064b9e89e 100644 --- a/frontend/app/src/components/home/profile/UserProfile.svelte +++ b/frontend/app/src/components/home/profile/UserProfile.svelte @@ -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"; @@ -211,6 +212,12 @@ function closeProfile() { dispatch("closeProfile"); } + + function onCopy() { + navigator.clipboard.writeText(user.userId).then(() => { + toastStore.showSuccessToast("userIdCopiedToClipboard"); + }); + } @@ -434,7 +441,12 @@ headerText={$_("advanced")}>
-
{user.userId}
+
+
{user.userId}
+
+ +
+
@@ -473,6 +485,15 @@ .userid { margin-bottom: $sp4; + .userid-txt { + display: flex; + gap: $sp3; + align-items: center; + + .copy { + cursor: pointer; + } + } } .para { diff --git a/frontend/app/src/i18n/cn.json b/frontend/app/src/i18n/cn.json index 92e7aa8a80..df34672b55 100644 --- a/frontend/app/src/i18n/cn.json +++ b/frontend/app/src/i18n/cn.json @@ -1008,5 +1008,6 @@ "makeGroupPublicFailed": "未能公开 {level}", "displayNameRules": "选修的", "displayName": "显示名称", - "communityDisplayNameRules": "只在这个社区内" + "communityDisplayNameRules": "只在这个社区内", + "userIdCopiedToClipboard": "用户 ID 已复制到剪贴板" } \ No newline at end of file diff --git a/frontend/app/src/i18n/de.json b/frontend/app/src/i18n/de.json index 23a0f1b9a5..e61b769365 100644 --- a/frontend/app/src/i18n/de.json +++ b/frontend/app/src/i18n/de.json @@ -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" } \ No newline at end of file diff --git a/frontend/app/src/i18n/en.json b/frontend/app/src/i18n/en.json index 78213e38c3..94de69c0e8 100644 --- a/frontend/app/src/i18n/en.json +++ b/frontend/app/src/i18n/en.json @@ -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.", diff --git a/frontend/app/src/i18n/es.json b/frontend/app/src/i18n/es.json index 3cda80b88d..83011f265c 100644 --- a/frontend/app/src/i18n/es.json +++ b/frontend/app/src/i18n/es.json @@ -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" } \ No newline at end of file diff --git a/frontend/app/src/i18n/fr.json b/frontend/app/src/i18n/fr.json index 6d0bafb639..f7dcaf2f6a 100644 --- a/frontend/app/src/i18n/fr.json +++ b/frontend/app/src/i18n/fr.json @@ -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" } \ No newline at end of file diff --git a/frontend/app/src/i18n/it.json b/frontend/app/src/i18n/it.json index 02abddd4fb..7bf5296383 100644 --- a/frontend/app/src/i18n/it.json +++ b/frontend/app/src/i18n/it.json @@ -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" } \ No newline at end of file diff --git a/frontend/app/src/i18n/iw.json b/frontend/app/src/i18n/iw.json index a2ceb98720..c04bee77ce 100644 --- a/frontend/app/src/i18n/iw.json +++ b/frontend/app/src/i18n/iw.json @@ -1005,5 +1005,6 @@ "makeGroupPublicFailed": "הפיכת {level} לציבורי נכשלה", "displayNameRules": "אופציונאלי", "displayName": "הצג שם", - "communityDisplayNameRules": "רק בתוך הקהילה הזו" + "communityDisplayNameRules": "רק בתוך הקהילה הזו", + "userIdCopiedToClipboard": "זיהוי המשתמש הועתק ללוח" } \ No newline at end of file diff --git a/frontend/app/src/i18n/jp.json b/frontend/app/src/i18n/jp.json index 2f6c894f91..dffb8804b6 100644 --- a/frontend/app/src/i18n/jp.json +++ b/frontend/app/src/i18n/jp.json @@ -1008,5 +1008,6 @@ "makeGroupPublicFailed": "{level} を公開できませんでした", "displayNameRules": "オプション", "displayName": "表示名", - "communityDisplayNameRules": "このコミュニティ内だけで" + "communityDisplayNameRules": "このコミュニティ内だけで", + "userIdCopiedToClipboard": "ユーザーIDがクリップボードにコピーされました" } \ No newline at end of file diff --git a/frontend/app/src/i18n/ru.json b/frontend/app/src/i18n/ru.json index a29c53d6d6..9a25b9739a 100644 --- a/frontend/app/src/i18n/ru.json +++ b/frontend/app/src/i18n/ru.json @@ -1007,5 +1007,6 @@ "makeGroupPublicFailed": "Не удалось сделать {level} общедоступным.", "displayNameRules": "необязательный", "displayName": "Отображаемое имя", - "communityDisplayNameRules": "только в этом сообществе" + "communityDisplayNameRules": "только в этом сообществе", + "userIdCopiedToClipboard": "Идентификатор пользователя скопирован в буфер обмена." } \ No newline at end of file diff --git a/frontend/app/src/i18n/vi.json b/frontend/app/src/i18n/vi.json index 2297d25b3c..c8c3d8838e 100644 --- a/frontend/app/src/i18n/vi.json +++ b/frontend/app/src/i18n/vi.json @@ -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" } \ No newline at end of file