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: Link card to profile #361

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f3a3517
add landing page and images
PanicS7 Mar 16, 2023
5ad78ab
Add premium component
PanicS7 Mar 16, 2023
140f48f
Improve style for landing page
PanicS7 Mar 16, 2023
b13bec4
Fix style problem
PanicS7 Mar 16, 2023
9cd2bb8
add functionality for close button
PanicS7 Mar 17, 2023
c1f392e
id for landing page is mandatory
PanicS7 Mar 17, 2023
37bf2c2
Convert premium component to modal
PanicS7 Mar 17, 2023
6714861
revert premium component changes
PanicS7 Mar 17, 2023
c03a5c8
Add benefits component
PanicS7 Mar 20, 2023
bc2141f
Add mailto to links
PanicS7 Mar 20, 2023
7446fb3
Improve style, comment unused code
PanicS7 Mar 21, 2023
f27aaf3
add TPopup
PanicS7 Mar 21, 2023
4a4f0e1
change button logic
PanicS7 Mar 21, 2023
6f259c6
show landing page conditionaly
PanicS7 Mar 23, 2023
1416d65
clear unused code
PanicS7 Mar 24, 2023
739d477
add redirect to button
PanicS7 Mar 24, 2023
ecf19c4
add button redirection and update database
PanicS7 Mar 26, 2023
0bdeaeb
Add contition to show premium modal
PanicS7 Mar 28, 2023
b1b81cc
Fix style and cleanup code
PanicS7 Mar 28, 2023
ed75cdf
clear unused code
PanicS7 Mar 28, 2023
52b95be
Merge branch 'main' into issue/349
PanicS7 Mar 28, 2023
725443d
eslint
PanicS7 Mar 28, 2023
2553379
update branch
PanicS7 Mar 29, 2023
bd2b68b
Merge branch 'issue/349' into demo-panics7
PanicS7 Mar 29, 2023
65a8c91
fix for eslint error and warning
PanicS7 Mar 29, 2023
aaf2a65
improve code
PanicS7 Mar 29, 2023
03904a4
change image format
PanicS7 Mar 29, 2023
6728321
change naming
PanicS7 Mar 29, 2023
d30ab62
change style to use tailwind
PanicS7 Mar 29, 2023
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
31 changes: 31 additions & 0 deletions components/TBenefits.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<section class="px-3 m-auto pb-2">
<h2 class="text-3xl text-center font-extrabold mb-4">{{ title }}</h2>
<div v-for="(benefit, index) in benefits" :key="index" class="flex gap-2">
<TIcon :name="icon" class="grid content-center" />
<p class="text-lg my-1" v-html="benefit"></p>
<!-- v-html allow passing html entity like &rsquo; -->
</div>
</section>
</template>

<script>
export default {
props: {
title: {
type: String,
default: '',
},
icon: {
type: String,
default: 'check-green',
},
benefits: {
type: Array,
default() {
return []
},
Copy link
Contributor

Choose a reason for hiding this comment

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

shorter:

Suggested change
default() {
return []
},
default: () => [],

Copy link
Author

Choose a reason for hiding this comment

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

I changed code, so it is shorter now

},
},
}
</script>
47 changes: 47 additions & 0 deletions components/TPremium.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<div
class="relative top-10 max-w-sm pt-3 pb-4 font-sans tracking-tight mx-auto"
>
<section class="bg-gray-200 p-4 rounded-lg mb-3">
<div class="m-auto w-fit"><img src="img/gift.png" /></div>
<h1 class="text-3xl text-center font-extrabold">Try Premium</h1>
<p class="text-lg text-center py-3">
Invite 5 friends to get a card from your profile and get premium for
free for 1 month. Limited offer, 200 left!
</p>
</section>

<TBenefits
title="Why get Premium?"
icon="check-green"
Copy link
Contributor

Choose a reason for hiding this comment

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

if it is already set by default, no need to overwrite it

Copy link
Author

