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 deposited tab #490

Merged
merged 6 commits into from
Jan 24, 2025
Merged
Changes from 3 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
6 changes: 6 additions & 0 deletions frontend/src/assets/icons/deposited.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions frontend/src/components/dashboard/deposited/Deposited.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import "./dashboard.css";
obah marked this conversation as resolved.
Show resolved Hide resolved
import { ReactComponent as EthIcon } from '../../../assets/icons/ethereum.svg';
import { ReactComponent as StrkIcon } from '../../../assets/icons/strk.svg';
import { ReactComponent as UsdIcon } from '../../../assets/icons/usd_coin.svg';

function Deposited({ data }) {
return (
<div className="tab-content">
<div className="deposited-info">
<div>
<span className="icon"><EthIcon /></span>
<p className="currency-name">ETH</p>
<p className="currency-value">{data.eth}</p>
</div>

<div className="info-divider" />

<div>
<span className="icon"><StrkIcon /></span>
<p className="currency-name">STRK</p>
<p className="currency-value">{data.strk}</p>
</div>

<div className="info-divider" />

<div>
<span className="icon"><UsdIcon /></span>
<p className="currency-name">USDC</p>
<p className="currency-value">{data.usdc}</p>
</div>

<div className="info-divider" />

<div>
<span className="icon"><EthIcon /></span>
<p className="currency-name">USDT</p>
<p className="currency-value">{data.usdt}</p>
</div>
</div>
</div>
)
}

export default Deposited;
72 changes: 72 additions & 0 deletions frontend/src/components/dashboard/deposited/deposited.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
.tab-content {
font-size: 16px;
font-weight: 600;
text-align: left;
width: fit-content;
height: fit-content;
padding: 4px;
padding-top: 0;
}

.icon {
width: 32px;
height: 32px;
margin-right: 8px;
background: var(--border-color);
border-radius: 900px;
display: flex;
align-items: center;
justify-content: center;
padding: 7px;
}

.deposited-info {
display: flex;
flex-direction: column;
gap: 8px;
justify-content: center;
align-items: center;
}

.currency-name {
color: var(--warning-text-color);
}

.currency-value {
color: var(--gray);
}

.info-divider {
height: 3px;
width: 100%;
border-radius: 8px;
background-color: var(--border-color);
margin: 0 1rem;
}

@media (max-width: 768px) {
.icon {
width: 24px;
height: 24px;
margin-right: 4px;
padding: 3px;
}

.tab-content {
width: 100%;
height: auto;
padding: 16px;
}
}

@media (max-width: 480px) {
.tab-content {
width: fit-content;
font-size: 14px;
}

.icon {
width: 20px;
height: 20px;
}
}
48 changes: 40 additions & 8 deletions frontend/src/pages/dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import { ReactComponent as StrkIcon } from '../../assets/icons/strk.svg';
import { ReactComponent as UsdIcon } from '../../assets/icons/usd_coin.svg';
import { ReactComponent as BorrowIcon } from '../../assets/icons/borrow_dynamic.svg';
import { ReactComponent as TelegramIcon } from '../../assets/icons/telegram_dashboard.svg';
import { ReactComponent as DepositIcon} from '../../assets/icons/deposited.svg';
import Spinner from '../../components/ui/spinner/Spinner';
import useDashboardData from '../../hooks/useDashboardData';
import { useClosePosition, useCheckPosition } from '../../hooks/useClosePosition';
@@ -22,10 +23,12 @@ import clockIcon from 'assets/icons/clock.svg';
import computerIcon from 'assets/icons/computer-icon.svg';
import depositIcon from 'assets/icons/deposit.svg';
import withdrawIcon from 'assets/icons/withdraw.svg';
import Deposited from "../../components/dashboard/deposited/Deposited";
obah marked this conversation as resolved.
Show resolved Hide resolved

export default function Component({ telegramId }) {
const { walletId } = useWalletStore();
const [isCollateralActive, setIsCollateralActive] = useState(true);
// const [isCollateralActive, setIsCollateralActive] = useState(true);
obah marked this conversation as resolved.
Show resolved Hide resolved
const [activeTab, setActiveTab] = useState("collateral");
obah marked this conversation as resolved.
Show resolved Hide resolved
const [showModal, setShowModal] = useState(false);
const handleOpen = () => setShowModal(true);
const handleClose = () => setShowModal(false);
@@ -166,6 +169,8 @@ export default function Component({ telegramId }) {
},
];

