Giter Site home page Giter Site logo

project_cryptoverse's Introduction

project_cryptoverse's People

Contributors

adrianhajdin avatar mandeepsinghmar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

project_cryptoverse's Issues

Cant get .env to work.

code
code2

I've created the .env file in the root folder.

REACT_APP_CRYPTO_RAPIDAPI_HOST = 'host url'

REACT_APP_RAPIDAPI_KEY = 'my api key'

REACT_APP_CRYPTO_API_URL = 'api url'

However, when I inspect the page on Chrome, I see "Failed to load resource: the server responded with a status of 404 (Not Found)"

I've tried installing "dotenv" from npm.

Uncaught TypeError: Cannot read properties of undefined (reading 'name')

I am developing CryptoDetails.jsx components. I am getting data from API successfully by

const { data, isFetching } = useGetCryptoDetailsQuery(coinId)
console.log(data)

and the specific data history by

console.log(data?.data?.coin.name)

The problem is, I can't acces data with

const cryptoDetails = data?.data?.coin
console.log(cryptoDetails.name)

The 2nd line of avobe code show me

Uncaught TypeError: Cannot read properties of undefined (reading 'name')

  • I think, that means the cyrptoDetails can't store the data?.data?.coin value. I have tried let & var instead of const. but didn't get any solution.

Note- If I comment out the line

console.log(cryptoDetails.name)

and do

const cryptoDetails = data?.data?.coin
console.log(data?.data?.coin.name)

reload the browser, than I got the result as I say before.
But in case if I do uncomment the console.log(cryptoDetails.name) & without any reload, It show the data. But then when I reload the browser, It show me the error.

Code of my Components

  • CrytoDetails.jsx
import React, { useState } from 'react'
import millify from 'millify'
import HTMLReactParser from 'html-react-parser'
import { useParams } from 'react-router-dom'
import { Row, Col, Typography, Select } from 'antd'
import { MoneyCollectOutlined, DollarCircleOutlined, FundOutlined, ExclamationCircleOutlined, StopOutlined, TrophyOutlined, CheckOutlined, NumberOutlined, ThunderboltOutlined } from '@ant-design/icons';
import { useGetCryptoDetailsQuery } from '../services/cryptoApi'
const { Title, Text } = Typography
const { Option } = Select

const CryptoDetails = () => {
    const { coinId } = useParams()
    const [timeperiod, setTimeperiod] = useState('7d')
    const { data, isFetching } = useGetCryptoDetailsQuery(coinId)

    console.log(data)
    const cryptoDetails = data?.data?.coin
    console.log(data?.data?.coin)
    console.log(cryptoDetails.name)
    console.log(data?.data?.coin.name)


    // const stats = [
    //     { title: 'Price to USD', value: `$ ${cryptoDetails.price && millify(cryptoDetails.price)}`, icon: <DollarCircleOutlined /> },
    //     { title: 'Rank', value: cryptoDetails.rank, icon: <NumberOutlined /> },
    //     { title: '24h Volume', value: `$ ${cryptoDetails.volume && millify(cryptoDetails.volume)}`, icon: <ThunderboltOutlined /> },
    //     { title: 'Market Cap', value: `$ ${cryptoDetails.marketCap && millify(cryptoDetails.marketCap)}`, icon: <DollarCircleOutlined /> },
    //     { title: 'All-time-high(daily avg.)', value: `$ ${millify(cryptoDetails.allTimeHigh.price)}`, icon: <TrophyOutlined /> },
    // ];

    return (
        <Col className='coin-detail-container'>
            <Col className='coin-heading-container'>
                <Title level={2} className='coin-name'>
                    {/* {cryptoDetails.name}({cryptoDetails.slug}) Price */}
                </Title>
                <p>
                    {/* {cryptoDetails.name} live price in US dollars. */}
                    View value statistics,market cap & supply
                </p>
            </Col>
            <Select
                defaultValue='7d'
                className='select-timeperiod'
                placeholder='Select Time Period'
                onChange={value => setTimeperiod(value)}
            >
                {time.map(date =>
                    <Option key={date}>{date}</Option>
                )}
            </Select>
        </Col>
    )
}

export default CryptoDetails

I have comment out the stats because they can't access cryptoDetails

  • cryptoApi.js
import {
    createApi,
    fetchBaseQuery
} from '@reduxjs/toolkit/query/react'

const baseUrl = 'https://coinranking1.p.rapidapi.com'

const createRequest = url => ({
    url,
    headers: cryptoApiHeaders
})

export const cryptoApi = createApi({
    reducerPath: 'cryptoApi',
    baseQuery: fetchBaseQuery({
        baseUrl
    }),
    endpoints: builder => ({
        getCryptos: builder.query({
            query: count => createRequest(`/coins?limit=${count}`)
        }),
        getCryptoDetails: builder.query({
            query: coinId => createRequest(`/coin/${coinId}`)
        })
    })
})

