diff --git a/apps/next-app/package.json b/apps/next-app/package.json index f8a6d56..d19dad7 100644 --- a/apps/next-app/package.json +++ b/apps/next-app/package.json @@ -26,7 +26,6 @@ "@types/react": "18.0.37", "@types/react-dom": "18.0.11", "autoprefixer": "10.4.14", - "axios": "^1.3.6", "date-fns": "^2.29.3", "eslint": "8.38.0", "eslint-config-next": "13.3.0", diff --git a/apps/next-app/src/pages/profile/index.tsx b/apps/next-app/src/pages/profile/index.tsx index b44bfcb..944b8c7 100644 --- a/apps/next-app/src/pages/profile/index.tsx +++ b/apps/next-app/src/pages/profile/index.tsx @@ -6,10 +6,7 @@ import { AvatarChanger } from 'shared/components/profile/AvatarChanger'; import { EditProfileForm } from 'shared/components/profile/EditProfileForm'; import { getApolloServerClient } from 'shared/services/apollo'; import { EDGE_FUNCTION_NAMES } from 'constants/EDGE_FUNCTION_NAMES'; -import { Checkmark } from 'shared/components/Checkmark'; -import { Crossmark } from 'shared/components/Crossmark'; -import { getSubscriptionPrice } from 'utils/getSubscriptionPrice'; -import { format, fromUnixTime } from 'date-fns'; +import { TransactionHistory } from 'shared/components/subscriptions/TransactionHistory'; interface ProfileProps { profile: GetProfileQuery['profilesCollection']; @@ -25,30 +22,7 @@ const Profile = ({ profile, charges }: ProfileProps) => { -
-

Transaction history

-
- {charges.charges.data.map( - ({ id, created, description, amount, currency, status }: any) => ( -
-
- {description}{' '} - - ({format(fromUnixTime(created), 'Pp')}) - -
-
- {getSubscriptionPrice(amount)} {currency.toUpperCase()} -
- {status === 'succeeded' ? : } -
- ) - )} -
-
+ ); }; diff --git a/apps/next-app/src/shared/components/subscriptions/TransactionHistory/index.ts b/apps/next-app/src/shared/components/subscriptions/TransactionHistory/index.ts new file mode 100644 index 0000000..a0b66fb --- /dev/null +++ b/apps/next-app/src/shared/components/subscriptions/TransactionHistory/index.ts @@ -0,0 +1 @@ +export { TransactionHistory } from './transactionHistory.component'; diff --git a/apps/next-app/src/shared/components/subscriptions/TransactionHistory/transactionHistory.component.tsx b/apps/next-app/src/shared/components/subscriptions/TransactionHistory/transactionHistory.component.tsx new file mode 100644 index 0000000..1cf9400 --- /dev/null +++ b/apps/next-app/src/shared/components/subscriptions/TransactionHistory/transactionHistory.component.tsx @@ -0,0 +1,39 @@ +import { format, fromUnixTime } from 'date-fns'; +import { Checkmark } from 'shared/components/Checkmark'; +import { Crossmark } from 'shared/components/Crossmark'; +import { getSubscriptionPrice } from 'utils/getSubscriptionPrice'; + +interface TransactionHistoryProps { + transactions: any; +} + +export const TransactionHistory = ({ + transactions, +}: TransactionHistoryProps) => { + return ( +
+

Transaction history

+
+ {transactions.charges.data.map( + ({ id, created, description, amount, currency, status }: any) => ( +
+
+ {description}{' '} + + ({format(fromUnixTime(created), 'Pp')}) + +
+
+ {getSubscriptionPrice(amount)} {currency.toUpperCase()} +
+ {status === 'succeeded' ? : } +
+ ) + )} +
+
+ ); +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6278c3a..17dd3f0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,9 +42,6 @@ importers: autoprefixer: specifier: 10.4.14 version: 10.4.14(postcss@8.4.22) - axios: - specifier: ^1.3.6 - version: 1.3.6 date-fns: specifier: ^2.29.3 version: 2.29.3 @@ -3332,6 +3329,7 @@ packages: /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + dev: true /auto-bind@4.0.0: resolution: {integrity: sha512-Hdw8qdNiqdJ8LqT0iK0sVzkFbzg6fhnQqqfWhBDxcHZvU75+B+ayzTy8x+k5Ix0Y92XOhOUlx74ps+bA6BeYMQ==} @@ -3363,16 +3361,6 @@ packages: engines: {node: '>=4'} dev: false - /axios@1.3.6: - resolution: {integrity: sha512-PEcdkk7JcdPiMDkvM4K6ZBRYq9keuVJsToxm2zQIM70Qqo2WHTdJZMXcG9X+RmRp2VPNUQC8W1RAGbgt6b1yMg==} - dependencies: - follow-redirects: 1.15.2 - form-data: 4.0.0 - proxy-from-env: 1.1.0 - transitivePeerDependencies: - - debug - dev: false - /axobject-query@3.1.1: resolution: {integrity: sha512-goKlv8DZrK9hUh975fnHzhNIO4jUnFCfv/dszV5VwUGDFjI6vQ2VwoyjYjYNEbBE8AH87TduWP5uyDR1D+Iteg==} dependencies: @@ -3860,6 +3848,7 @@ packages: engines: {node: '>= 0.8'} dependencies: delayed-stream: 1.0.0 + dev: true /commander@10.0.1: resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} @@ -4151,6 +4140,7 @@ packages: /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} + dev: true /dependency-graph@0.11.0: resolution: {integrity: sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==} @@ -4888,16 +4878,6 @@ packages: /flatted@3.2.7: resolution: {integrity: sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==} - /follow-redirects@1.15.2: - resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - dev: false - /for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} dependencies: @@ -4910,6 +4890,7 @@ packages: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.35 + dev: true /formdata-polyfill@4.0.10: resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} @@ -6450,12 +6431,14 @@ packages: /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} + dev: true /mime-types@2.1.35: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} dependencies: mime-db: 1.52.0 + dev: true /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} @@ -7129,10 +7112,6 @@ packages: react-is: 16.13.1 dev: false - /proxy-from-env@1.1.0: - resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - dev: false - /psl@1.9.0: resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} dev: true