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

updated onboarding #4

Open
wants to merge 1 commit into
base: main
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
59 changes: 59 additions & 0 deletions src/js-components/Advantages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import clsx from 'clsx';
import styles from './styles.module.css';
import React from 'react';


import OutwardArrowIcon from '@site/static/img/icons/outward_arrow.svg'
import InfoIcon from '@site/static/img/icons/info.svg'
import CodeIcon from '@site/static/img/icons/code.svg'
import OpenBookIcon from '@site/static/img/icons/open_book.svg'

const advantageItems = [
{
title: 'Lowest Borrow Rates.',
},
{
title: 'More assets, higher LTVs.',
},
{
title: 'Fixed rates for fixed terms.',
},
];

function AdvantageContent(advantageItem) {
const { title } = advantageItem;
return (
<div className={clsx('card')}>
<div className={clsx('card__body')}>
<div className={clsx(styles.advantageHeader)}>
<div>
<InfoIcon className={clsx(styles.advantageIcon)} role="img" />
<div></div>
</div>
<h4>{title}</h4>
</div>
</div>
</div >
)
}
Comment on lines +23 to +38
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use destructuring for function parameters.

The AdvantageContent function can use destructuring directly in the parameter list for cleaner code.

Apply this diff to use destructuring:

-function AdvantageContent(advantageItem) {
-  const { title } = advantageItem;
+function AdvantageContent({ title }) {
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function AdvantageContent(advantageItem) {
const { title } = advantageItem;
return (
<div className={clsx('card')}>
<div className={clsx('card__body')}>
<div className={clsx(styles.advantageHeader)}>
<div>
<InfoIcon className={clsx(styles.advantageIcon)} role="img" />
<div></div>
</div>
<h4>{title}</h4>
</div>
</div>
</div >
)
}
function AdvantageContent({ title }) {
return (
<div className={clsx('card')}>
<div className={clsx('card__body')}>
<div className={clsx(styles.advantageHeader)}>
<div>
<InfoIcon className={clsx(styles.advantageIcon)} role="img" />
<div></div>
</div>
<h4>{title}</h4>
</div>
</div>
</div >
)
}


function Advantage(advantageItem) {
return (
<div className={clsx('col col--4 ')}>
<AdvantageContent {...advantageItem} />
</div >
)
};
Comment on lines +40 to +46
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use destructuring for function parameters.

The Advantage function can use destructuring directly in the parameter list for cleaner code.

Apply this diff to use destructuring:

-function Advantage(advantageItem) {
+function Advantage({ title }) {

Committable suggestion was skipped due to low confidence.

export default function Advantages() {
return (
<section>
<div className="container">
<div className="row">
{advantageItems.map((props, idx) => (
<Advantage key={idx} {...props} />
))}
</div>
</div>
</section >
);
}
66 changes: 47 additions & 19 deletions src/js-components/Features.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,47 @@ import React from 'react';

import OutwardArrowIcon from '@site/static/img/icons/outward_arrow.svg'
import InfoIcon from '@site/static/img/icons/info.svg'
import CodeIcon from '@site/static/img/icons/code.svg'
import XLogo from "@site/static/img/x_logo.svg";
import DiscordLogo from "@site/static/img/discord_logo.svg";
import AppLogo from "@site/static/img/app_logo.svg";
import OpenBookIcon from '@site/static/img/icons/open_book.svg'



const featureItems = [
{
title: 'Stay Updated',
Icon: XLogo,
description: (
<>
Follow us on Twitter to get the most recent updates on product, partnerships, and opportunties on Loopscale!
</>
),
external_url: "https://x.com/LoopscaleLabs",
disabled: false
},
{
title: 'Access Alpha',
Icon: DiscordLogo,
description: (
<>
Jump in the Discord to ask questions, learn about the future of the Loopscale ecosystem, and more.
</>
),
external_url: "https://discord.gg/loopscale",
disabled: false
},
{
title: 'Use Loopscale',
Icon: AppLogo,
description: (
<>
Jump on the app and start lending or borrowing. Rack up points to stay as far ahead as you can.
</>
),
external_url: "https://app.loopscale.com",
disabled: false
},
{
title: 'What is Loopscale',
Icon: InfoIcon,
Expand All @@ -31,20 +66,7 @@ const featureItems = [
</>
),
slug: "/user-guides/create-an-account",
disabled: true

},
{
title: 'Loopscale Protocol',
Icon: CodeIcon,
description: (
<>
Learn about the architecture of the Loopscale Protocol smart contracts through guided examples.
</>
),
slug: "/protocol",
disabled: true

disabled: false
},
];
function Tag({ text }) {
Expand All @@ -69,23 +91,29 @@ function FeatureContent(featureItem) {

function Feature(featureItem) {
const { slug, disabled } = featureItem;
const colSize = featureItem.small ? 'col col--4 ' : 'col col--6 ';
return (
<div className={clsx('col col--4 ')}>
<div className={clsx(colSize)}>
Comment on lines +94 to +96
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use destructuring for function parameters.

The Feature function can use destructuring directly in the parameter list for cleaner code.

Apply this diff to use destructuring:

-function Feature(featureItem) {
-  const { slug, disabled } = featureItem;
+function Feature({ slug, disabled, small }) {

Committable suggestion was skipped due to low confidence.

{
disabled ? <FeatureContent {...featureItem} /> :
<a target="_self" href={slug}><FeatureContent {...featureItem} /></a>

}
</div >
)
};

export default function Features() {
return (
<section>
<div className="container">
<div className="row">
{featureItems.map((props, idx) => (
<Feature key={idx} {...props} />
{featureItems.slice(0,3).map((props, idx) => (
<Feature key={idx} {...{...props, small: true}} />
))}
</div>
<div className="row">
{featureItems.slice(3,5).map((props, idx) => (
<Feature key={idx} {...{...props, small: false}} />
))}
</div>
</div>
Expand Down
44 changes: 44 additions & 0 deletions src/js-components/GettingStarted.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import clsx from 'clsx';
import styles from './styles.module.css';
import React from 'react';
import connect from "@site/static/img/docs/onboarding-cards/connect.png"
import points from "@site/static/img/docs/onboarding-cards/points.png"
import borrow from "@site/static/img/docs/onboarding-cards/borrow.png"
import OutwardArrowIcon from '@site/static/img/icons/outward_arrow.svg'

const onboardingSteps = [
{
imgPath: connect,
},
{
imgPath: points
},
{
imgPath: borrow
},
]

const OnboardingStep = (stepDetails) => {
const { imgPath } = stepDetails;

return (
<div className={clsx('card', styles.product)}>
<OutwardArrowIcon className={clsx(styles.productArrowIcon)} role="img" />
<img src={imgPath} className={clsx(styles.productImage)} />
</div>
)
};

export default function GettingStarted() {
return (
<div className="container">
<div className="row">
{onboardingSteps.map(productItem =>
<div className={clsx('col col--4')}>
<OnboardingStep {...productItem} />
</div>)
Comment on lines +36 to +39
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a key property to the iterable.

The onboardingSteps.map should include a key property for each element to help React identify which items have changed.

Apply this diff to add the key property:

 {onboardingSteps.map((productItem, index) =>
   <div className={clsx('col col--4')} key={index}>
     <OnboardingStep {...productItem} />
   </div>)
 }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{onboardingSteps.map(productItem =>
<div className={clsx('col col--4')}>
<OnboardingStep {...productItem} />
</div>)
{onboardingSteps.map((productItem, index) =>
<div className={clsx('col col--4')} key={index}>
<OnboardingStep {...productItem} />
</div>)
Tools
Biome

[error] 37-37: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

}
</div>
</div>
);
}
20 changes: 8 additions & 12 deletions src/js-components/Home.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import clsx from 'clsx';
import React from 'react';
import { Features, Resources } from '@site/src/js-components';
import SearchBar from '@theme/SearchBar'
import { Features, GettingStarted } from '@site/src/js-components';
import styles from './styles.module.css';
import Advantages from './Advantages';

function Header() {
return (
<div className={clsx("container")}>
<div className={clsx("col col--8 col--offset-2", styles.header)}>
<h1>Loopscale Docs</h1>
<p className={clsx(styles.subtitle)}>
Loopscale provides market-driven, modular credit infrastructure for the next generation of capital markets.
</p>
<SearchBar />
<h1>Loopscale</h1>
<p className={clsx(styles.subtitle)}>
Loopscale is the next generation of onchain borrowing and lending platform that uses an orderbook instead of a curve to determine interest rate.
</p>
<Advantages />
</div>
</div>
)
Expand All @@ -22,14 +22,10 @@ export default function Home() {
return (
<main className="homeContainer">
<div className={clsx(styles.homeContainer)}>

<Header />
<GettingStarted />
<Features />
</div>
{/* <div className={clsx("container")}>
<hr />
</div>
<Resources /> */}
</main >
);
}
3 changes: 2 additions & 1 deletion src/js-components/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { default as Home } from '@site/src/js-components/Home.js';
export { default as Resources } from '@site/src/js-components/Resources.js';
export { default as Products } from '@site/src/js-components/Products.js';

export { default as GettingStarted } from "@site/src/js-components/GettingStarted.js";
export { default as Advantages } from '@site/src/js-components/Advantages.js';
export { default as Features } from '@site/src/js-components/Features.js';
export * from '@site/src/js-components/inline.js';
16 changes: 16 additions & 0 deletions src/js-components/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@
margin-bottom: var(--ifm-card-vertical-spacing);
}

.advantageHeader {
height: 100%;
text-align: left;
display: flex;
flex-direction: row;
justify-content: space-between;
color: var(--text-caption-color);
margin-bottom: var(--ifm-card-vertical-spacing);
}

.advantageIcon {
height: 32px;
width: 32px;
padding-right: 10px;
}

.cardBody {
font-size: var(--body1-font-size);
color: var(--text-caption-color)
Expand Down
2 changes: 1 addition & 1 deletion static/img/app_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion static/img/discord_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/docs/onboarding-cards/borrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/docs/onboarding-cards/connect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/docs/onboarding-cards/points.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions static/img/x_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.