Choose a reason for hiding this comment

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

You are right, I had changed code

:benefits="[
'Get special offers from organisers',
'Exclusive discounts',
'Access to online classes',
]"
class="max-w-fit"
/>

<section class="max-w-sm m-auto w-fit">
<TButton
href="mailto:[email protected]"
type="primary"
label="Get Premium"
class="w-64"
/>
</section>

<div class="w-fit m-auto my-4 flex flex-col gap-2">
<a
href="mailto:[email protected]"
class="underline text-center text-sm font-bold py-2"
>Are you an Organizer?</a
>
<a
href="mailto:[email protected]"
class="underline text-center text-sm font-bold py-2"
>Are you an Artist?</a
>
</div>
</div>
</template>
17 changes: 17 additions & 0 deletions components/TProfile.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template>
<div>
<TPopup v-if="showPopup" title="Try Premium" @close="showPopup = false">
<TPremium />
</TPopup>

<THeader>
<TButton
v-if="profile.type === 'City'"
Expand Down Expand Up @@ -308,6 +312,19 @@ export default {
default: () => ({}),
},
},
data() {
return {
showPopup: false,
}
},
mounted() {
// show tryPremium modal
const query = $nuxt.$route.query
Copy link
Contributor

Choose a reason for hiding this comment

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

solution for: error '$nuxt' is not defined

Suggested change
const query = $nuxt.$route.query
const query = this.$route.query

Copy link
Author

Choose a reason for hiding this comment

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

I had error in diferent file, so this does not fix anything, but I added this implementation

// check does query have tryPremium key
if (Object.prototype.hasOwnProperty.call(query, 'tryPremium')) {
this.showPopup = query.tryPremium
}
},
head() {
return getMeta('profiles', this.profile)
},
Expand Down
190 changes: 190 additions & 0 deletions pages/nfc/_landing.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
<template>
<div
v-if="!this.haveUsername"
class="font-sans bg-white leading-normal tracking-tight antialiased min-h-screen flex flex-col mx-auto max-w-xl border-r border-l"
>
<header class="max-w-sm m-auto pt-8 pb-7 px-3">
<img src="/img/brand.png" class="max-w-md m-auto" />
<h1 class="text-3xl text-center font-extrabold px-3 pt-4">
Share your social media instantly
</h1>
<img src="/img/screenshot.png" />
<p class="max-w-sm m-auto text-center px-3 pb-6 text-lg font-medium">
Turn a simple handshake into a lasting connection
</p>

<div class="max-w-max m-auto w-fit">
<TButton
type="primary"
:to="'/signin?target=nfc/' + this.pageId"
:allow-guests="true"
label="Link your Profile"
class="w-64"
/>
</div>
</header>

<TBenefits
title="Power of VIP Cards"
icon="check-green"
:benefits="[
'Instant contact exchange',
'Environmentally friendly',
'Convenient and easy to use',
'Affordable',
'Don&rsquo;t have space constraints',
'More secure',
]"
/>

<section class="bg-gray-200 p-4 mb-6">
<h2 class="text-3xl text-center font-extrabold p-3">How it works</h2>

<div class="max-w-md m-auto">
<div class="flex items-center">
<TIcon name="tap-card" />
<div class="ml-2">
<h3 class="text-slate-700 text-bold text-lg">Tap the card</h3>
<p class="text-gray-500 text-sm">
Tap your VIP Card on your own phone device
</p>
</div>
</div>

<img src="/img/divider.png" class="my-1" />

<div class="flex items-center">
<TIcon name="phone" />
<div class="ml-2">
<h3 class="text-slate-700 text-bold text-lg">
Create and link your profile
</h3>
<p class="text-gray-500 text-sm">
Sign-in and create your WeDance profile so it can be linked to
your VIP Card
</p>
</div>
</div>

<img src="/img/divider.png" class="my-1" />

