|
1 | | -<template> |
| 1 | +<template xmlns="http://www.w3.org/1999/html"> |
2 | 2 | <div> |
3 | 3 | <v-row> |
4 | 4 | <v-col> |
|
89 | 89 | {{ userTypeIcons[acc.raw.type] }} |
90 | 90 | </v-icon> |
91 | 91 | {{ acc.raw.username }} |
| 92 | + <!-- Copy username to clipboard --> |
| 93 | + <v-icon |
| 94 | + size="15" |
| 95 | + end |
| 96 | + :color="copiedUsernames.has(acc.raw.username) ? 'success' : 'grey'" |
| 97 | + @click.prevent="copyUsername(acc.raw.username)"> |
| 98 | + {{ copiedUsernames.has(acc.raw.username) ? 'mdi-check' : 'mdi-content-copy' }} |
| 99 | + </v-icon> |
92 | 100 | </div> |
93 | 101 | </template> |
94 | 102 | <span>{{ $t(`_user.type.${acc.raw.type}.name`).toUpperCase() }}</span> |
|
119 | 127 | {{ utils.formatDate(acc.raw.registered_on) }} |
120 | 128 | <!--{{ $i18n.d(new Date(acc.registered_on), 'short') }}--> |
121 | 129 | <br> |
122 | | - {{ acc.raw.identifier }} |
123 | | - <span v-if="$t(`_user.type.${acc.raw.type}.name`).toUpperCase() === 'STEAM'"> |
| 130 | + <span |
| 131 | + style="cursor: pointer" |
| 132 | + @click="copyIdentifier(acc.raw.identifier)"> |
| 133 | + {{ acc.raw.identifier }} |
| 134 | + </span> |
| 135 | + <span |
| 136 | + v-if="$t(`_user.type.${acc.raw.type}.name`).toUpperCase() === 'STEAM'" |
| 137 | + style="cursor: pointer" |
| 138 | + @click="copyIdentifier(getSteamid32(acc.raw.identifier))"> |
124 | 139 | <br> |
125 | 140 | {{ getSteamid32(acc.raw.identifier) }} |
126 | 141 | </span> |
|
130 | 145 | v-if="attributes != null |
131 | 146 | && attributes[acc.raw.id] != null |
132 | 147 | && Object.keys(attributes[acc.raw.id]).length > 0"> |
133 | | - <v-divider /> |
| 148 | + <v-divider/> |
134 | 149 | <v-card-text |
135 | 150 | class="pa-0" |
136 | 151 | > |
|
143 | 158 | dense |
144 | 159 | > |
145 | 160 | <tbody> |
146 | | - <tr |
147 | | - v-for="(attrVal, attrName) in attributes[acc.raw.id]" |
148 | | - :key="attrName" |
149 | | - > |
150 | | - <td> |
151 | | - {{ attributeDefinitionsDict[attrName].title }} |
152 | | - </td> |
153 | | - <td> |
154 | | - {{ attrVal }} {{ attributeDefinitionsDict[attrName].unit }} |
155 | | - </td> |
156 | | - </tr> |
| 161 | + <tr |
| 162 | + v-for="(attrVal, attrName) in attributes[acc.raw.id]" |
| 163 | + :key="attrName" |
| 164 | + > |
| 165 | + <td> |
| 166 | + {{ attributeDefinitionsDict[attrName].title }} |
| 167 | + </td> |
| 168 | + <td> |
| 169 | + {{ attrVal }} {{ attributeDefinitionsDict[attrName].unit }} |
| 170 | + </td> |
| 171 | + </tr> |
157 | 172 | </tbody> |
158 | 173 | </v-table> |
159 | 174 | </v-col> |
|
211 | 226 | sm="2" |
212 | 227 | class="d-flex text-center justify-center align-center" |
213 | 228 | > |
214 | | - <div><v-icon>mdi-link-variant</v-icon></div> |
| 229 | + <div> |
| 230 | + <v-icon>mdi-link-variant</v-icon> |
| 231 | + </div> |
215 | 232 | <v-btn |
216 | 233 | variant="outlined" |
217 | 234 | size="small" |
@@ -281,6 +298,7 @@ export default { |
281 | 298 | userTypeIcons: userService.userTypeIcons, |
282 | 299 | currentAttributes: {}, |
283 | 300 | userLinks: null, |
| 301 | + copiedUsernames: new Set(), // Track which usernames have been copied |
284 | 302 | }; |
285 | 303 | }, |
286 | 304 | computed: { |
@@ -423,6 +441,23 @@ export default { |
423 | 441 | this.$refs.linkDeleteConfirmationDialog.setError(err); |
424 | 442 | }); |
425 | 443 | }, |
| 444 | + copyUsername(username) { |
| 445 | + this.utils.textToClipboard(username); |
| 446 | + this.copiedUsernames.add(username); |
| 447 | +
|
| 448 | + // Remove the copied state after 2 seconds |
| 449 | + setTimeout(() => { |
| 450 | + this.copiedUsernames.delete(username); |
| 451 | + }, 2000); |
| 452 | + }, |
| 453 | + copyIdentifier(identifier) { |
| 454 | + this.utils.textToClipboard(identifier); |
| 455 | +
|
| 456 | + this.$notify({ |
| 457 | + type: 'success', |
| 458 | + text: this.$t('_messages.copyClipboard'), |
| 459 | + }); |
| 460 | + }, |
426 | 461 | }, |
427 | 462 | }; |
428 | 463 | </script> |
|
0 commit comments