Skip to content

Commit

Permalink
fix link input on create
Browse files Browse the repository at this point in the history
  • Loading branch information
scottrepreneur committed Feb 27, 2024
1 parent 56fb675 commit 7770a72
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 94 deletions.
12 changes: 2 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,10 @@
"settings": {
"import/resolver": {
"typescript": {
"project": [
"tsconfig.base.json",
"apps/*/tsconfig.json",
"libs/*/tsconfig.json"
]
"project": ["tsconfig.base.json", "packages/**/tsconfig.json"]
},
"node": {
"project": [
"tsconfig.base.json",
"apps/*/tsconfig.json",
"libs/*/tsconfig.json"
]
"project": ["tsconfig.base.json", "packages/**/tsconfig.json"]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@
},
"dependencies": {
"lodash": "^4.17.21",
"next": "^14.0.4"
"next": "14.0.1"
}
}
37 changes: 23 additions & 14 deletions packages/dapp/next.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ['@rainbow-me/rainbowkit'],
transpilePackages: [
'@rainbow-me/rainbowkit',
'@smart-invoice/constants',
'@smart-invoice/forms',
'@smart-invoice/graphql',
'@smart-invoice/hooks',
'@smart-invoice/types',
'@smart-invoice/ui',
'@smart-invoice/utils',
],
experimental: {
optimizePackageImports: [
'@chakra-ui/react',
'@rainbow-me/rainbowkit',
'@smart-invoice/constants',
'@smart-invoice/forms',
'@smart-invoice/graphql',
'@smart-invoice/hooks',
'@smart-invoice/types',
'@smart-invoice/ui',
'@smart-invoice/utils',
'viem',
'wagmi',
],
// optimizePackageImports: [
// // '@chakra-ui/react',
// '@rainbow-me/rainbowkit',
// '@smart-invoice/constants',
// '@smart-invoice/forms',
// '@smart-invoice/graphql',
// '@smart-invoice/hooks',
// '@smart-invoice/types',
// '@smart-invoice/ui',
// '@smart-invoice/utils',
// 'viem',
// 'wagmi',
// ],
},
};

Expand Down
2 changes: 1 addition & 1 deletion packages/dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"graphql-tag": "^2.12.6",
"graphql-zeus": "^5.3.3",
"lodash": "^4.17.21",
"next": "^14.0.4",
"next": "14.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.49.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/src/invoices.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-unused-vars */
/* eslint-disable camelcase */

import { logDebug } from '@smart-invoice/utils';
import { logDebug } from '@smart-invoice/shared';
import { Address, isAddress } from 'viem';

import { clients } from './client';
Expand Down
12 changes: 8 additions & 4 deletions packages/hooks/src/useDetailsPin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ export const useDetailsPin = ({
return undefined;
}

const newProjectAgreement = _.concat(invoiceProjectAgreement || []);
if (projectAgreement !== '') {
// TODO working around bigint type for createdAt
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const newProjectAgreement: any[] = _.concat(invoiceProjectAgreement || []);
if (projectAgreement && projectAgreement !== '') {
newProjectAgreement.push({
id: createdAt.toString(),
src: projectAgreement,
type: projectAgreement.startsWith('http') ? 'http' : 'ipfs',
createdAt,
type: projectAgreement?.startsWith('http') ? 'http' : 'ipfs',
createdAt: createdAt.toString(),
});
}

Expand All @@ -70,6 +72,7 @@ export const useDetailsPin = ({
endDate,
invoice,
]);
console.log('detailsData', detailsData);

const detailsPin = async () => {
const token = await fetchToken();
Expand All @@ -96,6 +99,7 @@ export const useDetailsPin = ({
!!detailsData,
staleTime: 1000 * 60 * 60 * 24, // 24 hours
});
console.log(data, isLoading, error);

return { data, isLoading, error };
};
11 changes: 11 additions & 0 deletions packages/hooks/src/useInvoiceCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ export const useInvoiceCreate = ({
});

const escrowData = useMemo(() => {
console.log(
!client,
!(resolver || customResolver),
!token,
!safetyValveDate,
!wrappedNativeToken(chainId),
!details,
!localInvoiceFactory,
!provider,
);
if (
!client ||
!(resolver || customResolver) ||
Expand Down Expand Up @@ -142,6 +152,7 @@ export const useInvoiceCreate = ({
wrappedNativeToken,
localInvoiceFactory,
]);
console.log(escrowData);

const { config, error: prepareError } = usePrepareContractWrite({
address: localInvoiceFactory,
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"blockies-ts": "^1.0.0",
"framer-motion": "^10.17.12",
"lodash": "^4.17.21",
"next": "^14.0.4",
"next": "14.0.1",
"react": "^18.2.0",
"react-datepicker": "^4.25.0",
"react-hook-form": "^7.49.3",
Expand Down
45 changes: 22 additions & 23 deletions packages/ui/src/atoms/ConnectWeb3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,28 @@ export function ConnectWeb3() {
<WalletFilledIcon boxSize="1.75rem" />
</Flex>

{isClient &&
(address ? (
<>
<Text fontSize="2xl" fontFamily="heading" mb={4}>
Connect Wallet
</Text>
<Text color="greyText" mb={4} textAlign="center">
{`Please switch to ${_.map(
SUPPORTED_NETWORKS,
network => chainsMap(network)?.name,
).join(' or ')}`}
</Text>
</>
) : (
<>
<Text fontSize="2xl" fontFamily="heading" mb={4}>
Network not supported
</Text>
<Text color="greyText" mb={4} textAlign="center">
To get started, connect your wallet
</Text>
</>
))}
{isClient && address ? (
<>
<Text fontSize="2xl" fontFamily="heading" mb={4}>
Connect Wallet
</Text>
<Text color="greyText" mb={4} textAlign="center">
{`Please switch to ${_.map(
SUPPORTED_NETWORKS,
network => chainsMap(network)?.name,
).join(' or ')}`}
</Text>
</>
) : (
<>
<Text fontSize="2xl" fontFamily="heading" mb={4}>
Network not supported
</Text>
<Text color="greyText" mb={4} textAlign="center">
To get started, connect your wallet
</Text>
</>
)}

{isClient && !address && (
<Button onClick={openConnectModal} px={12} isLoading={isConnecting}>
Expand Down
Loading

0 comments on commit 7770a72

Please sign in to comment.