Skip to content

Commit

Permalink
community-home-token-launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
salman-neslit committed Dec 26, 2024
1 parent 86109cf commit 72451a8
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 0 deletions.
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, setSelectedCommunityId] = 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';

0 comments on commit 72451a8

Please sign in to comment.