const depositedData = {eth: 1, strk: 12, usdc: 4, usdt: 9};

return (
<div className="dashboard">
<Sidebar items={dashboardItems} />
@@ -182,8 +187,8 @@ export default function Component({ telegramId }) {
<div className="dashboard-info-card">
<div className="tabs">
obah marked this conversation as resolved.
Show resolved Hide resolved
<button
onClick={() => setIsCollateralActive(true)}
className={`tab ${isCollateralActive ? 'active' : ''}`}
onClick={() => setActiveTab("collateral")}
className={`tab ${activeTab === "collateral" ? 'active' : ''}`}
>
<CollateralIcon className="tab-icon" />
<span className="tab-title">Collateral & Earnings</span>
@@ -192,26 +197,53 @@ export default function Component({ telegramId }) {
<div className="tab-divider" />

<button
onClick={() => setIsCollateralActive(false)}
className={`tab ${!isCollateralActive ? 'active borrow' : ''}`}
onClick={() => setActiveTab("borrow")}
className={`tab ${activeTab === "borrow" ? 'active' : ''}`}
>
<BorrowIcon className="tab-icon" />
<span className="tab-title">Borrow</span>
</button>

<div className="tab-divider" />

<button
onClick={() => setActiveTab("deposited")}
className={`tab ${activeTab === "deposited" ? 'active' : ''}`}
>
<DepositIcon className="tab-icon" />
<span className="tab-title">Deposited</span>
</button>
<div className="tab-indicator-container">
<div className={`tab-indicator ${isCollateralActive ? 'collateral' : 'borrow'}`} />
{/* <div className={`tab-indicator ${isCollateralActive ? 'collateral' : 'borrow'}`} /> */}
<div className={`tab-indicator ${activeTab}`} />
</div>
</div>
{isCollateralActive ? (
{activeTab === "collateral" && (
<Collateral
getCurrentSumColor={getCurrentSumColor}
startSum={startSum}
currentSum={currentSum}
data={cardData}
/>
) : (
)}

{activeTab === "borrow" && (
<Borrow data={cardData} />
)}

{activeTab === "deposited" && (
<Deposited data={depositedData} />
)}
{/* {isCollateralActive ? (
<Collateral
getCurrentSumColor={getCurrentSumColor}
startSum={startSum}
currentSum={currentSum}
data={cardData}
/>
) : (
<Borrow data={cardData} />
)} */}
obah marked this conversation as resolved.
Show resolved Hide resolved
</div>
<Button
className="redeem-btn"
27 changes: 21 additions & 6 deletions frontend/src/pages/dashboard/dashboard.css
obah marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -112,10 +112,14 @@ body {
color: var(--nav-button-hover);
}

.tab.active.borrow {
/* .tab.active.borrow {
color: #ff35d3;
}

.tab.active.deposited {
color: var(--nav-button-hover)
} */

.tab-indicator-container {
position: absolute;
bottom: -16px;
@@ -129,19 +133,30 @@ body {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
/* width: 100%; */
height: 100%;
transition: transform 0.3s ease;
}

.tab-indicator.collateral {
background: linear-gradient(90deg, #49abd2 0%, rgba(40, 16, 41, 0) 100%);
transform: translateX(0);
/* background: linear-gradient(90deg, #49abd2 0%, rgba(40, 16, 41, 0) 100%);
transform: translateX(0); */
width: 213px;
background: var(--nav-button-hover);
}

.tab-indicator.borrow {
background: linear-gradient(90deg, rgba(40, 16, 41, 0) 0%, #ff35d3 100%);
transform: translateX(0);
/* background: linear-gradient(90deg, rgba(40, 16, 41, 0) 0%, #ff35d3 100%, rgba(40, 16, 41, 0) 0%,);
transform: translateX(0); */
width: 155px;
background: var(--nav-button-hover);
}

.tab-indicator.deposited {
/* background: linear-gradient(90deg, rgba(40, 16, 41, 0) 0%, #74d6fd 100%);
transform: translateX(0); */
width: 155px;
background: var(--nav-button-hover);
}

.tab-icon {