Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<el-switch
v-model="value.enabled"
:inactive-text="findPlatform(key).name"
:disabled="editingDisabled(key)"
@change="
(newValue) => onSwitchChange(newValue, key)
"
Expand All @@ -33,14 +32,13 @@
class="flex flex-grow gap-2 mt-1 pb-3 last:!mb-6 last:pb-0"
>
<el-form-item
:prop="`identities.${ii}.name`"
:prop="`identities.${ii}.username`"
required
class="flex-grow"
>
<el-input
v-model="model.identities[ii].name"
placeholder="johndoe"
:disabled="editingDisabled(key)"
v-model="model.identities[ii].username"
:placeholder="identity.name.length ? identity.name : 'johndoe'"
@input="(newValue) =>
onInputChange(newValue, key, value, ii)
"
Expand All @@ -56,8 +54,8 @@
</div>
</template>
</el-form-item>

<el-button
:disabled="editingDisabled(key)"
class="btn btn--md btn--transparent w-10 h-10"
@click="removeUsername(ii)"
>
Expand Down Expand Up @@ -172,15 +170,10 @@ function findPlatform(platform) {
}

function onInputChange(newValue, key, value, index) {
if (index === 0) {
model.value.attributes = {
...props.modelValue.attributes,
url: {
...props.modelValue.attributes?.url,
[key]: `https://${value.urlPrefix}${newValue}`,
},
};
}
model.value.identities[index] = {
...props.modelValue.identities[index],
url: newValue.length ? `https://${value.urlPrefix}${newValue}` : null,
};
}

function platformInIdentities(platform) {
Expand All @@ -206,12 +199,6 @@ function onSwitchChange(value, key) {
}
}

function editingDisabled(platform) {
return props.record
? props.record.activeOn.includes(platform)
: false;
}

const removeUsername = (index) => {
const element = model.value.identities[index];
model.value.identities.splice(index, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
:track-event-channel="getPlatformDetails(platform)?.trackEventChannel"
:tooltip-label="getPlatformDetails(platform)?.tooltipLabel"
:show-handles-badge="true"
:as-link="true"
:as-link="getUrlsByPlatform(platform).length ? getUrlsByPlatform(platform)[0] : false"
custom-platform-icon-class="ri-community-fill"
/>
</div>
Expand Down Expand Up @@ -67,7 +67,7 @@ const platforms = computed(() => [...new Set(props.organization.identities.map((

const getHandlesByPlatform = (platform) => props.organization.identities
.filter((i) => i.platform === platform)
.map((i) => i.name);
.map((i) => (i.url ? i.url.split('/').at(-1) : i.name));
const getUrlsByPlatform = (platform) => props.organization.identities
.filter((i) => i.platform === platform)
.map((i) => getIdentityLink(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
<div class="flex gap-3 items-center">
<app-platform :platform="identity.platform" />
<span class="text-xs">
{{ identity.name ?? getPlatformDetails(identity.platform).name }}</span>
{{ (identity.url ? identity.url.split('/').at(-1) : identity.name) ?? getPlatformDetails(identity.platform).name }}</span>
</div>
<i
v-if="identity.url"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="flex gap-3 items-center">
<app-platform :platform="identity.platform" custom-platform-icon-class="ri-community-fill" />
<span class="text-gray-900 text-xs">
{{ identity.name ?? getPlatformDetails(identity.platform)?.name }}</span>
{{ (identity.url ? identity.url.split('/').at(-1) : identity.name) ?? getPlatformDetails(identity.platform)?.name }}</span>
</div>
<i
v-if="identity.url"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ function getInitialModel(record) {
identities: record ? [...record.identities.map((i) => ({
platform: i.platform,
name: i.name,
username: i.url ? i.url.split('/').at(-1) : '',
url: i.url,
}))] : [],
revenueRange: record ? record.revenueRange : {},
emails:
Expand Down Expand Up @@ -386,6 +388,11 @@ async function onSubmit() {
}
return acc;
}, []),
identities: formModel.value.identities.filter((i) => i.username.length > 0).map((i) => ({
platform: i.platform,
url: i.url,
name: i.name,
})),
phoneNumbers: formModel.value.phoneNumbers.reduce(
(acc, item) => {
if (item !== '') {
Expand Down