Skip to content

Commit

Permalink
fix: format
Browse files Browse the repository at this point in the history
  • Loading branch information
Slavik191 committed Dec 3, 2024
1 parent 3b864e0 commit feeb196
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,18 @@ export const ecosystemProjects: CmsCollection = {
widget: "string",
required: false,
},
{ label: "Multichain Link", name: "l2Link", widget: "string", required: false },
{ label: "Multichain feature", name: "multichainFeature", widget: "boolean", required: false },
{
label: "Multichain Link",
name: "l2Link",
widget: "string",
required: false,
},
{
label: "Multichain feature",
name: "multichainFeature",
widget: "boolean",
required: false,
},
{
label: "Tokens",
name: "tokens",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ export const multichainProjects: CmsCollection = {
widget: "object",
collapsed: true,
fields: [
{ label: "Text", name: "text", widget: "string" },
{ label: "'Learn More' Link", name: "learnMoreLink", widget: "string", required: false },
{ label: "Text", name: "text", widget: "string" },
{
label: "'Learn More' Link",
name: "learnMoreLink",
widget: "string",
required: false,
},
],
},
{ label: "TVL Key", name: "tvlId", widget: "string", required: false },
Expand All @@ -41,8 +46,18 @@ export const multichainProjects: CmsCollection = {
collapsed: true,
fields: [
{ label: "Token name", name: "tokenName", widget: "string" },
{ label: "Buy link", name: "buyLink", widget: "string", required: false },
{ label: "Swap link", name: "swapLink", widget: "string", required: false },
{
label: "Buy link",
name: "buyLink",
widget: "string",
required: false,
},
{
label: "Swap link",
name: "swapLink",
widget: "string",
required: false,
},
{ label: "Bridge link", name: "bridgeLink", widget: "string" },
],
},
Expand All @@ -52,8 +67,18 @@ export const multichainProjects: CmsCollection = {
widget: "object",
collapsed: true,
fields: [
{ label: "Snapshot Vote Link", name: "snapshotVoteLink", widget: "string", required: false },
{ label: "Deployed Addresses Link", name: "deployedAddressesLink", widget: "string", required: false },
{
label: "Snapshot Vote Link",
name: "snapshotVoteLink",
widget: "string",
required: false,
},
{
label: "Deployed Addresses Link",
name: "deployedAddressesLink",
widget: "string",
required: false,
},
],
},
{
Expand Down
13 changes: 7 additions & 6 deletions features/cms/previews/multichain/multichain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ export const MultichainPreview = ({
fieldsMetaData,
}: PreviewTemplateComponentProps) => {
const { multichainPage = [] } = entry.getIn(["data"]).toJS();
const { multichainPage: { ["multichain-projects"]: data = {} } = {} } = fieldsMetaData.toJS();
const namesList = multichainPage.map((id: string)=> data?.[id]?.name).filter((name: string) => name)
console.log(multichainPage)
const { multichainPage: { ["multichain-projects"]: data = {} } = {} } =
fieldsMetaData.toJS();
const namesList = multichainPage
.map((id: string) => data?.[id]?.name)
.filter((name: string) => name);
console.log(multichainPage);
return (
<>
<div>
<h3>Multichain Page</h3>
<p>
{namesList.join(", ")}
</p>
<p>{namesList.join(", ")}</p>
</div>
</>
);
Expand Down
84 changes: 57 additions & 27 deletions features/cms/previews/multichainProject/multichainProject.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { PreviewTemplateComponentProps } from "netlify-cms-core";
import {
multichainProjects
} from "features/cms/initialize/collections/";
import { multichainProjects } from "features/cms/initialize/collections/";
import { withStyledComponentsRendered } from "features/cms/utils/StyleInjector";
import {
Wrapper,
Expand All @@ -12,7 +10,7 @@ import {
Button,
Projects,
Project,
InfoIcon
InfoIcon,
} from "./multichainProjectStyles";

export const MultichainProjectPreview = ({
Expand All @@ -22,10 +20,7 @@ export const MultichainProjectPreview = ({
const {
logo,
name = null,
description: {
text = null,
learnMoreLink = null
} = {},
description: { text = null, learnMoreLink = null } = {},
networkType = null,
stack = null,
ecosystemProjects = [],
Expand All @@ -39,11 +34,8 @@ export const MultichainProjectPreview = ({
swapLink = null,
bridgeLink = null,
} = {},
ecosystemFilters: {
network = null,
tokens: tokensId = []
} = {},
feature = false
ecosystemFilters: { network = null, tokens: tokensId = [] } = {},
feature = false,
} = entry.getIn(["data"]).toJS();
const data = fieldsMetaData.toJS();

Expand All @@ -52,16 +44,39 @@ export const MultichainProjectPreview = ({
<>
<Wrapper>
<Card feature={feature.toString()}>
<InfoIcon hiden={(!snapshotVoteLink && !deployedAddressesLink).toString()}>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fillRule="evenodd" clipRule="evenodd" d="M12 21.2C17.081 21.2 21.2 17.081 21.2 12C21.2 6.91898 17.081 2.8 12 2.8C6.91898 2.8 2.8 6.91898 2.8 12C2.8 17.081 6.91898 21.2 12 21.2ZM12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23Z" fill="#131217" fillOpacity="0.2"/>
<path d="M12.752 7.484C12.296 7.484 11.978 7.4 11.798 7.232C11.618 7.052 11.528 6.842 11.528 6.602C11.528 6.53 11.534 6.446 11.546 6.35C11.558 6.254 11.576 6.152 11.6 6.044C11.66 5.72 11.792 5.468 11.996 5.288C12.212 5.096 12.548 5 13.004 5C13.46 5 13.778 5.09 13.958 5.27C14.138 5.438 14.228 5.642 14.228 5.882C14.228 5.954 14.222 6.038 14.21 6.134C14.198 6.23 14.18 6.332 14.156 6.44C14.096 6.764 13.958 7.022 13.742 7.214C13.538 7.394 13.208 7.484 12.752 7.484ZM11.708 18.698C11.132 18.698 10.7 18.548 10.412 18.248C10.124 17.948 9.98 17.558 9.98 17.078C9.98 16.922 9.992 16.766 10.016 16.61C10.04 16.454 10.07 16.268 10.106 16.052L11.132 10.76H8L8.252 9.194H13.346L11.834 16.988L12.194 17.132L15.308 14.27L16.406 15.26L15.002 16.664C14.63 17.036 14.294 17.354 13.994 17.618C13.694 17.87 13.418 18.08 13.166 18.248C12.914 18.404 12.668 18.518 12.428 18.59C12.2 18.662 11.96 18.698 11.708 18.698Z" fill="#131217" fillOpacity="0.2"/>
<InfoIcon
hiden={(!snapshotVoteLink && !deployedAddressesLink).toString()}
>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M12 21.2C17.081 21.2 21.2 17.081 21.2 12C21.2 6.91898 17.081 2.8 12 2.8C6.91898 2.8 2.8 6.91898 2.8 12C2.8 17.081 6.91898 21.2 12 21.2ZM12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23Z"
fill="#131217"
fillOpacity="0.2"
/>
<path
d="M12.752 7.484C12.296 7.484 11.978 7.4 11.798 7.232C11.618 7.052 11.528 6.842 11.528 6.602C11.528 6.53 11.534 6.446 11.546 6.35C11.558 6.254 11.576 6.152 11.6 6.044C11.66 5.72 11.792 5.468 11.996 5.288C12.212 5.096 12.548 5 13.004 5C13.46 5 13.778 5.09 13.958 5.27C14.138 5.438 14.228 5.642 14.228 5.882C14.228 5.954 14.222 6.038 14.21 6.134C14.198 6.23 14.18 6.332 14.156 6.44C14.096 6.764 13.958 7.022 13.742 7.214C13.538 7.394 13.208 7.484 12.752 7.484ZM11.708 18.698C11.132 18.698 10.7 18.548 10.412 18.248C10.124 17.948 9.98 17.558 9.98 17.078C9.98 16.922 9.992 16.766 10.016 16.61C10.04 16.454 10.07 16.268 10.106 16.052L11.132 10.76H8L8.252 9.194H13.346L11.834 16.988L12.194 17.132L15.308 14.27L16.406 15.26L15.002 16.664C14.63 17.036 14.294 17.354 13.994 17.618C13.694 17.87 13.418 18.08 13.166 18.248C12.914 18.404 12.668 18.518 12.428 18.59C12.2 18.662 11.96 18.698 11.708 18.698Z"
fill="#131217"
fillOpacity="0.2"
/>
</svg>
</InfoIcon>
<Logo src={logo}/>
<Logo src={logo} />
<h2>{name || "..."}</h2>
<p>
{text || "..."} {learnMoreLink && <><Link>Learn more</Link>.</>}
{text || "..."}{" "}
{learnMoreLink && (
<>
<Link>Learn more</Link>.
</>
)}
</p>
<Row>
<span>Network Type</span>
Expand All @@ -71,28 +86,43 @@ export const MultichainProjectPreview = ({
<span>Stack</span>
<span>{stack || "..."}</span>
</Row>
<Button disable={(!tokenName || !(buyLink || swapLink || bridgeLink)).toString()}>
<Button
disable={(
!tokenName || !(buyLink || swapLink || bridgeLink)
).toString()}
>
Get {tokenName || "..."}
</Button>
</Card>

<Card feature={feature.toString()} disable={(ecosystemProjects.length === 0).toString()}>
<Card
feature={feature.toString()}
disable={(ecosystemProjects.length === 0).toString()}
>
<h3>DeFi options for</h3>
<h2>{name || "..."}</h2>
<Projects>
{ecosystemProjects && ecosystemProjects.map((projectId: string) =>
{ecosystemProjects &&
ecosystemProjects.map((projectId: string) =>
ecosystems?.[projectId] ? (
<Project key={ecosystems[projectId].name}>
<img src={ecosystems[projectId].logo} className={"logo"}/>
<img src={ecosystems[projectId].logo} className={"logo"} />
<div className={"text"}>
<h5>{ecosystems[projectId].name}</h5>
<p className={"description"}>{ecosystems[projectId].l2Description ? ecosystems[projectId].l2Description : ecosystems[projectId].description}</p>
<p className={"description"}>
{ecosystems[projectId].l2Description
? ecosystems[projectId].l2Description
: ecosystems[projectId].description}
</p>
</div>
</Project>
) : null
)}
)}
</Projects>
<Button v2={"true"} hiden={(!(network && tokensId.length > 0)).toString()}>
<Button
v2={"true"}
hiden={(!(network && tokensId.length > 0)).toString()}
>
more DeFi options
</Button>
</Card>
Expand All @@ -106,4 +136,4 @@ export const registerMultichainProjectPreviewTemplate = () => {
multichainProjects.name,
withStyledComponentsRendered(MultichainProjectPreview)
);
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import styled from "styled-components";

export const Wrapper = styled.div``;

export const Card = styled.div<{ feature?: string, disable?: string }>`
export const Card = styled.div<{ feature?: string; disable?: string }>`
position: relative;
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -48,12 +48,11 @@ export const Logo = styled.img`
height: 200px;
&::after {
}
`;

export const Link = styled.span`
color: #0085FF;
color: #0085ff;
`;

export const Row = styled.div`
Expand All @@ -67,7 +66,11 @@ export const Row = styled.div`
box-sizing: border-box;
`;

export const Button = styled.div<{ v2?: string, hiden?: string, disable?: string }>`
export const Button = styled.div<{
v2?: string;
hiden?: string;
disable?: string;
}>`
display: flex;
align-items: center;
justify-content: center;
Expand Down
2 changes: 1 addition & 1 deletion pages/admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
registerFaqWidgetsPreviewTemplate,
registerStethInDefiProjectPreviewTemplate,
registerMultichainProjectPreviewTemplate,
registerMultichainPreviewTemplate
registerMultichainPreviewTemplate,
} from "features/cms";

export default function Tmp() {
Expand Down

0 comments on commit feeb196

Please sign in to comment.