diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index deac2cf1..00000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4a84c959..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "editor.formatOnSave": true, - "eslint.format.enable": true -} \ No newline at end of file diff --git a/frontend/pages/pricing.js b/frontend/pages/pricing.js new file mode 100644 index 00000000..0c87c052 --- /dev/null +++ b/frontend/pages/pricing.js @@ -0,0 +1,249 @@ +import React from "react"; +import { + Box, + Stack, + HStack, + Heading, + Text, + VStack, + useColorModeValue, + List, + ListItem, + ListIcon, + Button, +} from "@chakra-ui/react"; +import { FaCheckCircle } from "react-icons/fa"; +import { getLayout } from "../src/layouts"; + +function PriceWrapper({ children }) { + return ( + + {children} + + ); +} + +const Pricing = (props) => { + return ( + + + + Plans that fit your need + + + Start with 14-day free trial. No credit card needed. Cancel at + anytime. + + + + + + + Hobby + + + + $ + + + 79 + + + /month + + + + + + + + unlimited build minutes + + + + Lorem, ipsum dolor. + + + + 5TB Lorem, ipsum dolor. + + + + + + + + + + + + + Most Popular + + + + + Growth + + + + $ + + + 149 + + + /month + + + + + + + + unlimited build minutes + + + + Lorem, ipsum dolor. + + + + 5TB Lorem, ipsum dolor. + + + + 5TB Lorem, ipsum dolor. + + + + 5TB Lorem, ipsum dolor. + + + + + + + + + + + + Scale + + + + $ + + + 349 + + + /month + + + + + + + + unlimited build minutes + + + + Lorem, ipsum dolor. + + + + 5TB Lorem, ipsum dolor. + + + + + + + + + + ); +}; + +export async function getStaticProps() { + const metaTags = { + title: "Bugout: Measure the success of your dev tool", + description: + "Get usage metrics and crash reports. Improve your users' experience", + keywords: + "bugout, bugout-dev, bugout.dev, usage-metrics, analytics, dev-tool ,knowledge, docs, journal, entry, find-anything", + url: "https://bugout.dev", + image: + "https://s3.amazonaws.com/static.simiotics.com/landing/aviator-2.svg", + }; + +// const assetPreload = Object.keys(assets).map((key) => { +// return { +// rel: "preload", +// href: assets[key], +// as: "image", +// }; +// }); +// const preconnects = [ +// { rel: "preconnect", href: "https://s3.amazonaws.com" }, +// { rel: "preconnect", href: "https://assets.calendly.com/" }, +// ]; + +// const preloads = assetPreload.concat(preconnects); + + return { + props: { metaTags }, + }; +} + +Pricing.getLayout = getLayout; + +export default Pricing; diff --git a/frontend/src/components/AddUserTr.js b/frontend/src/components/AddUserTr.js deleted file mode 100644 index 1648fd38..00000000 --- a/frontend/src/components/AddUserTr.js +++ /dev/null @@ -1,96 +0,0 @@ - -import { jsx } from "@emotion/react"; -import { useEffect, useRef, Fragment } from "react"; -import { - FormControl, - FormErrorMessage, - InputGroup, - Input, - Select, - Td, - Tr, -} from "@chakra-ui/react"; -import { CloseIcon } from "@chakra-ui/icons"; - -import IconButton from "./IconButton"; - -const AddUserForm = ({ isOpen, toggleSelf, errors, register }) => { - const inputRef = useRef(null); - useEffect(() => { - if (isOpen) { - //without timeout input is not catching focus on chrome and firefox.. - //probably because it is hidden within accordion - setTimeout(() => { - inputRef.current.focus(); - }, 100); - } - }, [inputRef, isOpen]); - - return ( - - {isOpen && ( - - - - - - { - register(e, { required: "email is required" }); - inputRef.current = e; - }} - /> - - - {errors.email && errors.email.message} - - - - - - - - - {errors.role && errors.role.message} - - - - - - - toggleSelf(false)} - icon={} - /> - - - )} - - ); -}; - -export default AddUserForm; diff --git a/frontend/src/components/EntriesNavigation.js b/frontend/src/components/EntriesNavigation.js index fd0262b7..c3f627e9 100644 --- a/frontend/src/components/EntriesNavigation.js +++ b/frontend/src/components/EntriesNavigation.js @@ -1,52 +1,90 @@ -import React, { useRef, useEffect, useContext } from "react"; +import React, { useRef, useEffect, useContext, useState } from "react"; import { Flex, Spinner, Button, Center, Text, - Tabs, - TabList, - TabPanels, - Tab, - TabPanel, - Heading, + Menu, + MenuButton, + MenuList, + MenuItem, + MenuGroup, + IconButton, + Input, + Select, + Drawer, + DrawerBody, + DrawerFooter, + DrawerHeader, + DrawerOverlay, + DrawerContent, + DrawerCloseButton, + useDisclosure, + Tag, + TagLabel, + TagCloseButton, + Spacer, } from "@chakra-ui/react"; -import { useJournalEntries, useJournalPermissions } from "../core/hooks"; -import EntryList from "./EntryList"; +import { useSubscriptions } from "../core/hooks"; +import StreamEntry from "./StreamEntry"; import UIContext from "../core/providers/UIProvider/context"; -import HubspotForm from "react-hubspot-form"; +import { FaFilter } from "react-icons/fa"; +import useStream from "../core/hooks/useStream"; +import { ImCancelCircle } from "react-icons/im"; + const pageSize = 25; -const isContent = false; +const FILTER_TYPES = { + ADDRESS: 0, + GAS: 1, + GAS_PRICE: 2, + AMMOUNT: 3, + HASH: 4, + DISABLED: 99, +}; +const DIRECTIONS = { SOURCE: 0, DESTINATION: 1 }; +const CONDITION = { + EQUAL: 0, + CONTAINS: 1, + LESS: 2, + LESS_EQUAL: 3, + GREATER: 4, + GREATER_EQUAL: 5, + NOT_EQUAL: 6, +}; const EntriesNavigation = () => { const ui = useContext(UIContext); + const { isOpen, onOpen, onClose } = useDisclosure(); + const { subscriptionsCache } = useSubscriptions(); + const [newFilterState, _setNewFilterState] = useState([ + { + type: FILTER_TYPES.ADDRESS, + direction: DIRECTIONS.SOURCE, + condition: CONDITION.EQUAL, + value: null, + }, + ]); + const [filterState, setFilterState] = useState([]); - const { currentUserPermissions: permissions } = useJournalPermissions( - `9b0d7567-4634-4bf7-946d-60ef4414aa93`, - `personal` - ); - + const setNewFilterState = (props) => { + console.log( + "setNewFilterState", + props, + subscriptionsCache.data.subscriptions[0].id + ); + _setNewFilterState(props); + }; const loadMoreButtonRef = useRef(null); - const journalId = `9b0d7567-4634-4bf7-946d-60ef4414aa93`; - const appScope = `personal`; - - const { - fetchMore, - isFetchingMore, - canFetchMore, - refetch, - EntriesPages, - isLoading, - setSearchTerm, - } = useJournalEntries({ - journalId, - journalType: appScope, - pageSize, - isContent, - searchQuery: ui.searchTerm, - }); + const { fetchMore, isFetchingMore, canFetchMore, EntriesPages, isLoading } = + useStream({ + pageSize, + refreshRate: 1500, + searchQuery: ui.searchTerm, + enabled: true, + isContent: false, + }); const handleScroll = ({ currentTarget }) => { if ( @@ -59,11 +97,22 @@ const EntriesNavigation = () => { } }; + const setFilterProps = (filterIdx, props) => { + const newFilterProps = [...newFilterState]; + newFilterProps[filterIdx] = { ...newFilterProps[filterIdx], ...props }; + setNewFilterState(newFilterProps); + }; + useEffect(() => { - if (journalId) { - refetch(); + if ( + subscriptionsCache.data?.subscriptions[0]?.id && + newFilterState[0].value === null + ) { + setFilterProps(0, { + value: subscriptionsCache.data.subscriptions[0].address, + }); } - }, [journalId, ui.searchTerm, refetch, setSearchTerm]); + }, [subscriptionsCache.isLoading]); const entriesPagesData = EntriesPages ? EntriesPages.pages.map((page) => { @@ -72,13 +121,45 @@ const EntriesNavigation = () => { : [""]; const entries = entriesPagesData.flat(); + const canCreate = false; - const canCreate = - appScope !== "public" && permissions?.includes("journals.entries.create"); + const canDelete = false; - const canDelete = - appScope !== "public" && permissions?.includes("journals.entries.delete"); + const dropNewFilterArrayItem = (idx) => { + const newArray = [...newFilterState]; + delete newArray[idx]; + setNewFilterState(newArray); + }; + const dropFilterArrayItem = (idx) => { + console.log("dropFilterArrayItem", idx, filterState); + const newArray = [...filterState]; + newArray[idx].type = FILTER_TYPES.DISABLED; + setFilterState(newArray); + }; + + const handleFilterSubmit = () => { + setFilterState(newFilterState); + onClose(); + }; + + const handleAddressChange = (idx) => (e) => { + setFilterProps(idx, { value: e.target.value }); + }; + + const handleConditionChange = (idx) => (e) => { + console.log("handleConditionChange", idx, e.target.value); + setFilterProps(idx, { condition: parseInt(e.target.value) }); + }; + + const handleFilterStateCallback = (props) => { + console.log("handleFilterStateCallback", props); + const newFilterState = [...filterState]; + newFilterState.push({ ...props }); + setFilterState(newFilterState); + }; + if (subscriptionsCache.isLoading) return ""; + console.log("filterstate test", filterState); return ( { direction="column" flexGrow={1} > - - - - Live view - - - Analysis - - - - - - {entries && !isLoading ? ( - <> - - - Status - - - Source - - - Alias - - - Ammount - - - Date - - - - - handleScroll(e)} - > - {entries.map((entry) => ( - - ))} - {canFetchMore && !isFetchingMore && ( -
- -
- )} - {canFetchMore && isFetchingMore && ( -
-
+
+
+ ); + })} + + + Add filter row + + + + + setNewFilterState([ + ...newFilterState, + { + type: FILTER_TYPES.ADDRESS, + direction: DIRECTIONS.SOURCE, + condition: CONDITION.EQUAL, + value: subscriptionsCache.data.subscriptions[0].id, + }, + ]) + } + > + Source + + + setNewFilterState([ + ...newFilterState, + { + type: FILTER_TYPES.ADDRESS, + direction: DIRECTIONS.DESTINATION, + condition: CONDITION.EQUAL, + value: null, + }, + ]) + } + > + Destination + + + + + + + + + + + + {filterState.map((filter, idx) => { + if (filter.type === FILTER_TYPES.DISABLED) return ""; + return ( + + {filter?.type === FILTER_TYPES.ADDRESS && ( + + {filter.condition === CONDITION.NOT_EQUAL && "Not "} + {filter.direction === DIRECTIONS.SOURCE + ? "From: " + : "To: "} + {subscriptionsCache?.data?.subscriptions.find( + (subscription) => + subscription.address === filter.value + )?.label ?? filter.value} + )} - - - - ) : ( -
- -
- )} -
- - This section is under construction - Message us to tell your needs for this page - } - /> - -
-
-
- ); -}; -export default EntriesNavigation; - -{ - /* {entries && !isLoading ? ( - - - - - - - - Status - - - Source - - - Alias - - - Ammount - - - Date - + dropFilterArrayItem(idx)} /> + + ); + })} + + } + /> + + handleScroll(e)} > - {entries.map((entry) => ( - ( + ))} {canFetchMore && !isFetchingMore && ( @@ -387,10 +413,8 @@ export default EntriesNavigation; )} - - {/* {mode === "analysis" && tell us morex} - tell me moar - + + ) : (
- )} */ -} + )} + + ); +}; + +export default EntriesNavigation; diff --git a/frontend/src/components/EntryCard.js b/frontend/src/components/EntryCard.js deleted file mode 100644 index 0a314bb4..00000000 --- a/frontend/src/components/EntryCard.js +++ /dev/null @@ -1,22 +0,0 @@ - -import { jsx } from "@emotion/react"; -import { Box } from "@chakra-ui/react"; - -const EntryCard = (props) => { - const background = props.isActive ? "secondary.500" : "transparent"; - return ( - - {props.children} - - ); -}; - -export default EntryCard; diff --git a/frontend/src/components/EntryList.js b/frontend/src/components/EntryList.js deleted file mode 100644 index 480974f6..00000000 --- a/frontend/src/components/EntryList.js +++ /dev/null @@ -1,53 +0,0 @@ -import React, { useContext } from "react"; -import { Flex, Heading, Text, IconButton } from "@chakra-ui/react"; -import moment from "moment"; -import { ViewIcon } from "@chakra-ui/icons"; -import { useRouter } from "../core/hooks"; -import UIContext from "../core/providers/UIProvider/context"; - -const EntryList = ({ entry }) => { - const ui = useContext(UIContext); - const router = useRouter(); - - const handleViewClicked = (entryId) => { - ui.setEntryId(entryId); - ui.setEntriesViewMode("entry"); - router.push({ - pathname: `/stream/${entry.id}`, - query: router.query, - }); - }; - return ( - - - - {entry.title} - - - - - {moment(entry.created_at).format("DD MMM, YYYY, h:mm:ss")}{" "} - - } - onClick={() => handleViewClicked(entry.id)} - /> - - ); -}; - -export default EntryList; diff --git a/frontend/src/components/ErrorStats.js b/frontend/src/components/ErrorStats.js deleted file mode 100644 index 4c60a417..00000000 --- a/frontend/src/components/ErrorStats.js +++ /dev/null @@ -1,81 +0,0 @@ - -import { jsx } from "@emotion/react"; -import { - Box, - Spinner, - Center, - RadioGroup, - Radio, - Stack, - Divider, -} from "@chakra-ui/react"; -import { ErrorIndicators } from "."; -import { useMemo, useState } from "react"; - -// -const ErrorsStats = ({ data, isLoading }) => { - const [tagType, setTagType] = useState("common"); - - const LoadingSpinner = () => ( - -
-
-
- ); - - const highest_entropy_indicators = useMemo( - () => - data && - Object.keys(data?.highest_entropy_tags)?.map((key) => { - return { - key: key, - value: data?.highest_entropy_tags[key], - timeseries: [...data?.errors_time_series[key]], - }; - }), - [data] - ); - - const most_common_indicators = useMemo( - () => - data && - Object.keys(data?.most_common_errors)?.map((key) => { - return { - key: key, - value: data?.most_common_errors[key], - timeseries: [...data?.errors_time_series[key]], - }; - }), - [data] - ); - - if (isLoading || !data) return ; - - return ( - - - - {/* all */} - highest entropy - most common - - - - {tagType === "common" && ( - - )} - {tagType === "entropy" && ( - - )} - - ); -}; -export default ErrorsStats; diff --git a/frontend/src/components/GitHubContent.js b/frontend/src/components/GitHubContent.js deleted file mode 100644 index 04056c95..00000000 --- a/frontend/src/components/GitHubContent.js +++ /dev/null @@ -1,157 +0,0 @@ - -import { jsx } from "@emotion/react"; -import { Link, Text } from "@chakra-ui/react"; -const Topics = [ - { - title: "Welcome!", - body: [ - { - text: [ - - If you just installed Bugout, thank you for becoming a part of our - community! - , - ], - }, - ], - }, - { - title: "Pull request checklists with @bugout-dev", - body: [ - { - text: [ - - Sometimes, you need human oversight on your pull requests before you - can merge them. This is really useful for pull requests that change - database schema, introduce new environment variables, or introduce - changes with security or legal implications. - , - - You can use Bugout to create checklists on your pull requests. Just - mention{" "} - - @bugout-dev - - : - , - - @bugout-dev check require something important - , - For example:, - ], - }, - { - image: { - path: "/images/welcome/github/image2.png", - annotation: "github example", - }, - }, - { - text: [ - - When the manual step is finished, mention @bugout-dev again: - , - - @bugout-dev check accept something important - , - - At any time, you can see the status of your checklist by clicking on - the Details link next to the @bugout-dev continuous - integration check. - , - This is what it looks like:, - ], - }, - { - image: { - path: "/images/welcome/github/image1.png", - annotation: "github example2", - }, - }, - { - text: [ - - Play with @bugout-dev on our demo PR:{" "} - - https://github.com/bugout-dev/github-demo/pull/2 - - , - ], - }, - ], - }, - { - title: "Installing Bugout", - body: [ - { - text: [ - - You can install Bugout to your organization or to individual - repositories. Click here to install:{" "} - - https://github.com/apps/bugout-dev - - , - - To see what else you can do with Bugout on GitHub, check out our - demo repository:{" "} - - https://github.com/bugout-dev/github-demo - - , - ], - }, - ], - }, - { - title: "Contact us", - body: [ - { - text: [ - - If you have any questions or would like to suggest improvements to - Bugout, you can contact us by email: Neeraj -{" "} - - neeraj@bugout.dev - - , Sophia -{" "} - - sophia@bugout.dev - - . - , - - You can also reach us on the{" "} - - Bugout community Slack channel - - . Direct message Neeraj (@zomglings) or Sophia (@Sophia). - , - ], - }, - ], - }, -]; - -export default Topics; diff --git a/frontend/src/components/JournalLinkBox.js b/frontend/src/components/JournalLinkBox.js deleted file mode 100644 index d6868974..00000000 --- a/frontend/src/components/JournalLinkBox.js +++ /dev/null @@ -1,38 +0,0 @@ - -import { jsx } from "@emotion/react"; -import { Box, LinkBox } from "@chakra-ui/react"; - -const JournalLinkBox = (props) => { - return ( - - {props.children} - - ); -}; - -export default JournalLinkBox; diff --git a/frontend/src/components/ManageSubscription.js b/frontend/src/components/ManageSubscription.js deleted file mode 100644 index ce15cb2f..00000000 --- a/frontend/src/components/ManageSubscription.js +++ /dev/null @@ -1,177 +0,0 @@ - -import { jsx } from "@emotion/react"; -import { - Button, - Grid, - GridItem, - NumberInput, - NumberInputField, - NumberInputStepper, - NumberIncrementStepper, - NumberDecrementStepper, - Heading, - Input, - Center, - Spinner, - Text, - Flex, -} from "@chakra-ui/react"; -import { useSubscriptions } from "../core/hooks"; -import { Fragment } from "react"; -import { useForm } from "react-hook-form"; - -const ManageSubscription = ({ groupId, onAddSeatsClose }) => { - const { manageSubscriptionMutation, subscriptionsCache } = useSubscriptions( - groupId - ); - - const { - handleSubmit: addSeatsHandleSubmit, - register: addSeatsRegister, - } = useForm(); - - const { - handleSubmit: addEventsHandleSubmit, - register: addEventsRegister, - } = useForm(); - - const updateSubscriptionHandler = ({ groupId, units, planType }) => { - const desiredUnits = Math.trunc(units); - manageSubscriptionMutation.manageSubscription({ - groupId, - desiredUnits, - planType, - }); - onAddSeatsClose(); - }; - - if (subscriptionsCache.isLoading) - return ( -
-
- ); - - const eventPlan = subscriptionsCache.data.find( - (subscription) => subscription.plan_type === "events" - ); - const seatPlan = subscriptionsCache.data.find( - (subscription) => subscription.plan_type === "seats" - ); - return ( - - - Total number of seats? - -
- - - - - - - - - - - - - - - - -
-
- - Number of reports - - - - - - - - - - - - - - x1000 Reports/Month - - - - - - - - -
-
- ); -}; - -export default ManageSubscription; diff --git a/frontend/src/components/NameEditable.js b/frontend/src/components/NameEditable.js deleted file mode 100644 index 352574b0..00000000 --- a/frontend/src/components/NameEditable.js +++ /dev/null @@ -1,73 +0,0 @@ -/** @jsxRuntime classic */ -/** @jsx jsx */ -import { jsx } from "@emotion/react"; -import { useState, useEffect } from "react"; -import { - HStack, - Editable, - EditablePreview, - EditableInput, -} from "@chakra-ui/react"; -const NameEditable = ({ team, rename }) => { - const [name, setName] = useState(team.group_name); - - useEffect(() => { - setName(team.group_name); - }, [team.group_name]); - - const handleSubmit = () => { - rename.renameGroup({ name, groupId: team.group_id }); - }; - - return ( - handleSubmit()} - value={name} - onChange={(value) => setName(value)} - > - {() => ( - - - - - )} - - ); -}; - -export default NameEditable; diff --git a/frontend/src/components/Navbar.js b/frontend/src/components/Navbar.js index 3df601b7..a1350120 100644 --- a/frontend/src/components/Navbar.js +++ b/frontend/src/components/Navbar.js @@ -1,12 +1,10 @@ /** @jsxRuntime classic */ /** @jsx jsx */ import { jsx } from "@emotion/react"; -import React, { useEffect, Suspense, useContext } from "react"; +import React, { Suspense, useContext } from "react"; import { Flex } from "@chakra-ui/react"; -import { useUser } from "../core/hooks"; import UIContext from "../core/providers/UIProvider/context"; const ForgotPassword = React.lazy(() => import("./ForgotPassword")); -const Verify = React.lazy(() => import("./Verify")); const SignIn = React.lazy(() => import("./SignIn")); const SignUp = React.lazy(() => import("./SignUp")); const LandingNavbar = React.lazy(() => import("./LandingNavbar")); @@ -14,17 +12,7 @@ const AppNavbar = React.lazy(() => import("./AppNavbar")); const Navbar = () => { const { modal, toggleModal, isAppView, isLoggedIn } = useContext(UIContext); - const { user } = useUser(); - useEffect(() => { - if (user && !user.verified) { - toggleModal("verify"); - } - }, [user, toggleModal]); - - // ToDo: move this to constants - //Feature flag for email verification - const verificationEnabled = false; return ( { {modal === "login" && } - {verificationEnabled && modal === "verify" && ( - - )} - {modal === "forgot" && } - {(!isAppView || !isLoggedIn) && } {isAppView && isLoggedIn && } diff --git a/frontend/src/components/NewHumbugIntegration.js b/frontend/src/components/NewHumbugIntegration.js deleted file mode 100644 index f0d6af06..00000000 --- a/frontend/src/components/NewHumbugIntegration.js +++ /dev/null @@ -1,87 +0,0 @@ - -import { jsx } from "@emotion/react"; -import { useRef, useEffect } from "react"; -import { - Box, - Button, - GridItem, - Grid, - Text, - Heading, - Input, - FormErrorMessage, - FormControl, - InputGroup, -} from "@chakra-ui/react"; -import { useHumbugs } from "../core/hooks"; -import { useForm } from "react-hook-form"; - -const NewHumbugIntegration = ({ team }) => { - const { createHumbugMutation } = useHumbugs(); - const inputRef = useRef(); - const { - handleSubmit: addHumbugHandleSubmit, - register: addHumbugRegister, - errors: errorHambugRegister, - } = useForm(); - - const addHumbugHandler = ({ groupId, journalName }) => { - createHumbugMutation.createHumbug({ groupId, journalName }); - }; - - useEffect(() => { - setTimeout(() => inputRef.current.focus(), 100); - }, [inputRef]); - - return ( -
- - New Usage reports project - - How would you like to name it? - - - { - addHumbugRegister(e, { required: "Name is required" }); - inputRef.current = e; - }} - /> - - - {errorHambugRegister.journalName && - errorHambugRegister.journalName.message} - - - - - - - - - - -
- ); -}; - -export default NewHumbugIntegration; diff --git a/frontend/src/components/NewJournalModal.js b/frontend/src/components/NewJournalModal.js deleted file mode 100644 index 0a93cc32..00000000 --- a/frontend/src/components/NewJournalModal.js +++ /dev/null @@ -1,84 +0,0 @@ - -import { jsx } from "@emotion/react"; -import { useEffect, useState } from "react"; -import { useForm } from "react-hook-form"; -import { - Heading, - Box, - FormControl, - FormErrorMessage, - InputGroup, - Button, - Input, -} from "@chakra-ui/react"; -import Modal from "./Modal"; -import { useCreateJournal } from "../core/hooks"; - -const NewJournalModal = ({ toggleModal }) => { - const { handleSubmit, errors, register } = useForm(); - const [inputCount, setInputCount] = useState("0"); - const [createJournal, { isLoading, data }] = useCreateJournal(); - - const handleInput = (e) => { - if (inputCount === 50) { - return; - } - - setInputCount(e.target.value.length); - }; - - useEffect(() => { - if (!data) { - return; - } - - toggleModal(null); - }, [data, toggleModal]); - - return ( - toggleModal(null)}> - - Create Journal - -
- - - handleInput(e)} - placeholder="Journal name" - name="name" - ref={register({ required: "name is required!" })} - /> - - - {inputCount}/50 - - - {errors.name && errors.name.message} - - - - - -
- ); -}; - -export default NewJournalModal; diff --git a/frontend/src/components/NewSubscription.js b/frontend/src/components/NewSubscription.js index aa31450c..951f6b21 100644 --- a/frontend/src/components/NewSubscription.js +++ b/frontend/src/components/NewSubscription.js @@ -50,9 +50,25 @@ const NewSubscription = ({ isFreeOption, onClose }) => { Subscribe to a new address + + + + {errors.label && errors.label.message} + + @@ -92,11 +108,6 @@ const NewSubscription = ({ isFreeOption, onClose }) => { - - - - - We just sent you a verification code by email. - - - Please enter the code here so we can verify that you are who you say you - are. - - - ); -}; - -export default Verify; diff --git a/frontend/src/core/hooks/useSignUp.js b/frontend/src/core/hooks/useSignUp.js index 6b82fe57..f1212268 100644 --- a/frontend/src/core/hooks/useSignUp.js +++ b/frontend/src/core/hooks/useSignUp.js @@ -10,28 +10,31 @@ const useSignUp = (source) => { const { inviteAccept } = useInviteAccept(); const analytics = useAnalytics(); - const [signUp, { isLoading, error, data }] = useMutation( - AuthService.register(), - { - onSuccess: (response) => { - localStorage.setItem("BUGOUT_ACCESS_TOKEN", response.data.access_token); - const invite_code = window.sessionStorage.getItem("invite_code"); - if (invite_code) { - inviteAccept(invite_code); - } + const { + mutate: signUp, + isLoading, + error, + data, + isSuccess + } = useMutation(AuthService.register(), { + onSuccess: (response) => { + localStorage.setItem("BUGOUT_ACCESS_TOKEN", response.data.access_token); + const invite_code = window.sessionStorage.getItem("invite_code"); + if (invite_code) { + inviteAccept(invite_code); + } - if (analytics.isLoaded) { - analytics.mixpanel.track( - `${analytics.MIXPANEL_EVENTS.CONVERT_TO_USER}`, - { full_url: router.nextRouter.asPath, code: source } - ); - } - }, - onError: (error) => { - toast(error, "error"); - }, - } - ); + if (analytics.isLoaded) { + analytics.mixpanel.track( + `${analytics.MIXPANEL_EVENTS.CONVERT_TO_USER}`, + { full_url: router.nextRouter.asPath, code: source } + ); + } + }, + onError: (error) => { + toast(error, "error"); + }, + }); useEffect(() => { if (!data) { @@ -54,6 +57,7 @@ const useSignUp = (source) => { isLoading, data, error, + isSuccess, }; }; diff --git a/frontend/src/core/hooks/useStream.js b/frontend/src/core/hooks/useStream.js new file mode 100644 index 00000000..6920f9b5 --- /dev/null +++ b/frontend/src/core/hooks/useStream.js @@ -0,0 +1,76 @@ +import { useInfiniteQuery } from "react-query"; +import { queryCacheProps } from "./hookCommon"; +import { SubscriptionsService } from "../services"; + +const useJournalEntries = ({ + refreshRate, + isContent, + pageSize, + searchQuery, + enabled, +}) => { + const limit = pageSize ? pageSize : 25; + + const getStream = + (searchTerm) => + async ({ pageParam = 0 }) => { + if (!pageParam) { + pageParam = 0; + } + + const searchTags = searchTerm.split(" ").filter(function (n) { + if (n.startsWith("#")) return n; + else { + return null; + } + }); + + const response = await SubscriptionsService.getStream({ + searchTerm, + isContent, + limit, + offset: pageParam, + }); + const newEntryList = response.data.stream.map((entry) => ({ + ...entry, + })); + return { + data: [...newEntryList], + pageParams: { + pageParam: pageParam + 1, + next_offset: response.data.next_offset, + total_results: response.data.total_results, + offset: response.data.offset, + }, + }; + }; + + const { + data: EntriesPages, + isFetchingMore, + isLoading, + canFetchMore, + fetchMore, + refetch, + } = useInfiniteQuery(["stream", { searchQuery }], getStream(searchQuery), { + refetchInterval: refreshRate, + ...queryCacheProps, + getNextPageParam: (lastGroup) => { + return lastGroup.next_offset === null ? false : lastGroup.next_offset; + }, + onSuccess: (data) => { + }, + enabled: !!enabled, + }); + + return { + EntriesPages, + fetchMore, + isFetchingMore, + canFetchMore, + refetch, + isLoading, + }; +}; + +export default useJournalEntries; diff --git a/frontend/src/core/providers/UIProvider/index.js b/frontend/src/core/providers/UIProvider/index.js index 0f3c84d8..f418f494 100644 --- a/frontend/src/core/providers/UIProvider/index.js +++ b/frontend/src/core/providers/UIProvider/index.js @@ -42,13 +42,13 @@ const UIProvider = ({ children }) => { useEffect(() => { if (isAppView && isAppReady && !user?.username && !isLoggingOut) { - toggleModal("login"); + // toggleModal("login"); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [isAppView, isAppReady, user, isLoggingOut]); useEffect(() => { - if (isLoggingOut && !isAppView && !user) { + if (isLoggingOut && !isAppView && user) { setLoggingOut(false); } }, [isAppView, user, isLoggingOut]); @@ -90,7 +90,7 @@ const UIProvider = ({ children }) => { const [sidebarCollapsed, setSidebarCollapsed] = useStorage( window.sessionStorage, "sidebarCollapsed", - true + false ); // Whether sidebar should be toggled in mobile view diff --git a/frontend/src/core/services/subscriptions.service.js b/frontend/src/core/services/subscriptions.service.js index 6987167b..755db3d6 100644 --- a/frontend/src/core/services/subscriptions.service.js +++ b/frontend/src/core/services/subscriptions.service.js @@ -4,17 +4,17 @@ import { http } from "../utils"; const API = process.env.NEXT_PUBLIC_MOONSTREAM_API_URL; console.log(API); -// export const getTypes = () => -// http({ -// method: "GET", -// url: `${API}/subscription_types/`, -// }); - -// export const getSubscriptions = () => -// http({ -// method: "GET", -// url: `${API}/subscriptions/`, -// }); +export const getStream = ({ searchTerm, limit, offset, isContent }) => + http({ + method: "GET", + url: `${API}/stream`, + params: { + q: searchTerm, + limit: encodeURIComponent(limit), + offset: encodeURIComponent(offset), + content: encodeURIComponent(isContent), + }, + }); export const getTypes = () => http({ @@ -65,7 +65,6 @@ export const createSubscription = export const modifySubscription = () => ({ id, note }) => { - console.log("modifySubscription: ", note, id); const data = new FormData(); data.append("note", note); data.append("id", id); @@ -77,10 +76,9 @@ export const modifySubscription = }; export const deleteSubscription = () => (id) => { - console.log("deleteSubscription: ", id); return http({ method: "DELETE", - url: `${API}/subscription/${id}`, + url: `${API}/subscriptions/${id}`, }); }; diff --git a/frontend/src/core/utils/mockupRequests.js b/frontend/src/core/utils/mockupRequests.js index 75cf33cb..1b8985a7 100644 --- a/frontend/src/core/utils/mockupRequests.js +++ b/frontend/src/core/utils/mockupRequests.js @@ -12,6 +12,16 @@ const makeid = (length) => { return result; }; +const makenum = (length) => { + var result = ""; + var characters = "0123456789"; + var charactersLength = characters.length; + for (var i = 0; i < length; i++) { + result += characters.charAt(Math.floor(Math.random() * charactersLength)); + } + return result; +}; + const randDate = () => { return moment( new Date(+new Date() - Math.floor(Math.random() * 10000000000)) @@ -19,35 +29,40 @@ const randDate = () => { }; let MockSubscriptions = [ { - address: makeid(24), + label: "Bobs wallet", + address: `0x` + makeid(24), id: makeid(24), notes: "lorem", //ToDo: rename in to label created_at: randDate(), subscription_type: "ethereum_blockchain", }, { - address: makeid(24), + label: "Alices wallet", + address: `0x` + makeid(40), id: makeid(24), notes: "lorem", created_at: randDate(), subscription_type: "ethereum_txpool", }, { - address: makeid(24), + label: "Alogrand Ricks Wallet", + address: `0x` + makeid(40), id: makeid(24), notes: "lorem", created_at: randDate(), subscription_type: "algorand_blockchain", }, { - address: makeid(24), + label: "Unknown wallet", + address: `0x` + makeid(40), id: makeid(24), notes: "lorem", created_at: randDate(), subscription_type: "ethereum_blockchain", }, { - address: makeid(24), + label: "Unknown wallet", + address: `0x` + makeid(40), id: makeid(24), notes: "lorem", created_at: randDate(), @@ -90,6 +105,136 @@ const enableMockupRequests = (axiosInstance) => { ], }); + mock.onGet(`${MOCK_API}/stream`).reply(200, { + stream: [ + { + from_label: "Bobs wallet", + to_label: "Alices wallet", + to: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420AG", + from: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420c4", + gas: 2265656, + gasPrice: 1000000000, + hash: "0x5f0b6e212e55c7120f36fe6f88d46eb001c848064fd099116b42805bb3564ae6", + value: 0, + input: + "0x606061026b61014039602061026b60c03960c05160a01c1561002057600080fd5b61014051600055610160516001556001546101805181818301101561004457600080fd5b80820190509050600255600254421061005c57600080fd5b61025356600436101561000d576101ec565b600035601c52600051631998aeef8114156100855760015442101561003157600080fd5b600254421061003f57600080fd5b600454341161004d57600080fd5b600660035460e05260c052604060c020805460045481818301101561007157600080fd5b808201905090508155503360035534600455005b341561009057600080fd5b633ccfd60b8114156100db5760063360e05260c052604060c0205461014052600060063360e05260c052604060c02055600060006000600061014051336000f16100d957600080fd5b005b63fe67a54b811415610124576002544210156100f657600080fd5b6005541561010357600080fd5b600160055560006000600060006004546000546000f161012257600080fd5b005b6338af3eed81141561013c5760005460005260206000f35b634f245ef78114156101545760015460005260206000f35b632a24f46c81141561016c5760025460005260206000f35b6391f901578114156101845760035460005260206000f35b63d57bde7981141561019c5760045460005260206000f35b6312fa6feb8114156101b45760055460005260206000f35b6326b387bb8114156101ea5760043560a01c156101d057600080fd5b600660043560e05260c052604060c0205460005260206000f35b505b60006000fd5b61006161025303610061600039610061610253036000f30000000000000000000000002e337e0fb68f5e51ce9295e80bcd02273d7420c40000000000000000000000000000000000000000000000000000000060d2b04a00000000000000000000000000000000000000000000000000000000616b46ca", + }, + { + from_label: "Bobs wallet", + to_label: "Alices wallet", + to: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420AG", + from: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420c4", + gas: 2265656, + gasPrice: 1000000000, + hash: "0x5f0b6e212e55c7120f36fe6f88d46eb001c848064fd099116b42805bb3564ae6", + value: 0, + input: + "0x606061026b61014039602061026b60c03960c05160a01c1561002057600080fd5b61014051600055610160516001556001546101805181818301101561004457600080fd5b80820190509050600255600254421061005c57600080fd5b61025356600436101561000d576101ec565b600035601c52600051631998aeef8114156100855760015442101561003157600080fd5b600254421061003f57600080fd5b600454341161004d57600080fd5b600660035460e05260c052604060c020805460045481818301101561007157600080fd5b808201905090508155503360035534600455005b341561009057600080fd5b633ccfd60b8114156100db5760063360e05260c052604060c0205461014052600060063360e05260c052604060c02055600060006000600061014051336000f16100d957600080fd5b005b63fe67a54b811415610124576002544210156100f657600080fd5b6005541561010357600080fd5b600160055560006000600060006004546000546000f161012257600080fd5b005b6338af3eed81141561013c5760005460005260206000f35b634f245ef78114156101545760015460005260206000f35b632a24f46c81141561016c5760025460005260206000f35b6391f901578114156101845760035460005260206000f35b63d57bde7981141561019c5760045460005260206000f35b6312fa6feb8114156101b45760055460005260206000f35b6326b387bb8114156101ea5760043560a01c156101d057600080fd5b600660043560e05260c052604060c0205460005260206000f35b505b60006000fd5b61006161025303610061600039610061610253036000f30000000000000000000000002e337e0fb68f5e51ce9295e80bcd02273d7420c40000000000000000000000000000000000000000000000000000000060d2b04a00000000000000000000000000000000000000000000000000000000616b46ca", + }, + { + from_label: "Bobs wallet", + to_label: "Alices wallet", + to: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420AG", + from: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420c4", + gas: 2265656, + gasPrice: 1000000000, + hash: "0x5f0b6e212e55c7120f36fe6f88d46eb001c848064fd099116b42805bb3564ae6", + value: 0, + input: + "0x606061026b61014039602061026b60c03960c05160a01c1561002057600080fd5b61014051600055610160516001556001546101805181818301101561004457600080fd5b80820190509050600255600254421061005c57600080fd5b61025356600436101561000d576101ec565b600035601c52600051631998aeef8114156100855760015442101561003157600080fd5b600254421061003f57600080fd5b600454341161004d57600080fd5b600660035460e05260c052604060c020805460045481818301101561007157600080fd5b808201905090508155503360035534600455005b341561009057600080fd5b633ccfd60b8114156100db5760063360e05260c052604060c0205461014052600060063360e05260c052604060c02055600060006000600061014051336000f16100d957600080fd5b005b63fe67a54b811415610124576002544210156100f657600080fd5b6005541561010357600080fd5b600160055560006000600060006004546000546000f161012257600080fd5b005b6338af3eed81141561013c5760005460005260206000f35b634f245ef78114156101545760015460005260206000f35b632a24f46c81141561016c5760025460005260206000f35b6391f901578114156101845760035460005260206000f35b63d57bde7981141561019c5760045460005260206000f35b6312fa6feb8114156101b45760055460005260206000f35b6326b387bb8114156101ea5760043560a01c156101d057600080fd5b600660043560e05260c052604060c0205460005260206000f35b505b60006000fd5b61006161025303610061600039610061610253036000f30000000000000000000000002e337e0fb68f5e51ce9295e80bcd02273d7420c40000000000000000000000000000000000000000000000000000000060d2b04a00000000000000000000000000000000000000000000000000000000616b46ca", + }, + { + from_label: "Bobs wallet", + to_label: "Alices wallet", + to: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420AG", + from: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420c4", + gas: 2265656, + gasPrice: 1000000000, + hash: "0x5f0b6e212e55c7120f36fe6f88d46eb001c848064fd099116b42805bb3564ae6", + value: 0, + input: + "0x606061026b61014039602061026b60c03960c05160a01c1561002057600080fd5b61014051600055610160516001556001546101805181818301101561004457600080fd5b80820190509050600255600254421061005c57600080fd5b61025356600436101561000d576101ec565b600035601c52600051631998aeef8114156100855760015442101561003157600080fd5b600254421061003f57600080fd5b600454341161004d57600080fd5b600660035460e05260c052604060c020805460045481818301101561007157600080fd5b808201905090508155503360035534600455005b341561009057600080fd5b633ccfd60b8114156100db5760063360e05260c052604060c0205461014052600060063360e05260c052604060c02055600060006000600061014051336000f16100d957600080fd5b005b63fe67a54b811415610124576002544210156100f657600080fd5b6005541561010357600080fd5b600160055560006000600060006004546000546000f161012257600080fd5b005b6338af3eed81141561013c5760005460005260206000f35b634f245ef78114156101545760015460005260206000f35b632a24f46c81141561016c5760025460005260206000f35b6391f901578114156101845760035460005260206000f35b63d57bde7981141561019c5760045460005260206000f35b6312fa6feb8114156101b45760055460005260206000f35b6326b387bb8114156101ea5760043560a01c156101d057600080fd5b600660043560e05260c052604060c0205460005260206000f35b505b60006000fd5b61006161025303610061600039610061610253036000f30000000000000000000000002e337e0fb68f5e51ce9295e80bcd02273d7420c40000000000000000000000000000000000000000000000000000000060d2b04a00000000000000000000000000000000000000000000000000000000616b46ca", + }, + { + from_label: "Bobs wallet", + to_label: "Alices wallet", + to: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420AG", + from: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420c4", + gas: 2265656, + gasPrice: 1000000000, + hash: "0x5f0b6e212e55c7120f36fe6f88d46eb001c848064fd099116b42805bb3564ae6", + value: 0, + input: + "0x606061026b61014039602061026b60c03960c05160a01c1561002057600080fd5b61014051600055610160516001556001546101805181818301101561004457600080fd5b80820190509050600255600254421061005c57600080fd5b61025356600436101561000d576101ec565b600035601c52600051631998aeef8114156100855760015442101561003157600080fd5b600254421061003f57600080fd5b600454341161004d57600080fd5b600660035460e05260c052604060c020805460045481818301101561007157600080fd5b808201905090508155503360035534600455005b341561009057600080fd5b633ccfd60b8114156100db5760063360e05260c052604060c0205461014052600060063360e05260c052604060c02055600060006000600061014051336000f16100d957600080fd5b005b63fe67a54b811415610124576002544210156100f657600080fd5b6005541561010357600080fd5b600160055560006000600060006004546000546000f161012257600080fd5b005b6338af3eed81141561013c5760005460005260206000f35b634f245ef78114156101545760015460005260206000f35b632a24f46c81141561016c5760025460005260206000f35b6391f901578114156101845760035460005260206000f35b63d57bde7981141561019c5760045460005260206000f35b6312fa6feb8114156101b45760055460005260206000f35b6326b387bb8114156101ea5760043560a01c156101d057600080fd5b600660043560e05260c052604060c0205460005260206000f35b505b60006000fd5b61006161025303610061600039610061610253036000f30000000000000000000000002e337e0fb68f5e51ce9295e80bcd02273d7420c40000000000000000000000000000000000000000000000000000000060d2b04a00000000000000000000000000000000000000000000000000000000616b46ca", + }, + { + from_label: "Bobs wallet", + to_label: "Alices wallet", + to: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420AG", + from: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420c4", + gas: 2265656, + gasPrice: 1000000000, + hash: "0x5f0b6e212e55c7120f36fe6f88d46eb001c848064fd099116b42805bb3564ae6", + value: 0, + input: + "0x606061026b61014039602061026b60c03960c05160a01c1561002057600080fd5b61014051600055610160516001556001546101805181818301101561004457600080fd5b80820190509050600255600254421061005c57600080fd5b61025356600436101561000d576101ec565b600035601c52600051631998aeef8114156100855760015442101561003157600080fd5b600254421061003f57600080fd5b600454341161004d57600080fd5b600660035460e05260c052604060c020805460045481818301101561007157600080fd5b808201905090508155503360035534600455005b341561009057600080fd5b633ccfd60b8114156100db5760063360e05260c052604060c0205461014052600060063360e05260c052604060c02055600060006000600061014051336000f16100d957600080fd5b005b63fe67a54b811415610124576002544210156100f657600080fd5b6005541561010357600080fd5b600160055560006000600060006004546000546000f161012257600080fd5b005b6338af3eed81141561013c5760005460005260206000f35b634f245ef78114156101545760015460005260206000f35b632a24f46c81141561016c5760025460005260206000f35b6391f901578114156101845760035460005260206000f35b63d57bde7981141561019c5760045460005260206000f35b6312fa6feb8114156101b45760055460005260206000f35b6326b387bb8114156101ea5760043560a01c156101d057600080fd5b600660043560e05260c052604060c0205460005260206000f35b505b60006000fd5b61006161025303610061600039610061610253036000f30000000000000000000000002e337e0fb68f5e51ce9295e80bcd02273d7420c40000000000000000000000000000000000000000000000000000000060d2b04a00000000000000000000000000000000000000000000000000000000616b46ca", + }, + { + from_label: "Bobs wallet", + to_label: "Alices wallet", + to: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420AG", + from: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420c4", + gas: 2265656, + gasPrice: 1000000000, + hash: "0x5f0b6e212e55c7120f36fe6f88d46eb001c848064fd099116b42805bb3564ae6", + value: 0, + input: + "0x606061026b61014039602061026b60c03960c05160a01c1561002057600080fd5b61014051600055610160516001556001546101805181818301101561004457600080fd5b80820190509050600255600254421061005c57600080fd5b61025356600436101561000d576101ec565b600035601c52600051631998aeef8114156100855760015442101561003157600080fd5b600254421061003f57600080fd5b600454341161004d57600080fd5b600660035460e05260c052604060c020805460045481818301101561007157600080fd5b808201905090508155503360035534600455005b341561009057600080fd5b633ccfd60b8114156100db5760063360e05260c052604060c0205461014052600060063360e05260c052604060c02055600060006000600061014051336000f16100d957600080fd5b005b63fe67a54b811415610124576002544210156100f657600080fd5b6005541561010357600080fd5b600160055560006000600060006004546000546000f161012257600080fd5b005b6338af3eed81141561013c5760005460005260206000f35b634f245ef78114156101545760015460005260206000f35b632a24f46c81141561016c5760025460005260206000f35b6391f901578114156101845760035460005260206000f35b63d57bde7981141561019c5760045460005260206000f35b6312fa6feb8114156101b45760055460005260206000f35b6326b387bb8114156101ea5760043560a01c156101d057600080fd5b600660043560e05260c052604060c0205460005260206000f35b505b60006000fd5b61006161025303610061600039610061610253036000f30000000000000000000000002e337e0fb68f5e51ce9295e80bcd02273d7420c40000000000000000000000000000000000000000000000000000000060d2b04a00000000000000000000000000000000000000000000000000000000616b46ca", + }, + { + from_label: "Bobs wallet", + to_label: "Alices wallet", + to: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420AG", + from: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420c4", + gas: 2265656, + gasPrice: 1000000000, + hash: "0x5f0b6e212e55c7120f36fe6f88d46eb001c848064fd099116b42805bb3564ae6", + value: 0, + input: + "0x606061026b61014039602061026b60c03960c05160a01c1561002057600080fd5b61014051600055610160516001556001546101805181818301101561004457600080fd5b80820190509050600255600254421061005c57600080fd5b61025356600436101561000d576101ec565b600035601c52600051631998aeef8114156100855760015442101561003157600080fd5b600254421061003f57600080fd5b600454341161004d57600080fd5b600660035460e05260c052604060c020805460045481818301101561007157600080fd5b808201905090508155503360035534600455005b341561009057600080fd5b633ccfd60b8114156100db5760063360e05260c052604060c0205461014052600060063360e05260c052604060c02055600060006000600061014051336000f16100d957600080fd5b005b63fe67a54b811415610124576002544210156100f657600080fd5b6005541561010357600080fd5b600160055560006000600060006004546000546000f161012257600080fd5b005b6338af3eed81141561013c5760005460005260206000f35b634f245ef78114156101545760015460005260206000f35b632a24f46c81141561016c5760025460005260206000f35b6391f901578114156101845760035460005260206000f35b63d57bde7981141561019c5760045460005260206000f35b6312fa6feb8114156101b45760055460005260206000f35b6326b387bb8114156101ea5760043560a01c156101d057600080fd5b600660043560e05260c052604060c0205460005260206000f35b505b60006000fd5b61006161025303610061600039610061610253036000f30000000000000000000000002e337e0fb68f5e51ce9295e80bcd02273d7420c40000000000000000000000000000000000000000000000000000000060d2b04a00000000000000000000000000000000000000000000000000000000616b46ca", + }, + { + from_label: "Bobs wallet", + to_label: "Alices wallet", + to: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420AG", + from: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420c4", + gas: 2265656, + gasPrice: 1000000000, + hash: "0x5f0b6e212e55c7120f36fe6f88d46eb001c848064fd099116b42805bb3564ae6", + value: 0, + input: + "0x606061026b61014039602061026b60c03960c05160a01c1561002057600080fd5b61014051600055610160516001556001546101805181818301101561004457600080fd5b80820190509050600255600254421061005c57600080fd5b61025356600436101561000d576101ec565b600035601c52600051631998aeef8114156100855760015442101561003157600080fd5b600254421061003f57600080fd5b600454341161004d57600080fd5b600660035460e05260c052604060c020805460045481818301101561007157600080fd5b808201905090508155503360035534600455005b341561009057600080fd5b633ccfd60b8114156100db5760063360e05260c052604060c0205461014052600060063360e05260c052604060c02055600060006000600061014051336000f16100d957600080fd5b005b63fe67a54b811415610124576002544210156100f657600080fd5b6005541561010357600080fd5b600160055560006000600060006004546000546000f161012257600080fd5b005b6338af3eed81141561013c5760005460005260206000f35b634f245ef78114156101545760015460005260206000f35b632a24f46c81141561016c5760025460005260206000f35b6391f901578114156101845760035460005260206000f35b63d57bde7981141561019c5760045460005260206000f35b6312fa6feb8114156101b45760055460005260206000f35b6326b387bb8114156101ea5760043560a01c156101d057600080fd5b600660043560e05260c052604060c0205460005260206000f35b505b60006000fd5b61006161025303610061600039610061610253036000f30000000000000000000000002e337e0fb68f5e51ce9295e80bcd02273d7420c40000000000000000000000000000000000000000000000000000000060d2b04a00000000000000000000000000000000000000000000000000000000616b46ca", + }, + { + from_label: "Bobs wallet", + to_label: "Alices wallet", + to: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420AG", + from: "0x2E337E0Fb68F5e51ce9295E80BCd02273d7420c4", + gas: 2265656, + gasPrice: 1000000000, + hash: "0x5f0b6e212e55c7120f36fe6f88d46eb001c848064fd099116b42805bb3564ae6", + value: 0, + input: + "0x606061026b61014039602061026b60c03960c05160a01c1561002057600080fd5b61014051600055610160516001556001546101805181818301101561004457600080fd5b80820190509050600255600254421061005c57600080fd5b61025356600436101561000d576101ec565b600035601c52600051631998aeef8114156100855760015442101561003157600080fd5b600254421061003f57600080fd5b600454341161004d57600080fd5b600660035460e05260c052604060c020805460045481818301101561007157600080fd5b808201905090508155503360035534600455005b341561009057600080fd5b633ccfd60b8114156100db5760063360e05260c052604060c0205461014052600060063360e05260c052604060c02055600060006000600061014051336000f16100d957600080fd5b005b63fe67a54b811415610124576002544210156100f657600080fd5b6005541561010357600080fd5b600160055560006000600060006004546000546000f161012257600080fd5b005b6338af3eed81141561013c5760005460005260206000f35b634f245ef78114156101545760015460005260206000f35b632a24f46c81141561016c5760025460005260206000f35b6391f901578114156101845760035460005260206000f35b63d57bde7981141561019c5760045460005260206000f35b6312fa6feb8114156101b45760055460005260206000f35b6326b387bb8114156101ea5760043560a01c156101d057600080fd5b600660043560e05260c052604060c0205460005260206000f35b505b60006000fd5b61006161025303610061600039610061610253036000f30000000000000000000000002e337e0fb68f5e51ce9295e80bcd02273d7420c40000000000000000000000000000000000000000000000000000000060d2b04a00000000000000000000000000000000000000000000000000000000616b46ca", + }, + ], + pageParams: { + next_offset: 25, + total_results: 4, + offset: 0, + }, + }); + // mock.onGet(`${MOCK_API}/subscriptions/`).reply(200, { // data: { // is_free_subscription_availible: true, @@ -97,19 +242,20 @@ const enableMockupRequests = (axiosInstance) => { // }, // }); - mock.onPost(`${MOCK_API}/subscriptions/`).reply((config) => { - const params = config.data; // FormData of {name: ..., file: ...} - const id = params.get("id"); - const note = params.get("note"); + // mock.onPost(`${MOCK_API}/subscriptions/`).reply((config) => { + // const params = config.data; // FormData of {name: ..., file: ...} + // const id = params.get("id"); + // const label = params.get("label"); + // const address = params.get("address"); + // const subscription_type = params.get("subscription_type"); - return new Promise(function (resolve) { - setTimeout(function () { - const data = { id, note }; - console.log("mock", id, note); - MockSubscriptions.push({ ...data }); - resolve([200, { message: "OK", result: true }]); - }, 1000); - }); - }); + // return new Promise(function (resolve) { + // setTimeout(function () { + // const data = { id, label, address, subscription_type }; + // MockSubscriptions.push({ ...data }); + // resolve([200, { message: "OK", result: true }]); + // }, 1000); + // }); + // }); }; export default enableMockupRequests;