├── .gitignore
├── README.md
├── package.json
├── public
├── favicon.ico
├── index.html
├── logo192.png
├── logo512.png
├── manifest.json
└── robots.txt
├── src
├── App.css
├── App.test.tsx
├── App.tsx
├── assets
│ ├── aquarius0.png
│ ├── aquarius1.png
│ ├── aquarius2.png
│ ├── aquarius3.png
│ ├── aries0.png
│ ├── aries1.png
│ ├── aries2.png
│ ├── aries3.png
│ ├── astrapredict-icon.png
│ ├── cancer0.png
│ ├── cancer1.png
│ ├── cancer2.png
│ ├── cancer3.png
│ ├── capricorn0.png
│ ├── capricorn1.png
│ ├── capricorn2.png
│ ├── capricorn3.png
│ ├── demo.png
│ ├── gemini0.png
│ ├── gemini1.png
│ ├── gemini2.png
│ ├── gemini3.png
│ ├── hermetic-stars.jpg
│ ├── icon.png
│ ├── leo0.png
│ ├── leo1.png
│ ├── leo2.png
│ ├── leo3.png
│ ├── libra0.png
│ ├── libra1.png
│ ├── libra2.png
│ ├── libra3.png
│ ├── loader.gif
│ ├── pisces0.png
│ ├── pisces1.png
│ ├── pisces2.png
│ ├── pisces3.png
│ ├── preview.gif
│ ├── sagittarius0.png
│ ├── sagittarius1.png
│ ├── sagittarius2.png
│ ├── sagittarius3.png
│ ├── schema.png
│ ├── scorpio0.png
│ ├── scorpio1.png
│ ├── scorpio2.png
│ ├── scorpio3.png
│ ├── screen.png
│ ├── taurus0.png
│ ├── taurus1.png
│ ├── taurus2.png
│ ├── taurus3.png
│ ├── virgo0.png
│ ├── virgo1.png
│ ├── virgo2.png
│ └── virgo3.png
├── components
│ ├── Ascendant.tsx
│ ├── Coingecko.tsx
│ ├── Footer.tsx
│ ├── Landing.tsx
│ ├── Loader.tsx
│ ├── Navbar.tsx
│ ├── Prediction.tsx
│ └── Sidereal.tsx
├── constants.ts
├── hooks.ts
├── index.css
├── index.tsx
├── react-app-env.d.ts
├── reportWebVitals.ts
├── setupTests.ts
├── slice
│ ├── coinId.slice.ts
│ └── location.slice.ts
└── store.ts
├── tsconfig.json
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AstraPredict
2 |
3 | 
4 |
5 | Astrology is the ancient art of making predictions using the location of celestial bodies. AstraPredict seeks to modernize this art by implementing cutting-edge technology and knowledge of the true position of stars.
6 |
7 | What makes astrapredict different?
8 |
9 | - We take into account the precession of the equinox
10 | - We use ML and AI to make predictions
11 |
12 | Behind the scenes, the backend code uses machine learning models trained with the sidereal astrology position and the historical price of crypto-currencies. Once created, we are able to use any astrological position data to make a prediction for the price change at that time.
13 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "astrapredict-client",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@chakra-ui/icons": "^2.0.18",
7 | "@chakra-ui/react": "^2.5.5",
8 | "@emotion/react": "^11.10.6",
9 | "@emotion/styled": "^11.10.6",
10 | "@reduxjs/toolkit": "^1.9.3",
11 | "@testing-library/jest-dom": "^5.14.1",
12 | "@testing-library/react": "^13.0.0",
13 | "@testing-library/user-event": "^13.2.1",
14 | "@types/jest": "^27.0.1",
15 | "@types/node": "^16.7.13",
16 | "@types/react": "^18.0.0",
17 | "@types/react-chartjs-2": "^2.5.7",
18 | "@types/react-dom": "^18.0.0",
19 | "axios": "^1.3.5",
20 | "chakra-dayzed-datepicker": "^0.2.8",
21 | "chart.js": "^4.2.1",
22 | "date-fns": "^2.30.0",
23 | "dayzed": "^3.2.3",
24 | "framer-motion": "^10.11.2",
25 | "google-charts": "^2.0.0",
26 | "moment": "^2.29.4",
27 | "react": "^18.2.0",
28 | "react-chartjs-2": "^5.2.0",
29 | "react-dom": "^18.2.0",
30 | "react-google-charts": "^4.0.0",
31 | "react-redux": "^8.0.5",
32 | "react-router-dom": "^6.10.0",
33 | "react-scripts": "5.0.1",
34 | "typescript": "^4.4.2",
35 | "web-vitals": "^2.1.0"
36 | },
37 | "scripts": {
38 | "start": "react-scripts start",
39 | "build": "react-scripts build",
40 | "test": "react-scripts test",
41 | "eject": "react-scripts eject"
42 | },
43 | "eslintConfig": {
44 | "extends": [
45 | "react-app",
46 | "react-app/jest"
47 | ]
48 | },
49 | "browserslist": {
50 | "production": [
51 | ">0.2%",
52 | "not dead",
53 | "not op_mini all"
54 | ],
55 | "development": [
56 | "last 1 chrome version",
57 | "last 1 firefox version",
58 | "last 1 safari version"
59 | ]
60 | },
61 | "devDependencies": {
62 | "@types/webpack-env": "^1.18.0"
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 | AstraPredict
28 |
29 |
30 | You need to enable JavaScript to run this app.
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/public/logo192.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/public/logo512.png
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
16 | .App-header {
17 | background-color: #282c34;
18 | min-height: 100vh;
19 |
20 | font-size: calc(10px + 2vmin);
21 | color: white;
22 | }
23 |
24 | .App-center {
25 | min-height: 100vh;
26 | display: flex;
27 | flex-direction: column;
28 | align-items: center;
29 | justify-content: center;
30 | }
31 |
32 | .App-link {
33 | color: #61dafb;
34 | }
35 |
36 | .loader {
37 | position: relative;
38 | width: 50px;
39 | height: 50px;
40 | margin: 0 auto;
41 | animation: rotate 2s linear infinite;
42 | }
43 |
44 | .outer {
45 | position: absolute;
46 | top: 0;
47 | left: 0;
48 | width: 50px;
49 | height: 50px;
50 | border-radius: 50%;
51 | border: 3px solid #ccc;
52 | border-top-color: #555;
53 | animation: rotate 1s linear infinite reverse;
54 | }
55 |
56 | .inner {
57 | position: absolute;
58 | top: 8px;
59 | left: 8px;
60 | width: 34px;
61 | height: 34px;
62 | border-radius: 50%;
63 | border: 3px solid #ccc;
64 | border-top-color: #555;
65 | animation: rotate 1s linear infinite;
66 | }
67 |
68 | @keyframes rotate {
69 | from {
70 | transform: rotate(0deg);
71 | }
72 | to {
73 | transform: rotate(360deg);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/App.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render, screen } from '@testing-library/react';
3 | import App from './App';
4 |
5 | test('renders learn react link', () => {
6 | render( );
7 | const linkElement = screen.getByText(/learn react/i);
8 | expect(linkElement).toBeInTheDocument();
9 | });
10 |
--------------------------------------------------------------------------------
/src/App.tsx:
--------------------------------------------------------------------------------
1 | import "./App.css";
2 | import { useState, useEffect } from "react";
3 | import axios from "axios";
4 | import Prediction from "./components/Prediction";
5 | import Sidereal from "./components/Sidereal";
6 | import Navbar from "./components/Navbar";
7 | import Loader from "./components/Loader";
8 | import Landing from "./components/Landing";
9 | import Footer from "./components/Footer";
10 | import { Routes, Route } from "react-router-dom";
11 | import { useSelector } from "react-redux";
12 | import type { RootState } from "./store";
13 | import { useDispatch } from "react-redux";
14 | import { changeLocation } from "./slice/location.slice";
15 | import { baseURL } from "./constants";
16 |
17 | export interface IData {
18 | data: {
19 | planets: Array;
20 | location: {
21 | city: String;
22 | ip: String;
23 | region: String;
24 | country: String;
25 | time: String;
26 | };
27 | price_change: any;
28 | predicted: any;
29 | coin_id: String;
30 | coins: Array;
31 | prediction_date: String;
32 | prev_predicted: String;
33 | prev_date: String;
34 | };
35 | loading: boolean;
36 | }
37 |
38 | function App() {
39 | const defaultData = {
40 | planets: [],
41 | location: { city: "", ip: "", region: "", country: "", time: "" },
42 | price_change: 0,
43 | predicted: "",
44 | coin_id: "",
45 | coins: [],
46 | prediction_date: "",
47 | prev_predicted: "",
48 | prev_date: "",
49 | };
50 | const [data, setData] = useState(defaultData);
51 | const [loading, setLoading] = useState(true);
52 | const slice = useSelector((state: RootState) => state);
53 | const dispatch = useDispatch();
54 |
55 | useEffect(() => {
56 | if (!!slice?.coinIdReducer?.coinId) {
57 | setLoading(true);
58 | const getPrediction = async () => {
59 | try {
60 | const response: any = await axios.get(`${baseURL}/crypto-sidereal`, {
61 | params: { coinId: slice.coinIdReducer.coinId },
62 | });
63 | data.location.city
64 | ? setData({
65 | ...data,
66 | price_change: response.data.price_change,
67 | predicted: response.data.predicted,
68 | coin_id: response.data.coin_id,
69 | coins: response.data.coins,
70 | prediction_date: response.data.prediction_date,
71 | prev_predicted: response.data.prev_predicted,
72 | prev_date: response.data.prev_date,
73 | })
74 | : setData(response.data);
75 | setLoading(false);
76 | dispatch(
77 | changeLocation({
78 | data: {
79 | region: response.data.location.region,
80 | city: response.data.location.city,
81 | country: response.data.location.country,
82 | },
83 | date: slice.locationReducer.location.date,
84 | })
85 | );
86 | } catch (e) {
87 | console.log(e);
88 | }
89 | };
90 | getPrediction();
91 | }
92 | }, [slice.coinIdReducer.coinId]);
93 |
94 | useEffect(() => {
95 | if (
96 | slice?.locationReducer?.location?.date &&
97 | slice.coinIdReducer.coinId === data.coin_id
98 | ) {
99 | const getPrediction = async () => {
100 | setLoading(true);
101 | try {
102 | const response: any = await axios.get(`${baseURL}/custom-sidereal`, {
103 | params: {
104 | country: slice.locationReducer.location.data?.country,
105 | region: slice.locationReducer.location.data?.region,
106 | city: slice.locationReducer.location.data?.city,
107 | date: slice.locationReducer.location.date,
108 | },
109 | });
110 | setData({
111 | ...data,
112 | coin_id: slice.coinIdReducer.coinId.toString(),
113 | planets: response.data.data,
114 | });
115 | setLoading(false);
116 | } catch (e) {
117 | console.log(e);
118 | setLoading(false);
119 | }
120 | };
121 | getPrediction();
122 | }
123 | }, [slice.locationReducer.location]);
124 |
125 | return (
126 |
127 |
128 |
129 |
130 | 0 ? (
134 |
135 | ) : (
136 |
137 | )
138 | }
139 | />
140 |
145 | ) : (
146 |
147 | )
148 | }
149 | />
150 | } />
151 |
152 |
153 |
154 |
155 |
156 | );
157 | }
158 |
159 | export default App;
160 |
--------------------------------------------------------------------------------
/src/assets/aquarius0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/aquarius0.png
--------------------------------------------------------------------------------
/src/assets/aquarius1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/aquarius1.png
--------------------------------------------------------------------------------
/src/assets/aquarius2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/aquarius2.png
--------------------------------------------------------------------------------
/src/assets/aquarius3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/aquarius3.png
--------------------------------------------------------------------------------
/src/assets/aries0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/aries0.png
--------------------------------------------------------------------------------
/src/assets/aries1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/aries1.png
--------------------------------------------------------------------------------
/src/assets/aries2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/aries2.png
--------------------------------------------------------------------------------
/src/assets/aries3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/aries3.png
--------------------------------------------------------------------------------
/src/assets/astrapredict-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/astrapredict-icon.png
--------------------------------------------------------------------------------
/src/assets/cancer0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/cancer0.png
--------------------------------------------------------------------------------
/src/assets/cancer1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/cancer1.png
--------------------------------------------------------------------------------
/src/assets/cancer2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/cancer2.png
--------------------------------------------------------------------------------
/src/assets/cancer3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/cancer3.png
--------------------------------------------------------------------------------
/src/assets/capricorn0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/capricorn0.png
--------------------------------------------------------------------------------
/src/assets/capricorn1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/capricorn1.png
--------------------------------------------------------------------------------
/src/assets/capricorn2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/capricorn2.png
--------------------------------------------------------------------------------
/src/assets/capricorn3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/capricorn3.png
--------------------------------------------------------------------------------
/src/assets/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/demo.png
--------------------------------------------------------------------------------
/src/assets/gemini0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/gemini0.png
--------------------------------------------------------------------------------
/src/assets/gemini1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/gemini1.png
--------------------------------------------------------------------------------
/src/assets/gemini2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/gemini2.png
--------------------------------------------------------------------------------
/src/assets/gemini3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/gemini3.png
--------------------------------------------------------------------------------
/src/assets/hermetic-stars.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/hermetic-stars.jpg
--------------------------------------------------------------------------------
/src/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/icon.png
--------------------------------------------------------------------------------
/src/assets/leo0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/leo0.png
--------------------------------------------------------------------------------
/src/assets/leo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/leo1.png
--------------------------------------------------------------------------------
/src/assets/leo2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/leo2.png
--------------------------------------------------------------------------------
/src/assets/leo3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/leo3.png
--------------------------------------------------------------------------------
/src/assets/libra0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/libra0.png
--------------------------------------------------------------------------------
/src/assets/libra1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/libra1.png
--------------------------------------------------------------------------------
/src/assets/libra2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/libra2.png
--------------------------------------------------------------------------------
/src/assets/libra3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/libra3.png
--------------------------------------------------------------------------------
/src/assets/loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/loader.gif
--------------------------------------------------------------------------------
/src/assets/pisces0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/pisces0.png
--------------------------------------------------------------------------------
/src/assets/pisces1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/pisces1.png
--------------------------------------------------------------------------------
/src/assets/pisces2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/pisces2.png
--------------------------------------------------------------------------------
/src/assets/pisces3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/pisces3.png
--------------------------------------------------------------------------------
/src/assets/preview.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/preview.gif
--------------------------------------------------------------------------------
/src/assets/sagittarius0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/sagittarius0.png
--------------------------------------------------------------------------------
/src/assets/sagittarius1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/sagittarius1.png
--------------------------------------------------------------------------------
/src/assets/sagittarius2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/sagittarius2.png
--------------------------------------------------------------------------------
/src/assets/sagittarius3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/sagittarius3.png
--------------------------------------------------------------------------------
/src/assets/schema.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/schema.png
--------------------------------------------------------------------------------
/src/assets/scorpio0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/scorpio0.png
--------------------------------------------------------------------------------
/src/assets/scorpio1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/scorpio1.png
--------------------------------------------------------------------------------
/src/assets/scorpio2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/scorpio2.png
--------------------------------------------------------------------------------
/src/assets/scorpio3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/scorpio3.png
--------------------------------------------------------------------------------
/src/assets/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/screen.png
--------------------------------------------------------------------------------
/src/assets/taurus0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/taurus0.png
--------------------------------------------------------------------------------
/src/assets/taurus1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/taurus1.png
--------------------------------------------------------------------------------
/src/assets/taurus2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/taurus2.png
--------------------------------------------------------------------------------
/src/assets/taurus3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/taurus3.png
--------------------------------------------------------------------------------
/src/assets/virgo0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/virgo0.png
--------------------------------------------------------------------------------
/src/assets/virgo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/virgo1.png
--------------------------------------------------------------------------------
/src/assets/virgo2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/virgo2.png
--------------------------------------------------------------------------------
/src/assets/virgo3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iebgit/astrapredict-client/43b9df4b140ea784206989726433b9706d0c1853/src/assets/virgo3.png
--------------------------------------------------------------------------------
/src/components/Ascendant.tsx:
--------------------------------------------------------------------------------
1 | import "../App.css";
2 | import { useState, FC } from "react";
3 | import { Box } from "@chakra-ui/react";
4 | import { IData } from "../App";
5 | import { useSelector } from "react-redux";
6 | import type { RootState } from "../store";
7 |
8 | const regexPattern = /[^A-Za-z]/g;
9 |
10 | const Ascendant: FC = ({ data }) => {
11 | const slice = useSelector((state: RootState) => state);
12 | const [images, setImages] = useState(
13 | importAll(require.context("../assets", false, /\.(png|jpe?g|svg)$/))
14 | );
15 |
16 | function importAll(r: any) {
17 | let imgs: any = {};
18 | r.keys().forEach((item: String) => {
19 | imgs[item.replace("./", "")] = r(item);
20 | });
21 | return imgs;
22 | }
23 | // get image for ascendant from current padam or house of the sun
24 | function getImage() {
25 | return images[
26 | `${data.planets[0].longitude.replace(regexPattern, "").toLowerCase()}${
27 | Number(data.planets[1].padam) - 1
28 | }.png`
29 | ];
30 | }
31 |
32 | function getRandomInt(max: number) {
33 | return Math.floor(Math.random() * max);
34 | }
35 |
36 | return (
37 |
38 |
39 |
40 |
41 | {data.location.city}, {data.location.region}
42 |
43 |
44 |
45 | {!!slice?.locationReducer?.location?.date
46 | ? slice.locationReducer.location.date
47 | : data.location.time.split(" ")[0]}{" "}
48 | {data.location.time.split(" ")[1].split(".")[0]}
49 |
50 |
51 |
52 |
53 |
58 |
59 |
60 |
67 | {data.planets[0].planet.toUpperCase()}: {data.planets[0].longitude}
68 |
69 |
70 |
71 | );
72 | };
73 |
74 | export default Ascendant;
75 | export {};
76 |
--------------------------------------------------------------------------------
/src/components/Coingecko.tsx:
--------------------------------------------------------------------------------
1 | import axios from "axios";
2 |
3 | const getMarketData = async (coins: Array) => {
4 | try {
5 | const coinsString: String = coins.join(",");
6 | const coingeckoUrl: String = `https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=${coinsString}&order=market_cap_desc&per_page=100&page=1&sparkline=false&price_change_percentage=24h&locale=en`;
7 | const coingeckoRes: any = await axios.get(coingeckoUrl.toString());
8 | return coingeckoRes;
9 | } catch (e) {
10 | console.log(e);
11 | }
12 | };
13 |
14 | const getHistoryData = async (coinId: String) => {
15 | try {
16 | const coingeckoUrl = `https://api.coingecko.com/api/v3/coins/${coinId}/ohlc?vs_currency=usd&days=max`;
17 | const coingeckoRes = axios.get(coingeckoUrl);
18 | return coingeckoRes;
19 | } catch (e) {
20 | console.log(e);
21 | }
22 | };
23 |
24 | export { getMarketData, getHistoryData };
25 |
--------------------------------------------------------------------------------
/src/components/Footer.tsx:
--------------------------------------------------------------------------------
1 | import { Box, Text, Link } from "@chakra-ui/react";
2 |
3 | function Footer() {
4 | const currentYear = new Date().getFullYear();
5 |
6 | return (
7 |
8 |
9 | © {currentYear} AstraPredict. All rights reserved.
10 |
11 |
18 | GitHub
19 |
20 |
21 | );
22 | }
23 |
24 | export default Footer;
25 |
--------------------------------------------------------------------------------
/src/components/Landing.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import {
3 | Box,
4 | Heading,
5 | Text,
6 | useColorModeValue,
7 | Flex,
8 | Image,
9 | Button,
10 | } from "@chakra-ui/react";
11 | import hermeticImage from "../assets/aquarius0.png";
12 | import starImage from "../assets/aquarius2.png";
13 | import placeholder from "../assets/icon.png";
14 | import { useNavigate } from "react-router-dom";
15 |
16 | const Landing: React.FC = () => {
17 | const navigate = useNavigate();
18 | return (
19 |
20 |
21 |
28 |
29 |
35 | Why We Are The Best
36 |
37 |
38 | AstraPredict's mission is to identify patterns that may exist
39 | between sidereal astrology and phenomena that influence human
40 | behavior and can thus be used to make predictions. The principle
41 | advantage of this system is that it contradicts the most prevalent
42 | perspective in the west and is far more accurate due to the
43 | precession of the equinox.
44 |
45 |
46 |
47 |
48 |
49 |
50 |
56 | What Is The Precession Of The Equinox?
57 |
58 |
59 | The precession of the equinox is a gradual shift in the orientation
60 | of the Earth's axis of rotation, which causes the position of the
61 | equinoxes to move slowly over time. As a result, the position of the
62 | vernal equinox moves westward along the ecliptic at a rate of about
63 | 1 degree every 72 years. Check out the true position of the stars
64 | based on your location:
65 |
66 | navigate("/sidereal")}
74 | >
75 | Current Positions
76 |
77 |
78 |
85 |
86 |
87 | );
88 | };
89 |
90 | export default Landing;
91 |
--------------------------------------------------------------------------------
/src/components/Loader.tsx:
--------------------------------------------------------------------------------
1 | import "../App.css";
2 | import {Text, useColorModeValue} from "@chakra-ui/react"
3 |
4 | export default function Loader() {
5 | return (
6 |
7 |
8 | We are currently using free servers.
9 | This may take a while...
10 |
11 |
12 |
13 |
17 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/src/components/Navbar.tsx:
--------------------------------------------------------------------------------
1 | import { Link } from "react-router-dom";
2 | import {
3 | Box,
4 | Flex,
5 | Text,
6 | IconButton,
7 | Button,
8 | Stack,
9 | Collapse,
10 | Icon,
11 | Popover,
12 | PopoverTrigger,
13 | PopoverContent,
14 | useColorModeValue,
15 | useBreakpointValue,
16 | useDisclosure,
17 | Image,
18 | } from "@chakra-ui/react";
19 | import {
20 | HamburgerIcon,
21 | CloseIcon,
22 | ChevronDownIcon,
23 | ChevronRightIcon,
24 | } from "@chakra-ui/icons";
25 | import icon from "../assets/icon.png";
26 |
27 | export default function Navbar() {
28 | const { isOpen, onToggle } = useDisclosure();
29 |
30 | return (
31 |
32 |
43 |
48 | :
52 | }
53 | variant={"ghost"}
54 | aria-label={"Toggle Navigation"}
55 | />
56 |
57 |
63 |
64 |
65 |
66 |
74 | {" "}
80 |
86 | AstraPredict
87 |
88 |
89 |
90 |
91 | {/*
97 |
108 | Sign In
109 |
110 |
122 | Sign Up
123 |
124 | */}
125 |
126 |
127 |
128 |
129 |
130 |
131 | );
132 | }
133 |
134 | const DesktopNav = () => {
135 | const popoverContentBgColor = useColorModeValue("white", "orange.800");
136 |
137 | return (
138 |
139 | {NAV_ITEMS.map((navItem) => (
140 |
141 |
142 |
143 |
154 | {navItem.label}
155 |
156 |
157 |
158 | {navItem.children && (
159 |
167 |
168 | {navItem.children.map((child) => (
169 |
170 | ))}
171 |
172 |
173 | )}
174 |
175 |
176 | ))}
177 |
178 | );
179 | };
180 |
181 | const DesktopSubNav = ({ label, link }: NavItem) => {
182 | return (
183 |
184 |
185 |
186 |
191 | {label}
192 |
193 | {/* {subLabel} */}
194 |
195 |
204 |
205 |
206 |
207 |
208 | );
209 | };
210 |
211 | const MobileNav = () => {
212 | return (
213 |
218 | {NAV_ITEMS.map((navItem) => (
219 |
220 | ))}
221 |
222 | );
223 | };
224 |
225 | const MobileNavItem = ({ label, children, link }: NavItem) => {
226 | const { isOpen, onToggle } = useDisclosure();
227 |
228 | return (
229 |
230 |
239 |
243 | {label}
244 |
245 | {children && (
246 |
253 | )}
254 |
255 |
256 |
257 |
265 |
266 |
267 | );
268 | };
269 |
270 | interface NavItem {
271 | label: string;
272 | children?: Array;
273 | link?: any;
274 | }
275 |
276 | const NAV_ITEMS: Array = [
277 | {
278 | label: "Sidereal",
279 | link: "./sidereal",
280 | },
281 |
282 | {
283 | label: "Prediction",
284 | link: "./prediction",
285 | },
286 | ];
287 |
--------------------------------------------------------------------------------
/src/components/Prediction.tsx:
--------------------------------------------------------------------------------
1 | import "../App.css";
2 | import Ascendant from "./Ascendant";
3 | import { FC, useState, useEffect } from "react";
4 | import { getMarketData } from "./Coingecko";
5 | import { useNavigate } from "react-router-dom";
6 | import {
7 | Box,
8 | SimpleGrid,
9 | Table,
10 | Thead,
11 | Tbody,
12 | Tr,
13 | Th,
14 | Td,
15 | TableCaption,
16 | TableContainer,
17 | Input,
18 | Button,
19 | Progress,
20 | Stack,
21 | Image,
22 | } from "@chakra-ui/react";
23 | import icon from "../assets/icon.png";
24 | import { IData } from "../App";
25 | import { useDispatch, useSelector } from "react-redux";
26 | import { changeCoinId } from "../slice/coinId.slice";
27 | import type { RootState } from "../store";
28 |
29 | interface coinsArray {
30 | data: Array;
31 | }
32 |
33 | const Prediction: FC = ({ data, loading }) => {
34 | const slice = useSelector((state: RootState) => state);
35 | const [id, setId] = useState(slice.locationReducer.location.date);
36 | const [input, setInput] = useState("bitcoin");
37 | const [coins, setCoins] = useState({ data: [] });
38 | const dispatch = useDispatch();
39 |
40 | useEffect(() => {
41 | setId(slice.locationReducer.location.date);
42 | }, [slice.locationReducer.location.date]);
43 |
44 | useEffect(() => {
45 | if (coins?.data?.length === 0 && data.planets.length > 0) {
46 | const getCoinsImages = async () => {
47 | const coinsArray = await getMarketData(data.coins);
48 | setCoins(coinsArray);
49 | };
50 | getCoinsImages();
51 | }
52 | }, [data.location.ip]);
53 |
54 | return (
55 |
56 |
57 |
58 | {" "}
59 |
60 |
61 |
62 | setInput(e.target.value)}
65 | />
66 |
67 |
68 | {
72 | dispatch(changeCoinId(input.toLowerCase()));
73 | }}
74 | >
75 | Submit
76 |
77 |
78 |
79 |
86 | {coins?.data?.length ? (
87 | coins?.data?.map((coin, i) => (
88 | {
91 | dispatch(changeCoinId(coin.id));
92 | }}
93 | title={coin.id}
94 | width="60px"
95 | padding="10px"
96 | _hover={{ cursor: "pointer" }}
97 | src={coin.image.toString()}
98 | >
99 | ))
100 | ) : (
101 |
108 | )}
109 |
110 |
111 | {loading ? (
112 |
113 | ) : (
114 |
115 | )}
116 |
117 |
118 |
119 |
120 |
121 |
122 | Date
123 |
124 |
125 | Description
126 |
127 | 24 Hr %∆
128 |
129 |
130 |
131 | {data?.coin_id ? data.coin_id : "bitcoin"} predictions
132 |
133 |
134 |
135 | {data.prev_date.split(" ")[0]}
136 | Predicted
137 |
138 | {" "}
139 | 0
143 | ? "green"
144 | : "red",
145 | fontWeight: "bold",
146 | }}
147 | >
148 | {(Number(data.prev_predicted) * 100).toFixed(4)} %
149 |
150 |
151 |
152 |
153 | {data.prev_date.split(" ")[0]}
154 | Actual
155 |
156 | {" "}
157 | 0 ? "green" : "red",
160 | fontWeight: "bold",
161 | }}
162 | >
163 | {Number(data.price_change).toFixed(4)} %
164 |
165 |
166 |
167 |
168 |
169 | {" "}
170 |
176 | {data.prediction_date.split(" ")[0]}
177 |
178 |
179 |
180 |
186 | Future
187 |
188 |
189 |
190 |
191 | {" "}
192 | 0 ? "green" : "red",
195 | fontWeight: "bold",
196 | }}
197 | >
198 | {(Number(data.predicted) * 100).toFixed(4)} %
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 | );
209 | };
210 |
211 | export default Prediction;
212 | export {};
213 |
--------------------------------------------------------------------------------
/src/components/Sidereal.tsx:
--------------------------------------------------------------------------------
1 | import "../App.css";
2 | import { FC, useEffect, useState } from "react";
3 | import Ascendant from "./Ascendant";
4 | import {
5 | Box,
6 | SimpleGrid,
7 | Table,
8 | Thead,
9 | Tbody,
10 | Tfoot,
11 | Tr,
12 | Th,
13 | Td,
14 | TableCaption,
15 | TableContainer,
16 | Input,
17 | Progress,
18 | Button,
19 | Stack,
20 | } from "@chakra-ui/react";
21 | import { SingleDatepicker } from "chakra-dayzed-datepicker";
22 | import { IData } from "../App";
23 | import { useDispatch, useSelector } from "react-redux";
24 | import { changeLocation } from "../slice/location.slice";
25 | import type { RootState } from "../store";
26 | import moment from "moment";
27 |
28 | const Sidereal: FC = ({ data, loading }) => {
29 | const slice = useSelector((state: RootState) => state);
30 | const [date, setDate] = useState(
31 | slice.locationReducer.location.date
32 | ? new Date(slice.locationReducer.location.date?.replace("-", "/"))
33 | : new Date()
34 | );
35 | const dispatch = useDispatch();
36 |
37 | return (
38 |
39 |
40 |
41 |
42 |
43 |
44 |
49 |
50 |
51 | {
55 | dispatch(
56 | changeLocation({
57 | date: moment(date).format("YYYY-MM-DD"),
58 | data: slice.locationReducer.location.data,
59 | })
60 | );
61 | }}
62 | >
63 | Submit
64 |
65 |
66 |
67 | {loading ? (
68 |
69 | ) : (
70 |
71 | )}
72 |
73 |
74 |
75 |
76 | Planets
77 |
78 | Positions
79 |
80 |
81 |
82 |
83 | Sidereal Positions {moment(date).format("YYYY-MM-DD")}
84 |
85 |
86 |
87 | {data.planets.slice(1).map((planet, i) => {
88 | return (
89 |
90 | {planet.planet}
91 |
92 | {" "}
93 |
94 | {planet.longitude}
95 |
96 |
97 |
98 | );
99 | })}
100 |
101 |
102 |
103 |
104 |
105 |
106 | );
107 | };
108 |
109 | export default Sidereal;
110 |
--------------------------------------------------------------------------------
/src/constants.ts:
--------------------------------------------------------------------------------
1 | const baseURL = "https://astrapredict.onrender.com"
2 |
3 | export {baseURL}
--------------------------------------------------------------------------------
/src/hooks.ts:
--------------------------------------------------------------------------------
1 | import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'
2 | import type { RootState, AppDispatch } from './store'
3 |
4 | // Use throughout your app instead of plain `useDispatch` and `useSelector`
5 | export const useAppDispatch: () => AppDispatch = useDispatch
6 | export const useAppSelector: TypedUseSelectorHook = useSelector
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom/client";
3 | import "./index.css";
4 | import App from "./App";
5 | import { ChakraProvider } from "@chakra-ui/react";
6 | import { BrowserRouter } from "react-router-dom";
7 | import store from "./store";
8 | import { Provider } from "react-redux";
9 |
10 | const root = ReactDOM.createRoot(
11 | document.getElementById("root") as HTMLElement
12 | );
13 | root.render(
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | );
24 |
25 | // If you want to start measuring performance in your app, pass a function
26 | // to log results (for example: reportWebVitals(console.log))
27 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
28 |
--------------------------------------------------------------------------------
/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/src/reportWebVitals.ts:
--------------------------------------------------------------------------------
1 | import { ReportHandler } from 'web-vitals';
2 |
3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => {
4 | if (onPerfEntry && onPerfEntry instanceof Function) {
5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
6 | getCLS(onPerfEntry);
7 | getFID(onPerfEntry);
8 | getFCP(onPerfEntry);
9 | getLCP(onPerfEntry);
10 | getTTFB(onPerfEntry);
11 | });
12 | }
13 | };
14 |
15 | export default reportWebVitals;
16 |
--------------------------------------------------------------------------------
/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------
/src/slice/coinId.slice.ts:
--------------------------------------------------------------------------------
1 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'
2 | import type { RootState } from '../store'
3 |
4 | // Define a type for the slice state
5 | interface CoinIdState {
6 | coinId: String
7 | }
8 |
9 | // Define the initial state using that type
10 | const initialState: CoinIdState = {
11 | coinId: "bitcoin",
12 | }
13 |
14 | export const coinIdSlice = createSlice({
15 | name: 'coinId',
16 | // `createSlice` will infer the state type from the `initialState` argument
17 | initialState,
18 | reducers: {
19 | // Use the PayloadAction type to declare the contents of `action.payload`
20 | changeCoinId: (state, action: PayloadAction) => {
21 | state.coinId = action.payload
22 | },
23 | },
24 | })
25 |
26 | export const { changeCoinId } = coinIdSlice.actions
27 |
28 | // Other code such as selectors can use the imported `RootState` type
29 | export const coinId = (state: RootState) => state.coinIdReducer
30 |
31 | export default coinIdSlice.reducer
--------------------------------------------------------------------------------
/src/slice/location.slice.ts:
--------------------------------------------------------------------------------
1 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'
2 | import type { RootState } from '../store'
3 |
4 | // Define a type for the slice state
5 | interface LocationState {
6 | location: data
7 | }
8 |
9 | interface data {
10 | date: String,
11 | data: {region: String, city: String, country: String}
12 | }
13 |
14 | // Define the initial state using that type
15 | const initialState: LocationState = {
16 | location: {date: '' , data: {region: "New York", city: "New York", country: "US" }},
17 | }
18 |
19 | export const LocationSlice = createSlice({
20 | name: 'location',
21 | // `createSlice` will infer the state type from the `initialState` argument
22 | initialState,
23 | reducers: {
24 | // Use the PayloadAction type to declare the contents of `action.payload`
25 | changeLocation: (state, action: PayloadAction) => {
26 | state.location = action.payload
27 | },
28 | },
29 | })
30 |
31 | export const { changeLocation } = LocationSlice.actions
32 |
33 | // Other code such as selectors can use the imported `RootState` type
34 | export const locationData = (state: RootState) => state.locationReducer
35 |
36 | export default LocationSlice.reducer
--------------------------------------------------------------------------------
/src/store.ts:
--------------------------------------------------------------------------------
1 | import { configureStore } from '@reduxjs/toolkit'
2 | import coinIdReducer from './slice/coinId.slice'
3 | import locationReducer from './slice/location.slice'
4 |
5 | const store = configureStore({
6 | reducer: {
7 | coinIdReducer,
8 | locationReducer
9 | },
10 | })
11 | export default store
12 |
13 | // Infer the `RootState` and `AppDispatch` types from the store itself
14 | export type RootState = ReturnType
15 | // Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
16 | export type AppDispatch = typeof store.dispatch
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "strict": true,
14 | "forceConsistentCasingInFileNames": true,
15 | "noFallthroughCasesInSwitch": true,
16 | "module": "esnext",
17 | "moduleResolution": "node",
18 | "resolveJsonModule": true,
19 | "isolatedModules": true,
20 | "noEmit": true,
21 | "jsx": "react-jsx"
22 | },
23 | "include": [
24 | "src"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------