Skip to content

Commit

Permalink
working version of the app
Browse files Browse the repository at this point in the history
  • Loading branch information
nadvolod committed Feb 20, 2022
1 parent e904cb8 commit d4599e7
Show file tree
Hide file tree
Showing 18 changed files with 569 additions and 379 deletions.
43 changes: 43 additions & 0 deletions blockchain-app/client/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"env": {
"browser": true,
"es2021": true
},
"parser": "@typescript-eslint/parser",
"extends": [
"airbnb",
Expand Down Expand Up @@ -29,6 +33,45 @@
"namedComponents": "arrow-function",
"unnamedComponents": "arrow-function"
}
],
"react/react-in-jsx-scope": 0,
"react/jsx-props-no-spreading": 0,
"import/extensions": 0,
"react/prop-types": 0,
"linebreak-style": 0,
"react/state-in-constructor": 0,
"import/prefer-default-export": 0,
"max-len": [2, 250],
"operator-linebreak": 0,
"comma-dangle": 0,
"no-console": 0,
"no-alert": 0,
"no-multiple-empty-lines": [
"error",
{
"max": 1,
"maxEOF": 1
}
],
"no-underscore-dangle": [
"error",
{
"allow": ["_d", "_dh", "_h", "_id", "_m", "_n", "_t", "_text"]
}
],
"object-curly-newline": 0,
"jsx-a11y/click-events-have-key-events": 0,
"jsx-a11y/alt-text": 0,
"jsx-a11y/no-autofocus": 0,
"jsx-a11y/no-static-element-interactions": 0,
"react/no-array-index-key": 0,
"jsx-a11y/anchor-is-valid": [
"error",
{
"components": ["Link"],
"specialLink": ["to", "hrefLeft", "hrefRight"],
"aspects": ["noHref", "invalidHref", "preferButton"]
}
]
}
}
42 changes: 0 additions & 42 deletions blockchain-app/client/src/App.css

This file was deleted.

24 changes: 10 additions & 14 deletions blockchain-app/client/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import './index.css'
// imd
import { Navbar, Welcome, Footer, Services, Transactions } from './components'

const App = () => {
return (
<div className="min-h-screen">
<div className="gradient-bg-welcome">
<Navbar />
<Welcome />
</div>
<Services />
<Transactions />
<Footer />
const App = () => (
<div className="min-h-screen">
<div className="gradient-bg-welcome">
<Navbar />
<Welcome />
</div>
)
}
<Services />
<Transactions />
<Footer />
</div>
)

export default App
34 changes: 30 additions & 4 deletions blockchain-app/client/src/components/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
import React from 'react';
import React from "react";

const Footer = () => {
return <div>Footer</div>;
};
import logo from "../../images/logo.png";

const Footer = () => (
<div className="w-full flex md:justify-center justify-between items-center flex-col p-4 gradient-bg-footer">
<div className="w-full flex sm:flex-row flex-col justify-between items-center my-4">
<div className="flex flex-[0.5] justify-center items-center">
<img src={logo} alt="logo" className="w-32" />
</div>
<div className="flex flex-1 justify-evenly items-center flex-wrap sm:mt-0 mt-5 w-full">
<p className="text-white text-base text-center mx-2 cursor-pointer">Market</p>
<p className="text-white text-base text-center mx-2 cursor-pointer">Exchange</p>
<p className="text-white text-base text-center mx-2 cursor-pointer">Tutorials</p>
<p className="text-white text-base text-center mx-2 cursor-pointer">Wallets</p>
</div>
</div>

<div className="flex justify-center items-center flex-col mt-5">
<p className="text-white text-sm text-center">Come join us and hear for the unexpected miracle</p>
<p className="text-white text-sm text-center font-medium mt-2">[email protected]</p>
</div>

<div className="sm:w-[90%] w-full h-[0.25px] bg-gray-400 mt-5 " />

<div className="sm:w-[90%] w-full flex justify-between items-center mt-3">
<p className="text-white text-left text-xs">@kryptomastery2022</p>
<p className="text-white text-right text-xs">All rights reserved</p>
</div>
</div>
);

