-
Notifications
You must be signed in to change notification settings - Fork 55
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
create organizer profile on add event. #358
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,9 @@ | |
> | ||
<TProfilePhoto2 size="md" :src="item.photo" /> | ||
<div class="flex-grow"> | ||
<div v-if="item.name" class="font-bold text-sm">{{ item.name }}</div> | ||
<div v-if="item.name" class="font-bold text-sm"> | ||
{{ item.name }} | ||
</div> | ||
<div class="text-xs text-gray-700 flex space-x-2"> | ||
<div>@{{ item.username }}</div> | ||
<div v-if="item.instagram" class="space-x-1 flex"> | ||
|
@@ -68,53 +70,74 @@ | |
</div> | ||
<template v-if="inviteUsername"> | ||
<div | ||
class="flex px-4 py-2 hover:bg-blue-100 items-center cursor-pointer space-x-1 text-sm text-gray-700" | ||
@click=" | ||
create({ | ||
username: inviteUsername, | ||
instagram: `https://instagram.com/` + inviteUsername, | ||
}) | ||
" | ||
class="flex justify-center px-4 py-2 hover:bg-blue-100 items-center cursor-pointer space-x-1 text-sm text-gray-700" | ||
> | ||
<div> | ||
{{ $t('TInputProfile.import') }} | ||
</div> | ||
<TIcon name="instagram" size="4" /> | ||
<div> | ||
{{ inviteUsername }} | ||
</div> | ||
<h3 @click="showPopup = !showPopup" class="text-center"> | ||
+ Add New Organizer | ||
</h3> | ||
</div> | ||
<div | ||
class="flex px-4 py-2 hover:bg-blue-100 items-center cursor-pointer space-x-1 text-sm text-gray-700" | ||
@click=" | ||
create({ | ||
username: inviteUsername, | ||
facebook: `https://facebook.com/` + inviteUsername, | ||
}) | ||
" | ||
> | ||
<div> | ||
{{ $t('TInputProfile.import') }} | ||
<TPopup v-if="showPopup"> | ||
<div class="flex justify-between border-b pb-2 mb-4"> | ||
<div class="grow font-bold text-center">Add New Organizer</div> | ||
<button class="cursor-pointer" @click="showPopup = false"> | ||
<TIcon name="close" class="cursor-pointer w-4 h-4" /> | ||
</button> | ||
</div> | ||
<TIcon name="facebook" size="4" /> | ||
<div> | ||
{{ inviteUsername }} | ||
<div class="my-4 flex flex-col justify-center"> | ||
<div>Social Media or Website</div> | ||
<TField | ||
v-model="websites" | ||
component="TInputArray" | ||
:children="{ | ||
component: 'TInput', | ||
placeholder: 'https://', | ||
}" | ||
label-position="top" | ||
/> | ||
<p> | ||
You can use link to their Instagram or Facebook or anything else | ||
</p> | ||
<div class="flex justify-end gap-x-2"> | ||
<TButton @click="showPopup = false" label="Cancel" /> | ||
<TButton | ||
@click=" | ||
create({ | ||
username: inviteUsername, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a problem with username extraction. Let's say this link will be provided |
||
...dynamicData, | ||
}) | ||
" | ||
label="Save" | ||
type="primary" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</TPopup> | ||
</template> | ||
</div> | ||
</div> | ||
</template> | ||
<script> | ||
import { computed, ref, watch } from '@nuxtjs/composition-api' | ||
import { computed, onMounted, ref, watch } from '@nuxtjs/composition-api' | ||
import { useAlgolia } from '~/use/algolia' | ||
import { useEvents } from '~/use/events' | ||
import { useDoc } from '~/use/doc' | ||
import { useAuth } from '~/use/auth' | ||
import TPopup from '../TPopup.vue' | ||
import TInputArray from './TInputArray.vue' | ||
import TInput from './TInput.vue' | ||
import TField from '../TField.vue' | ||
|
||
export default { | ||
name: 'TInputProfile', | ||
inheritAttrs: false, | ||
|
||
components: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. components are auto imported |
||
TPopup, | ||
TInputArray, | ||
TInput, | ||
TField, | ||
}, | ||
|
||
props: { | ||
value: { | ||
type: [Object, String], | ||
|
@@ -139,6 +162,24 @@ export default { | |
const { eventRoleOptions } = useEvents() | ||
const { create: createProfile } = useDoc('profiles') | ||
|
||
const showPopup = ref(false) | ||
const websites = ref([]) | ||
|
||
const dynamicData = computed(() => { | ||
let data = {} | ||
|
||
websites.value.forEach((website) => { | ||
if (website.includes('facebook')) { | ||
data.facebook = website | ||
} else if (website.includes('instagram')) { | ||
data.instagram = website | ||
} else if (website.includes('twitter')) { | ||
data.twitter = website | ||
} | ||
}) | ||
return data | ||
}) | ||
|
||
if (typeof props.value === 'string') { | ||
emit('input', { username: props.value }) | ||
} | ||
|
@@ -236,6 +277,9 @@ export default { | |
eventRoleOptions, | ||
create, | ||
inviteUsername, | ||
showPopup, | ||
dynamicData, | ||
websites, | ||
} | ||
}, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check other pages where TInputArray is used, i think this change will break that component on other pages