Skip to content

Commit

Permalink
add invite link in nav
Browse files Browse the repository at this point in the history
  • Loading branch information
lyoshenka committed Mar 6, 2024
1 parent b06e63b commit 920380d
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 87 deletions.
4 changes: 4 additions & 0 deletions components/core/mobile/MobileNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { HorizontalDivider } from '../Divider'
import { MobileMenuItem } from './MobileMenuItem'
import { MobileMenuProfileItem } from './MobileMenuProfileItem'
import { useProfile } from '@/components/auth/useProfile'
import { CitizenshipStatus } from '@/utils/types/profile'

interface MobileNavBarProps {
profileId?: string
Expand All @@ -24,6 +25,9 @@ export const MobileNavBar = ({ open, profileId }: MobileNavBarProps) => {
{user && (
<MobileMenuItem menuItem={'myLocations'} profileId={profileId} />
)}
{user && user.citizenshipStatus == CitizenshipStatus.Verified && (
<MobileMenuItem menuItem={'invite'} profileId={profileId} />
)}
{user && user.isAdmin && (
<MobileMenuItem menuItem={'admin'} profileId={profileId} />
)}
Expand Down
7 changes: 7 additions & 0 deletions components/core/navbar/ProfileNavMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Icon from '../Icon'
import { Caption, Subline1 } from '../Typography'
import events from '@/lib/googleAnalytics/events'
import { MenuItemOption } from '@/utils/nav/types'
import { CitizenshipStatus } from '@/utils/types/profile'

interface ProfileNavMenuProps {
visible: boolean
Expand Down Expand Up @@ -76,6 +77,12 @@ export const ProfileNavMenu = ({ visible }: ProfileNavMenuProps) => {
<Caption $color="yellow100">({user.locationCount})</Caption>
</MenuItemWithNote>
</ProfileMenuItem>
{user.citizenshipStatus == CitizenshipStatus.Verified && (
<ProfileMenuItem onClick={() => handleClick('invite')} href="/invite">
<Icon name="plus" size={2} color="green400" />
<Subline1 $color="yellow100">Invite</Subline1>
</ProfileMenuItem>
)}
{user.isAdmin && (
<ProfileMenuItem onClick={() => handleClick('admin')} href="/admin">
<Icon name="person" size={2} color="green400" />
Expand Down
188 changes: 101 additions & 87 deletions components/navigation/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,99 +7,113 @@ import { EXTERNAL_LINKS } from '@/utils/external-links'
import events from '@/lib/googleAnalytics/events'
import { H1, fonts } from '@/components/core/Typography'
import { TextContent } from '@/components/landing/TextSection'
import { useProfile } from '@/components/auth/useProfile'
import { CitizenshipStatus } from '@/utils/types/profile'

export const FOOTER_HEIGHT = '265' // TODO: fix this huge hack

export const Footer = () => (
<Container>
<LandingContent>
<FooterContainer>
<TextSections>
<Section>
<Header>Product</Header>
<AppLink
onClick={() => events.viewCityDirectoryEvent()}
location="/city-directory"
iconSize={0}
>
<Name>City Directory</Name>
</AppLink>
<AppLink
external
location={EXTERNAL_LINKS.CARETAKER_TYPEFORM}
iconSize={0}
>
<Name>List Your Property</Name>
</AppLink>
<AppLink
external
location={EXTERNAL_LINKS.CITIZENSHIP}
iconSize={0}
>
<Name>Citizenship</Name>
</AppLink>
<AppLink
external
location={EXTERNAL_LINKS.PRIVACY_AND_TERMS}
iconSize={0}
>
<Name>Privacy & Terms</Name>
</AppLink>
<AppLink location="/security" iconSize={0}>
<Name>Security</Name>
</AppLink>
</Section>

<Section>
<Header>Resources</Header>
<AppLink external location={EXTERNAL_LINKS.VISION} iconSize={0}>
<Name>Vision</Name>
</AppLink>
<AppLink external location={EXTERNAL_LINKS.BLOG} iconSize={0}>
<Name>Blog</Name>
</AppLink>
<AppLink external location={EXTERNAL_LINKS.PODCAST} iconSize={0}>
<Name>Podcast</Name>
</AppLink>
<AppLink external location={EXTERNAL_LINKS.STORE} iconSize={0}>
<Name>Store</Name>
</AppLink>
<AppLink
external
location={`mailto:${EXTERNAL_LINKS.GENERAL_EMAIL_ADDRESS}`}
iconSize={0}
>
<Name>Contact Us</Name>
</AppLink>
</Section>
export const Footer = () => {
const { user } = useProfile()
return (
<Container>
<LandingContent>
<FooterContainer>
<TextSections>
<Section>
<Header>Product</Header>
<AppLink
onClick={() => events.viewCityDirectoryEvent()}
location="/city-directory"
iconSize={0}
>
<Name>City Directory</Name>
</AppLink>
<AppLink
external
location={EXTERNAL_LINKS.CARETAKER_TYPEFORM}
iconSize={0}
>
<Name>List Your Property</Name>
</AppLink>
<AppLink
external
location={EXTERNAL_LINKS.CITIZENSHIP}
iconSize={0}
>
<Name>Citizenship</Name>
</AppLink>
{user && user.citizenshipStatus == CitizenshipStatus.Verified && (
<AppLink external location="/invite" iconSize={0}>
<Name>Invite Friends</Name>
</AppLink>
)}
<AppLink
external
location={EXTERNAL_LINKS.PRIVACY_AND_TERMS}
iconSize={0}
>
<Name>Privacy & Terms</Name>
</AppLink>
<AppLink location="/security" iconSize={0}>
<Name>Security</Name>
</AppLink>
</Section>

<Section>
<Header>Resources</Header>
<AppLink external location={EXTERNAL_LINKS.VISION} iconSize={0}>
<Name>Vision</Name>
</AppLink>
<AppLink external location={EXTERNAL_LINKS.BLOG} iconSize={0}>
<Name>Blog</Name>
</AppLink>
<AppLink external location={EXTERNAL_LINKS.PODCAST} iconSize={0}>
<Name>Podcast</Name>
</AppLink>
<AppLink external location={EXTERNAL_LINKS.STORE} iconSize={0}>
<Name>Store</Name>
</AppLink>
<AppLink
external
location={`mailto:${EXTERNAL_LINKS.GENERAL_EMAIL_ADDRESS}`}
iconSize={0}
>
<Name>Contact Us</Name>
</AppLink>
</Section>

<Section>
<Header>Social</Header>
<AppLink external location={EXTERNAL_LINKS.DISCORD} iconSize={0}>
<Name>Discord</Name>
</AppLink>
<AppLink external location={EXTERNAL_LINKS.FORUM} iconSize={0}>
<Name>Forum</Name>
</AppLink>
<AppLink external location={EXTERNAL_LINKS.TWITTER} iconSize={0}>
<Name>Twitter</Name>
</AppLink>
<AppLink
external
location={EXTERNAL_LINKS.INSTAGRAM}
iconSize={0}
>
<Name>Instagram</Name>
</AppLink>
</Section>
</TextSections>

<Section>
<Header>Social</Header>
<AppLink external location={EXTERNAL_LINKS.DISCORD} iconSize={0}>
<Name>Discord</Name>
</AppLink>
<AppLink external location={EXTERNAL_LINKS.FORUM} iconSize={0}>
<Name>Forum</Name>
</AppLink>
<AppLink external location={EXTERNAL_LINKS.TWITTER} iconSize={0}>
<Name>Twitter</Name>
</AppLink>
<AppLink external location={EXTERNAL_LINKS.INSTAGRAM} iconSize={0}>
<Name>Instagram</Name>
</AppLink>
<FooterLogo>
<Icon name="logo-cabin" size={3.8} color="green400" />
<IconText>Cabin</IconText>
</FooterLogo>
</Section>
</TextSections>

<Section>
<FooterLogo>
<Icon name="logo-cabin" size={3.8} color="green400" />
<IconText>Cabin</IconText>
</FooterLogo>
</Section>
</FooterContainer>
</LandingContent>
</Container>
)
</FooterContainer>
</LandingContent>
</Container>
)
}

const Container = styled.div`
display: flex;
Expand Down
12 changes: 12 additions & 0 deletions pages/api/v2/profile/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ async function handler(
}
}

const existingWallet = await prisma.wallet.findUnique({
where: { address: body.walletAddress },
include: { profile: true },
})

if (existingWallet && existingWallet.profile) {
res
.status(400)
.send({ error: 'This wallet is already connected to an account' })
return
}

const profile = await createProfile({
privyDID,
walletAddress: body.walletAddress,
Expand Down
7 changes: 7 additions & 0 deletions utils/nav/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type MenuItemOption =
| 'profile'
| 'citizenship'
| 'myLocations'
| 'invite'
| 'signOut'
| 'signIn'
| 'admin'
Expand Down Expand Up @@ -63,6 +64,11 @@ export const MenuItemsAuthenticatedMap: Record<
path: '/my-locations',
displayText: 'My Locations',
},
invite: {
icon: 'plus',
path: '/invite',
displayText: 'Invite',
},
admin: {
icon: 'person',
path: '/admin',
Expand Down Expand Up @@ -102,6 +108,7 @@ export const MenuItemsUnauthenticatedMap: Record<
},
profile: null,
citizenship: null,
invite: null,
admin: null,
signOut: null,
signIn: {
Expand Down

0 comments on commit 920380d

Please sign in to comment.