export default Footer;
9 changes: 3 additions & 6 deletions blockchain-app/client/src/components/Loader.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import React from 'react';

// notice that here we have () with no return statement as we typically do for a component
const Loader = () => (
<div className='flex justify-center items-center py-3'>
<div className='animate-spin rounded-full h-32 w-32 border-b-2 border-red-700' />
</div>
<div className="flex justify-center items-center py-3">
<div className="animate-spin rounded-full h-32 w-32 border-b-2 border-red-700" />
</div>
);

export default Loader;
28 changes: 11 additions & 17 deletions blockchain-app/client/src/components/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
// rafce
import React from 'react'
import { HiMenuAlt4 } from 'react-icons/hi'
import { AiOutlineClose } from 'react-icons/ai'

import logo from '../../images/logo.png'

// another component, created outside of the Navbar component
const NavBarItem = ({ title, classprops }) => {
return <li className={`mx-4 cursor-pointer ${classprops}`}>{title}</li>
}
const NavBarItem = ({ title, classprops }) => (
<li className={`mx-4 cursor-pointer ${classprops}`}>{title}</li>
)

const Navbar = () => {
// search docs to see how to use class names
// https://tailwindcss.com/docs/width#percentage-widths
const [toggleMenu, setToggleMenu] = React.useState(false)

return (
<nav className="w-full flex md:justify-center justify-between items-center p-4">
<div className="md:flex-[0.5] flex-initial justify-center items-center">
<img src={logo} alt="logo" className="w-32 cursor-pointer" />
</div>
<ul className="text-white md:flex hidden list-none flex-row justify-between items-center flex-initial">
{/* {['Market', 'Exchange', 'Tutorials', 'Wallets'].map((item, index) => (
<NavBarItem key={item + index} title={item} />
))} */}
{/* Login button */}
{/* <ul className="text-white md:flex hidden list-none flex-row justify-between items-center flex-initial">
{['Market', 'Exchange', 'Tutorials', 'Wallets'].map((item, index) => (
<NavBarItem key={item + index} title={item} />
))}
<li className="bg-[#2952e3] py-2 px-7 mx-4 rounded-full cursor-pointer hover:bg-[#2546bd]">
Login
</li>
</ul>
{/* navigation for mobile devices */}
<div className="flex relative" data-testid="hamburger-menu">
</ul> */}
<div className="flex relative">
{!toggleMenu && (
<HiMenuAlt4
fontSize={28}
Expand All @@ -46,14 +41,13 @@ const Navbar = () => {
)}
{toggleMenu && (
<ul
data-testid="mobile-menu-open"
className="z-10 fixed -top-0 -right-2 p-3 w-[70vw] h-screen shadow-2xl md:hidden list-none
flex flex-col justify-start items-end rounded-md blue-glassmorphism text-white animate-slide-in"
>
<li className="text-xl w-full my-2">
<AiOutlineClose onClick={() => setToggleMenu(false)} />
</li>
{['Wallets'].map((item, index) => (
{['Market', 'Exchange', 'Tutorials', 'Wallets'].map((item, index) => (
<NavBarItem key={item + index} title={item} classprops="my-2 text-lg" />
))}
</ul>
Expand Down
60 changes: 55 additions & 5 deletions blockchain-app/client/src/components/Services.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,57 @@
import React from 'react';
import React from 'react'
import { BsShieldFillCheck } from 'react-icons/bs'
import { BiSearchAlt } from 'react-icons/bi'
import { RiHeart2Fill } from 'react-icons/ri'

const Services = () => {
return <div>Services</div>;
};
const ServiceCard = ({ color, title, icon, subtitle }) => (
<div className="flex flex-row justify-start items-start white-glassmorphism p-3 m-2 cursor-pointer hover:shadow-xl">
<div className={`w-10 h-10 rounded-full flex justify-center items-center ${color}`}>
{icon}
</div>
<div className="ml-5 flex flex-col flex-1">
<h3 className="mt-2 text-white text-lg">{title}</h3>
<p className="mt-1 text-white text-sm md:w-9/12">{subtitle}</p>
</div>
</div>
)

export default Services;
const Services = () => (
<div className="flex w-full justify-center items-center gradient-bg-services">
<div className="flex mf:flex-row flex-col items-center justify-between md:p-20 py-12 px-4">
<div className="flex-1 flex flex-col justify-start items-start">
<h1 className="text-white text-3xl sm:text-5xl py-2 ">
Services that we
<br />
continue to improve
</h1>
<p className="text-left my-2 text-white font-light md:w-9/12 w-11/12 text-base">
The best choice for buying and selling your crypto assets, with the various
super friendly services we offer
</p>
</div>

<div className="flex-1 flex flex-col justify-start items-center">
<ServiceCard
color="bg-[#2952E3]"
title="Security gurantee"
icon={<BsShieldFillCheck fontSize={21} className="text-white" />}
subtitle="Security is guranteed. We always maintain privacy and maintain the quality of our products"
/>
<ServiceCard
color="bg-[#8945F8]"
title="Best exchange rates"
icon={<BiSearchAlt fontSize={21} className="text-white" />}
subtitle="Security is guranteed. We always maintain privacy and maintain the quality of our products"
/>
<ServiceCard
color="bg-[#F84550]"
title="Fastest transactions"
icon={<RiHeart2Fill fontSize={21} className="text-white" />}
subtitle="Security is guranteed. We always maintain privacy and maintain the quality of our products"
/>
</div>
</div>
</div>
)

export default Services
74 changes: 71 additions & 3 deletions blockchain-app/client/src/components/Transactions.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,76 @@
// .jsx just means that we will write React JSX code inside this file
import React from 'react';
import React, { useContext } from "react";

import { TransactionContext } from "../context/TransactionContext";

import useFetch from "../hooks/useFetch";
import dummyData from "../utils/dummyData";
import { shortenAddress } from "../utils/shortenAddress";

const TransactionsCard = ({ addressTo, addressFrom, timestamp, message, keyword, amount, url }) => {
const gifUrl = useFetch({ keyword });

return (
<div className="bg-[#181918] m-4 flex flex-1
2xl:min-w-[450px]
2xl:max-w-[500px]
sm:min-w-[270px]
sm:max-w-[300px]
min-w-full
flex-col p-3 rounded-md hover:shadow-2xl"
>
<div className="flex flex-col items-center w-full mt-3">
<div className="display-flex justify-start w-full mb-6 p-2">
<a href={`https://ropsten.etherscan.io/address/${addressFrom}`} target="_blank" rel="noreferrer">
<p className="text-white text-base">From: {shortenAddress(addressFrom)}</p>
</a>
<a href={`https://ropsten.etherscan.io/address/${addressTo}`} target="_blank" rel="noreferrer">
<p className="text-white text-base">To: {shortenAddress(addressTo)}</p>
</a>
<p className="text-white text-base">Amount: {amount} ETH</p>
{message && (
<>
<br />
<p className="text-white text-base">Message: {message}</p>
</>
)}
</div>
<img
src={gifUrl || url}
alt="nature"
className="w-full h-64 2xl:h-96 rounded-md shadow-lg object-cover"
/>
<div className="bg-black p-3 px-5 w-max rounded-3xl -mt-5 shadow-2xl">
<p className="text-[#37c7da] font-bold">{timestamp}</p>
</div>
</div>
</div>
);
};

const Transactions = () => {
return <div>Transactions</div>;
const { transactions, currentAccount } = useContext(TransactionContext);

return (
<div className="flex w-full justify-center items-center 2xl:px-20 gradient-bg-transactions">
<div className="flex flex-col md:p-12 py-12 px-4">
{currentAccount ? (
<h3 className="text-white text-3xl text-center my-2">
Latest Transactions
</h3>
) : (
<h3 className="text-white text-3xl text-center my-2">
Connect your account to see the latest transactions
</h3>
)}

<div className="flex flex-wrap justify-center items-center mt-10">
{[...dummyData, ...transactions].reverse().map((transaction, i) => (
<TransactionsCard key={i} {...transaction} />
))}
</div>
</div>
</div>
);
};

export default Transactions;
Loading

0 comments on commit d4599e7

Please sign in to comment.