Skip to content

Commit b55643b

Browse files
committed
Improve linked user copy to clipboard of details
1 parent 09d0843 commit b55643b

1 file changed

Lines changed: 51 additions & 16 deletions

File tree

src/components/DashboardComponents/LinkedAccounts.vue

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<template>
1+
<template xmlns="http://www.w3.org/1999/html">
22
<div>
33
<v-row>
44
<v-col>
@@ -89,6 +89,14 @@
8989
{{ userTypeIcons[acc.raw.type] }}
9090
</v-icon>
9191
{{ 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>
92100
</div>
93101
</template>
94102
<span>{{ $t(`_user.type.${acc.raw.type}.name`).toUpperCase() }}</span>
@@ -119,8 +127,15 @@
119127
{{ utils.formatDate(acc.raw.registered_on) }}
120128
<!--{{ $i18n.d(new Date(acc.registered_on), 'short') }}-->
121129
<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))">
124139
<br>
125140
{{ getSteamid32(acc.raw.identifier) }}
126141
</span>
@@ -130,7 +145,7 @@
130145
v-if="attributes != null
131146
&& attributes[acc.raw.id] != null
132147
&& Object.keys(attributes[acc.raw.id]).length > 0">
133-
<v-divider />
148+
<v-divider/>
134149
<v-card-text
135150
class="pa-0"
136151
>
@@ -143,17 +158,17 @@
143158
dense
144159
>
145160
<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>
157172
</tbody>
158173
</v-table>
159174
</v-col>
@@ -211,7 +226,9 @@
211226
sm="2"
212227
class="d-flex text-center justify-center align-center"
213228
>
214-
<div><v-icon>mdi-link-variant</v-icon></div>
229+
<div>
230+
<v-icon>mdi-link-variant</v-icon>
231+
</div>
215232
<v-btn
216233
variant="outlined"
217234
size="small"
@@ -281,6 +298,7 @@ export default {
281298
userTypeIcons: userService.userTypeIcons,
282299
currentAttributes: {},
283300
userLinks: null,
301+
copiedUsernames: new Set(), // Track which usernames have been copied
284302
};
285303
},
286304
computed: {
@@ -423,6 +441,23 @@ export default {
423441
this.$refs.linkDeleteConfirmationDialog.setError(err);
424442
});
425443
},
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+
},
426461
},
427462
};
428463
</script>

0 commit comments

Comments
 (0)