Skip to content

Commit

Permalink
refactor(pay): moving hooks to hooks folder
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhart1o1 committed May 7, 2024
1 parent 01a484d commit 1b29b6e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions apps/consent/app/login/phone/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ const Login = async ({ searchParams }: { searchParams: LoginProps }) => {
const authAction = "Login"
return <PhoneAuth login_challenge={login_challenge} authAction={authAction} />
}

export default Login
2 changes: 1 addition & 1 deletion apps/pay/components/parse-pos-payment/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
parseDisplayCurrency,
} from "../../utils/utils"

import { useDisplayCurrency } from "../../lib/use-display-currency"
import { useDisplayCurrency } from "../../hooks/use-display-currency"

import Memo from "../memo"

Expand Down
4 changes: 2 additions & 2 deletions apps/pay/components/parse-pos-payment/receive-invoice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useScreenshot } from "use-react-screenshot"
import { USD_INVOICE_EXPIRE_INTERVAL } from "../../config/config"
import useCreateInvoice from "../../hooks/use-create-Invoice"
import { LnInvoiceObject } from "../../lib/graphql/index.types"
import useSatPrice from "../../lib/use-sat-price"
import useSatPrice from "../../hooks/use-sat-price"
import { ACTION_TYPE } from "../../app/reducer"
import PaymentOutcome from "../payment-outcome"
import { Share } from "../share"
Expand All @@ -24,7 +24,7 @@ import LoadingComponent from "../loading"
import styles from "./parse-payment.module.css"
import NFCComponent from "./nfc"

import useRealtimePrice from "@/lib/use-realtime-price"
import useRealtimePrice from "@/hooks/use-realtime-price"

interface Props {
recipientWalletCurrency?: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { gql } from "@apollo/client"
import { useCurrencyListQuery } from "./graphql/generated"

import { useCallback, useMemo } from "react"

import { useCurrencyListQuery } from "./graphql/generated"

gql`
query currencyList {
currencyList {
Expand Down Expand Up @@ -52,10 +54,13 @@ export const useDisplayCurrency = () => {

const displayCurrencyDictionary = useMemo(() => {
const currencyList = dataCurrencyList?.currencyList || []
return currencyList.reduce((acc, currency) => {
acc[currency.id] = currency
return acc
}, {} as Record<string, typeof defaultDisplayCurrency>)
return currencyList.reduce(
(acc, currency) => {
acc[currency.id] = currency
return acc
},
{} as Record<string, typeof defaultDisplayCurrency>,
)
}, [dataCurrencyList?.currencyList])

const formatCurrency = useCallback(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { gql, SubscriptionResult } from "@apollo/client"
import * as React from "react"

import {
RealtimePriceWsSubscription,
useRealtimePriceInitialQuery,
useRealtimePriceWsSubscription,
} from "../lib/graphql/generated"
import { useDisplayCurrency } from "../lib/use-display-currency"
import { useDisplayCurrency } from "../hooks/use-display-currency"

gql`
subscription realtimePriceWs($currency: DisplayCurrency!) {
Expand Down
File renamed without changes.

0 comments on commit 1b29b6e

Please sign in to comment.