export const {
    useGetCryptosQuery,
    useGetCryptoDetailsQuery
} = cryptoApi

I have remove the cryptoApiHeaders because of the API code. But in main code I have it.

  • How to solve it.
  • What does it mean data?.data?.coin
    • (?.)

TypeError: can't access property "toString", value is undefined

I'm having the undefined error and can't fix it. Here is my code for Homepage.jsx:-


import React from 'react'
import millify from 'millify'
import { Typography, Row, Col, Statistic } from 'antd'
import { Link } from 'react-router-dom'

import { useGetCryptosQuery } from '../services/cryptoApi'
import Cryptocurrencies from './Cryptocurrencies'
import News from './News'
import Loader from '../components/Loader'

const { Title } = Typography

const Homepage = () => {
  const { data, isFetching } = useGetCryptosQuery(10)
  const globalStats = data?.data?.stats

  if (isFetching) return <Loader />
  console.log(data)

  
  return (
    <>
      <Title level={2} className="heading">
        Global Crypto Statistics
      </Title>
      <Row>
        <Col span={12}>
          <Statistic title="Total Cryptocurrencies" value={globalStats.total} />
        </Col>
        <Col span={12}>
          <Statistic
            title="Total Exchanges"
            value={millify(globalStats.totalExchanges)}
          />
        </Col>
        <Col span={12}>
          <Statistic
            title="Total Market Cap:"
            // value={`$${millify(globalStats.totalMarketCap)}`}
          />
        </Col>
        <Col span={12}>
          <Statistic
            title="Total 24h Volume"
            // value={`$${millify(globalStats.total24hVolume)}`}
          />
        </Col>
        <Col span={12}>
          {/* <Statistic title="Total Markets" value={globalStats.totalMarkets} /> */}
        </Col>
      </Row>
      <div className="home-heading-container">
        <Title level={2} className="home-title">
          Top 10 Cryptocurrencies in the world
        </Title>
        <Title level={3} className="show-more">
          <Link to="/cryptocurrencies">Show more</Link>
        </Title>
      </div>
      <Cryptocurrencies simplified />
      <div className="home-heading-container">
        <Title level={2} className="home-title">
          Latest Crypto News
        </Title>
        <Title level={3}>
          <Link to="/news">Show more</Link>
        </Title>
      </div>
      <News simplified />
    </>
  )
}

export default Homepage

Here is a screenshot of the error - it retrieves the object and you can see success and number of exchanges but I'm getting value is undefined error... Any ideas?

2021-11-15_16-30

TypeError: Object(...) is not a function

