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

Feat: Add distinct/user ID #2539

Merged
merged 5 commits into from
Jul 30, 2024
Merged
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
35 changes: 34 additions & 1 deletion packages/frontend-2/components/settings/user/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,32 @@
<SettingsUserProfileChangePassword :user="user" />
<hr class="my-6 md:my-10" />
<SettingsUserProfileDeleteAccount :user="user" />
<hr class="my-6 md:my-10" />
<div class="text-xs text-foreground-2 w-full flex flex-col space-y-2">
<div class="flex">
User ID: #{{ user.id }}
<ClipboardIcon
class="w-4 h-4 ml-2 cursor-pointer hover:text-foreground transition"
@click="copyUserId"
/>
</div>
<div v-if="distinctId" class="flex">
{{ distinctId }}
<ClipboardIcon
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We dont really have the right button for this but I'll adjust the styling of this anyway once we have the design system updates

class="w-4 h-4 ml-2 cursor-pointer hover:text-foreground transition"
@click="copyDistinctId"
/>
</div>
</div>
</div>
</section>
</template>

<script setup lang="ts">
import { graphql } from '~~/lib/common/generated/gql'
import type { SettingsUserProfile_UserFragment } from '~~/lib/common/generated/gql/graphql'
import { useActiveUser } from '~/lib/auth/composables/activeUser'
import { ClipboardIcon } from '@heroicons/vue/24/outline'

graphql(`
fragment SettingsUserProfile_User on User {
Expand All @@ -23,7 +42,21 @@ graphql(`
}
`)

defineProps<{
const { distinctId } = useActiveUser()

const props = defineProps<{
user: SettingsUserProfile_UserFragment
}>()

const { copy } = useClipboard()

const copyUserId = () => {
copy(props.user.id)
}

const copyDistinctId = () => {
if (distinctId.value) {
copy(distinctId.value)
}
}
</script>