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

Token launcher for home page #10447

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ const NewProposalPage = lazy(() => import('views/pages/new_proposal/index'));
const DiscussionsPage = lazy(
() => import('views/pages/discussions/DiscussionsPage'),
);
const CommunityHomePage = lazy(
() => import('../views/pages/CommunityHome/CommunityHomePage'),
);
const ViewThreadPage = lazy(
() => import('../views/pages/view_thread/ViewThreadPage'),
);
Expand Down Expand Up @@ -317,6 +320,13 @@ const CommonDomainRoutes = ({
// GOVERNANCE END

// DISCUSSIONS
<Route
key="/:scope/community-home"
path="/:scope/community-home"
element={withLayout(CommunityHomePage, {
scoped: true,
})}
/>,
<Route
key="/:scope/discussions"
path="/:scope/discussions"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ export const DiscussionSection = ({
location,
);

const matchesCommunityHomeRoute = matchRoutes(
[{ path: ':scope/community-home' }],
location,
);

const matchesArchivedRoute = matchRoutes(
[{ path: '/archived' }, { path: ':scope/archived' }],
location,
Expand Down Expand Up @@ -113,6 +118,31 @@ export const DiscussionSection = ({
localStorage[`${app.activeChainId()}-discussions-toggle-tree`],
);
const discussionsGroupData: SectionGroupAttrs[] = [
{
title: 'Community Home',
containsChildren: false,
hasDefaultToggle: false,
isVisible: true,
isUpdated: true,
isActive: !!matchesCommunityHomeRoute,
onClick: (e, toggle: boolean) => {
e.preventDefault();
resetSidebarState();
handleRedirectClicks(
navigate,
e,
`/community-home`,
communityId,
() => {
setDiscussionsToggleTree(
`children.CommunityHome.toggledState`,
toggle,
);
},
);
},
displayData: null,
},
{
title: 'All',
containsChildren: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@import '../../../styles/shared';

.BreadcrumbsComponent {
z-index: 0 !important;
}

.CommunityHome {
display: flex;
flex: 1;
flex-direction: column;
overflow: hidden;

.header-section {
display: flex;
flex-direction: column;
gap: 16px;
position: sticky;
top: 0;
z-index: 1;
background-color: $white;

.btn-border {
margin: 0 !important;
padding: 0 !important;

&:focus-within {
border-width: 1px !important;
padding: 0 !important;
}
}
}

.my-16 {
margin: 16px 0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { findDenominationString } from 'helpers/findDenomination';
import { useFlag } from 'hooks/useFlag';
import React, { useRef, useState } from 'react';
import { useManageCommunityStakeModalStore } from 'state/ui/modals';
import CWPageLayout from 'views/components/component_kit/new_designs/CWPageLayout';
import { CWText } from '../../components/component_kit/cw_text';
import { CWModal } from '../../components/component_kit/new_designs/CWModal';
import ManageCommunityStakeModal from '../../modals/ManageCommunityStakeModal/ManageCommunityStakeModal';
import IdeaLaunchpad from '../Communities/IdeaLaunchpad';
import './CommunityHomePage.scss';

const CommunityHome = () => {
const containerRef = useRef();
const tokenizedCommunityEnabled = useFlag('tokenizedCommunity');

const {
setModeOfManageCommunityStakeModal,
modeOfManageCommunityStakeModal,
} = useManageCommunityStakeModalStore();

const [selectedCommunityId] = useState<string>();

return (
// @ts-expect-error <StrictNullChecks/>
<CWPageLayout ref={containerRef} className="CommunitiesPageLayout">
<div className="CommunityHome">
<div className="header-section">
<div className="description">
<CWText
type="h1"
{...(tokenizedCommunityEnabled && { fontWeight: 'semiBold' })}
>
Home {tokenizedCommunityEnabled ? '' : 'Communities'}
</CWText>
</div>
<IdeaLaunchpad />
</div>
<CWModal
size="small"
content={
<ManageCommunityStakeModal
mode={modeOfManageCommunityStakeModal}
// @ts-expect-error <StrictNullChecks/>
onModalClose={() => setModeOfManageCommunityStakeModal(null)}
denomination={
findDenominationString(selectedCommunityId || '') || 'ETH'
}
/>
}
// @ts-expect-error <StrictNullChecks/>
onClose={() => setModeOfManageCommunityStakeModal(null)}
open={!!modeOfManageCommunityStakeModal}
/>
</div>
</CWPageLayout>
);
};

export default CommunityHome;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './CommunityHomePage';
Loading