From a00a54c4f08b0c05c864f09a53b5ad15a19d0033 Mon Sep 17 00:00:00 2001 From: Mehdi Torabi <46302001+mehdi-torabiv@users.noreply.github.com> Date: Thu, 28 Nov 2024 16:46:15 +0300 Subject: [PATCH] fix mui (#352) * fix mui * fix * fix --- package-lock.json | 68 ++++++ package.json | 1 + .../TcHivemindDiscordAnswering.tsx | 16 +- .../TcHivemindDiscordLearnings.tsx | 16 +- .../TcDiscordIntegrationSettingsDialog.tsx | 19 +- src/pages/reputation-score/mint.tsx | 214 +++++++++--------- 6 files changed, 211 insertions(+), 123 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3a5f9cf1..3c1bbb54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "@mui/lab": "^5.0.0-alpha.121", "@mui/material": "^5.11.6", "@mui/x-date-pickers": "^6.18.6", + "@mui/x-tree-view": "^7.22.1", "@rainbow-me/rainbowkit": "^2.2.0", "@tanstack/react-query": "^5.59.19", "@types/node": "18.11.9", @@ -7393,6 +7394,73 @@ "node": ">=6" } }, + "node_modules/@mui/x-internals": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@mui/x-internals/-/x-internals-7.21.0.tgz", + "integrity": "sha512-94YNyZ0BhK5Z+Tkr90RKf47IVCW8R/1MvdUhh6MCQg6sZa74jsX+x+gEZ4kzuCqOsuyTyxikeQ8vVuCIQiP7UQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.25.7", + "@mui/utils": "^5.16.6 || ^6.0.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mui-org" + }, + "peerDependencies": { + "react": "^17.0.0 || ^18.0.0" + } + }, + "node_modules/@mui/x-tree-view": { + "version": "7.22.1", + "resolved": "https://registry.npmjs.org/@mui/x-tree-view/-/x-tree-view-7.22.1.tgz", + "integrity": "sha512-EdFuzAgHn+/b++oNbm8JuXiF4MbRW+Dg70+MNbp2fQi8U1J38kg1hwvIFQ6Wi2AEt3Dv9euaPMFJM+a/4pk5Ng==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.25.7", + "@mui/utils": "^5.16.6 || ^6.0.0", + "@mui/x-internals": "7.21.0", + "@types/react-transition-group": "^4.4.11", + "clsx": "^2.1.1", + "prop-types": "^15.8.1", + "react-transition-group": "^4.4.5" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mui-org" + }, + "peerDependencies": { + "@emotion/react": "^11.9.0", + "@emotion/styled": "^11.8.1", + "@mui/material": "^5.15.14 || ^6.0.0", + "@mui/system": "^5.15.14 || ^6.0.0", + "react": "^17.0.0 || ^18.0.0", + "react-dom": "^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@emotion/react": { + "optional": true + }, + "@emotion/styled": { + "optional": true + } + } + }, + "node_modules/@mui/x-tree-view/node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/@next/env": { "version": "14.2.18", "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.18.tgz", diff --git a/package.json b/package.json index bac7a375..b050d67e 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@mui/lab": "^5.0.0-alpha.121", "@mui/material": "^5.11.6", "@mui/x-date-pickers": "^6.18.6", + "@mui/x-tree-view": "^7.22.1", "@rainbow-me/rainbowkit": "^2.2.0", "@tanstack/react-query": "^5.59.19", "@types/node": "18.11.9", diff --git a/src/components/communitySettings/HivemindSettings/TcHivemindDiscordAnswering.tsx b/src/components/communitySettings/HivemindSettings/TcHivemindDiscordAnswering.tsx index fb85c8c5..a77cf2f5 100644 --- a/src/components/communitySettings/HivemindSettings/TcHivemindDiscordAnswering.tsx +++ b/src/components/communitySettings/HivemindSettings/TcHivemindDiscordAnswering.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; -import { TreeItem, TreeView } from '@mui/lab'; import { FormControlLabel } from '@mui/material'; +import { SimpleTreeView, TreeItem } from '@mui/x-tree-view'; import { MdChevronRight, MdExpandMore } from 'react-icons/md'; import { TbRefresh } from 'react-icons/tb'; @@ -142,14 +142,16 @@ function TcHivemindDiscordAnswering({ ) : ( - } - defaultExpandIcon={} + {discordPlatformChannels.map((channel, index) => ( ( @@ -215,7 +217,7 @@ function TcHivemindDiscordAnswering({ ))} ))} - + )} diff --git a/src/components/communitySettings/HivemindSettings/TcHivemindDiscordLearnings.tsx b/src/components/communitySettings/HivemindSettings/TcHivemindDiscordLearnings.tsx index bc7e4cb9..23d36f88 100644 --- a/src/components/communitySettings/HivemindSettings/TcHivemindDiscordLearnings.tsx +++ b/src/components/communitySettings/HivemindSettings/TcHivemindDiscordLearnings.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; -import { TreeItem, TreeView } from '@mui/lab'; import { FormControlLabel } from '@mui/material'; +import { SimpleTreeView, TreeItem } from '@mui/x-tree-view'; import moment from 'moment'; import { MdCalendarMonth, MdExpandMore } from 'react-icons/md'; import { MdChevronRight } from 'react-icons/md'; @@ -203,14 +203,16 @@ function TcHivemindDiscordLearnings({ ) : ( - } - defaultExpandIcon={} + {discordPlatformChannels.map((channel, index) => ( ( @@ -276,7 +278,7 @@ function TcHivemindDiscordLearnings({ ))} ))} - + )} diff --git a/src/components/communitySettings/communityPlatforms/TcDiscordIntegrationSettingsDialog.tsx b/src/components/communitySettings/communityPlatforms/TcDiscordIntegrationSettingsDialog.tsx index 72f3b343..1b2306e8 100644 --- a/src/components/communitySettings/communityPlatforms/TcDiscordIntegrationSettingsDialog.tsx +++ b/src/components/communitySettings/communityPlatforms/TcDiscordIntegrationSettingsDialog.tsx @@ -1,5 +1,4 @@ import React, { useEffect, useState } from 'react'; -import { TreeItem, TreeView } from '@mui/lab'; import { Alert, AlertTitle, @@ -7,6 +6,7 @@ import { FormControlLabel, Typography, } from '@mui/material'; +import { SimpleTreeView, TreeItem } from '@mui/x-tree-view'; import moment from 'moment'; import { useRouter } from 'next/router'; import { AiOutlineClose } from 'react-icons/ai'; @@ -15,6 +15,7 @@ import { IoClose, IoSettingsSharp } from 'react-icons/io5'; import { MdCalendarMonth, MdExpandMore } from 'react-icons/md'; import { MdChevronRight } from 'react-icons/md'; import { RiTimeLine } from 'react-icons/ri'; +import '@mui/lab'; import TcCommunityPlatformIcon from './TcCommunityPlatformIcon'; import TcButton from '../../shared/TcButton'; @@ -398,13 +399,15 @@ function TcDiscordIntegrationSettingsDialog({ ) : ( - } - defaultExpandIcon={} + {discordPlatformChannels?.map((channel, index) => ( {channel.subChannels.map((subChannel, index) => ( ))} - + )} @@ -528,7 +531,7 @@ function TcDiscordIntegrationSettingsDialog({ variant='h6' /> -
+
@@ -148,7 +151,7 @@ function Mint() { const ConnectWalletSection: React.FC = () => ( - + Connect Your Wallet To mint your reputation score, please connect your wallet. @@ -168,69 +171,72 @@ const AttestationSection: React.FC = ({ const router = useRouter(); const handleNavigation = () => { - const url = "https://identity-on-chain-platform.pages.dev/permissions"; + const url = 'https://identity-on-chain-platform.pages.dev/permissions'; router.push(url); }; - return( + return ( - - Join the On-Chain Platform - - TogetherCrew has partnered with an on-chain platform to create secure, - on-chain attestations of user credentials. With on-chain access, you can - grant permission to applications, enabling them to decrypt and verify - your credentials. - - {isConnected && ( - - {isLoading ? ( - - - - ) : ( - <> - {userProfile.length > 0 ? ( - userProfile.map((profile, index) => ( - - )) - ) : ( - - - No Attestations Found - - In order to mint your reputation score, you need to have - idenitifers connected to wallet address. please register - your wallet on On-chain platform and attestation your - idenitifers. - - - - - )} - - )} - - )} + + Join the On-Chain Platform + + TogetherCrew has partnered with an on-chain platform to create secure, + on-chain attestations of user credentials. With on-chain access, you + can grant permission to applications, enabling them to decrypt and + verify your credentials. + + {isConnected && ( + + {isLoading ? ( + + + + ) : ( + <> + {userProfile.length > 0 ? ( + userProfile.map((profile, index) => ( + + )) + ) : ( + + + No Attestations Found + + In order to mint your reputation score, you need to have + idenitifers connected to wallet address. please register + your wallet on On-chain platform and attestation your + idenitifers. + + + + + )} + + )} + + )} + - - ) - -} + ); +}; const MintSection: React.FC = ({ isLoading, @@ -248,11 +254,19 @@ const MintSection: React.FC = ({ args: [address, dynamicNFTModuleInfo?.metadata[0]?.tokenId], }); - const { writeContractAsync, isPending } = useWriteContract(); + const { + data: transactionHash, + writeContractAsync, + isPending, + } = useWriteContract(); + + const { isPending: isWaiting } = useWaitForTransactionReceipt({ + hash: transactionHash, + }); return ( - + Mint Your Reputation Score Mint your reputation score to gain access to exclusive features and @@ -315,10 +329,8 @@ const MintSection: React.FC = ({ '0x0', ], }); - showMessage('Minting successful', 'success'); } catch (error: any) { console.error('Mint failed:', error); - showMessage('Minting failed', 'error'); } }} disabled={isPending || !dynamicNFTModuleInfo?.metadata[0]?.tokenId} @@ -335,47 +347,47 @@ const UserProfileBox: React.FC = ({ profile }) => { const router = useRouter(); const handleNavigation = () => { - const url = "https://identity-on-chain-platform.pages.dev/permissions"; + const url = 'https://identity-on-chain-platform.pages.dev/permissions'; router.push(url); }; - + return ( - - - - {capitalizeFirstLetter(profile.provider)} - - - - - + + + + {capitalizeFirstLetter(profile.provider)} + + + + + ); };