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

Add project-details tab card components #147

Merged
merged 1 commit into from
Apr 7, 2024
Merged
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
2 changes: 1 addition & 1 deletion src/projects/components/project-details-cards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const ProjectDetailsCards = ({ projects }: Props) => {
return (
<div className="flex flex-col gap-6">
{projects.map((project) => (
<ProjectDetailsCard key={project.id} project={project} />
<ProjectDetailsCard key={project.id} withActions project={project} />
))}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import { ProjectDetailsCardLinks } from './links';

interface Props {
project: ProjectAllInfo;
withActions?: boolean;
}

export const ProjectDetailsCard = ({ project }: Props) => {
export const ProjectDetailsCard = ({ project, withActions }: Props) => {
const { name, website, logo, description, chains } = project;

const src = getLogoUrl(website, logo);
Expand Down Expand Up @@ -62,11 +63,15 @@ export const ProjectDetailsCard = ({ project }: Props) => {

<ChainsInfoTag chains={chains} />

<Divider />
{withActions && (
<>
<Divider />

<DetailsPanelActionsWrapper>
<DetailsPanelCTA text={CTA_TEXT} />
</DetailsPanelActionsWrapper>
<DetailsPanelActionsWrapper>
<DetailsPanelCTA text={CTA_TEXT} />
</DetailsPanelActionsWrapper>
</>
)}
</DetailsPanelCardWrapper>
);
};
Expand Down
21 changes: 19 additions & 2 deletions src/projects/pages/project-params-page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use client';

import dynamic from 'next/dynamic';

import { ROUTE_TABS } from '~/shared/core/constants';

import { useProjectDetails } from '~/projects/hooks/use-project-details';
Expand All @@ -16,8 +18,23 @@ export const ProjectParamsPage = ({ params: { id, tab } }: Props) => {

if (!data) return null;

if (tab === ROUTE_TABS.SHARED.DETAILS) return <p>ProjectDetailsCard</p>;
if (tab === ROUTE_TABS.SHARED.ORG) return <p>ProjectOrgCard</p>;
if (tab === ROUTE_TABS.SHARED.DETAILS) {
return <ProjectDetailsCard project={data} />;
}

if (tab === ROUTE_TABS.SHARED.ORG) {
return <OrgDetailsCard withActions org={data.organization} />;
}

return null;
};

const ProjectDetailsCard = dynamic(() =>
import(
'~/projects/components/project-details-cards/project-details-card'
).then((m) => m.ProjectDetailsCard),
);

const OrgDetailsCard = dynamic(() =>
import('~/orgs/components/org-details-card').then((m) => m.OrgDetailsCard),
);
Loading