5 |
6 |
7 | const HomePage = () => {

8 | const { data, isFetching } = useGetCryptoQuery();
9 | console.log('test',data);
10 |

I got this error while coding the above lines. need help

getCryptos query is not fetching any data anymore

Hi all,
I now also have to ask a question about RapidApi. I am about to get the first query "getCryptos" running. But no matter what I try, the console.log always shows "undefined". I have done all updates to v2 and even copied some code from here. I've gotten to the point where I can say that the following code doesn't seem to work properly:

getCryptos: builder.query({ query: (count) => createRequest(/coins?limit=${count}) })

Can anyone help here? I have also update my key in the env file ofc.
Bildschirmfoto 2022-02-16 um 00 40 49
Bildschirmfoto 2022-02-16 um 00 39 21
Bildschirmfoto 2022-02-16 um 00 39 03
Bildschirmfoto 2022-02-16 um 00 38 52

Getting Error Failed to load config "react-app" to extend from.

Hi, i am trying to run the app on my local system to check the select functionality not working when i coded along with the tutorial. I have replaced all the .env variables with my keys and have installed all the dependencies from package.json. As per comments from stackoverflow i have also entered command 'npm install --force -D eslint-config-react-app'/'yarn add eslint-config-react -D' but still the error persists. Does anybody know how to solve this issue?
Screenshot (27)

I have attached the screenshot for reference

Error with using ant design

After I run npm start a blank page is displayed on my localhost port and the following error is displayed: "Failed to parse source map: 'webpack://antd/./components/config-provider/style/index.less' URL is not supported". Any suggestions?

Show more not working

I am halfway through the tutorial at the point where you can toggle between the 10 top Cryptos and the 100 top cryptos.
I click and nothing happens. Instead, I get this error while on the Brave browser, while on Google I get no errors but it still does not display the 100 coins.

Error in event handler: TypeError: Cannot read properties of undefined (reading 'observe')
For the news, I am also getting no objects....
"cryptoNews: undefined" and "too many requests" even though I am now paying for the service

I have checked and even copied some of the relevant code, up to that point and I just can't figure out why the ? operator is not getting read when I click on "Show more"

scroll fix

HI, @adrianhajdin when user is in bottom of screen in any where in app and navigate to another link or click on any crypto to get its detail user get navigate to another page in bottom of screen. For example:-
image
image

** I have solution for this issue and submitted a Pull request for this **
Please give your opinion on this @adrianhajdin happy to listen from you .

Switch is not exported from 'react-router-dom'

./src/App.js
Attempted import error: 'Switch' is not exported from 'react-router-dom'.

It seems that instead of Switch, it must be Routes now but I have tried that and that is not working either

Title problem

Instead of rank and name I am getting the code of title itself. Problem occurred with Cryptocurrencies.jsx , in the Card component title

Change is not affecting in line chart values

Values of chart are not changing after changing the time period from dropdown
It is only fetching the first record from redux and displaying that instead of the latest one
Can someone help with this?

What is simplified ? and those ?.

I don't understand how and what is simplified ?
Is this an Boolean Operator?

{!simplified && ( <div className='search-crypto'> <Input placeholder='Search Cryptocurrency' onChange={(event) => setSearchTerm(event.target.value) } /> </div> )}

and those question marks, are they ternary operators? ...I've never seen them before
const filterData = cryptosList?.data?.coins.filter((coin) => coin.name.toLowerCase().includes(searchTerm.toLocaleLowerCase()));

Failed to compile

Error while loading rule 'jsx-a11y/alt-text': rule.create is not a function
Occurred while linting F:\cryptoapp\src\components\index.js
This error occurred during the build time and cannot be dismissed.

coinranking API not free anymore

401Unauthorized
Body
Headers
{1 item
"message":"This endpoint is disabled for your subscription"
}
I get this when i try to use the Get exchange
anyway we can use it ?

"span={6}" issue on Exchange.js Deep Dive

I was getting this issue with alignment of values:
image

original code:
image

span={6} seemed to be the issue.

Here's what the code can be. Not perfect but it's functional!
image

Change out span={6} to style={{ width: "18.9vw" }} inside the

See new layout w/ iPhone and Desktop:
image

image

localhost displaying blank screen

After running npm start on my terminal, my react App opens up a localhost page but it displays a blank screen and nothing else. How would I fix this issue.?

TypeError: Cannot read properties of undefined (reading 'total')

_Line 3:10: 'Button' is defined but never used no-unused-vars Line 6:74: 'MenuOutlined' is defined but never used no-unused-vars_

import React from 'react';
// eslint-disable-next-line
import millify from 'millify';
import { Typography, Row, Col, Statistic } from 'antd';
// eslint-disable-next-line
import { Link } from 'react-router-dom';

import { useGetCryptosQuery } from '../services/cryptoApi';

const { Title } = Typography;

const Homepage = () => {
const { data, isFetching } = useGetCryptosQuery(10);
const globalStats = data?.data?.stats;
if(isFetching) return 'Loading...';
return (
<>
<Title level={2} className="heading">Global Crypto Stats</Title>







</>
)
}

export default Homepage

"category" is not a registered scale

I'm am getting this error when trying to click on crypto to see the chart. It doesn't give me a line anywhere in the code where this would be a problem. Please help!
Thank you

Convert Route components in App.js to self-closing tags

In App.js , for better readability, we should convert

  <Switch>
    <Route exact path="/">
        <Homepage />
    </Route>

    <Route exact path="/exchanges">
        <Exchanges />
    </Route>
  </Switch>

to

  <Switch>
    <Route exact path="/" component={Homepage}>
    <Route exact path="/exchanges" component={Exchanges}>
  </Switch>

Would like to know your thoughts @adrianhajdin
I can submit a PR if assigned this issue ๐Ÿ˜„

TypeError: Object(...) is not a function

any fix for this error

384 | const {
385 | data,
386 | isFetching

387 | } = Object(services_cryptoApi__WEBPACK_IMPORTED_MODULE_4_["useGetCryptosQuery"])();
| ^ 388 | const globalStats = data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.stats;
389 | if (isFetching) return 'Loading Data...';
390 | return /#PURE/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment, null, /#PURE/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Title, {

Cryptodetails.jsx not displaying the 24h Volume correctly after the upgrade to Coinranking API v2, only displays as "undefined".

After the upgrade to the Coinranking API v2 many features of the app stopped working correctly due to the changes in endpoints. One of these problem areas was the 24h Volume criteria on the Cryptodetails.jsx component.

In order to read the correct item from the API JSON object you need to adjust your code from:

{ title: '24h Volume', value: $ ${cryptoDetails.volume && cryptoDetails.volume}, icon: }

to the following:

{ title: '24h Volume', value: $ ${cryptoDetails?.["24hVolume"] && millify(cryptoDetails?.["24hVolume"])}, icon: }

the change being from 'volume' to '["24hVolume"]' as per the changes in the Coinranking API documentation.

I hope this helps the rest of you who are trying to fix the program after the API update.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.