Skip to content

Commit

Permalink
Merge branch 'master' into tim/referral-ce
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/commonwealth/client/scripts/views/modals/InviteLinkModal/useReferralLink.ts
  • Loading branch information
timolegros committed Dec 20, 2024
2 parents b6c047d + 34e959e commit 19e18ef
Show file tree
Hide file tree
Showing 53 changed files with 669 additions and 30 deletions.
1 change: 1 addition & 0 deletions libs/model/src/services/openai/generateTokenIdea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const generateTokenIdea = async function* ({
const imageResponse = await openai.images.generate({
prompt: TOKEN_AI_PROMPTS_CONFIG.image(tokenIdea.name, tokenIdea.symbol),
size: '256x256',
model: 'dall-e-2',
n: 1,
response_format: 'url',
});
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const featureFlags = {
referrals: buildFlag(process.env.FLAG_REFERRALS),
stickyEditor: buildFlag(process.env.FLAG_STICKY_EDITOR),
newMobileNav: buildFlag(process.env.FLAG_NEW_MOBILE_NAV),
rewardsPage: buildFlag(process.env.FLAG_REWARDS_PAGE),
};

export type AvailableFeatureFlag = keyof typeof featureFlags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ const CommunityNotFoundPage = lazy(
() => import('views/pages/CommunityNotFoundPage'),
);

const RewardsPage = lazy(() => import('views/pages/RewardsPage'));

const CommonDomainRoutes = ({
tokenizedCommunityEnabled,
}: RouteFeatureFlags) => [
Expand Down Expand Up @@ -180,6 +182,11 @@ const CommonDomainRoutes = ({
type: 'common',
})}
/>,
<Route
key="/rewards"
path="/rewards"
element={withLayout(RewardsPage, { type: 'common' })}
/>,
<Route
key="/search"
path="/search"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ const NewProfilePage = lazy(() => import('views/pages/new_profile'));
const EditNewProfilePage = lazy(() => import('views/pages/edit_new_profile'));
const ProfilePageRedirect = lazy(() => import('views/pages/profile_redirect'));

const RewardsPage = lazy(() => import('views/pages/RewardsPage'));

const CustomDomainRoutes = ({
tokenizedCommunityEnabled,
}: RouteFeatureFlags) => {
Expand Down Expand Up @@ -177,6 +179,11 @@ const CustomDomainRoutes = ({
path="/myTransactions"
element={withLayout(MyTransactions, { type: 'common' })}
/>,
<Route
key="/rewards"
path="/rewards"
element={withLayout(RewardsPage, { type: 'common' })}
/>,

// NOTIFICATIONS
<Route
Expand Down
12 changes: 0 additions & 12 deletions packages/commonwealth/client/scripts/views/Sublayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import app from 'state';
import useSidebarStore from 'state/ui/sidebar';
import { SublayoutHeader } from 'views/components/SublayoutHeader';
import { Sidebar } from 'views/components/sidebar';
import twitterspaceGrowlImage from '../../assets/img/TwitterspaceGrowlImage.png';
import { useHandleInviteLink } from '../hooks/useHandleInviteLink';
import useNecessaryEffect from '../hooks/useNecessaryEffect';
import useStickyHeader from '../hooks/useStickyHeader';
Expand All @@ -23,7 +22,6 @@ import { AdminOnboardingSlider } from './components/AdminOnboardingSlider';
import { Breadcrumbs } from './components/Breadcrumbs';
import MobileNavigation from './components/MobileNavigation';
import AuthButtons from './components/SublayoutHeader/AuthButtons';
import { CWGrowlTemplate } from './components/SublayoutHeader/GrowlTemplate/CWGrowlTemplate';
import useJoinCommunity from './components/SublayoutHeader/useJoinCommunity';
import { UserTrainingSlider } from './components/UserTrainingSlider';
import { CWModal } from './components/component_kit/new_designs/CWModal';
Expand Down Expand Up @@ -196,16 +194,6 @@ const Sublayout = ({ children, isInsideCommunity }: SublayoutProps) => {
)}
{children}
</div>
<CWGrowlTemplate
growlType="twitterspace"
growlImage={twitterspaceGrowlImage}
headerText="Livestream with How To DAO this Thursday!"
bodyText="Join Dillon Chen (Common CEO) and Kevin Owocki (Gitcoin Co-Founder) on 12/19 at 11am ET to
shape the future of digital collaboration and community building"
buttonText="Reserve Your Spot!"
buttonLink="https://lu.ma/8nk6j7n4"
extraText='Exclusive bundle offer: "How To DAO" book + more!'
/>
</div>
<WelcomeOnboardModal
isOpen={isWelcomeOnboardModalOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import {
import '@knocklabs/react-notification-feed/dist/index.css';
import React, { memo, useEffect, useRef, useState } from 'react';
import useUserStore from 'state/ui/user';
import {
handleIconClick,
handleMouseEnter,
handleMouseLeave,
} from '../../menus/utils';
import { CWTooltip } from '../component_kit/new_designs/CWTooltip/CWTooltip';
import CustomNotificationCell from './CustomNotificationCell';
import './KnockNotifications.scss';
const KNOCK_PUBLIC_API_KEY =
Expand Down Expand Up @@ -71,10 +77,43 @@ export const KnockNotifications = memo(function KnockNotifications() {
{/* Optionally, use the KnockFeedProvider to connect an in-app feed */}
<KnockFeedProvider feedId={KNOCK_IN_APP_FEED_ID} colorMode="light">
<div>
<NotificationIconButton
ref={notifButtonRef}
onClick={() => setIsVisible(!isVisible)}
<CWTooltip
content="Notifications"
placement="bottom"
renderTrigger={(handleInteraction, isTooltipOpen) => (
<div
onClick={(e) =>
handleIconClick({
e,
isMenuOpen: isVisible,
isTooltipOpen,
handleInteraction,
onClick: () => setIsVisible(!isVisible),
})
}
onMouseEnter={(e) => {
handleMouseEnter({
e,
isMenuOpen: isVisible,
handleInteraction,
});
}}
onMouseLeave={(e) => {
handleMouseLeave({
e,
isTooltipOpen,
handleInteraction,
});
}}
>
<NotificationIconButton
ref={notifButtonRef}
onClick={() => setIsVisible(!isVisible)}
/>
</div>
)}
/>

<NotificationFeedPopover
buttonRef={notifButtonRef}
isVisible={isVisible}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
display: flex;
justify-content: space-around;
align-items: center;
padding-inline: min(30px, 3%);
padding-inline: min(10px, 1%);
margin-top: 8px;
margin-bottom: 16px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const MobileNavigation = () => {
const location = useLocation();
const user = useUserStore();
const newMobileNav = useFlag('newMobileNav');
const rewardsEnabled = useFlag('rewardsPage');

const [isDrawerOpen, setIsDrawerOpen] = useState(false);

Expand Down Expand Up @@ -56,6 +57,15 @@ const MobileNavigation = () => {
},
]
: []),
...(user.isLoggedIn && rewardsEnabled
? [
{
type: 'rewards' as const,
onClick: () => navigate('/rewards', {}, null),
selected: !!matchRoutes([{ path: '/rewards' }], location),
},
]
: []),
];

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
flex-direction: column;
justify-content: center;
align-items: center;
padding: 4px 16px 0;
min-width: 80px;
padding: 4px 8px 0;

svg {
fill: $neutral-600;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { typeToIconAndName } from './utils';
import './NavigationButton.scss';

export interface NavigationButtonProps {
type: 'home' | 'create' | 'explore' | 'notifications';
type: 'home' | 'create' | 'explore' | 'notifications' | 'rewards';
selected: boolean;
onClick: () => void;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ export const typeToIconAndName = (
return ['compassPhosphor', 'Explore'];
case 'notifications':
return ['bell', 'Notifications'];
case 'rewards':
return ['cardholder', 'Rewards'];
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,31 @@
margin-bottom: auto;
margin-left: 5px;
}

.rewards-button {
margin-left: 24px;
display: flex;
align-items: center;
justify-content: center;

svg {
fill: $neutral-500;
}

.rewards-button-container {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;

.earnings {
margin-left: 4px;
font-family: $font-family-roboto;
color: $neutral-500;
white-space: nowrap;
}
}
}
}

.DesktopMenuContainer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ import { HelpMenuPopover } from 'views/menus/help_menu';

import UserDropdown from './UserDropdown';

import { useFlag } from 'hooks/useFlag';
import { useFetchCustomDomainQuery } from 'state/api/configuration';
import useUserStore from 'state/ui/user';
import AuthButtons from 'views/components/SublayoutHeader/AuthButtons';
import { AuthModalType } from 'views/modals/AuthModal';
import { capDecimals } from 'views/modals/ManageCommunityStakeModal/utils';
import { CWText } from '../../component_kit/cw_text';
import './DesktopHeader.scss';

interface DesktopHeaderProps {
Expand All @@ -28,6 +31,7 @@ interface DesktopHeaderProps {

const DesktopHeader = ({ onMobile, onAuthModalOpen }: DesktopHeaderProps) => {
const navigate = useCommonNavigate();
const rewardsEnabled = useFlag('rewardsPage');
const { menuVisible, setMenu, menuName, setUserToggledVisibility } =
useSidebarStore();
const user = useUserStore();
Expand Down Expand Up @@ -118,7 +122,41 @@ const DesktopHeader = ({ onMobile, onAuthModalOpen }: DesktopHeaderProps) => {

<HelpMenuPopover />
</div>
{user.isLoggedIn && <KnockNotifications />}
{user.isLoggedIn && (
<>
<KnockNotifications />

{rewardsEnabled && (
<div className="rewards-button">
<CWTooltip
content="Wallet and rewards"
placement="bottom"
renderTrigger={(handleInteraction) => (
<div
className="rewards-button-container"
onClick={() => navigate('/rewards', {}, null)}
onMouseEnter={handleInteraction}
onMouseLeave={handleInteraction}
>
<CWIconButton
iconName="cardholder"
weight="fill"
iconButtonTheme="black"
/>
<CWText
className="earnings"
fontWeight="medium"
type="caption"
>
{capDecimals('0.125')} ETH
</CWText>
</div>
)}
/>
</div>
)}
</>
)}
</div>

{user.isLoggedIn && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import {
} from 'views/components/component_kit/cw_toggle';
import CWIconButton from 'views/components/component_kit/new_designs/CWIconButton';
import useAuthentication from '../../modals/AuthModal/useAuthentication';
import { MobileTabType } from '../../pages/RewardsPage/types';
import { mobileTabParam } from '../../pages/RewardsPage/utils';
import { useCommunityStake } from '../CommunityStake';
import UserMenuItem from './UserMenuItem';
import useCheckAuthenticatedAddresses from './useCheckAuthenticatedAddresses';
Expand Down Expand Up @@ -87,6 +89,7 @@ const useUserMenuItems = ({
recheck: isMenuOpen,
});

const rewardsEnabled = useFlag('rewardsPage');
const referralsEnabled = useFlag('referrals');

const userData = useUserStore();
Expand Down Expand Up @@ -297,7 +300,14 @@ const useUserMenuItems = ({
{
type: 'default',
label: 'My transactions',
onClick: () => navigate(`/myTransactions`, {}, null),
onClick: () =>
navigate(
rewardsEnabled
? `/rewards?tab=${mobileTabParam[MobileTabType.WalletBalance]}`
: `/myTransactions`,
{},
null,
),
},
{
type: 'default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
BellSimpleSlash,
BookOpenText,
Brain,
Cardholder,
CaretDoubleLeft,
CaretDoubleRight,
CaretDown,
Expand Down Expand Up @@ -89,6 +90,7 @@ import {
Trash,
Trophy,
TwitterLogo,
UserSwitch,
Users,
UsersThree,
Warning,
Expand Down Expand Up @@ -147,6 +149,7 @@ export const iconLookup = {
bellRinging: withPhosphorIcon(BellSimpleRinging),
bellMuted: withPhosphorIcon(BellSimpleSlash),
bookOpenText: withPhosphorIcon(BookOpenText),
cardholder: withPhosphorIcon(Cardholder),
cautionCircle: Icons.CWCautionCircle,
cautionTriangle: Icons.CWCautionTriangle,
chatDots: withPhosphorIcon(ChatDots),
Expand Down Expand Up @@ -286,6 +289,7 @@ export const iconLookup = {
unsubscribe: Icons.CWUnsubscribe,
upvote: withPhosphorIcon(ArrowFatUp),
users: withPhosphorIcon(Users),
userSwitch: withPhosphorIcon(UserSwitch),
vote: Icons.CWVote,
views: Icons.CWViews,
wallet: Icons.CWWallet,
Expand Down
2 changes: 1 addition & 1 deletion packages/commonwealth/client/scripts/views/pages/404.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const PageNotFound = (props: PageNotFoundProps) => {
<CWButton
buttonType="primary"
label="Home"
onClick={() => navigate('/dashboard/for-you')}
onClick={() => navigate('/dashboard/for-you', {}, null)}
/>
)}
<AuthModal
Expand Down
Loading

0 comments on commit 19e18ef

Please sign in to comment.