├── .env ├── src ├── react-app-env.d.ts ├── config │ └── index.ts ├── assets │ ├── icons │ │ ├── logo.png │ │ ├── tether.png │ │ ├── avatar-blank.png │ │ ├── xmr.svg │ │ └── xrp.svg │ └── images │ │ └── sidebar-background.jpg ├── containers │ ├── 404 │ │ ├── 404.css │ │ └── index.tsx │ ├── sendout-history │ │ ├── styled.ts │ │ └── index.tsx │ ├── layout │ │ ├── main-layout │ │ │ ├── content │ │ │ │ ├── styled.ts │ │ │ │ └── index.tsx │ │ │ ├── footer │ │ │ │ ├── index.tsx │ │ │ │ └── styled.ts │ │ │ ├── styled.ts │ │ │ ├── header │ │ │ │ ├── index.tsx │ │ │ │ └── styled.ts │ │ │ ├── index.tsx │ │ │ └── sidebar │ │ │ │ ├── styled.ts │ │ │ │ └── index.tsx │ │ └── auth-layout │ │ │ ├── footer │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ │ ├── styled.ts │ │ │ ├── index.tsx │ │ │ └── header │ │ │ ├── index.tsx │ │ │ └── styled.ts │ ├── signup │ │ ├── styled.ts │ │ └── index.tsx │ ├── signin │ │ ├── styled.ts │ │ └── index.tsx │ ├── app │ │ └── index.tsx │ ├── add-funds │ │ ├── styled.ts │ │ └── index.tsx │ └── quick-sms │ │ ├── index.tsx │ │ └── styled.ts ├── validation │ ├── is-email.ts │ └── is-empty.ts ├── setupTests.ts ├── hooks │ ├── use-app-dispatch.ts │ └── use-app-seletecor.ts ├── components │ ├── form-input │ │ ├── styled.ts │ │ └── index.tsx │ ├── form-card │ │ ├── index.tsx │ │ └── styled.ts │ ├── loading │ │ ├── index.tsx │ │ └── styled.ts │ ├── toastr │ │ └── index.tsx │ ├── highlight-button │ │ ├── index.tsx │ │ └── styled.ts │ └── form-button │ │ ├── index.tsx │ │ └── styled.ts ├── styles │ ├── mq.ts │ ├── theme.ts │ ├── global.ts │ └── typography.ts ├── common │ ├── types │ │ └── auth-types.ts │ ├── services │ │ ├── auth-api-service.ts │ │ └── http-api-service.ts │ └── api │ │ └── auth.ts ├── hocs │ └── require-auth.tsx ├── features │ ├── menu-slice.ts │ └── auth-slice.ts ├── app │ ├── store.ts │ └── routes.ts ├── index.tsx ├── index.css └── serviceWorker.ts ├── public ├── robots.txt ├── logo.png ├── favicon.ico ├── logo192.png ├── logo512.png ├── manifest.json └── index.html ├── .prettierrc ├── .gitignore ├── tsconfig.paths.json ├── tsconfig.json ├── config-overrides.js ├── package.json └── README.md /.env: -------------------------------------------------------------------------------- 1 | NODE_PATH=./ -------------------------------------------------------------------------------- /src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devmad119/react-redux-typescript-axios-starter/HEAD/public/logo.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devmad119/react-redux-typescript-axios-starter/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devmad119/react-redux-typescript-axios-starter/HEAD/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devmad119/react-redux-typescript-axios-starter/HEAD/public/logo512.png -------------------------------------------------------------------------------- /src/config/index.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | apiUrl: 'http://localhost:5000', 3 | tokenSuffix: 'Supremacy ', 4 | }; 5 | -------------------------------------------------------------------------------- /src/assets/icons/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devmad119/react-redux-typescript-axios-starter/HEAD/src/assets/icons/logo.png -------------------------------------------------------------------------------- /src/assets/icons/tether.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devmad119/react-redux-typescript-axios-starter/HEAD/src/assets/icons/tether.png -------------------------------------------------------------------------------- /src/assets/icons/avatar-blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devmad119/react-redux-typescript-axios-starter/HEAD/src/assets/icons/avatar-blank.png -------------------------------------------------------------------------------- /src/assets/images/sidebar-background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devmad119/react-redux-typescript-axios-starter/HEAD/src/assets/images/sidebar-background.jpg -------------------------------------------------------------------------------- /src/containers/sendout-history/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | 3 | export const StyledSendoutHistory = styled.div` 4 | display: flex; 5 | ` -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 150, 3 | "tabWidth": 2, 4 | "singleQuote": true, 5 | "trailingComma": "all", 6 | "semi": true, 7 | "arrowParens": "avoid" 8 | } 9 | -------------------------------------------------------------------------------- /src/containers/layout/main-layout/content/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | 3 | export const StyledContent = styled.div` 4 | min-height: calc(100vh - 120px); 5 | padding: 40px 30px; 6 | `; 7 | -------------------------------------------------------------------------------- /src/containers/sendout-history/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const SenoutHistory: React.FC = () => { 4 | return ( 5 | <> 6 | Sendout History 7 | > 8 | ); 9 | }; 10 | 11 | export default SenoutHistory; 12 | -------------------------------------------------------------------------------- /src/validation/is-email.ts: -------------------------------------------------------------------------------- 1 | export default function isEmail(email: string) { 2 | return email.match( 3 | /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, 4 | ); 5 | } 6 | -------------------------------------------------------------------------------- /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/extend-expect'; 6 | -------------------------------------------------------------------------------- /src/hooks/use-app-dispatch.ts: -------------------------------------------------------------------------------- 1 | import { useDispatch } from 'react-redux'; 2 | import type { AppDispatch } from 'app/store'; 3 | 4 | // Use throughout your app instead of plain `useDispatch` 5 | const useAppDispatch = () => useDispatch(); 6 | 7 | export default useAppDispatch; 8 | -------------------------------------------------------------------------------- /src/hooks/use-app-seletecor.ts: -------------------------------------------------------------------------------- 1 | import { TypedUseSelectorHook, useSelector } from 'react-redux'; 2 | import type { RootState } from 'app/store'; 3 | 4 | // Use throughout your app instead of plain `useSelector` 5 | const useAppSelector: TypedUseSelectorHook = useSelector; 6 | 7 | export default useAppSelector; 8 | -------------------------------------------------------------------------------- /src/components/form-input/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | 3 | export const StyledInput = styled.input` 4 | font-size: 15px; 5 | letter-spacing: 1px; 6 | color: #3b3f5c; 7 | margin: 10px 0; 8 | padding: 12px 20px; 9 | outline: none; 10 | border: 1px solid #3b3f5c; 11 | width: 100%; 12 | `; 13 | -------------------------------------------------------------------------------- /src/styles/mq.ts: -------------------------------------------------------------------------------- 1 | export enum ScreenSize { 2 | SM = 375, 3 | MD = 768, 4 | LG = 1180, 5 | } 6 | 7 | const mq = { 8 | small: `@media (min-width: ${ScreenSize.SM / 16}em)`, 9 | medium: `@media (min-width: ${ScreenSize.MD / 16}em)`, 10 | large: `@media (min-width: ${ScreenSize.LG / 16}em)`, 11 | }; 12 | 13 | export default mq; 14 | -------------------------------------------------------------------------------- /src/containers/layout/auth-layout/footer/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyledFooter } from './styled'; 3 | 4 | const Footer: React.FC = () => { 5 | return ( 6 | 7 | Copyright © All rights reserved ♡ by SupremacySMS 8 | 9 | ); 10 | }; 11 | 12 | export default Footer; 13 | -------------------------------------------------------------------------------- /src/containers/layout/main-layout/footer/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyledFooter } from './styled'; 3 | 4 | const Footer: React.FC = () => { 5 | return ( 6 | 7 | Copyright © All rights reserved ♡ by SupremacySMS 8 | 9 | ); 10 | }; 11 | 12 | export default Footer; 13 | -------------------------------------------------------------------------------- /src/containers/layout/main-layout/content/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyledContent } from './styled'; 3 | 4 | interface Props { 5 | children: any; 6 | } 7 | 8 | const Content: React.FC = props => { 9 | const { children } = props; 10 | 11 | return {children}; 12 | }; 13 | 14 | export default Content; 15 | -------------------------------------------------------------------------------- /src/validation/is-empty.ts: -------------------------------------------------------------------------------- 1 | export default function isEmpty(value: any) { 2 | let result: boolean = false; 3 | if ( 4 | value === undefined || 5 | value === null || 6 | (typeof value === 'object' && Object.keys(value).length === 0) || 7 | (typeof value === 'string' && value.trim().length === 0) 8 | ) 9 | result = true; 10 | return result; 11 | } 12 | -------------------------------------------------------------------------------- /src/containers/layout/auth-layout/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import theme from 'styles/theme'; 3 | 4 | export const AuthSection = styled.div` 5 | padding: 10vh 0; 6 | margin-top: 70px; 7 | background-color: ${theme.color.background.dark}; 8 | min-height: calc(100vh - 120px); 9 | display: flex; 10 | align-items: center; 11 | justify-content: center; 12 | `; 13 | -------------------------------------------------------------------------------- /src/components/form-card/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyledCard } from './styled'; 3 | 4 | interface Props { 5 | children: any; 6 | onKeyDown: Function; 7 | } 8 | 9 | const FormCard: React.FC = props => { 10 | const { children, onKeyDown } = props; 11 | return onKeyDown(e)}>{children}; 12 | }; 13 | 14 | export default FormCard; 15 | -------------------------------------------------------------------------------- /src/components/form-card/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | 3 | export const StyledCard = styled.div` 4 | display: flex; 5 | flex-direction: column; 6 | border-radius: 5px; 7 | padding: 24px 30px; 8 | box-shadow: 0 10px 34px -15px rgb(245 245 247); 9 | text-align: center; 10 | align-items: center; 11 | min-width: 350px; 12 | position: relative; 13 | z-index: 0; 14 | `; 15 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /src/components/loading/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { CustomLoadingWrapper, CustomLoadingContent, Label } from './styled'; 3 | 4 | const Loading: React.FC = () => { 5 | return ( 6 | 7 | 8 | Loading 9 | 10 | 11 | 12 | ); 13 | }; 14 | 15 | export default Loading; 16 | -------------------------------------------------------------------------------- /src/common/types/auth-types.ts: -------------------------------------------------------------------------------- 1 | export type CreateUser = { 2 | email: string; 3 | password: string; 4 | userName: string; 5 | }; 6 | 7 | export type CheckAccount = { 8 | account: string; 9 | password: string; 10 | }; 11 | 12 | export type TokenResponse = { 13 | api_token: string; 14 | handle: string; 15 | }; 16 | 17 | export type CurrentUser = { 18 | _id: string; 19 | email: string; 20 | userName: string; 21 | }; 22 | -------------------------------------------------------------------------------- /src/containers/layout/main-layout/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import theme from 'styles/theme'; 3 | 4 | export const MainSection = styled.div` 5 | width: -webkit-fill-available; 6 | `; 7 | 8 | export const ContentSection = styled.div` 9 | overflow: auto; 10 | height: calc(100vh - 70px); 11 | `; 12 | 13 | export const StyledMainLayout = styled.div` 14 | display: flex; 15 | background-color: ${theme.color.background.main}; 16 | `; 17 | -------------------------------------------------------------------------------- /src/containers/layout/auth-layout/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Header from './header'; 3 | import Footer from './footer'; 4 | import { AuthSection } from './styled'; 5 | 6 | interface Props { 7 | children: any; 8 | } 9 | 10 | const AuthLayout: React.FC = props => { 11 | const { children } = props; 12 | 13 | return ( 14 | <> 15 | 16 | {children} 17 | 18 | > 19 | ); 20 | }; 21 | 22 | export default AuthLayout; 23 | -------------------------------------------------------------------------------- /src/components/toastr/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { ToastContainer } from 'react-toastify'; 3 | 4 | const Toastr: React.FC = () => { 5 | return ( 6 | 18 | ); 19 | }; 20 | 21 | export default Toastr; 22 | -------------------------------------------------------------------------------- /src/assets/icons/xmr.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tsconfig.paths.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "src", 4 | "paths": { 5 | "/*": ["*"], 6 | "app/*": ["app/*"], 7 | "assets/*": ["assets/*"], 8 | "common*": ["common/*"], 9 | "components/*": ["components/*"], 10 | "containers/*": ["containers/*"], 11 | "context/*": ["context/*"], 12 | "hocs/*": ["hocs/*"], 13 | "hooks/*": ["hooks/*"], 14 | "styles/*": ["styles/*"], 15 | "validation/*": ["validation/*"], 16 | "features/*": ["features/*"] 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/containers/layout/main-layout/footer/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import theme from 'styles/theme'; 3 | 4 | export const StyledFooter = styled.footer` 5 | background-color: ${theme.color.background.light}; 6 | padding: 15px 55px; 7 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 8 | display: flex; 9 | width: 100%; 10 | justify-content: center; 11 | align-items: center; 12 | z-index: 1; 13 | 14 | span { 15 | font-size: 15px; 16 | color: ${theme.color.text.light}; 17 | } 18 | `; 19 | -------------------------------------------------------------------------------- /src/containers/layout/auth-layout/footer/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import theme from 'styles/theme'; 3 | 4 | export const StyledFooter = styled.footer` 5 | background-color: ${theme.color.background.midnight}; 6 | padding: 15px 55px; 7 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 8 | display: flex; 9 | width: 100%; 10 | justify-content: center; 11 | align-items: center; 12 | z-index: 1; 13 | 14 | span { 15 | font-size: 15px; 16 | color: ${theme.color.text.light}; 17 | } 18 | `; 19 | -------------------------------------------------------------------------------- /src/components/form-input/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyledInput } from './styled'; 3 | 4 | interface Props { 5 | name?: string; 6 | type?: 'text' | 'password' | 'email' | 'date' | 'checkbox' | 'radio'; 7 | value?: string; 8 | placeholder?: string; 9 | onChange: Function; 10 | } 11 | 12 | const FormInput: React.FC = props => { 13 | const { name, type, value, placeholder, onChange } = props; 14 | return onChange(e)} />; 15 | }; 16 | 17 | export default FormInput; 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/components/highlight-button/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyledButton } from './styled'; 3 | import { PuffLoader } from 'react-spinners'; 4 | 5 | interface Props { 6 | children: any; 7 | onClick: Function; 8 | loading: boolean; 9 | } 10 | 11 | const HighlightButton: React.FC = props => { 12 | const { onClick, children, loading } = props; 13 | 14 | return ( 15 | onClick()} disabled={loading}> 16 | 17 | {!loading && children} 18 | 19 | ); 20 | }; 21 | 22 | export default HighlightButton; 23 | -------------------------------------------------------------------------------- /src/containers/layout/main-layout/header/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | import { StyledHeader, Links } from './styled'; 4 | import avatarBlank from 'assets/icons/avatar-blank.png'; 5 | 6 | const Header: React.FC = () => { 7 | return ( 8 | 9 | 10 | Add Funds 11 | Balance 12 | 13 | 14 | 15 | 16 | 17 | ); 18 | }; 19 | 20 | export default Header; 21 | -------------------------------------------------------------------------------- /src/components/form-button/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyledButton } from './styled'; 3 | import { PuffLoader } from 'react-spinners'; 4 | 5 | interface Props { 6 | children: any; 7 | variant?: 'primary' | 'secondary'; 8 | onClick: Function; 9 | loading: boolean; 10 | } 11 | 12 | const FormButton: React.FC = props => { 13 | const { variant, onClick, children, loading } = props; 14 | 15 | return ( 16 | onClick()} disabled={loading}> 17 | 18 | {children} 19 | 20 | ); 21 | }; 22 | 23 | export default React.memo(FormButton); 24 | -------------------------------------------------------------------------------- /src/hocs/require-auth.tsx: -------------------------------------------------------------------------------- 1 | import { ComponentType } from 'react'; 2 | import { Redirect } from 'react-router-dom'; 3 | import { selectIsAuthenticated } from 'features/auth-slice'; 4 | import useAppSelector from 'hooks/use-app-seletecor'; 5 | import authApi from 'common/api/auth'; 6 | 7 | const requireAuth = 8 | (BaseComponent: ComponentType) => 9 | (props: Props) => { 10 | const isAuthenticated = useAppSelector(selectIsAuthenticated); 11 | 12 | if (!isAuthenticated) { 13 | authApi.logout(); 14 | return ; 15 | } 16 | 17 | return ; 18 | }; 19 | 20 | export default requireAuth; 21 | -------------------------------------------------------------------------------- /src/containers/layout/auth-layout/header/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | import { StyledHeader, Logo, LogoTitle, Links } from './styled'; 4 | import logoImg from 'assets/icons/logo.png'; 5 | 6 | const Header: React.FC = () => { 7 | return ( 8 | 9 | 10 | 11 | 12 | Supremacy 13 | 14 | 15 | 16 | Sign In 17 | Sign Up 18 | 19 | 20 | ); 21 | }; 22 | 23 | export default Header; 24 | -------------------------------------------------------------------------------- /src/styles/theme.ts: -------------------------------------------------------------------------------- 1 | const theme = { 2 | color: { 3 | text: { 4 | white: '#FFF', 5 | light: '#999CAD', 6 | muted: 'rgb(248 249 254 / 50%)', 7 | link: '#0D8FE6', 8 | midnight: '#202A5A', 9 | danger: '#e51169', 10 | }, 11 | background: { 12 | dark: '#010a0c', 13 | night: '#060818', 14 | midnight: '#0e1726', 15 | light: '#151839bb', 16 | main: '#222b52', 17 | panel: '#151939ff', 18 | highlight: '#353F68', 19 | white: '#FFF', 20 | }, 21 | border: { 22 | light: '#E8E6EA', 23 | }, 24 | button: { 25 | primary: '#4361ee', 26 | secondary: '#cc33ff', 27 | }, 28 | }, 29 | }; 30 | 31 | export default theme; 32 | -------------------------------------------------------------------------------- /src/features/menu-slice.ts: -------------------------------------------------------------------------------- 1 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'; 2 | import { RootState } from 'app/store'; 3 | 4 | interface MenuState { 5 | selectedIndex: number; 6 | } 7 | 8 | const initialState: MenuState = { 9 | selectedIndex: 0, 10 | }; 11 | 12 | export const menuSlice = createSlice({ 13 | name: 'menu', 14 | initialState, 15 | // The `reducers` field lets us define reducers and generate associated actions 16 | reducers: { 17 | setSelectedIndex: (state: MenuState, action: PayloadAction) => { 18 | state.selectedIndex = action.payload; 19 | }, 20 | }, 21 | }); 22 | 23 | export const { setSelectedIndex } = menuSlice.actions; 24 | 25 | export const selectIndex = (state: RootState) => state.menu.selectedIndex; 26 | 27 | export default menuSlice.reducer; 28 | -------------------------------------------------------------------------------- /src/containers/signup/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import { heading } from 'styles/typography'; 3 | import theme from 'styles/theme'; 4 | 5 | export const Title = styled.h4` 6 | ${heading.h5.regular}; 7 | margin-top: 30px; 8 | margin-bottom: 10px; 9 | `; 10 | 11 | export const LinkText = styled.span` 12 | color: ${theme.color.text.light}; 13 | margin-top: 10px; 14 | margin-bottom: 10px; 15 | font-size: small; 16 | display: flex; 17 | flex-direction: column; 18 | 19 | ::after { 20 | transition: all 0.2s ease-in-out; 21 | content: ''; 22 | height: 1px; 23 | background-color: white; 24 | width: 100%; 25 | left: 0; 26 | bottom: -5px; 27 | transform: scaleX(0); 28 | } 29 | :hover { 30 | color: #c0c0c0; 31 | ::after { 32 | transform: scaleX(1); 33 | } 34 | } 35 | `; 36 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.paths.json", 3 | "compilerOptions": { 4 | "target": "es5", 5 | "lib": [ 6 | "dom", 7 | "dom.iterable", 8 | "esnext" 9 | ], 10 | "allowJs": true, 11 | "skipLibCheck": true, 12 | "esModuleInterop": true, 13 | "allowSyntheticDefaultImports": true, 14 | "strict": true, 15 | "forceConsistentCasingInFileNames": true, 16 | "noFallthroughCasesInSwitch": true, 17 | "module": "esnext", 18 | "moduleResolution": "node", 19 | "resolveJsonModule": true, 20 | "isolatedModules": true, 21 | "noEmit": true, 22 | "jsx": "react-jsx", 23 | "importHelpers": true, 24 | "baseUrl": "src" 25 | }, 26 | "include": [ 27 | "src/**/*.ts", 28 | "src/**/*.tsx", 29 | "src/**/*.json" 30 | ], 31 | "exclude": [ 32 | "node_modules" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /src/components/highlight-button/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | 3 | export const StyledButton = styled.button` 4 | display: flex; 5 | align-items: center; 6 | justify-content: center; 7 | background: linear-gradient(65.4deg, #4e89fe 18.74%, #6ac7fc 88.33%); 8 | border-radius: 5px; 9 | padding: 8px 16px; 10 | color: white; 11 | width: 100%; 12 | border: none; 13 | cursor: pointer; 14 | :hover { 15 | background: linear-gradient(65.4deg, #6ac7fc 15.74%, #4e89fe 78.33%); 16 | } 17 | :active { 18 | transform: scale(0.95); 19 | } 20 | :disabled { 21 | padding: 8px 8px; 22 | box-shadow: 0 0px 0px 0 rgba(0, 0, 0, 0.2), 0 0px 0px 0 rgba(0, 0, 0, 0.19); 23 | } 24 | 25 | label { 26 | margin-left: 5px; 27 | cursor: pointer; 28 | } 29 | 30 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 31 | `; 32 | -------------------------------------------------------------------------------- /src/components/form-button/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import theme from 'styles/theme'; 3 | 4 | interface Props { 5 | variant?: string; 6 | } 7 | 8 | export const StyledButton = styled.button` 9 | display: flex; 10 | justify-content: center; 11 | align-items: center; 12 | border: none; 13 | margin: 10px 0; 14 | padding: 8px 16px; 15 | color: white; 16 | width: 100%; 17 | background: ${({ variant }) => { 18 | switch (variant) { 19 | case 'primary': 20 | return theme.color.button.primary; 21 | case 'secondary': 22 | return theme.color.button.secondary; 23 | default: 24 | return theme.color.button.primary; 25 | } 26 | }}; 27 | line-height: 1.5; 28 | cursor: pointer; 29 | transition: all 0.2s ease-in-out; 30 | 31 | :disabled { 32 | opacity: 0.65; 33 | } 34 | :hover { 35 | margin: 7px 0 13px 0; 36 | } 37 | :active { 38 | transform: scale(0.95); 39 | } 40 | `; 41 | -------------------------------------------------------------------------------- /src/containers/layout/main-layout/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PerfectScrollbar from 'react-perfect-scrollbar'; 3 | import Header from './header'; 4 | import Footer from './footer'; 5 | import Sidebar from './sidebar'; 6 | import Content from './content'; 7 | import { MainSection, StyledMainLayout, ContentSection } from './styled'; 8 | import requireAuth from 'hocs/require-auth'; 9 | 10 | interface Props { 11 | children: any; 12 | } 13 | 14 | 15 | const MainLayout: React.FC = props => { 16 | const { children } = props; 17 | 18 | return ( 19 | 20 | 21 | 22 | 23 | 24 | 25 | {children} 26 | 27 | 28 | 29 | 30 | 31 | ); 32 | }; 33 | 34 | export default requireAuth(MainLayout); 35 | -------------------------------------------------------------------------------- /config-overrides.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = function override(config) { 4 | config.resolve = { 5 | ...config.resolve, 6 | alias: { 7 | ...config.alias, 8 | '/*': path.resolve(__dirname, 'src/*'), 9 | 'app/*': path.resolve(__dirname, 'src/app/*'), 10 | 'assets/*': path.resolve(__dirname, 'src/assets/*'), 11 | 'common/*': path.resolve(__dirname, 'src/common/*'), 12 | 'components/*': path.resolve(__dirname, 'src/components/*'), 13 | 'containers/*': path.resolve(__dirname, 'src/containers/*'), 14 | 'context/*': path.resolve(__dirname, 'src/context/*'), 15 | 'hocs/*': path.resolve(__dirname, 'src/hocs/*'), 16 | 'hooks/*': path.resolve(__dirname, 'src/hooks/*'), 17 | 'styles/*': path.resolve(__dirname, 'src/styles/*'), 18 | 'validation/*': path.resolve(__dirname, 'src/validation/*'), 19 | 'features/*': path.resolve(__dirname, 'src/features/*'), 20 | }, 21 | }; 22 | 23 | return config; 24 | }; 25 | -------------------------------------------------------------------------------- /src/containers/layout/main-layout/header/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import theme from 'styles/theme'; 3 | 4 | export const StyledHeader = styled.header` 5 | background-color: ${theme.color.background.light}; 6 | padding: 15px 55px; 7 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 8 | display: flex; 9 | justify-content: flex-end; 10 | align-items: center; 11 | z-index: 1; 12 | width: 100%; 13 | `; 14 | 15 | export const Links = styled.div` 16 | display: flex; 17 | flex-direction: row; 18 | align-items: center; 19 | justify-content: space-between; 20 | 21 | & > * { 22 | padding: 0 15px; 23 | } 24 | 25 | a { 26 | position: relative; 27 | display: flex; 28 | flex-direction: column; 29 | font-weight: 500; 30 | color: white; 31 | 32 | :hover { 33 | color: #c0c0c0; 34 | ::after { 35 | transform: scaleX(1); 36 | } 37 | } 38 | 39 | img { 40 | border-radius: 100%; 41 | } 42 | } 43 | `; 44 | -------------------------------------------------------------------------------- /src/common/services/auth-api-service.ts: -------------------------------------------------------------------------------- 1 | import HttpApiService from './http-api-service'; 2 | import { config } from 'config'; 3 | import { CreateUser, CheckAccount } from 'common/types/auth-types'; 4 | 5 | const API_BASE = `${config.apiUrl}`; 6 | 7 | class AuthApiService extends HttpApiService { 8 | constructor() { 9 | super(`${API_BASE}`); 10 | } 11 | 12 | <<<<<<< HEAD 13 | public signUp = (userData: CreateUser) => { 14 | return this.create('/signup', userData); 15 | }; 16 | 17 | public signIn = (accountData: CheckAccount) => { 18 | return this.post('/signin', accountData); 19 | }; 20 | 21 | public signOut = () => { 22 | ======= 23 | signUp = (userData: CreateUser) => { 24 | return this.create('/signup', userData); 25 | }; 26 | 27 | signIn = (accountData: CheckAccount) => { 28 | return this.post('/signin', accountData); 29 | }; 30 | 31 | signOut = () => { 32 | >>>>>>> 5e15841be91b42d6463e692a2fe206784607cad4 33 | return this.get('/signout'); 34 | }; 35 | } 36 | 37 | export default AuthApiService; 38 | -------------------------------------------------------------------------------- /src/features/auth-slice.ts: -------------------------------------------------------------------------------- 1 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'; 2 | import { RootState } from 'app/store'; 3 | import isEmpty from 'validation/is-empty'; 4 | 5 | interface AuthState { 6 | isAuthenticated: boolean; 7 | currentUser: any; 8 | } 9 | 10 | const initialState: AuthState = { 11 | isAuthenticated: false, 12 | currentUser: {}, 13 | }; 14 | 15 | export const authSlice = createSlice({ 16 | name: 'auth', 17 | initialState, 18 | // The `reducers` field lets us define reducers and generate associated actions 19 | reducers: { 20 | setCurrentUser: (state: AuthState, action: PayloadAction) => { 21 | state.isAuthenticated = !isEmpty(action.payload); 22 | state.currentUser = action.payload; 23 | }, 24 | }, 25 | }); 26 | 27 | export const { setCurrentUser } = authSlice.actions; 28 | 29 | export const selectIsAuthenticated = (state: RootState) => state.auth.isAuthenticated; 30 | export const selectCurrentUser = (state: RootState) => state.auth.currentUser; 31 | 32 | export default authSlice.reducer; 33 | -------------------------------------------------------------------------------- /src/app/store.ts: -------------------------------------------------------------------------------- 1 | import { configureStore, ThunkAction, Action } from '@reduxjs/toolkit'; 2 | import storage from 'redux-persist/lib/storage'; 3 | import { combineReducers } from 'redux'; 4 | import { persistReducer } from 'redux-persist'; 5 | import thunk from 'redux-thunk'; 6 | import authReducer from 'features/auth-slice'; 7 | import menuReducer from 'features/menu-slice'; 8 | 9 | const reducers = combineReducers({ 10 | auth: authReducer, 11 | menu: menuReducer, 12 | }); 13 | 14 | const persistConfig = { 15 | key: 'root', 16 | storage, 17 | whitelist: ['auth', 'menu'], 18 | }; 19 | 20 | const persistedReducer = persistReducer(persistConfig, reducers); 21 | 22 | const store = configureStore({ 23 | reducer: persistedReducer, 24 | devTools: process.env.NODE_ENV !== 'production', 25 | middleware: [thunk], 26 | }); 27 | 28 | export default store; 29 | 30 | export type AppDispatch = typeof store.dispatch; 31 | export type RootState = ReturnType; 32 | export type AppThunk = ThunkAction>; 33 | -------------------------------------------------------------------------------- /src/containers/signin/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import { heading } from 'styles/typography'; 3 | import theme from 'styles/theme'; 4 | import { Link } from 'react-router-dom'; 5 | 6 | export const Title = styled.h4` 7 | ${heading.h5.regular}; 8 | margin-top: 30px; 9 | `; 10 | 11 | export const SubTitle = styled.span` 12 | color: ${theme.color.text.light}; 13 | margin-top: 10px; 14 | margin-bottom: 10px; 15 | `; 16 | 17 | export const LinkText = styled.span` 18 | color: ${theme.color.text.light}; 19 | margin-top: 10px; 20 | margin-bottom: 10px; 21 | font-size: small; 22 | display: flex; 23 | flex-direction: column; 24 | 25 | ::after { 26 | transition: all 0.2s ease-in-out; 27 | content: ''; 28 | height: 1px; 29 | background-color: white; 30 | width: 100%; 31 | left: 0; 32 | bottom: -5px; 33 | transform: scaleX(0); 34 | } 35 | :hover { 36 | color: #c0c0c0; 37 | ::after { 38 | transform: scaleX(1); 39 | } 40 | } 41 | `; 42 | 43 | export const StyledLink = styled(Link)` 44 | align-self: flex-end; 45 | `; 46 | -------------------------------------------------------------------------------- /src/styles/global.ts: -------------------------------------------------------------------------------- 1 | import { createGlobalStyle } from 'styled-components'; 2 | import { font } from 'styles/typography'; 3 | import theme from 'styles/theme'; 4 | 5 | const GlobalStyle = createGlobalStyle` 6 | html, 7 | body { 8 | padding: 0; 9 | margin: 0; 10 | } 11 | 12 | html { 13 | font-size: 62.5%; 14 | font-family: ${font.base}; 15 | text-rendering: optimizeLegibility; 16 | } 17 | 18 | body { 19 | font-size: 1.6rem; 20 | color: ${theme.color.text.white}; 21 | } 22 | 23 | h1, h2, h3, h4, h5, h6 { 24 | margin: 0 0 0 0; 25 | } 26 | 27 | *, 28 | *::before, 29 | *::after { 30 | box-sizing: border-box; 31 | } 32 | 33 | a { 34 | text-decoration: none; 35 | } 36 | 37 | ul, 38 | ol { 39 | padding: 0; 40 | margin: 0; 41 | list-style-type: none; 42 | } 43 | 44 | input, button { 45 | font-family: ${font.base}; 46 | } 47 | 48 | #root { 49 | height: 100%; 50 | display: flex; 51 | flex-direction: column; 52 | 53 | > * { 54 | flex-shrink: 0; 55 | } 56 | } 57 | `; 58 | 59 | export default GlobalStyle; 60 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import { PersistGate } from 'redux-persist/integration/react'; 4 | import { persistStore } from 'redux-persist'; 5 | import 'index.css'; 6 | import App from 'containers/app'; 7 | import store from 'app/store'; 8 | import { Provider } from 'react-redux'; 9 | import * as serviceWorker from 'serviceWorker'; 10 | import 'react-toastify/dist/ReactToastify.css'; 11 | import 'react-pro-sidebar/dist/css/styles.css'; 12 | import 'react-perfect-scrollbar/dist/css/styles.css'; 13 | 14 | const persistor = persistStore(store); 15 | 16 | ReactDOM.render( 17 | 18 | 19 | 20 | 21 | 22 | 23 | , 24 | document.getElementById('root'), 25 | ); 26 | 27 | // If you want your app to work offline and load faster, you can change 28 | // unregister() to register() below. Note this comes with some pitfalls. 29 | // Learn more about service workers: https://bit.ly/CRA-PWA 30 | serviceWorker.unregister(); 31 | -------------------------------------------------------------------------------- /src/app/routes.ts: -------------------------------------------------------------------------------- 1 | import { lazy } from 'react'; 2 | 3 | //lazy loading for all layouts and components 4 | const AuthLayout = lazy(() => import('containers/layout/auth-layout')); 5 | const MainLayout = lazy(() => import('containers/layout/main-layout')); 6 | const SignIn = lazy(() => import('containers/signin')); 7 | const SignUp = lazy(() => import('containers/signup')); 8 | const QuickSMS = lazy(() => import('containers/quick-sms')); 9 | const AddFunds = lazy(() => import('containers/add-funds')); 10 | const SendoutHistory = lazy(() => import('containers/sendout-history')); 11 | 12 | // routes 13 | export type RouteType = { 14 | path: string; 15 | exact: boolean; 16 | layout: any; 17 | component: any; 18 | }; 19 | 20 | const routes: RouteType[] = [ 21 | { path: '/signin', exact: true, layout: AuthLayout, component: SignIn }, 22 | { path: '/signup', exact: true, layout: AuthLayout, component: SignUp }, 23 | { path: '/quick-sms', exact: true, layout: MainLayout, component: QuickSMS }, 24 | { path: '/add-funds', exact: true, layout: MainLayout, component: AddFunds }, 25 | { path: '/sendout-history', exact: true, layout: MainLayout, component: SendoutHistory }, 26 | ]; 27 | 28 | export default routes; 29 | -------------------------------------------------------------------------------- /src/assets/icons/xrp.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/common/api/auth.ts: -------------------------------------------------------------------------------- 1 | import Cookies from 'js-cookie'; 2 | import jwtDecode from 'jwt-decode'; 3 | import { TokenResponse } from 'common/types/auth-types'; 4 | 5 | const ACCESS_TOKEN = 'access_token'; 6 | const USER_HANDLE = 'user_handle'; 7 | 8 | const isTokenValid = (token: string) => { 9 | try { 10 | const decoded: { exp: number } = jwtDecode(token); 11 | return new Date(decoded.exp * 1000) > new Date(); 12 | } catch { 13 | return false; 14 | } 15 | }; 16 | 17 | const login = (payload: TokenResponse) => { 18 | Cookies.set(ACCESS_TOKEN, payload.api_token); 19 | Cookies.set(USER_HANDLE, payload.handle); 20 | }; 21 | 22 | const logout = () => { 23 | Cookies.remove(ACCESS_TOKEN); 24 | Cookies.remove(USER_HANDLE); 25 | }; 26 | 27 | const getToken = () => Cookies.get(ACCESS_TOKEN); 28 | 29 | const getUserHandle = () => Cookies.get(USER_HANDLE); 30 | 31 | const isAuthenticated = () => { 32 | const token = getToken(); 33 | const userHandle = getUserHandle(); 34 | if (!token || !userHandle) { 35 | return false; 36 | } 37 | return isTokenValid(token); 38 | }; 39 | 40 | const authApi = { 41 | login, 42 | logout, 43 | getToken, 44 | getUserHandle, 45 | isAuthenticated, 46 | isTokenValid, 47 | }; 48 | 49 | export default authApi; 50 | -------------------------------------------------------------------------------- /src/containers/layout/main-layout/sidebar/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import { heading } from 'styles/typography'; 3 | 4 | export const Logo = styled.div` 5 | display: flex; 6 | flex-direction: row; 7 | align-items: center; 8 | cursor: pointer; 9 | 10 | img { 11 | text-align: center; 12 | animation-name: spin, depth; 13 | animation-timing-function: linear; 14 | animation-iteration-count: infinite; 15 | animation-duration: 3s; 16 | } 17 | @keyframes spin { 18 | from { 19 | transform: rotateY(0deg); 20 | } 21 | to { 22 | transform: rotateY(-360deg); 23 | } 24 | } 25 | @keyframes depth { 26 | 0% { 27 | text-shadow: 0 0 black; 28 | } 29 | 25% { 30 | text-shadow: 1px 0 black, 2px 0 black, 3px 0 black, 4px 0 black, 5px 0 black; 31 | } 32 | 50% { 33 | text-shadow: 0 0 black; 34 | } 35 | 75% { 36 | text-shadow: -1px 0 black, -2px 0 black, -3px 0 black, -4px 0 black, -5px 0 black; 37 | } 38 | 100% { 39 | text-shadow: 0 0 black; 40 | } 41 | } 42 | `; 43 | 44 | export const LogoTitle = styled.h4` 45 | ${heading.h4.bold}; 46 | margin-left: 10px; 47 | color: white; 48 | text-align: center; 49 | color: #fff; 50 | font-weight: 700; 51 | text-transform: uppercase; 52 | text-shadow: 0px 0px 5px #fff, 0px 0px 10px #fff; 53 | `; 54 | -------------------------------------------------------------------------------- /src/containers/layout/auth-layout/header/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import { heading } from 'styles/typography'; 3 | import theme from 'styles/theme'; 4 | 5 | export const StyledHeader = styled.header` 6 | background-color: ${theme.color.background.midnight}; 7 | padding: 15px 55px; 8 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 9 | position: fixed; 10 | top: 0; 11 | left: 0; 12 | width: 100vw; 13 | display: flex; 14 | justify-content: space-between; 15 | align-items: center; 16 | z-index: 1; 17 | `; 18 | 19 | export const Logo = styled.div` 20 | display: flex; 21 | flex-direction: row; 22 | align-items: center; 23 | cursor: pointer; 24 | `; 25 | 26 | export const LogoTitle = styled.h4` 27 | ${heading.h4.bold}; 28 | margin-left: 10px; 29 | color: white; 30 | `; 31 | 32 | export const Links = styled.div` 33 | display: flex; 34 | flex-direction: row; 35 | align-items: center; 36 | justify-content: space-between; 37 | 38 | & > * { 39 | padding: 0 15px; 40 | } 41 | & > *:not(:last-child) { 42 | border-right: 1px solid ${theme.color.text.light}; 43 | } 44 | 45 | a { 46 | position: relative; 47 | display: flex; 48 | flex-direction: column; 49 | font-weight: 500; 50 | color: white; 51 | ::after { 52 | transition: all 0.2s ease-in-out; 53 | content: ''; 54 | height: 2px; 55 | background-color: white; 56 | width: 100%; 57 | left: 0; 58 | bottom: -5px; 59 | transform: scaleX(0); 60 | } 61 | :hover { 62 | color: #c0c0c0; 63 | ::after { 64 | transform: scaleX(1); 65 | } 66 | } 67 | } 68 | `; 69 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@reduxjs/toolkit": "^1.5.1", 7 | "@testing-library/jest-dom": "^4.2.4", 8 | "@testing-library/react": "^9.3.2", 9 | "@testing-library/user-event": "^7.1.2", 10 | "@types/jest": "^24.0.0", 11 | "@types/node": "^12.0.0", 12 | "@types/react": "^16.9.0", 13 | "@types/react-dom": "^16.9.0", 14 | "@types/react-redux": "^7.1.7", 15 | "axios": "^0.24.0", 16 | "js-cookie": "^3.0.1", 17 | "jwt-decode": "^3.1.2", 18 | "react": "^17.0.2", 19 | "react-dom": "^17.0.2", 20 | "react-icons": "^4.3.1", 21 | "react-perfect-scrollbar": "^1.5.8", 22 | "react-pro-sidebar": "^0.7.1", 23 | "react-redux": "^7.2.0", 24 | "react-router-dom": "5.2.0", 25 | "react-scripts": "4.0.3", 26 | "react-spinners": "^0.11.0", 27 | "react-toastify": "^8.1.0", 28 | "redux-persist": "^6.0.0", 29 | "styled-components": "^5.3.3", 30 | "typescript": "~4.1.5" 31 | }, 32 | "scripts": { 33 | "start": "react-app-rewired start", 34 | "build": "react-app-rewired build", 35 | "test": "react-app-rewired test", 36 | "eject": "react-app-rewired eject" 37 | }, 38 | "eslintConfig": { 39 | "extends": "react-app" 40 | }, 41 | "browserslist": { 42 | "production": [ 43 | ">0.2%", 44 | "not dead", 45 | "not op_mini all" 46 | ], 47 | "development": [ 48 | "last 1 chrome version", 49 | "last 1 firefox version", 50 | "last 1 safari version" 51 | ] 52 | }, 53 | "devDependencies": { 54 | "@types/js-cookie": "^3.0.1", 55 | "@types/react-router-dom": "^5.3.2", 56 | "@types/redux-persist": "^4.3.1", 57 | "@types/styled-components": "^5.1.15", 58 | "react-app-rewired": "^2.1.8" 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 14 | 15 | 24 | Supremacy SMS 25 | 26 | 27 | You need to enable JavaScript to run this app. 28 | 29 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/containers/app/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { Suspense, useEffect } from 'react'; 2 | import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom'; 3 | import GlobalStyles from 'styles/global'; 4 | import routes, { RouteType } from 'app/routes'; 5 | import Toastr from 'components/toastr'; 6 | import Loading from 'components/loading'; 7 | import { selectIsAuthenticated } from 'features/auth-slice'; 8 | import useAppSelector from 'hooks/use-app-seletecor'; 9 | import authApi from 'common/api/auth'; 10 | import { setCurrentUser } from 'features/auth-slice'; 11 | import useAppDispatch from 'hooks/use-app-dispatch'; 12 | 13 | const Error404 = React.lazy(() => import('containers/404')); 14 | 15 | const App: React.FC = () => { 16 | const isAuthenticated = useAppSelector(selectIsAuthenticated); 17 | const dispatch = useAppDispatch(); 18 | 19 | useEffect(() => { 20 | if(!authApi.isAuthenticated()) { 21 | dispatch(setCurrentUser({})); 22 | authApi.logout(); 23 | } 24 | }, []); 25 | 26 | return ( 27 | <> 28 | }> 29 | 30 | 31 | 32 | 33 | {isAuthenticated ? : } 34 | 35 | {routes.map((route: RouteType, index: number) => { 36 | return ( 37 | 38 | 39 | 40 | 41 | 42 | ); 43 | })} 44 | 45 | 46 | 47 | 48 | 49 | > 50 | ); 51 | }; 52 | 53 | export default App; 54 | -------------------------------------------------------------------------------- /src/styles/typography.ts: -------------------------------------------------------------------------------- 1 | import { css } from 'styled-components'; 2 | 3 | export const font = { 4 | base: '"Montserrat", sans-serif', 5 | }; 6 | 7 | export const heading = { 8 | h1: { 9 | bold: css` 10 | font-size: 4.2rem; 11 | font-weight: 700; 12 | `, 13 | }, 14 | h2: { 15 | semiBold: css` 16 | font-size: 3.4rem; 17 | font-weight: 600; 18 | `, 19 | light: css` 20 | font-size: 3.4rem; 21 | font-weight: 300; 22 | `, 23 | }, 24 | h3: { 25 | regular: css` 26 | font-size: 2.4rem; 27 | font-weight: 400; 28 | `, 29 | medium: css` 30 | font-size: 2.4rem; 31 | font-weight: 500; 32 | `, 33 | bold: css` 34 | font-size: 2.4rem; 35 | font-weight: 700; 36 | `, 37 | }, 38 | h4: { 39 | bold: css` 40 | font-size: 2.2rem; 41 | font-weight: 700; 42 | `, 43 | }, 44 | h5: { 45 | bold: css` 46 | font-size: 2rem; 47 | font-weight: 700; 48 | `, 49 | regular: css` 50 | font-size: 2rem; 51 | font-weight: 400; 52 | `, 53 | }, 54 | }; 55 | 56 | export const paragraph = { 57 | large: { 58 | bold: css` 59 | font-size: 1.6rem; 60 | font-weight: 700; 61 | `, 62 | medium: css` 63 | font-size: 1.6rem; 64 | font-weight: 500; 65 | `, 66 | regular: css` 67 | font-size: 1.6rem; 68 | font-weight: 400; 69 | `, 70 | }, 71 | small: { 72 | bold: css` 73 | font-size: 1.4rem; 74 | font-weight: 700; 75 | `, 76 | medium: css` 77 | font-size: 1.4rem; 78 | font-weight: 500; 79 | `, 80 | regular: css` 81 | font-size: 1.4rem; 82 | font-weight: 400; 83 | `, 84 | }, 85 | smaller: { 86 | bold: css` 87 | font-size: 1.2rem; 88 | font-weight: 700; 89 | `, 90 | medium: css` 91 | font-size: 1.2rem; 92 | font-weight: 500; 93 | `, 94 | regular: css` 95 | font-size: 1.2rem; 96 | font-weight: 400; 97 | `, 98 | }, 99 | }; 100 | -------------------------------------------------------------------------------- /src/containers/add-funds/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | 3 | export const StyledDepositHistory = styled.div` 4 | display: flex; 5 | flex-direction: column; 6 | & > *:not(:first-child) { 7 | margin-top: 3vh; 8 | } 9 | align-items: center; 10 | `; 11 | 12 | export const CardSection = styled.div` 13 | display: flex; 14 | flex-direction: row; 15 | justify-content: space-between; 16 | width: 95%; 17 | `; 18 | 19 | interface Props { 20 | colors: any; 21 | } 22 | 23 | export const HighlightCard = styled.div` 24 | border-radius: 5px; 25 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 26 | color: white; 27 | display: flex; 28 | flex-direction: column; 29 | background: ${({ colors }) => { 30 | return `linear-gradient(65.4deg, ${colors[0]} 18.74%, ${colors[1]} 88.33%);`; 31 | }}; 32 | width: 23vw; 33 | padding: 15px 15px 15px 20px; 34 | transition: all 0.2s; 35 | :hover { 36 | transform: scale(1.05); 37 | } 38 | cursor: pointer; 39 | `; 40 | 41 | export const TopSection = styled.div` 42 | display: flex; 43 | flex-direction: row; 44 | justify-content: space-between; 45 | svg { 46 | font-size: 2em; 47 | margin-top: 3px; 48 | font-weight: 600; 49 | } 50 | span { 51 | font-size: 1.3em; 52 | } 53 | `; 54 | 55 | export const CenterSection = styled.div` 56 | display: flex; 57 | flex-direction: row; 58 | justify-content: flex-start; 59 | align-items: center; 60 | margin-top: 10px; 61 | 62 | svg { 63 | font-size: 1.2em; 64 | } 65 | span { 66 | margin-left: 5px; 67 | font-size: 1em; 68 | } 69 | `; 70 | 71 | export const BottomSection = styled.button` 72 | display: flex; 73 | flex-direction: row; 74 | justify-content: flex-start; 75 | align-items: center; 76 | margin-top: 10px; 77 | svg { 78 | font-size: 1em; 79 | } 80 | span { 81 | font-size: 0.9em; 82 | } 83 | cursor: pointer; 84 | border: none; 85 | background: rgb(174, 56, 73); 86 | color: white; 87 | padding: 5px 5px; 88 | box-shadow: 0px 0px 2px black, 0px 0px 2px black; 89 | 90 | transition: all 0.3s; 91 | :active { 92 | transform: scale(0.95); 93 | } 94 | `; 95 | -------------------------------------------------------------------------------- /src/components/loading/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import theme from 'styles/theme'; 3 | 4 | export const CustomLoadingWrapper = styled.div` 5 | display: flex; 6 | width: 100%; 7 | height: 100%; 8 | left: 0%; 9 | top: 0%; 10 | align-items: center; 11 | justify-content: center; 12 | position: fixed; 13 | z-index: 99999; 14 | background: ${theme.color.background.dark}; 15 | flex-direction: column; 16 | `; 17 | export const CustomLoadingContent = styled.div` 18 | position: absolute; 19 | top: 50%; 20 | left: 50%; 21 | transform: translate(-50%, -50%); 22 | width: 150px; 23 | height: 150px; 24 | background: transparent; 25 | border: 3px solid #3c3c3c; 26 | border-radius: 50%; 27 | text-align: center; 28 | line-height: 150px; 29 | font-family: sans-serif; 30 | font-size: 20px; 31 | color: #fff000; 32 | letter-spacing: 4px; 33 | text-transform: uppercase; 34 | text-shadow: 0 0 10px #fff000; 35 | box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); 36 | &:before { 37 | content: ''; 38 | position: absolute; 39 | top: -3px; 40 | left: -3px; 41 | width: 100%; 42 | height: 100%; 43 | border: 3px solid transparent; 44 | border-top: 3px solid #fff000; 45 | border-right: 3px solid #fff000; 46 | border-radius: 50%; 47 | animation: animateC 2s linear infinite; 48 | @keyframes animateC { 49 | 0% { 50 | transform: rotate(0deg); 51 | } 52 | 100% { 53 | transform: rotate(360deg); 54 | } 55 | } 56 | } 57 | `; 58 | export const Label = styled.span` 59 | display: block; 60 | position: absolute; 61 | top: calc(50% - 2px); 62 | left: 50%; 63 | width: 50%; 64 | height: 4px; 65 | background: transparent; 66 | transform-origin: left; 67 | animation: animate 2s linear infinite; 68 | @keyframes animate { 69 | 0% { 70 | transform: rotate(45deg); 71 | } 72 | 100% { 73 | transform: rotate(405deg); 74 | } 75 | } 76 | &:before { 77 | content: ''; 78 | position: absolute; 79 | width: 16px; 80 | height: 16px; 81 | border-radius: 50%; 82 | background: #fff000; 83 | top: -6px; 84 | right: -8px; 85 | box-shadow: 0 0 20px #fff000; 86 | } 87 | `; 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app), using the [Redux](https://redux.js.org/) and [Redux Toolkit](https://redux-toolkit.js.org/) template. 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `yarn start` 8 | 9 | Runs the app in the development mode. 10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits. 13 | You will also see any lint errors in the console. 14 | 15 | ### `yarn test` 16 | 17 | Launches the test runner in the interactive watch mode. 18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `yarn build` 21 | 22 | Builds the app for production to the `build` folder. 23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes. 26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `yarn eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | -------------------------------------------------------------------------------- /src/containers/quick-sms/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { FiSend } from 'react-icons/fi'; 3 | import { 4 | StyledQuickSMS, 5 | MessageStatistics, 6 | MessageStatisticsHeader, 7 | MessageStatisticsBody, 8 | State, 9 | Sendout, 10 | PhoneNumbers, 11 | PhoneNumbersHeader, 12 | PhoneNumbersBody, 13 | MessageSection, 14 | InputSection, 15 | InputHeader, 16 | InputBody, 17 | OptionalSection, 18 | StyledSelect, 19 | } from './styled'; 20 | import HighlightButton from 'components/highlight-button'; 21 | 22 | const buttonLabels = ['Test', 'Send']; 23 | 24 | const QuickSMS: React.FC = () => { 25 | const [sendState, SetSendState] = useState(0); 26 | 27 | const handleSubmit = () => { 28 | SetSendState(sendState + 1); 29 | }; 30 | 31 | return ( 32 | 33 | 34 | Message Statistics 35 | 36 | 37 | 0 38 | Pending 39 | 40 | 41 | 0 42 | Queued 43 | 44 | 45 | 0 46 | Sent 47 | 48 | 49 | 0 50 | Failed 51 | 52 | 53 | 0 54 | Delivered 55 | 56 | 57 | 58 | 59 | 60 | Phone Numbers 61 | 62 | 63 | 64 | 65 | Write the message in here. 66 | 67 | 68 | 69 | 70 | T-Mobile 71 | At & t 72 | Verizon 73 | Sprint 74 | Metro pcs 75 | 76 | 77 | 78 | {buttonLabels[sendState % 2]} 79 | 80 | 81 | 82 | 83 | 84 | ); 85 | }; 86 | 87 | export default QuickSMS; 88 | -------------------------------------------------------------------------------- /src/containers/signin/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Link, useHistory } from 'react-router-dom'; 3 | import { toast } from 'react-toastify'; 4 | import FormCard from 'components/form-card'; 5 | import FormInput from 'components/form-input'; 6 | import FormButton from 'components/form-button'; 7 | import { Title, SubTitle, LinkText, StyledLink } from './styled'; 8 | import logoImg from 'assets/icons/logo.png'; 9 | import isEmpty from 'validation/is-empty'; 10 | import AuthApiService from 'common/services/auth-api-service'; 11 | import { CheckAccount, TokenResponse, CurrentUser } from 'common/types/auth-types'; 12 | import { setCurrentUser } from 'features/auth-slice'; 13 | import useAppDispatch from 'hooks/use-app-dispatch'; 14 | import authApi from 'common/api/auth'; 15 | 16 | interface State { 17 | account: string; 18 | password: string; 19 | } 20 | 21 | const initialState: State = { 22 | account: '', 23 | password: '', 24 | }; 25 | 26 | const SignIn: React.FC = () => { 27 | const authApiService = new AuthApiService(); 28 | const dispatch = useAppDispatch(); 29 | const history = useHistory(); 30 | 31 | const [loading, setLoading] = useState(false); 32 | const [state, setState] = useState(initialState); 33 | 34 | const handleChange = (event: React.ChangeEvent) => { 35 | setState({ ...state, [event.target.name]: event.target.value }); 36 | }; 37 | 38 | const handleSubmit = async () => { 39 | if (isEmpty(state.account)) { 40 | toast.warning('Please enter the email or username.'); 41 | return; 42 | } 43 | if (isEmpty(state.password)) { 44 | toast.warning('Please fill the password.'); 45 | return; 46 | } 47 | if (state.password.length < 6) { 48 | toast.warning('Password must be longer than 6 characters.'); 49 | return; 50 | } 51 | 52 | const userData: CheckAccount = { 53 | account: state.account, 54 | password: state.password, 55 | }; 56 | 57 | try { 58 | setLoading(true); 59 | const res = await authApiService.signIn(userData); 60 | setLoading(false); 61 | if (res.data) { 62 | const tokenResponse: TokenResponse = { 63 | api_token: res.data.token, 64 | handle: res.data.data.userName, 65 | }; 66 | const currentUser: CurrentUser = { 67 | _id: res.data.data._id, 68 | email: res.data.data.email, 69 | userName: res.data.data.userName, 70 | }; 71 | dispatch(setCurrentUser(currentUser)); 72 | authApi.login(tokenResponse); 73 | toast.success(res.data.message); 74 | history.push('/'); 75 | } else { 76 | toast.error('Something went wrong.'); 77 | } 78 | } catch (error) { 79 | setLoading(false); 80 | toast.error(error as string); 81 | } 82 | }; 83 | 84 | const handleKeyDown = async (event: any) => { 85 | if (event.key === 'Enter') { 86 | await handleSubmit(); 87 | } 88 | }; 89 | 90 | return ( 91 | 92 | 93 | WELCOME 94 | Sign in by entering the information below 95 | 96 | 97 | 98 | Forgot Password? 99 | 100 | 101 | Sign In 102 | 103 | 104 | Don't have an account? 105 | 106 | 107 | ); 108 | }; 109 | 110 | export default SignIn; 111 | -------------------------------------------------------------------------------- /src/containers/signup/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Link,useHistory } from 'react-router-dom'; 3 | import { toast } from 'react-toastify'; 4 | import FormCard from 'components/form-card'; 5 | import FormInput from 'components/form-input'; 6 | import FormButton from 'components/form-button'; 7 | import { Title, LinkText } from './styled'; 8 | import logoImg from 'assets/icons/logo.png'; 9 | import isEmpty from 'validation/is-empty'; 10 | import isEmail from 'validation/is-email'; 11 | import AuthApiService from 'common/services/auth-api-service'; 12 | import { CreateUser } from 'common/types/auth-types'; 13 | 14 | interface State { 15 | userName: string; 16 | email: string; 17 | password: string; 18 | confirmPassword: string; 19 | } 20 | 21 | const initialState: State = { 22 | userName: '', 23 | email: '', 24 | password: '', 25 | confirmPassword: '', 26 | }; 27 | 28 | const SignUp: React.FC = () => { 29 | const authApiService = new AuthApiService(); 30 | const history = useHistory(); 31 | 32 | const [loading, setLoading] = useState(false); 33 | const [state, setState] = useState(initialState); 34 | 35 | const handleChange = (event: React.ChangeEvent) => { 36 | setState({ ...state, [event.target.name]: event.target.value }); 37 | }; 38 | 39 | const handleSubmit = async () => { 40 | if (isEmpty(state.userName)) { 41 | toast.warning('Please fill the username.'); 42 | return; 43 | } 44 | if (isEmpty(state.email)) { 45 | toast.warning('Please fill the email.'); 46 | return; 47 | } 48 | if (!isEmail(state.email)) { 49 | toast.warning('Please enter the valid email.'); 50 | return; 51 | } 52 | if (isEmpty(state.password)) { 53 | toast.warning('Please fill the password.'); 54 | return; 55 | } 56 | if (state.password.length < 6) { 57 | toast.warning('Password must be longer than 6 characters.'); 58 | return; 59 | } 60 | if (state.password !== state.confirmPassword) { 61 | toast.warning('Please enter the correct password.'); 62 | return; 63 | } 64 | 65 | const userData: CreateUser = { 66 | email: state.email, 67 | password: state.password, 68 | userName: state.userName, 69 | }; 70 | 71 | try { 72 | setLoading(true); 73 | const res = await authApiService.signUp(userData); 74 | setLoading(false); 75 | if (res.data) { 76 | toast.success(res.data.message); 77 | history.push('/signin'); 78 | } else { 79 | toast.error('Something went wrong.'); 80 | } 81 | } catch (error) { 82 | setLoading(false); 83 | toast.error(error as string); 84 | } 85 | }; 86 | 87 | const handleKeyDown = async (event: any) => { 88 | if (event.key === 'Enter') { 89 | await handleSubmit(); 90 | } 91 | }; 92 | 93 | return ( 94 | <> 95 | 96 | 97 | Please Sign Up in here! 98 | 99 | 100 | 101 | 102 | 103 | Sign Up 104 | 105 | 106 | Already have an account? 107 | 108 | 109 | > 110 | ); 111 | }; 112 | 113 | export default SignUp; 114 | -------------------------------------------------------------------------------- /src/containers/404/404.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css?family=Fira+Sans'); 2 | /*Variables*/ 3 | .left-section .inner-content { 4 | position: absolute; 5 | top: 50%; 6 | transform: translateY(-50%); 7 | } 8 | 9 | .background { 10 | position: absolute; 11 | top: 0; 12 | left: 0; 13 | width: 100%; 14 | height: 100%; 15 | background: linear-gradient(#010a0c, #151839bb); 16 | color: #f5f6fa; 17 | font-family: 'Fira Sans', sans-serif; 18 | } 19 | 20 | .background .ground { 21 | position: absolute; 22 | bottom: 0; 23 | width: 100%; 24 | height: 25vh; 25 | background: #0c0e10; 26 | } 27 | 28 | @media (max-width: 770px) { 29 | .background .ground { 30 | height: 0vh; 31 | } 32 | } 33 | 34 | .container { 35 | position: relative; 36 | margin: 0 auto; 37 | width: 85%; 38 | height: 100vh; 39 | padding-bottom: 25vh; 40 | display: flex; 41 | flex-direction: row; 42 | justify-content: space-around; 43 | } 44 | 45 | @media (max-width: 770px) { 46 | .container { 47 | flex-direction: column; 48 | padding-bottom: 0vh; 49 | } 50 | } 51 | 52 | .home { 53 | text-align: center; 54 | max-width: 480px; 55 | font-size: 0.8em; 56 | padding: 0 1rem; 57 | margin: 0 auto; 58 | color: #f5f6fa; 59 | text-shadow: 0 0 1rem #fefefe; 60 | } 61 | 62 | .left-section, 63 | .right-section { 64 | position: relative; 65 | } 66 | 67 | .left-section { 68 | width: 40%; 69 | } 70 | 71 | @media (max-width: 770px) { 72 | .left-section { 73 | width: 100%; 74 | height: 40%; 75 | position: absolute; 76 | top: 0; 77 | } 78 | } 79 | 80 | @media (max-width: 770px) { 81 | .left-section .inner-content { 82 | position: relative; 83 | padding: 1rem 0; 84 | } 85 | } 86 | 87 | .heading { 88 | text-align: center; 89 | font-size: 9em; 90 | line-height: 1.3em; 91 | margin: 2rem 0 0.5rem 0; 92 | padding: 0; 93 | text-shadow: 0 0 1rem #fefefe; 94 | } 95 | 96 | @media (max-width: 770px) { 97 | .heading { 98 | font-size: 7em; 99 | line-height: 1.15; 100 | margin: 0; 101 | } 102 | } 103 | 104 | .subheading { 105 | text-align: center; 106 | max-width: 480px; 107 | font-size: 1.5em; 108 | line-height: 1.15em; 109 | padding: 0 1rem; 110 | margin: 0 auto; 111 | } 112 | 113 | @media (max-width: 770px) { 114 | .subheading { 115 | font-size: 1.3em; 116 | line-height: 1.15; 117 | max-width: 100%; 118 | } 119 | } 120 | 121 | .right-section { 122 | width: 50%; 123 | } 124 | 125 | @media (max-width: 770px) { 126 | .right-section { 127 | width: 100%; 128 | height: 60%; 129 | position: absolute; 130 | bottom: 0; 131 | } 132 | } 133 | 134 | .svgimg { 135 | position: absolute; 136 | bottom: 0; 137 | padding-top: 10vh; 138 | padding-left: 1vh; 139 | max-width: 100%; 140 | max-height: 100%; 141 | } 142 | 143 | @media (max-width: 770px) { 144 | .svgimg { 145 | padding: 0; 146 | } 147 | } 148 | 149 | .svgimg .bench-legs { 150 | fill: #0c0e10; 151 | } 152 | 153 | .svgimg .top-bench, 154 | .svgimg .bottom-bench { 155 | stroke: #0c0e10; 156 | stroke-width: 1px; 157 | fill: #5b3e2b; 158 | } 159 | 160 | .svgimg .bottom-bench path:nth-child(1) { 161 | fill: #432d20; 162 | } 163 | 164 | .svgimg .lamp-details { 165 | fill: #202425; 166 | } 167 | 168 | .svgimg .lamp-accent { 169 | fill: #2c3133; 170 | } 171 | 172 | .svgimg .lamp-bottom { 173 | fill: linear-gradient(#202425, #0c0e10); 174 | } 175 | 176 | .svgimg .lamp-light { 177 | fill: #efefef; 178 | } 179 | 180 | @keyframes glow { 181 | 0% { 182 | text-shadow: 0 0 1rem #fefefe; 183 | } 184 | 50% { 185 | text-shadow: 0 0 1.85rem #ededed; 186 | } 187 | 100% { 188 | text-shadow: 0 0 1rem #fefefe; 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /src/containers/quick-sms/styled.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import theme from 'styles/theme'; 3 | 4 | export const StyledQuickSMS = styled.div` 5 | display: flex; 6 | flex-direction: column; 7 | align-items: center; 8 | `; 9 | 10 | export const MessageStatistics = styled.div` 11 | display: flex; 12 | flex-direction: column; 13 | width: 70%; 14 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 15 | `; 16 | 17 | export const MessageStatisticsHeader = styled.div` 18 | background-color: ${theme.color.background.highlight}; 19 | border-radius: 5px 5px 0px 0px; 20 | padding: 10px 0px 10px 10px; 21 | text-shadow: 0px 0px 5px #56c4f4, 0px 0px 10px #56c4f4; 22 | `; 23 | 24 | export const MessageStatisticsBody = styled.div` 25 | display: flex; 26 | background-color: ${theme.color.background.panel}; 27 | padding: 10px 35px; 28 | justify-content: space-between; 29 | align-items: center; 30 | border-radius: 0px 0px 5px 5px; 31 | `; 32 | 33 | interface StateProps { 34 | variant: string; 35 | } 36 | 37 | export const State = styled.div` 38 | display: flex; 39 | flex-direction: column; 40 | justify-content: center; 41 | align-items: center; 42 | text-shadow: ${({ variant }) => '0px 0px 5px ' + variant + ', 0px 0px 10px ' + variant}; 43 | `; 44 | 45 | export const Sendout = styled.div` 46 | margin-top: 20px; 47 | display: flex; 48 | justify-content: space-between; 49 | width: 70%; 50 | `; 51 | 52 | export const PhoneNumbers = styled.div` 53 | display: flex; 54 | flex-direction: column; 55 | width: 60%; 56 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 57 | `; 58 | 59 | export const PhoneNumbersHeader = styled.div` 60 | background-color: ${theme.color.background.highlight}; 61 | border-radius: 5px 5px 0px 0px; 62 | padding: 10px 0px 10px 10px; 63 | text-shadow: 0px 0px 5px #56c4f4, 0px 0px 10px #56c4f4; 64 | `; 65 | 66 | export const PhoneNumbersBody = styled.div` 67 | display: flex; 68 | background-color: ${theme.color.background.panel}; 69 | padding: 10px 15px; 70 | justify-content: space-between; 71 | align-items: center; 72 | border-radius: 0px 0px 5px 5px; 73 | min-height: calc(100vh - 364px); 74 | `; 75 | 76 | export const MessageSection = styled.div` 77 | display: flex; 78 | flex-direction: column; 79 | justify-content: space-between; 80 | width: 35%; 81 | `; 82 | 83 | export const InputSection = styled.div` 84 | display: flex; 85 | flex-direction: column; 86 | width: 100%; 87 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 88 | `; 89 | 90 | export const InputHeader = styled.div` 91 | background-color: ${theme.color.background.highlight}; 92 | border-radius: 5px 5px 0px 0px; 93 | padding: 10px 0px 10px 10px; 94 | text-shadow: 0px 0px 5px #56c4f4, 0px 0px 10px #56c4f4; 95 | `; 96 | 97 | export const InputBody = styled.textarea` 98 | max-width: 100%; 99 | min-width: 100%; 100 | padding: 15px 10px 15px 15px; 101 | background-color: ${theme.color.background.panel}; 102 | min-height: calc(100vh - 420px); 103 | max-height: calc(100vh - 420px); 104 | border-radius: 0px 0px 5px 5px; 105 | border: 0px ${theme.color.background.panel} solid !important; 106 | color: white; 107 | font-size: 15px; 108 | outline: none; 109 | font-family: 'Montserrat', sans-serif; 110 | `; 111 | 112 | export const OptionalSection = styled.div` 113 | display: grid; 114 | grid-template-columns: 4fr 2fr; 115 | justify-content: space-between; 116 | `; 117 | 118 | export const StyledSelect = styled.select` 119 | margin-right: 10px; 120 | padding: 8px 5px 8px 8px; 121 | background-color: ${theme.color.background.highlight}; 122 | border-radius: 5px 5px 5px 5px; 123 | border: 0px ${theme.color.background.panel} solid !important; 124 | color: white; 125 | font-size: 15px; 126 | outline: none; 127 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 128 | cursor: pointer; 129 | `; 130 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: 'Montserrat', sans-serif; 4 | -webkit-font-smoothing: antialiased; 5 | -moz-osx-font-smoothing: grayscale; 6 | } 7 | 8 | #sidebar .closemenu { 9 | color: #6ac7fc; 10 | position: absolute; 11 | right: 0; 12 | z-index: 9999; 13 | line-height: 20px; 14 | border-radius: 50%; 15 | font-weight: bold; 16 | font-size: 30px; 17 | top: 55px; 18 | cursor: pointer; 19 | } 20 | 21 | #sidebar .pro-sidebar { 22 | width: 240px; 23 | min-width: 100%; 24 | height: 100vh; 25 | } 26 | 27 | #sidebar .pro-sidebar.collapsed { 28 | width: 85px; 29 | min-width: 85px; 30 | } 31 | 32 | #sidebar .pro-sidebar-inner { 33 | background: #0e1025; 34 | box-shadow: 0.5px 0.866px 2px 0px rgba(0, 0, 0, 0.15); 35 | } 36 | 37 | .pro-sidebar > .pro-sidebar-inner > img.sidebar-bg { 38 | width: 100%; 39 | height: 100%; 40 | object-fit: cover; 41 | object-position: center; 42 | position: absolute; 43 | opacity: 0.3; 44 | left: 0; 45 | top: 0; 46 | z-index: 100; 47 | filter: blur(10px); 48 | } 49 | 50 | #sidebar .pro-sidebar-inner .pro-sidebar-layout { 51 | overflow-y: hidden; 52 | height: 100vh; 53 | } 54 | 55 | #sidebar .pro-sidebar-inner .pro-sidebar-layout .logotext p { 56 | font-size: 20px; 57 | padding: 0 20px; 58 | color: rgba(252, 252, 252, 0.521); 59 | font-weight: bold; 60 | } 61 | 62 | #sidebar .pro-sidebar-inner .pro-sidebar-layout ul { 63 | padding: 0 5px; 64 | } 65 | 66 | #sidebar .pro-sidebar-inner .pro-sidebar-layout ul .pro-inner-item { 67 | color: rgb(230, 230, 230); 68 | margin: 10px 0px; 69 | font-weight: bold; 70 | } 71 | 72 | #sidebar .pro-sidebar-inner .pro-sidebar-layout ul .pro-inner-item:hover { 73 | background-color: rgba(0, 0, 0, 0.2); 74 | border-radius: 5px; 75 | opacity: 1; 76 | } 77 | 78 | #sidebar .pro-sidebar-inner .pro-sidebar-layout ul .pro-inner-item .pro-icon-wrapper { 79 | background-color: #c0c0c0; 80 | color: #000; 81 | border-radius: 3px; 82 | } 83 | 84 | #sidebar .pro-sidebar-inner .pro-sidebar-layout ul .pro-inner-item .pro-icon-wrapper .pro-item-content { 85 | color: #000; 86 | } 87 | 88 | #sidebar .logo { 89 | padding: 20px; 90 | } 91 | 92 | .pro-sidebar > .pro-sidebar-inner > .pro-sidebar-layout .pro-sidebar-header { 93 | display: flex; 94 | padding: 15px 15px; 95 | } 96 | 97 | #sidebar .pro-sidebar-inner .pro-sidebar-layout ul .pro-inner-item .pro-icon-wrapper { 98 | background-color: transparent; 99 | color: #6ac7fc; 100 | border-radius: 50%; 101 | box-shadow: 0px 0px 5px #6ac7fc, 0px 0px 10px #6ac7fc; 102 | } 103 | 104 | .pro-menu-item.active { 105 | background-color: rgba(0, 0, 0, 0.4); 106 | border-radius: 5px; 107 | opacity: 1; 108 | } 109 | 110 | .pro-sidebar-content { 111 | overflow: auto; 112 | } 113 | 114 | .pro-sidebar .pro-menu > ul > .pro-sub-menu > .pro-inner-list-item { 115 | background-color: transparent !important; 116 | } 117 | 118 | @media only screen and (max-width: 720px) { 119 | html { 120 | overflow: hidden; 121 | } 122 | } 123 | 124 | /* .pro-sub-menu.open { 125 | background-color: rgba(0, 0, 0, 0.5); 126 | border-radius: 5px; 127 | opacity: 0.8; 128 | } */ 129 | 130 | .pro-sub-menu.open > .pro-inner-item { 131 | background-color: rgba(0, 0, 0, 0.2); 132 | border-radius: 5px; 133 | opacity: 1; 134 | } 135 | 136 | .popper-inner { 137 | background-color: #0e1025 !important; 138 | } 139 | 140 | .ant-table-thead > tr > th { 141 | color: white; 142 | background: #353f68; 143 | border-color: #0e1025; 144 | } 145 | 146 | .anticon svg { 147 | color: white; 148 | } 149 | 150 | .ant-table-tbody > tr > td { 151 | color: white; 152 | background: #151939ff !important; 153 | border-color: #0e1025; 154 | } 155 | 156 | .ant-table { 157 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 158 | border-radius: 10px; 159 | } 160 | 161 | .ant-table-tbody > tr:last-child td:first-child { 162 | border-bottom-left-radius: 5px; 163 | } 164 | 165 | .ant-table-tbody > tr:last-child td:last-child { 166 | border-bottom-right-radius: 5px; 167 | } 168 | 169 | .ant-table-thead > tr:last-child td:first-child { 170 | border-bottom-left-radius: 5px; 171 | } 172 | 173 | .ant-table-thead > tr:last-child td:last-child { 174 | border-bottom-right-radius: 5px; 175 | } 176 | -------------------------------------------------------------------------------- /src/common/services/http-api-service.ts: -------------------------------------------------------------------------------- 1 | import axios, { AxiosInstance, AxiosPromise, AxiosResponse } from 'axios'; 2 | import authApi from 'common/api/auth'; 3 | import isEmpty from 'validation/is-empty'; 4 | import { config } from 'config'; 5 | 6 | class HttpApiService { 7 | private _axiosInstance: AxiosInstance | undefined; 8 | private readonly _baseURL: string; 9 | 10 | constructor(baseURL: string) { 11 | this._baseURL = baseURL; 12 | this.createAxiosInstance(); 13 | } 14 | 15 | private defaultOptions = (): any => { 16 | let headers: any = {}; 17 | if (isEmpty(authApi.getToken())) { 18 | headers = { 19 | Accept: 'application/json', 20 | }; 21 | } else { 22 | headers = { 23 | Accept: 'application/json', 24 | Authorization: config.tokenSuffix + authApi.getToken(), 25 | }; 26 | } 27 | 28 | return { 29 | baseURL: this._baseURL, 30 | withCredentials: true, // Window Authentification 31 | headers, 32 | }; 33 | }; 34 | 35 | /** 36 | * Create axios instance 37 | */ 38 | private createAxiosInstance() { 39 | this._axiosInstance = axios.create(this.defaultOptions()); 40 | // this.checkAutorization() 41 | 42 | // Add a request interceptor 43 | this._axiosInstance.interceptors.request.use( 44 | config => config, 45 | error => { 46 | return Promise.reject(error); 47 | }, 48 | ); 49 | 50 | // Add a response interceptor 51 | this._axiosInstance.interceptors.response.use(this.handleSuccess, this.handleError); 52 | } 53 | 54 | public get(endpoint: string, conf = {}): AxiosPromise { 55 | return new Promise((resolve, reject) => { 56 | this._axiosInstance!.get(`${endpoint}`, conf) 57 | .then(response => { 58 | resolve(response); 59 | }) 60 | .catch(error => { 61 | reject(error); 62 | }); 63 | }); 64 | } 65 | 66 | public create(endpoint: string, data: {}, conf = {}): AxiosPromise { 67 | return this.post(endpoint, data, conf); 68 | } 69 | 70 | public post(endpoint: string, data: {}, conf = {}): AxiosPromise { 71 | return new Promise((resolve, reject) => { 72 | this._axiosInstance!.post(`${endpoint}`, data, conf) 73 | .then(response => { 74 | resolve(response); 75 | }) 76 | .catch(error => { 77 | reject(error); 78 | }); 79 | }); 80 | } 81 | 82 | public update(endpoint: string, data: {}, conf = {}): AxiosPromise { 83 | return new Promise((resolve, reject) => { 84 | this._axiosInstance!.put(`${endpoint}`, data, conf) 85 | .then(response => { 86 | resolve(response); 87 | }) 88 | .catch(error => { 89 | reject(error); 90 | }); 91 | }); 92 | } 93 | 94 | public delete(endpoint: string, id: any, conf = {}): AxiosPromise { 95 | return new Promise((resolve, reject) => { 96 | this._axiosInstance!.delete(`${endpoint}/${id}`, conf) 97 | .then(response => { 98 | resolve(response); 99 | }) 100 | .catch(error => { 101 | reject(error); 102 | }); 103 | }); 104 | } 105 | 106 | public deleteFile(endpoint: string, conf = {}): AxiosPromise { 107 | return new Promise((resolve, reject) => { 108 | this._axiosInstance!.delete(`${endpoint}`, conf) 109 | .then(response => { 110 | resolve(response); 111 | }) 112 | .catch(error => { 113 | reject(error); 114 | }); 115 | }); 116 | } 117 | 118 | public uploadFile(endpoint: string, data: FormData, conf = {}): AxiosPromise { 119 | return this.post(endpoint, data, conf); 120 | } 121 | 122 | public downloadFile(endpoint: string): AxiosPromise { 123 | const conf = { 124 | responseType: 'blob', // important 125 | timeout: 30000, 126 | }; 127 | return this.get(endpoint, conf); 128 | } 129 | 130 | handleSuccess(response: AxiosResponse) { 131 | // console.log('handleSuccess' + JSON.stringify(response)) 132 | return response; 133 | } 134 | 135 | handleError = (err: any) => { 136 | let errorStatement: string = ''; 137 | if (!err.response) { 138 | console.log(`Network error: ${err}`); 139 | errorStatement = err.message; 140 | } else { 141 | if (err.response) { 142 | const { status } = err.response; 143 | console.log(`HttpService::Error(${status}) : ${err.response.data.message}`); 144 | errorStatement = err.response.data.message; 145 | } 146 | } 147 | return Promise.reject(errorStatement); 148 | }; 149 | 150 | redirectTo = (document: any, path: string) => { 151 | document.location = path; 152 | }; 153 | } 154 | 155 | export default HttpApiService; 156 | -------------------------------------------------------------------------------- /src/containers/404/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | import { setSelectedIndex } from 'features/menu-slice'; 4 | import useAppDispatch from 'hooks/use-app-dispatch'; 5 | import './404.css'; 6 | 7 | const Error404: React.FC = () => { 8 | const dispatch = useAppDispatch(); 9 | 10 | return ( 11 | <> 12 | 13 | 14 | 15 | 16 | 17 | 18 | 404 19 | 20 | Looks like the page you were looking for is no longer here. 21 | 22 | 23 | dispatch(setSelectedIndex(0))}> 24 | Please go to home! 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 36 | 37 | 38 | 45 | 46 | 47 | 51 | 53 | 54 | 55 | 60 | 65 | 66 | 67 | 72 | 74 | 75 | 76 | 78 | 79 | 80 | 81 | 82 | 87 | 88 | 89 | 90 | 91 | > 92 | ); 93 | }; 94 | 95 | export default Error404; 96 | -------------------------------------------------------------------------------- /src/serviceWorker.ts: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.0/8 are considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/, 20 | ), 21 | ); 22 | 23 | type Config = { 24 | onSuccess?: (registration: ServiceWorkerRegistration) => void; 25 | onUpdate?: (registration: ServiceWorkerRegistration) => void; 26 | }; 27 | 28 | export function register(config?: Config) { 29 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 30 | // The URL constructor is available in all browsers that support SW. 31 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 32 | if (publicUrl.origin !== window.location.origin) { 33 | // Our service worker won't work if PUBLIC_URL is on a different origin 34 | // from what our page is served on. This might happen if a CDN is used to 35 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 36 | return; 37 | } 38 | 39 | window.addEventListener('load', () => { 40 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 41 | 42 | if (isLocalhost) { 43 | // This is running on localhost. Let's check if a service worker still exists or not. 44 | checkValidServiceWorker(swUrl, config); 45 | 46 | // Add some additional logging to localhost, pointing developers to the 47 | // service worker/PWA documentation. 48 | navigator.serviceWorker.ready.then(() => { 49 | console.log( 50 | 'This web app is being served cache-first by a service ' + 51 | 'worker. To learn more, visit https://bit.ly/CRA-PWA', 52 | ); 53 | }); 54 | } else { 55 | // Is not localhost. Just register service worker 56 | registerValidSW(swUrl, config); 57 | } 58 | }); 59 | } 60 | } 61 | 62 | function registerValidSW(swUrl: string, config?: Config) { 63 | navigator.serviceWorker 64 | .register(swUrl) 65 | .then((registration) => { 66 | registration.onupdatefound = () => { 67 | const installingWorker = registration.installing; 68 | if (installingWorker == null) { 69 | return; 70 | } 71 | installingWorker.onstatechange = () => { 72 | if (installingWorker.state === 'installed') { 73 | if (navigator.serviceWorker.controller) { 74 | // At this point, the updated precached content has been fetched, 75 | // but the previous service worker will still serve the older 76 | // content until all client tabs are closed. 77 | console.log( 78 | 'New content is available and will be used when all ' + 79 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.', 80 | ); 81 | 82 | // Execute callback 83 | if (config && config.onUpdate) { 84 | config.onUpdate(registration); 85 | } 86 | } else { 87 | // At this point, everything has been precached. 88 | // It's the perfect time to display a 89 | // "Content is cached for offline use." message. 90 | console.log('Content is cached for offline use.'); 91 | 92 | // Execute callback 93 | if (config && config.onSuccess) { 94 | config.onSuccess(registration); 95 | } 96 | } 97 | } 98 | }; 99 | }; 100 | }) 101 | .catch((error) => { 102 | console.error('Error during service worker registration:', error); 103 | }); 104 | } 105 | 106 | function checkValidServiceWorker(swUrl: string, config?: Config) { 107 | // Check if the service worker can be found. If it can't reload the page. 108 | fetch(swUrl, { 109 | headers: { 'Service-Worker': 'script' }, 110 | }) 111 | .then((response) => { 112 | // Ensure service worker exists, and that we really are getting a JS file. 113 | const contentType = response.headers.get('content-type'); 114 | if ( 115 | response.status === 404 || 116 | (contentType != null && contentType.indexOf('javascript') === -1) 117 | ) { 118 | // No service worker found. Probably a different app. Reload the page. 119 | navigator.serviceWorker.ready.then((registration) => { 120 | registration.unregister().then(() => { 121 | window.location.reload(); 122 | }); 123 | }); 124 | } else { 125 | // Service worker found. Proceed as normal. 126 | registerValidSW(swUrl, config); 127 | } 128 | }) 129 | .catch(() => { 130 | console.log( 131 | 'No internet connection found. App is running in offline mode.', 132 | ); 133 | }); 134 | } 135 | 136 | export function unregister() { 137 | if ('serviceWorker' in navigator) { 138 | navigator.serviceWorker.ready 139 | .then((registration) => { 140 | registration.unregister(); 141 | }) 142 | .catch((error) => { 143 | console.error(error.message); 144 | }); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /src/containers/add-funds/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { BsCurrencyBitcoin } from 'react-icons/bs'; 3 | import { AiOutlinePlus } from 'react-icons/ai'; 4 | import { FaEthereum, FaHandHoldingUsd, FaBitcoin } from 'react-icons/fa'; 5 | import { SiLitecoin } from 'react-icons/si'; 6 | import { GiMoneyStack } from 'react-icons/gi'; 7 | import XMRIcon from 'assets/icons/xmr.svg'; 8 | import XRPIcon from 'assets/icons/xrp.svg'; 9 | import TetherIcon from 'assets/icons/tether.png'; 10 | import { StyledDepositHistory, CardSection, HighlightCard, TopSection, CenterSection, BottomSection } from './styled'; 11 | 12 | const AddFunds: React.FC = () => { 13 | return ( 14 | 15 | 16 | 17 | 18 | 19 | Bitcoin 20 | 21 | 22 | 23 | Any amount is acceptable 24 | 25 | 26 | 27 | Add Balance Using Bitcoin Currency 28 | 29 | 30 | 31 | 32 | 33 | Ether 34 | 35 | 36 | 37 | Any amount is acceptable 38 | 39 | 40 | 41 | Add Balance Using Ethereum Currency 42 | 43 | 44 | 45 | 46 | 47 | Lite Coin 48 | 49 | 50 | 51 | Any amount is acceptable 52 | 53 | 54 | 55 | Add Balance Using Lite Coin Currency 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | Bitcoin Cash 64 | 65 | 66 | 67 | Any amount is acceptable 68 | 69 | 70 | 71 | Add Balance Using Bitcoin Cash Currency 72 | 73 | 74 | 75 | 76 | 77 | XMR 78 | 79 | 80 | 81 | Any amount is acceptable 82 | 83 | 84 | 85 | Add Balance Using XMR Currency 86 | 87 | 88 | 89 | 90 | 91 | XRP 92 | 93 | 94 | 95 | Any amount is acceptable 96 | 97 | 98 | 99 | Add Balance Using XRP Currency 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | Tether 108 | 109 | 110 | 111 | Any amount is acceptable 112 | 113 | 114 | 115 | Add Balance Using Tether Currency 116 | 117 | 118 | 119 | 120 | 121 | USD Tron/TRC-20 122 | 123 | 124 | 125 | Any amount is acceptable 126 | 127 | 128 | 129 | Add Balance Using USD Tron/TRC-20 130 | 131 | 132 | 133 | 134 | 135 | Perfect Money 136 | 137 | 138 | 139 | Min/Max is 20 USD/5000 USD 140 | 141 | 142 | 143 | Add Balance Using Perfect Money 144 | 145 | 146 | 147 | 148 | ); 149 | }; 150 | 151 | export default AddFunds; 152 | -------------------------------------------------------------------------------- /src/containers/layout/main-layout/sidebar/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import { Link, useHistory } from 'react-router-dom'; 3 | import PerfectScrollbar from 'react-perfect-scrollbar'; 4 | import { ProSidebar, Menu, SubMenu, MenuItem, SidebarHeader, SidebarFooter, SidebarContent } from 'react-pro-sidebar'; 5 | import { 6 | FiLogOut, 7 | FiArrowLeftCircle, 8 | FiMessageSquare, 9 | FiArrowRightCircle, 10 | FiMail, 11 | FiBarChart, 12 | FiPocket, 13 | FiUsers, 14 | FiSettings, 15 | FiSend, 16 | FiPlusCircle, 17 | FiGift, 18 | } from 'react-icons/fi'; 19 | import { toast } from 'react-toastify'; 20 | import { Logo, LogoTitle } from './styled'; 21 | import logoImg from 'assets/icons/logo.png'; 22 | import sidebarBackground from 'assets/images/sidebar-background.jpg'; 23 | import AuthApiService from 'common/services/auth-api-service'; 24 | import useAppDispatch from 'hooks/use-app-dispatch'; 25 | import useAppSelector from 'hooks/use-app-seletecor'; 26 | import { setCurrentUser } from 'features/auth-slice'; 27 | import authApi from 'common/api/auth'; 28 | import { setSelectedIndex, selectIndex } from 'features/menu-slice'; 29 | 30 | const Sidebar: React.FC = () => { 31 | const history = useHistory(); 32 | const dispatch = useAppDispatch(); 33 | const authApiService = new AuthApiService(); 34 | 35 | const [menuCollapse, setMenuCollapse] = useState(false); 36 | const menuIconClick = () => { 37 | menuCollapse ? setMenuCollapse(false) : setMenuCollapse(true); 38 | }; 39 | const selectedIndex = useAppSelector(selectIndex); 40 | 41 | const handleSignOut = async () => { 42 | try { 43 | const res = await authApiService.signOut(); 44 | if (res.data) { 45 | await authApi.logout(); 46 | await dispatch(setCurrentUser({})); 47 | toast.success(res.data.message); 48 | history.push('/signin'); 49 | } 50 | } catch (error) { 51 | toast.error(error as string); 52 | } 53 | }; 54 | 55 | useEffect(() => { 56 | switch (selectedIndex) { 57 | case 0: 58 | history.push('/quick-sms'); 59 | break; 60 | case 1: 61 | history.push('/sendout-status'); 62 | break; 63 | case 2: 64 | history.push('/sendout-history'); 65 | break; 66 | case 3: 67 | history.push('/statistics'); 68 | break; 69 | case 4: 70 | history.push('/add-funds'); 71 | break; 72 | case 5: 73 | history.push('/deposit-history'); 74 | break; 75 | case 6: 76 | history.push('/settings'); 77 | break; 78 | default: 79 | history.push('/quick-sms'); 80 | break; 81 | } 82 | }, [selectedIndex]); 83 | 84 | return ( 85 | <> 86 | 87 | {/* collapsed props to change menu size using menucollapse state */} 88 | 89 | 90 | 91 | {/* changing menu collapse icon on click */} 92 | {menuCollapse ? : } 93 | 94 | 95 | 96 | 97 | {!menuCollapse && Supremacy} 98 | 99 | 100 | 101 | 102 | 103 | 104 | }> 105 | }> 106 | Quick SMS 107 | dispatch(setSelectedIndex(0))} /> 108 | 109 | }> 110 | Sendout Status 111 | dispatch(setSelectedIndex(1))} /> 112 | 113 | }> 114 | Sendout History 115 | dispatch(setSelectedIndex(2))} /> 116 | 117 | }> 118 | Statistics 119 | dispatch(setSelectedIndex(3))} /> 120 | 121 | 122 | }> 123 | }> 124 | Add funds 125 | dispatch(setSelectedIndex(4))} /> 126 | 127 | }> 128 | Deposit History 129 | dispatch(setSelectedIndex(5))} /> 130 | 131 | 132 | }> 133 | }> 134 | Settings 135 | dispatch(setSelectedIndex(6))} /> 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | } onClick={handleSignOut}> 144 | Sign Out 145 | 146 | 147 | 148 | 149 | 150 | > 151 | ); 152 | }; 153 | 154 | export default Sidebar; 155 | --------------------------------------------------------------------------------
20 | Looks like the page you were looking for is no longer here. 21 | 22 | 23 | dispatch(setSelectedIndex(0))}> 24 | Please go to home! 25 | 26 |