<div class="flex items-center">
<TIcon name="card-network" />
<div class="ml-2">
<h3 class="text-slate-700 text-bold text-lg">Start networking</h3>
<p class="text-gray-500 text-sm">
Share your profile by tapping your VIP Card on other
people&rsquo;s mobiles and start networking faster
</p>
</div>
</div>
</div>
</section>

<TBenefits
title="Premium Membership"
icon="check-green"
:benefits="[
'Get special offers from organisers',
'Exclusive discounts',
'Access to online classes',
]"
/>

<section class="max-w-md m-auto h-64 p-3 mt-8">
<h2 class="text-3xl text-center font-extrabold mb-2">Follow us</h2>
<p class="font-normal text-lg text-center">
We regularly post event announcements and introduce new members on our
social media.
</p>
<div class="max-w-md m-auto pb-16">
<div class="flex justify-center gap-3 pt-8">
<a href="https://www.instagram.com/WeDancePlatform/" target="_blank">
<TIcon
name="instagram"
size="10"
class="rounded-full p-2"
style="box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px rgba(0, 0, 0, 0.06);"
Copy link
Contributor

Choose a reason for hiding this comment

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

use tailwind shadows

Copy link
Author

Choose a reason for hiding this comment

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

I changed it to use "shadow" tailwind class

/>
</a>
<a href="https://t.me/WeDanceTravel" target="_blank">
<TIcon
name="telegram"
size="10"
class="rounded-full p-2"
style="box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px rgba(0, 0, 0, 0.06);"
/>
</a>
<a href="https://twitter.com/WeDancePlatform" target="_blank">
<TIcon
name="twitter"
size="10"
class="rounded-full p-2"
style="box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px rgba(0, 0, 0, 0.06);"
/>
</a>
<a
href="https://www.facebook.com/people/WeDance/100079633097491/"
target="_blank"
>
<TIcon
name="facebook"
size="10"
class="rounded-full p-2"
style="box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px rgba(0, 0, 0, 0.06);"
/>
</a>
</div>
</div>
</section>
</div>
<div v-else>
Page have username
</div>
</template>

<script>
import { db } from '~/plugins/firebase'
import { useDoc } from '~/use/doc'
import { useAuth } from '~/use/auth'

export default {
layout: 'empty',
async asyncData({ redirect }) {
const { softUpdate } = useDoc('nfc-card')
let username = ''

let pageId = $nuxt.$route.params.landing
Copy link
Contributor

Choose a reason for hiding this comment

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

landing is confusing name for param, rename it to id

Suggested change
let pageId = $nuxt.$route.params.landing
let pageId = $nuxt.$route.params.id

Copy link
Author

Choose a reason for hiding this comment

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

It is "id" now

// when page is loaded after signIn
if (pageId === undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

shorter:

Suggested change
if (pageId === undefined) {
if (!pageId) {

Copy link
Author

Choose a reason for hiding this comment

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

To fix error "nuxt is not defined" I changed my implementation, so this code is outdated

// get pageId
let path = $nuxt.$route.query.target
path = path.split('/')
pageId = path[1]

// get user username
username = useAuth().username.value

// handle update database
softUpdate(pageId, { username })

// redirect to user profile
redirect(302, `/${username}?tryPremium=true`)
}
const collection = await db
.collection('nfc-card')
.doc(pageId)
.get()
console.log(collection.data())

let haveUsername = false
haveUsername = collection.data().username !== ''
// haveUsername = collection.data().username !== '' ? true : false

return {
haveUsername,
pageId,
}
},
}
</script>
5 changes: 5 additions & 0 deletions pages/nfc/index.vue
Copy link
Contributor

Choose a reason for hiding this comment

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

that page is not needed

Copy link
Author

Choose a reason for hiding this comment

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

Page is removed now

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
nfc
</div>
</template>
Binary file added static/img/brand.png
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be svg

Copy link
Author

Choose a reason for hiding this comment

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

It is changed now

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/gift.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions static/svg/card-network.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions static/svg/check-green.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading