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

Adjusted 'unlock full profile' action and citizen location visibility #269

Merged
merged 8 commits into from
Dec 16, 2024
2 changes: 0 additions & 2 deletions ui/components/jobs/Job.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ export default function Job({
{isActive && (
<div
id={id}
className={`flex flex-col justify-between bg-dark-cool rounded-md lg:w-[500px]`}
id="job-container"
className={`flex flex-col justify-between bg-dark-cool rounded-md mx-5 lg:mx-0`}
>
<Frame>
Expand Down
7 changes: 5 additions & 2 deletions ui/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { useState } from 'react'
import { useContext } from 'react'
import { Toaster } from 'react-hot-toast'
import ChainContext from '../../lib/thirdweb/chain-context'
import CitizenContext from '@/lib/citizen/citizen-context'
import useNavigation from '@/lib/navigation/useNavigation'
import { LogoSidebarLight, LogoSidebar } from '../assets'
import { PrivyConnectWallet } from '../privy/PrivyConnectWallet'
import CitizenProfileLink from '../subscription/CitizenProfileLink'
Expand All @@ -18,7 +20,6 @@ import ColorsAndSocials from './Sidebar/ColorsAndSocials'
import LanguageChange from './Sidebar/LanguageChange'
import MobileMenuTop from './Sidebar/MobileMenuTop'
import MobileSidebar from './Sidebar/MobileSidebar'
import { navigation } from './Sidebar/Navigation'
import NavigationLink from './Sidebar/NavigationLink'

interface Layout {
Expand All @@ -36,10 +37,13 @@ export default function Layout({ children, lightMode, setLightMode }: Layout) {
const chain = useChain()
const { selectedChain } = useContext(ChainContext)

const { citizen } = useContext(CitizenContext)
Copy link
Contributor

@jaderiverstokes jaderiverstokes Dec 16, 2024

Choose a reason for hiding this comment

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

do the changes in this file do anything? i don't see any added references

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I swapped the old navigation for a hook so that I can conditionally render nav links such as 'Become a Citizen'

const { contract: citizenContract } = useContract(
CITIZEN_ADDRESSES[selectedChain.slug]
)

const navigation = useNavigation(citizen)

const [currentLang, setCurrentLang] = useState(router.locale)
const { t } = useTranslation('common')
//Background is defined in this root div.
Expand All @@ -50,7 +54,6 @@ export default function Layout({ children, lightMode, setLightMode }: Layout) {
!lightMode ? 'dark background-dark' : 'background-light'
} min-h-screen`}
>

{/*Mobile menu top bar*/}
<MobileMenuTop
setSidebarOpen={setSidebarOpen}
Expand Down
16 changes: 10 additions & 6 deletions ui/components/subscription/CitizenActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type CitizenActionsProps = {
address?: string
nft?: any
incompleteProfile?: boolean
isTeamMember?: boolean
mooneyBalance?: number
vmooneyBalance?: number
setCitizenMetadataModalEnabled: Function
Expand All @@ -26,6 +27,7 @@ export default function CitizenActions({
address,
nft,
incompleteProfile,
isTeamMember,
mooneyBalance,
vmooneyBalance,
setCitizenMetadataModalEnabled,
Expand Down Expand Up @@ -148,12 +150,14 @@ export default function CitizenActions({
onClick={() => window.open('https://guild.xyz/moondao')}
/>

<Action
title="Create a Team"
description="Join a team or create your own to work together on accelerating space."
icon={<PlusIcon height={30} width={30} />}
onClick={() => router.push('/team')}
/>
{!isTeamMember && (
<Action
title="Create a Team"
description="Join a team or create your own to work together on accelerating space."
icon={<PlusIcon height={30} width={30} />}
onClick={() => router.push('/team')}
/>
)}
</div>
</SlidingCardMenu>
</Frame>
Expand Down
82 changes: 82 additions & 0 deletions ui/lib/navigation/useNavigation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import {
BuildingLibraryIcon,
ClipboardDocumentListIcon,
FolderIcon,
PlusIcon,
RocketLaunchIcon,
} from '@heroicons/react/24/outline'
import { useMemo } from 'react'
import IconOrg from '@/components/assets/IconOrg'

export default function useNavigation(citizen: any) {
const navigation = useMemo(() => {
return [
{
name: 'Join',
href: '/join',
icon: PlusIcon,
children: [
!citizen && { name: 'Become a Citizen', href: '/citizen' },
{ name: 'Create a Team', href: '/team' },
],
},
{
name: 'Network',
href: '/network',
icon: IconOrg,
},
{
name: 'Info',
icon: FolderIcon,
href: '/info',
children: [
{ name: 'News', href: '/news' },
{ name: 'About', href: '/about' },
{
name: 'Constitution',
href: 'https://docs.moondao.com/Governance/Constitution',
},
{ name: 'Events', href: '/events' },
{ name: 'Analytics', href: '/analytics' },
],
},
{
name: 'Governance',
icon: BuildingLibraryIcon,
href: '/governance',
children: [
{
name: 'All Proposals',
href: '/vote',
},
{
name: 'Submit Proposal',
href: '/submission',
},
{
name: 'Submit Contribution',
href: '/submission?tag=contribution',
},
{
name: 'Get $MOONEY',
href: '/get-mooney',
},
{ name: 'Get Voting Power', href: '/lock' },
{ name: 'Bridge', href: '/bridge' },
],
},
{
name: 'Marketplace',
icon: RocketLaunchIcon,
href: '/marketplace',
},
{
name: 'Jobs',
href: '/jobs',
icon: ClipboardDocumentListIcon,
},
]
}, [citizen])

return navigation
}
4 changes: 3 additions & 1 deletion ui/pages/citizen/[tokenIdOrName].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export default function CitizenDetailPage({
<></>
)}

{location !== '' && (
{location !== '' && citizen && (
<div className="mt-2 flex items-center gap-2 lg:ml-5">
<MapPinIcon
width={30}
Expand Down Expand Up @@ -360,6 +360,7 @@ export default function CitizenDetailPage({
address={address}
nft={nft}
incompleteProfile={incompleteProfile}
isTeamMember={hats.length > 0}
mooneyBalance={MOONEYBalance}
vmooneyBalance={VMOONEYBalance}
setCitizenMetadataModalEnabled={setCitizenMetadataModalEnabled}
Expand Down Expand Up @@ -389,6 +390,7 @@ export default function CitizenDetailPage({
title="Unlock Full Profile"
description="Become a Citizen of the Space Acceleration Network to view the full profile. Citizenship also unlocks access to the jobs board, marketplace discounts, and more benefits."
icon={<LockOpenIcon width={30} height={30} />}
onClick={() => router.push('/citizen')}
/>
)}
{subIsValid && !isDeleted && !isGuest ? (
Expand Down
Loading