From f1fe904fc79b55668b114c3aa9294afd0c6ef654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C5=A1per=20Grom?= Date: Fri, 5 Jan 2024 13:34:34 +0100 Subject: [PATCH 1/9] Change layout for merge suggestions (#2011) --- .../pages/member-merge-suggestions-page.vue | 111 +++++++++--------- .../organization-merge-suggestions-page.vue | 110 ++++++++--------- 2 files changed, 110 insertions(+), 111 deletions(-) diff --git a/frontend/src/modules/member/pages/member-merge-suggestions-page.vue b/frontend/src/modules/member/pages/member-merge-suggestions-page.vue index 0f4aa8c8c1..9db1912980 100644 --- a/frontend/src/modules/member/pages/member-merge-suggestions-page.vue +++ b/frontend/src/modules/member/pages/member-merge-suggestions-page.vue @@ -14,27 +14,40 @@ Here you can check all the merging suggestions. -
+
-
- - -
-
{{ offset + 1 }} of {{ Math.ceil(count) }} suggestions
+
+
+ +
+
{{ offset + 1 }} of {{ Math.ceil(count) }} suggestions
+
+ +
+
+
+ + Ignore suggestion + + + Merge contacts +
-
-
-
+
+
-
+
-
+
- -
-
- - Ignore suggestion - -
-
- - Merge contacts - -
-
diff --git a/frontend/src/modules/organization/pages/organization-merge-suggestions-page.vue b/frontend/src/modules/organization/pages/organization-merge-suggestions-page.vue index 1a60af2444..92d0deb431 100644 --- a/frontend/src/modules/organization/pages/organization-merge-suggestions-page.vue +++ b/frontend/src/modules/organization/pages/organization-merge-suggestions-page.vue @@ -14,27 +14,40 @@ Here you can check all the merging suggestions.
-
+
-
- - -
-
{{ offset + 1 }} of {{ Math.ceil(count) }} suggestions
+
+
+ +
+
{{ offset + 1 }} of {{ Math.ceil(count) }} suggestions
+
+ +
+
+
+ + Ignore suggestion + + + Merge organizations +
-
-
-
+
+
-
+
-
+
@@ -95,28 +117,6 @@
-
-
- - Ignore suggestion - -
-
- - Merge organizations - -
-
From 5440bb2611ca68c9af459a1256fd1ecf652696d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Saint-Roch?= Date: Fri, 5 Jan 2024 13:42:32 +0100 Subject: [PATCH 2/9] Do not override organization name on enrichment (#2027) --- .../src/activities/normalizeEnrichedMember.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/services/apps/premium/members_enrichment_worker/src/activities/normalizeEnrichedMember.ts b/services/apps/premium/members_enrichment_worker/src/activities/normalizeEnrichedMember.ts index 207325957f..6fbcacb90c 100644 --- a/services/apps/premium/members_enrichment_worker/src/activities/normalizeEnrichedMember.ts +++ b/services/apps/premium/members_enrichment_worker/src/activities/normalizeEnrichedMember.ts @@ -154,7 +154,6 @@ export async function updateOrganizations(input: EnrichingMember): Promise Date: Fri, 5 Jan 2024 13:12:28 +0000 Subject: [PATCH 3/9] Refactor identities display (#2023) --- frontend/package-lock.json | 13 ++ frontend/package.json | 3 +- frontend/src/assets/scss/buttons.scss | 53 ------ .../form/member-form-identities.vue | 26 +-- .../components/list/member-list-table.vue | 9 +- .../member/components/member-display-name.vue | 2 +- .../member/components/member-identities.vue | 66 ------- .../member-merge-suggestions-details.vue | 80 +-------- .../view/_aside/_aside-enriched.vue | 12 +- .../view/_aside/_aside-identities-extra.vue | 100 +++++++++++ .../view/_aside/_aside-identities.vue | 116 +++--------- .../view/_aside/_aside-organizations.vue | 2 +- .../components/view/member-view-aside.vue | 36 ++-- .../form/organization-form-identities.vue | 43 ++--- .../list/organization-list-table.vue | 12 +- .../components/organization-identities.vue | 106 ----------- ...organization-merge-suggestions-details.vue | 77 +------- .../view/_aside/_aside-identities-extra.vue | 155 ++++++++++++++++ .../view/_aside/_aside-identities.vue | 63 +++++++ .../view/organization-view-aside.vue | 139 +-------------- .../view/organization-view-members.vue | 22 +-- .../organization/types/Organization.ts | 6 +- .../widget-active-leaderboard-members.vue | 2 +- .../shared/widget-members-table-row.vue | 79 +++++++++ .../shared/widget-members-table.vue | 72 +------- .../identities-horizontal-list-members.vue | 32 ++++ ...entities-horizontal-list-organizations.vue | 32 ++++ .../components/identities-horizontal-list.vue | 112 ++++++++++++ .../identities-vertical-list-members.vue | 39 ++++ ...identities-vertical-list-organizations.vue | 41 +++++ .../components/identities-vertical-list.vue | 116 ++++++++++++ .../config/identitiesOrder/member/index.ts | 9 + .../config/identitiesOrder/member/list.ts | 18 ++ .../config/identitiesOrder/member/profile.ts | 18 ++ .../identitiesOrder/member/suggestions.ts | 18 ++ .../identitiesOrder/organization/index.ts | 9 + .../identitiesOrder/organization/list.ts | 10 ++ .../identitiesOrder/organization/profile.ts | 10 ++ .../organization/suggestions.ts | 10 ++ .../identities/config/useMemberIdentities.ts | 136 ++++++++++++++ .../config/useOrganizationIdentities.ts | 132 ++++++++++++++ .../platform/components/platform-icon.vue | 38 ++++ .../platform/components/platform-img.vue | 33 ++++ .../platform/components/platform-svg.vue | 31 ++++ .../modules/platform/components/platform.vue | 87 +++++++++ .../shared/modules/platform/types/Platform.ts | 20 +++ .../src/shared/platform/platform-list.vue | 87 --------- .../src/shared/platform/platform-popover.vue | 82 --------- .../src/shared/platform/platform-svg-icon.vue | 87 --------- frontend/src/shared/platform/platform.vue | 167 ------------------ frontend/src/shared/shared-module.js | 2 - 51 files changed, 1496 insertions(+), 1174 deletions(-) delete mode 100644 frontend/src/modules/member/components/member-identities.vue create mode 100644 frontend/src/modules/member/components/view/_aside/_aside-identities-extra.vue delete mode 100644 frontend/src/modules/organization/components/organization-identities.vue create mode 100644 frontend/src/modules/organization/components/view/_aside/_aside-identities-extra.vue create mode 100644 frontend/src/modules/organization/components/view/_aside/_aside-identities.vue create mode 100644 frontend/src/modules/widget/components/shared/widget-members-table-row.vue create mode 100644 frontend/src/shared/modules/identities/components/identities-horizontal-list-members.vue create mode 100644 frontend/src/shared/modules/identities/components/identities-horizontal-list-organizations.vue create mode 100644 frontend/src/shared/modules/identities/components/identities-horizontal-list.vue create mode 100644 frontend/src/shared/modules/identities/components/identities-vertical-list-members.vue create mode 100644 frontend/src/shared/modules/identities/components/identities-vertical-list-organizations.vue create mode 100644 frontend/src/shared/modules/identities/components/identities-vertical-list.vue create mode 100644 frontend/src/shared/modules/identities/config/identitiesOrder/member/index.ts create mode 100644 frontend/src/shared/modules/identities/config/identitiesOrder/member/list.ts create mode 100644 frontend/src/shared/modules/identities/config/identitiesOrder/member/profile.ts create mode 100644 frontend/src/shared/modules/identities/config/identitiesOrder/member/suggestions.ts create mode 100644 frontend/src/shared/modules/identities/config/identitiesOrder/organization/index.ts create mode 100644 frontend/src/shared/modules/identities/config/identitiesOrder/organization/list.ts create mode 100644 frontend/src/shared/modules/identities/config/identitiesOrder/organization/profile.ts create mode 100644 frontend/src/shared/modules/identities/config/identitiesOrder/organization/suggestions.ts create mode 100644 frontend/src/shared/modules/identities/config/useMemberIdentities.ts create mode 100644 frontend/src/shared/modules/identities/config/useOrganizationIdentities.ts create mode 100644 frontend/src/shared/modules/platform/components/platform-icon.vue create mode 100644 frontend/src/shared/modules/platform/components/platform-img.vue create mode 100644 frontend/src/shared/modules/platform/components/platform-svg.vue create mode 100644 frontend/src/shared/modules/platform/components/platform.vue create mode 100644 frontend/src/shared/modules/platform/types/Platform.ts delete mode 100644 frontend/src/shared/platform/platform-list.vue delete mode 100644 frontend/src/shared/platform/platform-popover.vue delete mode 100644 frontend/src/shared/platform/platform-svg-icon.vue delete mode 100644 frontend/src/shared/platform/platform.vue diff --git a/frontend/package-lock.json b/frontend/package-lock.json index f9297e73ac..088700e33d 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -63,6 +63,7 @@ }, "devDependencies": { "@tailwindcss/line-clamp": "^0.4.2", + "@types/pluralize": "^0.0.33", "@typescript-eslint/eslint-plugin": "^5.4.0", "@typescript-eslint/parser": "^5.4.0", "@vue/compiler-sfc": "^3.2.29", @@ -2191,6 +2192,12 @@ "resolved": "https://registry.npmjs.org/@types/object.pick/-/object.pick-1.3.2.tgz", "integrity": "sha512-sn7L+qQ6RLPdXRoiaE7bZ/Ek+o4uICma/lBFPyJEKDTPTBP1W8u0c4baj3EiS4DiqLs+Hk+KUGvMVJtAw3ePJg==" }, + "node_modules/@types/pluralize": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/@types/pluralize/-/pluralize-0.0.33.tgz", + "integrity": "sha512-JOqsl+ZoCpP4e8TDke9W79FDcSgPAR0l6pixx2JHkhnRjvShyYiAYw2LVsnA7K08Y6DeOnaU6ujmENO4os/cYg==", + "dev": true + }, "node_modules/@types/semver": { "version": "7.5.0", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", @@ -13609,6 +13616,12 @@ "resolved": "https://registry.npmjs.org/@types/object.pick/-/object.pick-1.3.2.tgz", "integrity": "sha512-sn7L+qQ6RLPdXRoiaE7bZ/Ek+o4uICma/lBFPyJEKDTPTBP1W8u0c4baj3EiS4DiqLs+Hk+KUGvMVJtAw3ePJg==" }, + "@types/pluralize": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/@types/pluralize/-/pluralize-0.0.33.tgz", + "integrity": "sha512-JOqsl+ZoCpP4e8TDke9W79FDcSgPAR0l6pixx2JHkhnRjvShyYiAYw2LVsnA7K08Y6DeOnaU6ujmENO4os/cYg==", + "dev": true + }, "@types/semver": { "version": "7.5.0", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 37579dc950..bfc354c4eb 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -27,9 +27,9 @@ "@octokit/core": "^3.6.0", "@tiptap/extension-link": "^2.1.12", "@tiptap/extension-placeholder": "^2.1.12", + "@tiptap/pm": "^2.1.12", "@tiptap/starter-kit": "^2.1.12", "@tiptap/vue-3": "^2.1.12", - "@tiptap/pm": "^2.1.12", "@vitejs/plugin-vue": "^4.2.3", "@vue/eslint-config-airbnb": "^7.0.0", "@vuelidate/core": "^2.0.1", @@ -74,6 +74,7 @@ }, "devDependencies": { "@tailwindcss/line-clamp": "^0.4.2", + "@types/pluralize": "^0.0.33", "@typescript-eslint/eslint-plugin": "^5.4.0", "@typescript-eslint/parser": "^5.4.0", "@vue/compiler-sfc": "^3.2.29", diff --git a/frontend/src/assets/scss/buttons.scss b/frontend/src/assets/scss/buttons.scss index 48dcf7205d..2aa77d2d7f 100644 --- a/frontend/src/assets/scss/buttons.scss +++ b/frontend/src/assets/scss/buttons.scss @@ -310,59 +310,6 @@ @apply -mr-0.5; } -// Identities -.btn { - &--twitter, - &--twitter:hover { - @apply bg-white border border-gray-200; - } - - &--discord, - &--discord:hover { - background-color: rgba(88, 101, 242, 0.15); - } - - &--crunchbase, - &--crunchbase:hover { - background: rgba(20, 106, 255, 0.15); - } - - &--hackernews, - &--hackernews:hover { - background-color: rgba(255, 102, 0, 0.15); - color: #ff6600; - } - - &--email, - &--email:hover, - &--phone, - &--phone:hover, - &--custom-platform, - &--custom-platform:hover, - &--facebook, - &--facebook:hover { - @apply leading-none cursor-pointer bg-white text-gray-600 border border-gray-200; - } - - &--github, - &--github:hover, - &--devto, - &--devto:hover { - @apply bg-gray-100 border border-gray-200; - } - - &--slack, - &--slack:hover, - &--linkedin, - &--linkedin:hover, - &--stackoverflow, - &--stackoverflow:hover, - &--git, - &--git:hover { - @apply bg-white border border-gray-200; - } -} - .el-button { --el-button-outline-color: transparent !important; } diff --git a/frontend/src/modules/member/components/form/member-form-identities.vue b/frontend/src/modules/member/components/form/member-form-identities.vue index c3a80ac1da..b1b858949a 100644 --- a/frontend/src/modules/member/components/form/member-form-identities.vue +++ b/frontend/src/modules/member/components/form/member-form-identities.vue @@ -22,7 +22,7 @@ >
-
+
- +
Email address
@@ -114,6 +117,7 @@ import { } from 'vue'; import { CrowdIntegrations } from '@/integrations/integrations-config'; import cloneDeep from 'lodash/cloneDeep'; +import AppPlatformIcon from '@/shared/modules/platform/components/platform-icon.vue'; const emit = defineEmits(['update:modelValue']); const props = defineProps({ @@ -176,72 +180,54 @@ const identitiesForm = reactive({ props.modelValue.username?.devto !== undefined || false, urlPrefix: 'dev.to/', - imgContainerClass: - 'h-8 w-8 rounded flex items-center justify-center text-base bg-gray-100 border border-gray-200', }, discord: { enabled: props.modelValue.username?.discord !== undefined || false, urlPrefix: 'discord.com/', - imgContainerClass: - 'h-8 w-8 rounded flex items-center justify-center text-base btn--discord cursor-auto hover:cursor-auto', }, github: { enabled: props.modelValue.username?.github !== undefined || false, urlPrefix: 'github.com/', - imgContainerClass: - 'h-8 w-8 rounded flex items-center justify-center text-base bg-gray-100 border border-gray-200', }, slack: { enabled: props.modelValue.username?.slack !== undefined || false, urlPrefix: 'slack.com/', - imgContainerClass: - 'h-8 w-8 rounded flex items-center justify-center text-base btn--slack cursor-auto hover:cursor-auto bg-white border border-gray-200', }, twitter: { enabled: props.modelValue.username?.twitter !== undefined || false, urlPrefix: 'twitter.com/', - imgContainerClass: - 'h-8 w-8 rounded flex items-center justify-center text-base btn--twitter', }, linkedin: { enabled: props.modelValue.username?.linkedin !== undefined || false, urlPrefix: 'linkedin.com/in/', - imgContainerClass: - 'h-8 w-8 rounded flex items-center justify-center text-base btn--linkedin', }, reddit: { enabled: props.modelValue.username?.reddit !== undefined || false, urlPrefix: 'reddit.com/user/', - imgContainerClass: - 'h-8 w-8 rounded flex items-center justify-center text-base btn--reddit', }, hackernews: { enabled: props.modelValue.username?.hackernews !== undefined || false, urlPrefix: 'news.ycombinator.com/user?id=', - imgContainerClass: - 'h-8 w-8 rounded flex items-center justify-center text-base btn--hackernews', }, stackoverflow: { enabled: props.modelValue.username?.stackoverflow !== undefined || false, urlPrefix: 'stackoverflow.com/users/', - imgContainerClass: - 'h-8 w-8 rounded flex items-center justify-center text-base btn--stackoverflow', }, }); diff --git a/frontend/src/modules/member/components/list/member-list-table.vue b/frontend/src/modules/member/components/list/member-list-table.vue index b4b9344c4d..89408f3e4a 100644 --- a/frontend/src/modules/member/components/list/member-list-table.vue +++ b/frontend/src/modules/member/components/list/member-list-table.vue @@ -161,7 +161,7 @@ - + @@ -755,9 +758,9 @@ import AppSvg from '@/shared/svg/svg.vue'; import CrEnrichmentSneakPeakContent from '@/shared/modules/enrichment/components/enrichment-sneak-peak-content.vue'; import { mapGetters } from '@/shared/vuex/vuex.helpers'; import Plans from '@/security/plans'; +import AppIdentitiesHorizontalListMembers from '@/shared/modules/identities/components/identities-horizontal-list-members.vue'; import AppMemberBadge from '../member-badge.vue'; import AppMemberDropdownContent from '../member-dropdown-content.vue'; -import AppMemberIdentities from '../member-identities.vue'; import AppMemberReach from '../member-reach.vue'; import AppMemberEngagementLevel from '../member-engagement-level.vue'; import AppMemberLastActivity from '../member-last-activity.vue'; diff --git a/frontend/src/modules/member/components/member-display-name.vue b/frontend/src/modules/member/components/member-display-name.vue index c13caa6df8..0c385bf645 100644 --- a/frontend/src/modules/member/components/member-display-name.vue +++ b/frontend/src/modules/member/components/member-display-name.vue @@ -1,5 +1,5 @@ - - - - diff --git a/frontend/src/modules/member/components/suggestions/member-merge-suggestions-details.vue b/frontend/src/modules/member/components/suggestions/member-merge-suggestions-details.vue index 4c3171ae9c..12190832ae 100644 --- a/frontend/src/modules/member/components/suggestions/member-merge-suggestions-details.vue +++ b/frontend/src/modules/member/components/suggestions/member-merge-suggestions-details.vue @@ -149,69 +149,11 @@
@@ -227,9 +169,10 @@ import AppAvatar from '@/shared/avatar/avatar.vue'; import AppCommunityEngagementLevel from '@/modules/member/components/member-engagement-level.vue'; import AppTags from '@/modules/tag/components/tag-list.vue'; import AppLoading from '@/shared/loading/loading-placeholder.vue'; -import { CrowdIntegrations } from '@/integrations/integrations-config'; import { MemberPermissions } from '@/modules/member/member-permissions'; import { mapGetters } from '@/shared/vuex/vuex.helpers'; +import memberOrder from '@/shared/modules/identities/config/identitiesOrder/member'; +import AppIdentitiesVerticalListMembers from '@/shared/modules/identities/components/identities-vertical-list-members.vue'; const props = defineProps({ member: { @@ -271,15 +214,6 @@ const bio = ref(null); const displayShowMore = ref(null); const more = ref(null); -const platformDetails = (platform) => CrowdIntegrations.getConfig(platform); -const identityUrl = (platform, username, attributes) => { - if (platform === 'discord' || platform === 'slack') { - return null; - } - - return CrowdIntegrations.getConfig(platform)?.url({ username, attributes }); -}; - onMounted(() => { setTimeout(() => { if (!bio.value) { diff --git a/frontend/src/modules/member/components/view/_aside/_aside-enriched.vue b/frontend/src/modules/member/components/view/_aside/_aside-enriched.vue index 5c902406a8..dc85c40888 100644 --- a/frontend/src/modules/member/components/view/_aside/_aside-enriched.vue +++ b/frontend/src/modules/member/components/view/_aside/_aside-enriched.vue @@ -1,7 +1,9 @@ + + -
+
@@ -73,9 +77,11 @@ + +
+ + +
+
+
+ Email(s) +
+ + Edit + +
+ +
+ + +
+ Show {{ displayMore ? 'less' : 'more' }} +
+
+
+ + + diff --git a/frontend/src/modules/member/components/view/_aside/_aside-identities.vue b/frontend/src/modules/member/components/view/_aside/_aside-identities.vue index 82beec5ea4..c3f5f6bae5 100644 --- a/frontend/src/modules/member/components/view/_aside/_aside-identities.vue +++ b/frontend/src/modules/member/components/view/_aside/_aside-identities.vue @@ -1,5 +1,5 @@ +
-
+ + - - - diff --git a/frontend/src/modules/organization/components/suggestions/organization-merge-suggestions-details.vue b/frontend/src/modules/organization/components/suggestions/organization-merge-suggestions-details.vue index a59103262f..b23664e208 100644 --- a/frontend/src/modules/organization/components/suggestions/organization-merge-suggestions-details.vue +++ b/frontend/src/modules/organization/components/suggestions/organization-merge-suggestions-details.vue @@ -229,64 +229,12 @@
@@ -303,8 +251,8 @@ import { mapGetters } from '@/shared/vuex/vuex.helpers'; import { withHttp } from '@/utils/string'; import { formatDateToTimeAgo } from '@/utils/date'; import revenueRange from '@/modules/organization/config/enrichment/revenueRange'; -import AppPlatform from '@/shared/platform/platform.vue'; -import { CrowdIntegrations } from '@/integrations/integrations-config'; +import AppIdentitiesVerticalListOrganizations from '@/shared/modules/identities/components/identities-vertical-list-organizations.vue'; +import organizationOrder from '@/shared/modules/identities/config/identitiesOrder/organization'; const props = defineProps({ organization: { @@ -346,15 +294,6 @@ const bio = ref(null); const displayShowMore = ref(null); const more = ref(null); -const getPlatformDetails = (platform) => CrowdIntegrations.getConfig(platform); - -const getIdentityLink = (identity) => { - if (identity.url) { - return withHttp(identity.url); - } - return null; -}; - onMounted(() => { setTimeout(() => { if (!bio.value) { diff --git a/frontend/src/modules/organization/components/view/_aside/_aside-identities-extra.vue b/frontend/src/modules/organization/components/view/_aside/_aside-identities-extra.vue new file mode 100644 index 0000000000..9bcd2350e5 --- /dev/null +++ b/frontend/src/modules/organization/components/view/_aside/_aside-identities-extra.vue @@ -0,0 +1,155 @@ + + + diff --git a/frontend/src/modules/organization/components/view/_aside/_aside-identities.vue b/frontend/src/modules/organization/components/view/_aside/_aside-identities.vue new file mode 100644 index 0000000000..1554c9adef --- /dev/null +++ b/frontend/src/modules/organization/components/view/_aside/_aside-identities.vue @@ -0,0 +1,63 @@ + + + diff --git a/frontend/src/modules/organization/components/view/organization-view-aside.vue b/frontend/src/modules/organization/components/view/organization-view-aside.vue index de1135400c..7704853e4b 100644 --- a/frontend/src/modules/organization/components/view/organization-view-aside.vue +++ b/frontend/src/modules/organization/components/view/organization-view-aside.vue @@ -1,104 +1,14 @@ + + diff --git a/frontend/src/shared/modules/identities/components/identities-horizontal-list-organizations.vue b/frontend/src/shared/modules/identities/components/identities-horizontal-list-organizations.vue new file mode 100644 index 0000000000..61684cd604 --- /dev/null +++ b/frontend/src/shared/modules/identities/components/identities-horizontal-list-organizations.vue @@ -0,0 +1,32 @@ + + + + + diff --git a/frontend/src/shared/modules/identities/components/identities-horizontal-list.vue b/frontend/src/shared/modules/identities/components/identities-horizontal-list.vue new file mode 100644 index 0000000000..b94d1c6d3b --- /dev/null +++ b/frontend/src/shared/modules/identities/components/identities-horizontal-list.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/frontend/src/shared/modules/identities/components/identities-vertical-list-members.vue b/frontend/src/shared/modules/identities/components/identities-vertical-list-members.vue new file mode 100644 index 0000000000..f9d401eea4 --- /dev/null +++ b/frontend/src/shared/modules/identities/components/identities-vertical-list-members.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/frontend/src/shared/modules/identities/components/identities-vertical-list-organizations.vue b/frontend/src/shared/modules/identities/components/identities-vertical-list-organizations.vue new file mode 100644 index 0000000000..c8df99e6a4 --- /dev/null +++ b/frontend/src/shared/modules/identities/components/identities-vertical-list-organizations.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/frontend/src/shared/modules/identities/components/identities-vertical-list.vue b/frontend/src/shared/modules/identities/components/identities-vertical-list.vue new file mode 100644 index 0000000000..714a756723 --- /dev/null +++ b/frontend/src/shared/modules/identities/components/identities-vertical-list.vue @@ -0,0 +1,116 @@ + + + + + diff --git a/frontend/src/shared/modules/identities/config/identitiesOrder/member/index.ts b/frontend/src/shared/modules/identities/config/identitiesOrder/member/index.ts new file mode 100644 index 0000000000..f02d97fd77 --- /dev/null +++ b/frontend/src/shared/modules/identities/config/identitiesOrder/member/index.ts @@ -0,0 +1,9 @@ +import list from './list'; +import profile from './profile'; +import suggestions from './suggestions'; + +export default { + list, + profile, + suggestions, +}; diff --git a/frontend/src/shared/modules/identities/config/identitiesOrder/member/list.ts b/frontend/src/shared/modules/identities/config/identitiesOrder/member/list.ts new file mode 100644 index 0000000000..83795b6d91 --- /dev/null +++ b/frontend/src/shared/modules/identities/config/identitiesOrder/member/list.ts @@ -0,0 +1,18 @@ +import { Platform } from '@/shared/modules/platform/types/Platform'; + +export default [ + Platform.GITHUB, + Platform.DISCORD, + Platform.HACKER_NEWS, + Platform.LINKEDIN, + Platform.TWITTER, + Platform.SLACK, + Platform.DEVTO, + Platform.REDDIT, + Platform.STACK_OVERFLOW, + Platform.DISCOURSE, + Platform.HUBSPOT, + Platform.GIT, + Platform.GROUPS_IO, + Platform.CUSTOM, +]; diff --git a/frontend/src/shared/modules/identities/config/identitiesOrder/member/profile.ts b/frontend/src/shared/modules/identities/config/identitiesOrder/member/profile.ts new file mode 100644 index 0000000000..83795b6d91 --- /dev/null +++ b/frontend/src/shared/modules/identities/config/identitiesOrder/member/profile.ts @@ -0,0 +1,18 @@ +import { Platform } from '@/shared/modules/platform/types/Platform'; + +export default [ + Platform.GITHUB, + Platform.DISCORD, + Platform.HACKER_NEWS, + Platform.LINKEDIN, + Platform.TWITTER, + Platform.SLACK, + Platform.DEVTO, + Platform.REDDIT, + Platform.STACK_OVERFLOW, + Platform.DISCOURSE, + Platform.HUBSPOT, + Platform.GIT, + Platform.GROUPS_IO, + Platform.CUSTOM, +]; diff --git a/frontend/src/shared/modules/identities/config/identitiesOrder/member/suggestions.ts b/frontend/src/shared/modules/identities/config/identitiesOrder/member/suggestions.ts new file mode 100644 index 0000000000..83795b6d91 --- /dev/null +++ b/frontend/src/shared/modules/identities/config/identitiesOrder/member/suggestions.ts @@ -0,0 +1,18 @@ +import { Platform } from '@/shared/modules/platform/types/Platform'; + +export default [ + Platform.GITHUB, + Platform.DISCORD, + Platform.HACKER_NEWS, + Platform.LINKEDIN, + Platform.TWITTER, + Platform.SLACK, + Platform.DEVTO, + Platform.REDDIT, + Platform.STACK_OVERFLOW, + Platform.DISCOURSE, + Platform.HUBSPOT, + Platform.GIT, + Platform.GROUPS_IO, + Platform.CUSTOM, +]; diff --git a/frontend/src/shared/modules/identities/config/identitiesOrder/organization/index.ts b/frontend/src/shared/modules/identities/config/identitiesOrder/organization/index.ts new file mode 100644 index 0000000000..f02d97fd77 --- /dev/null +++ b/frontend/src/shared/modules/identities/config/identitiesOrder/organization/index.ts @@ -0,0 +1,9 @@ +import list from './list'; +import profile from './profile'; +import suggestions from './suggestions'; + +export default { + list, + profile, + suggestions, +}; diff --git a/frontend/src/shared/modules/identities/config/identitiesOrder/organization/list.ts b/frontend/src/shared/modules/identities/config/identitiesOrder/organization/list.ts new file mode 100644 index 0000000000..1aceb5547e --- /dev/null +++ b/frontend/src/shared/modules/identities/config/identitiesOrder/organization/list.ts @@ -0,0 +1,10 @@ +import { Platform } from '@/shared/modules/platform/types/Platform'; + +export default [ + Platform.GITHUB, + Platform.LINKEDIN, + Platform.TWITTER, + Platform.CRUNCHBASE, + Platform.HUBSPOT, + Platform.CUSTOM, +]; diff --git a/frontend/src/shared/modules/identities/config/identitiesOrder/organization/profile.ts b/frontend/src/shared/modules/identities/config/identitiesOrder/organization/profile.ts new file mode 100644 index 0000000000..1aceb5547e --- /dev/null +++ b/frontend/src/shared/modules/identities/config/identitiesOrder/organization/profile.ts @@ -0,0 +1,10 @@ +import { Platform } from '@/shared/modules/platform/types/Platform'; + +export default [ + Platform.GITHUB, + Platform.LINKEDIN, + Platform.TWITTER, + Platform.CRUNCHBASE, + Platform.HUBSPOT, + Platform.CUSTOM, +]; diff --git a/frontend/src/shared/modules/identities/config/identitiesOrder/organization/suggestions.ts b/frontend/src/shared/modules/identities/config/identitiesOrder/organization/suggestions.ts new file mode 100644 index 0000000000..1aceb5547e --- /dev/null +++ b/frontend/src/shared/modules/identities/config/identitiesOrder/organization/suggestions.ts @@ -0,0 +1,10 @@ +import { Platform } from '@/shared/modules/platform/types/Platform'; + +export default [ + Platform.GITHUB, + Platform.LINKEDIN, + Platform.TWITTER, + Platform.CRUNCHBASE, + Platform.HUBSPOT, + Platform.CUSTOM, +]; diff --git a/frontend/src/shared/modules/identities/config/useMemberIdentities.ts b/frontend/src/shared/modules/identities/config/useMemberIdentities.ts new file mode 100644 index 0000000000..decadaee87 --- /dev/null +++ b/frontend/src/shared/modules/identities/config/useMemberIdentities.ts @@ -0,0 +1,136 @@ +import { CrowdIntegrations } from '@/integrations/integrations-config'; +import { Member } from '@/modules/member/types/Member'; +import { Platform } from '@/shared/modules/platform/types/Platform'; + +export default ({ + member, + order, +}: { + member: Partial; + order: Platform[]; +}) => { + const { username = {}, attributes = {}, emails = [] } = member || {}; + + const getIdentityHandles = (platform: string) => { + if (platform === Platform.CUSTOM) { + const customPlatforms = Object.keys(username).filter( + (p) => (!order.includes(p) || p === Platform.CUSTOM) + && p !== Platform.EMAIL + && p !== Platform.EMAILS, + ); + + return customPlatforms.flatMap((p) => username[p].map((u) => ({ + platform: p, + url: null, + name: u, + }))); + } + + return username[platform] + ? username[platform].map((u) => ({ + platform, + url: null, + name: u, + })) + : []; + }; + + const getIdentityLink = (identity: { + platform: string; + url: string; + name: string; + }, platform: string) => { + if (!CrowdIntegrations.getConfig(platform)?.showProfileLink) { + return null; + } + + return ( + identity.url + ?? CrowdIntegrations.getConfig(platform)?.url({ + username: identity.name, + attributes, + }) + ?? attributes?.url?.[platform] + ); + }; + + const getIdentities = (): { + [key: string]: { + handle: string; + link: string; + }[]; + } => order.reduce((acc, platform) => { + const handles = getIdentityHandles(platform); + + if (platform === Platform.CUSTOM && handles.length) { + const sortedCustomIdentities = handles.sort((a, b) => { + const platformComparison = a.platform.localeCompare(b.platform); + + if (platformComparison === 0) { + // If platforms are equal, sort by name + return a.name.localeCompare(b.name); + } + + return platformComparison; // Otherwise, sort by platform + }); + + sortedCustomIdentities.forEach((identity) => { + if (acc[identity.platform]?.length) { + acc[identity.platform].push({ + handle: identity.name, + link: getIdentityLink(identity, platform), + }); + } else { + acc[identity.platform] = [ + { + handle: identity.name, + link: getIdentityLink(identity, platform), + }, + ]; + } + }); + } else { + const platformHandlesValues = handles.map((identity) => ({ + handle: identity.name, + link: getIdentityLink(identity, platform), + })); + + if (platformHandlesValues.length) { + acc[platform] = platformHandlesValues; + } + } + + return acc; + }, {}); + + const getEmails = (): { + handle: string; + link: string; + }[] => { + const rootEmails = (emails || []).map((e) => ({ + link: `mailto:${e}`, + handle: e, + })); + + const usernameEmail = username.email + ? username.email.map((u) => ({ + link: null, + handle: u, + })) + : []; + + const usernameEmails = username.emails + ? username.emails.map((u) => ({ + link: `mailto:${e}`, + handle: u, + })) + : []; + + return [...rootEmails, ...usernameEmail, ...usernameEmails]; + }; + + return { + getIdentities, + getEmails, + }; +}; diff --git a/frontend/src/shared/modules/identities/config/useOrganizationIdentities.ts b/frontend/src/shared/modules/identities/config/useOrganizationIdentities.ts new file mode 100644 index 0000000000..1f25cff373 --- /dev/null +++ b/frontend/src/shared/modules/identities/config/useOrganizationIdentities.ts @@ -0,0 +1,132 @@ +import { CrowdIntegrations } from '@/integrations/integrations-config'; +import { withHttp } from '@/utils/string'; +import { Organization } from '@/modules/organization/types/Organization'; +import { Platform } from '@/shared/modules/platform/types/Platform'; + +export default ({ + organization, + order, +}: { + organization: Partial; + order: Platform[]; +}) => { + const { + identities = [], + emails = [], + phoneNumbers = [], + } = organization || {}; + + const getIdentityHandles = (platform: string) => { + const parsedIdentities = identities?.length ? identities : []; + + if (platform === Platform.CUSTOM) { + const customPlatforms = parsedIdentities.filter( + (i) => (!order.includes(i.platform) || i.platform === Platform.CUSTOM) + && i.platform !== Platform.EMAIL + && i.platform !== Platform.EMAILS, + ); + + return customPlatforms; + } + + return parsedIdentities.filter((i) => i.platform === platform) || []; + }; + + const getIdentities = (): { + [key: string]: { + handle: string; + link: string; + }[]; + } => order.reduce((acc, p) => { + const handles = getIdentityHandles(p); + + if ( + (p === Platform.CUSTOM || p === Platform.PHONE_NUMBERS) + && handles.length + ) { + const sortedCustomIdentities = handles.sort((a, b) => { + const platformComparison = a.platform.localeCompare(b.platform); + + if (platformComparison === 0) { + // If platforms are equal, sort by name + return a.name.localeCompare(b.name); + } + + return platformComparison; // Otherwise, sort by platform + }); + + sortedCustomIdentities.forEach((i) => { + if (acc[i.platform]?.length) { + acc[i.platform].push({ + handle: i.name, + link: i.url ? withHttp(i.url) : null, + }); + } else { + acc[i.platform] = [ + { + handle: i.name, + link: i.url ? withHttp(i.url) : null, + }, + ]; + } + }); + } else { + const handlesValues = handles.map((i) => ({ + handle: + CrowdIntegrations.getConfig(i.platform)?.organization?.handle(i) + ?? i.name + ?? CrowdIntegrations.getConfig(i.platform)?.name + ?? i.platform, + link: i.url ? withHttp(i.url) : null, + })); + + if (handlesValues.length) { + acc[p] = handlesValues; + } + } + + return acc; + }, {}); + + const getEmails = (): { + handle: string; + link: string; + }[] => { + const parsedIdentities = identities?.length ? identities : []; + + const rootEmails = (emails || []).map((e) => ({ + link: `mailto:${e}`, + handle: e, + })); + + const identitiesEmails = parsedIdentities + .filter((i) => i.platform === 'emails') + .map((i) => ({ + link: i.url ? `mailto:${i.url}` : null, + handle: i.name, + })); + + const identitiesEmail = parsedIdentities + .filter((i) => i.platform === 'email') + .map((i) => ({ + link: i.url ? `mailto:${i.url}` : null, + handle: i.name, + })); + + return [...rootEmails, ...identitiesEmails, ...identitiesEmail]; + }; + + const getPhoneNumbers = (): { + handle: string; + link: string; + }[] => (phoneNumbers || []).map((p) => ({ + link: `tel:${p}`, + handle: p, + })); + + return { + getIdentities, + getEmails, + getPhoneNumbers, + }; +}; diff --git a/frontend/src/shared/modules/platform/components/platform-icon.vue b/frontend/src/shared/modules/platform/components/platform-icon.vue new file mode 100644 index 0000000000..d46d93ff03 --- /dev/null +++ b/frontend/src/shared/modules/platform/components/platform-icon.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/frontend/src/shared/modules/platform/components/platform-img.vue b/frontend/src/shared/modules/platform/components/platform-img.vue new file mode 100644 index 0000000000..3da8906d77 --- /dev/null +++ b/frontend/src/shared/modules/platform/components/platform-img.vue @@ -0,0 +1,33 @@ + + + + + diff --git a/frontend/src/shared/modules/platform/components/platform-svg.vue b/frontend/src/shared/modules/platform/components/platform-svg.vue new file mode 100644 index 0000000000..cd57246bad --- /dev/null +++ b/frontend/src/shared/modules/platform/components/platform-svg.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/frontend/src/shared/modules/platform/components/platform.vue b/frontend/src/shared/modules/platform/components/platform.vue new file mode 100644 index 0000000000..a656b69a9b --- /dev/null +++ b/frontend/src/shared/modules/platform/components/platform.vue @@ -0,0 +1,87 @@ + + + + + + + diff --git a/frontend/src/shared/modules/platform/types/Platform.ts b/frontend/src/shared/modules/platform/types/Platform.ts new file mode 100644 index 0000000000..e4469d4012 --- /dev/null +++ b/frontend/src/shared/modules/platform/types/Platform.ts @@ -0,0 +1,20 @@ +export enum Platform { + GITHUB = 'github', + DISCORD = 'discord', + HACKER_NEWS = 'hackernews', + LINKEDIN = 'linkedin', + TWITTER = 'twitter', + SLACK = 'slack', + DEVTO = 'devto', + REDDIT = 'reddit', + STACK_OVERFLOW = 'stackOverflow', + DISCOURSE = 'discourse', + HUBSPOT = 'hubspot', + GIT = 'git', + GROUPS_IO = 'groupsio', + CUSTOM = 'custom', + EMAIL = 'email', + EMAILS = 'emails', + PHONE_NUMBERS = 'phoneNumbers', + CRUNCHBASE = 'crunchbase', +} diff --git a/frontend/src/shared/platform/platform-list.vue b/frontend/src/shared/platform/platform-list.vue deleted file mode 100644 index 7a60e0204b..0000000000 --- a/frontend/src/shared/platform/platform-list.vue +++ /dev/null @@ -1,87 +0,0 @@ - - - - - diff --git a/frontend/src/shared/platform/platform-popover.vue b/frontend/src/shared/platform/platform-popover.vue deleted file mode 100644 index 3948a90bc3..0000000000 --- a/frontend/src/shared/platform/platform-popover.vue +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - diff --git a/frontend/src/shared/platform/platform-svg-icon.vue b/frontend/src/shared/platform/platform-svg-icon.vue deleted file mode 100644 index d61d0e911d..0000000000 --- a/frontend/src/shared/platform/platform-svg-icon.vue +++ /dev/null @@ -1,87 +0,0 @@ - - - - - diff --git a/frontend/src/shared/platform/platform.vue b/frontend/src/shared/platform/platform.vue deleted file mode 100644 index 50d96391a4..0000000000 --- a/frontend/src/shared/platform/platform.vue +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - diff --git a/frontend/src/shared/shared-module.js b/frontend/src/shared/shared-module.js index efba4575dd..6e3ca84ff1 100644 --- a/frontend/src/shared/shared-module.js +++ b/frontend/src/shared/shared-module.js @@ -14,7 +14,6 @@ import InlineSelectInput from '@/shared/form/inline-select-input.vue'; import Dialog from '@/shared/dialog/dialog.vue'; import EmptyStateCta from '@/shared/empty-state/empty-state-cta.vue'; import EmptyState from '@/shared/empty-state/empty-state.vue'; -import Platform from '@/shared/platform/platform.vue'; import Drawer from '@/shared/drawer/drawer.vue'; import AppLoader from '@/shared/loading/loader.vue'; import AppPageWrapper from '@/shared/layout/page-wrapper.vue'; @@ -41,7 +40,6 @@ export default { 'app-dialog': Dialog, 'app-empty-state-cta': EmptyStateCta, 'app-empty-state': EmptyState, - 'app-platform': Platform, 'app-drawer': Drawer, 'app-loader': AppLoader, 'app-page-wrapper': AppPageWrapper, From d28b124a1807a95a8169ae590c15de3bc8a0f8d9 Mon Sep 17 00:00:00 2001 From: joanagmaia Date: Fri, 5 Jan 2024 13:36:02 +0000 Subject: [PATCH 4/9] Fix empty emails and phone numbers (#2028) --- .../components/list/member-list-table.vue | 10 +++---- .../components/identities-vertical-list.vue | 2 +- .../identities/config/useMemberIdentities.ts | 30 +++++++++++-------- .../config/useOrganizationIdentities.ts | 10 ++++--- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/frontend/src/modules/member/components/list/member-list-table.vue b/frontend/src/modules/member/components/list/member-list-table.vue index 89408f3e4a..360639235e 100644 --- a/frontend/src/modules/member/components/list/member-list-table.vue +++ b/frontend/src/modules/member/components/list/member-list-table.vue @@ -199,11 +199,11 @@ class="block" >
+{{ scope.row.emails.length - 3 }} + >+{{ scope.row.emails.filter((e) => !!e).length - 3 }}
-
+
-
+