diff --git a/src/App.js b/src/App.js new file mode 100644 index 0000000..39bbe2e --- /dev/null +++ b/src/App.js @@ -0,0 +1,23 @@ +import React, { useState, useEffect } from 'react'; +import WelcomeModal from './components/WelcomeModal'; + +function App() { + const [showWelcomeModal, setShowWelcomeModal] = useState(false); + + useEffect(() => { + // Check if user has visited before + const hasVisited = localStorage.getItem('hasVisitedCAP'); + if (!hasVisited) { + setShowWelcomeModal(true); + localStorage.setItem('hasVisitedCAP', 'true'); + } + }, []); + + return ( +
+ setShowWelcomeModal(false)} /> +
+ ); +} + +export default App; \ No newline at end of file diff --git a/src/components/WelcomeModal.css b/src/components/WelcomeModal.css new file mode 100644 index 0000000..0eb62dc --- /dev/null +++ b/src/components/WelcomeModal.css @@ -0,0 +1,41 @@ +.tab-content { + padding: 20px 0; +} + +.tab-content h5 { + margin-bottom: 15px; + font-weight: 600; +} + +.tab-content h6 { + margin-bottom: 10px; + font-weight: 600; +} + +.tab-content p { + margin-bottom: 15px; + line-height: 1.5; +} + +.tab-content ul { + margin-bottom: 20px; +} + +.tab-content li { + margin-bottom: 8px; +} + +.bridge-steps .step, +.instruction-section { + margin-bottom: 20px; +} + +.bridge-steps .step:last-child, +.instruction-section:last-child { + margin-bottom: 0; +} + +.bridge-steps .step h6, +.instruction-section h6 { + color: #007bff; +} \ No newline at end of file diff --git a/src/components/WelcomeModal.js b/src/components/WelcomeModal.js new file mode 100644 index 0000000..a0275a0 --- /dev/null +++ b/src/components/WelcomeModal.js @@ -0,0 +1,83 @@ +import React, { useState, useEffect } from 'react'; +import './WelcomeModal.css'; + +const WelcomeModal = () => { + const [isOpen, setIsOpen] = useState(false); + const [currentStep, setCurrentStep] = useState(0); + + const steps = [ + { + title: "Welcome to CAP", + content: "CAP is a decentralized trading platform that allows you to trade digital assets with low fees and high performance." + }, + { + title: "How to Use the Dashboard", + content: "Navigate through the dashboard using the sidebar. You can view your positions, trading history, and portfolio performance." + }, + { + title: "Bridging Funds", + content: "To deposit funds, use the integrated bridge to move assets from Arbitrum to CAP. You can access the bridge anytime from the 'Bridge' tab." + } + ]; + + const openModal = () => { + setIsOpen(true); + // Load the appropriate step content + if (localStorage.getItem('welcomeModalStep')) { + setCurrentStep(parseInt(localStorage.getItem('welcomeModalStep'))); + } + }; + + const closeModal = () => { + setIsOpen(false); + localStorage.setItem('welcomeModalStep', currentStep); + }; + + const nextStep = () => { + if (currentStep < steps.length - 1) { + setCurrentStep(currentStep + 1); + } else { + closeModal(); + } + }; + + const prevStep = () => { + if (currentStep > 0) { + setCurrentStep(currentStep - 1); + } + }; + + // When the component mounts, check if the welcome modal has been shown + useEffect(() => { + if (!localStorage.getItem('hasShownWelcomeModal')) { + openModal(); + localStorage.setItem('hasShownWelcomeModal', 'true'); + } + }, []); + + return ( +
+ {isOpen && ( +
+
+

{steps[currentStep]?.title}

+

{steps[currentStep]?.content}

+ +
+ {currentStep > 0 && ( + + )} + {currentStep < steps.length - 1 ? ( + + ) : ( + + )} +
+
+
+ )} +
+ ); +}; + +export default WelcomeModal; \ No newline at end of file diff --git a/src/components/WelcomeModal.jsx b/src/components/WelcomeModal.jsx new file mode 100644 index 0000000..a7804dd --- /dev/null +++ b/src/components/WelcomeModal.jsx @@ -0,0 +1,104 @@ +import React, { useState } from 'react'; +import { Modal, Button, Tabs, Tab } from 'react-bootstrap'; +import './WelcomeModal.css'; + +const WelcomeModal = ({ show, onHide }) => { + const [key, setKey] = useState('welcome'); + + return ( + + + Welcome to CAP Trading Dashboard + + + setKey(k)} + > + +
+
What is CAP?
+

CAP is a decentralized trading protocol that allows users to trade assets with low fees and high efficiency.

+ +
Getting Started
+
    +
  • Connect your wallet using the button in the top right
  • +
  • Bridge funds from Arbitrum using the Bridge tab
  • +
  • Start trading using the trading dashboard
  • +
+
+
+ + +
+
Bridge Funds from Arbitrum
+

To start trading, you'll need to bridge your funds from Arbitrum to CAP.

+ +
+
+
Step 1: Connect Wallet
+

Make sure your wallet is connected to the Arbitrum network.

+
+
+
Step 2: Select Assets
+

Choose which assets you want to bridge to CAP.

+
+
+
Step 3: Confirm Transaction
+

Confirm the bridge transaction in your wallet.

+
+
+
Step 4: Wait for Confirmation
+

Wait for the bridge to complete (usually 1-5 minutes).

+
+
+ + +
+
+ + +
+
Using the Trading Dashboard
+ +
+
1. Market Selection
+

Choose which trading pair you want to trade from the market selector dropdown.

+
+ +
+
2. Order Placement
+

Enter your order details in the order form on the left panel. You can place market orders, limit orders, and stop orders.

+
+ +
+
3. Order Book
+

View the current buy and sell orders in the order book in the center of the screen.

+
+ +
+
4. Trade History
+

See your recent trades and order history in the right panel.

+
+ +
+
5. Portfolio
+

Check your current holdings and account balances at the bottom of the screen.

+
+
+
+
+
+ + + +
+ ); +}; + +export default WelcomeModal; \ No newline at end of file