-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
23 changed files
with
887 additions
and
667 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,45 @@ | ||
import React from "react" | ||
|
||
import { getClient } from "../ssr-client" | ||
|
||
import { defaultCurrencyMetadata } from "../currency-metadata" | ||
|
||
import UsernameLayoutContainer from "@/components/layouts/username-layout" | ||
import { InvoiceProvider } from "@/context/invoice-context" | ||
import { | ||
AccountDefaultWalletsDocument, | ||
AccountDefaultWalletsQuery, | ||
} from "@/lib/graphql/generated" | ||
|
||
export default function UsernameLayout({ | ||
children, | ||
params, | ||
}: { | ||
type Props = { | ||
children: React.ReactNode | ||
params: { | ||
username: string | ||
} | ||
}) { | ||
} | ||
|
||
export default async function UsernameLayout({ children, params }: Props) { | ||
const response = await getClient().query<AccountDefaultWalletsQuery>({ | ||
query: AccountDefaultWalletsDocument, | ||
variables: { username: params.username }, | ||
}) | ||
|
||
const initialState = { | ||
currentAmount: "0", | ||
createdInvoice: false, | ||
walletCurrency: response.data.accountDefaultWallet.walletCurrency, | ||
walletId: response.data.accountDefaultWallet.id, | ||
username: params.username, | ||
pinnedToHomeScreenModalVisible: false, | ||
memo: "", | ||
displayCurrencyMetaData: defaultCurrencyMetadata, | ||
} | ||
|
||
return ( | ||
<UsernameLayoutContainer username={params.username}> | ||
{children} | ||
</UsernameLayoutContainer> | ||
<InvoiceProvider initialState={initialState}> | ||
<UsernameLayoutContainer username={params.username}> | ||
{children} | ||
</UsernameLayoutContainer> | ||
</InvoiceProvider> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Currency } from "@/lib/graphql/generated" | ||
|
||
export const defaultCurrencyMetadata: Currency = { | ||
id: "USD", | ||
flag: "🇺🇸", | ||
name: "US Dollar", | ||
symbol: "$", | ||
fractionDigits: 2, | ||
__typename: "Currency", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Currency } from "@/lib/graphql/generated" | ||
|
||
export const satsCurrencyMetadata: Currency = { | ||
id: "SAT", | ||
flag: "Sats ₿", | ||
name: "Satoshi", | ||
symbol: "sats", | ||
fractionDigits: 0, | ||
__typename: "Currency", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { HttpLink } from "@apollo/client" | ||
import { registerApolloClient } from "@apollo/experimental-nextjs-app-support/rsc" | ||
import { | ||
NextSSRApolloClient, | ||
NextSSRInMemoryCache, | ||
} from "@apollo/experimental-nextjs-app-support/ssr" | ||
|
||
import { getClientSideGqlConfig } from "@/config/config" | ||
|
||
export const { getClient } = registerApolloClient(() => { | ||
return new NextSSRApolloClient({ | ||
cache: new NextSSRInMemoryCache(), | ||
link: new HttpLink({ | ||
uri: getClientSideGqlConfig().coreGqlUrl, | ||
fetchOptions: { cache: "no-store" }, | ||
|
||
// fetch: (uri, options) => { | ||
// const headersWithTrace = options?.headers || {} | ||
// propagation.inject(context.active(), headersWithTrace) | ||
// return fetch(String(uri), { | ||
// ...options, | ||
// headers: headersWithTrace, | ||
// }) | ||
// }, | ||
}), | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.