Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/wagmi rainbowkit #348

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39,402 changes: 28,702 additions & 10,700 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"@mui/lab": "^5.0.0-alpha.121",
"@mui/material": "^5.10.13",
"@mui/x-date-pickers": "^6.18.6",
"@rainbow-me/rainbowkit": "^2.1.2",
"@tanstack/react-query": "^5.45.1",
"@types/node": "18.11.9",
"@types/react": "18.0.25",
"@types/react-dom": "18.0.8",
"3d-force-graph-vr": "^2.2.2",
"aframe": "^1.4.2",
"axios": "^1.2.2",
Expand Down Expand Up @@ -63,7 +63,9 @@
"react-timezone-select": "^1.3.2",
"react-toastify": "^9.1.1",
"timezones-list": "^3.0.1",
"typescript": "4.8.4",
"typescript": "^5.4.5",
"viem": "^2.15.1",
"wagmi": "^2.10.2",
"zustand": "^4.3.1"
},
"devDependencies": {
Expand All @@ -73,6 +75,8 @@
"@types/d3-force": "^3.0.4",
"@types/lodash": "^4.14.202",
"@types/papaparse": "^5.3.8",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/testing-library__user-event": "^4.2.0",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
Expand Down
Binary file added src/assets/nftbackground.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions src/assets/svg/arbitrum-arb-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@ function HivemindSettings() {
activePlatform === index
? 'bg-secondary/80 text-white'
: ![
'Discord',
'GDrive',
'Github',
'Notion',
'MediaWiki',
].includes(platform)
'Discord',
'GDrive',
'Github',
'Notion',
'MediaWiki',
].includes(platform)
? 'bg-white'
: 'bg-white text-black'
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ function TcCommunityPlatforms() {
activeTab === index
? 'bg-secondary/80 text-white'
: ![
'Discord',
'GDrive',
'Github',
'Notion',
'MediaWiki',
].includes(platform)
'Discord',
'GDrive',
'Github',
'Notion',
'MediaWiki',
].includes(platform)
? 'bg-white'
: 'bg-white text-black'
)}
Expand Down Expand Up @@ -237,25 +237,47 @@ function TcCommunityPlatforms() {
/>
</div>

<TcCard
className='min-h-[6rem] max-w-[10rem]'
children={
<div className='flex flex-col items-center justify-center space-y-2 py-4'>
<TcText text='Hivemind' variant='subtitle1' fontWeight='bold' />
<TcButton
text={
hivemindManageIsLoading ? (
<CircularProgress size={20} />
) : (
'Manage'
)
}
variant='text'
onClick={() => handleManageHivemindModule()}
/>
</div>
}
/>
<div className='flex space-x-3'>
<TcCard
className='min-h-[6rem] min-w-[10rem] max-w-[10rem]'
children={
<div className='flex flex-col items-center justify-center space-y-2 py-4'>
<TcText text='Hivemind' variant='subtitle1' fontWeight='bold' />
<TcButton
text={
hivemindManageIsLoading ? (
<CircularProgress size={20} />
) : (
'Manage'
)
}
variant='text'
onClick={() => handleManageHivemindModule()}
/>
</div>
}
/>
<TcCard
className='min-h-[6rem] min-w-[10rem] max-w-[10rem]'
children={
<div className='flex flex-col items-center justify-center space-y-2 py-4'>
<TcText text='Reputation Score' variant='subtitle1' fontWeight='bold' />
<TcButton
text={
hivemindManageIsLoading ? (
<CircularProgress size={20} />
) : (
'Manage'
)
}
variant='text'
onClick={() => router.push('/community-settings/reputation-score')}
/>
</div>
}
/>
</div>

</div>
</div>
);
Expand Down
14 changes: 12 additions & 2 deletions src/components/layouts/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Link from 'next/link';
import { useRouter } from 'next/router';
import { FiSettings } from 'react-icons/fi';
import { MdOutlineAnnouncement } from 'react-icons/md';
import { RiNftFill } from "react-icons/ri";

import TcText from '../shared/TcText';
import { conf } from '../../configs/index';
Expand Down Expand Up @@ -75,6 +76,15 @@ const Sidebar = () => {
/>
),
},
{
name: 'Reputation NFT',
path: '/engagement/reputation-nft/',
icon: (
<RiNftFill
style={{ fontSize: 20, color: 'black', margin: '0 auto' }}
/>
),
},
{
name: 'Community Settings',
path: '/community-settings',
Expand Down Expand Up @@ -122,8 +132,8 @@ const Sidebar = () => {
onClick={() => router.push('/centric/select-community')}
>
{connectedPlatform &&
connectedPlatform.metadata &&
connectedPlatform.metadata.icon ? (
connectedPlatform.metadata &&
connectedPlatform.metadata.icon ? (
<Image
src={`${conf.DISCORD_CDN}icons/${connectedPlatform.metadata.id}/${connectedPlatform.metadata.icon}`}
width='100'
Expand Down
14 changes: 12 additions & 2 deletions src/components/layouts/xs/SidebarXs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { conf } from '../../../configs';
import { useToken } from '../../../context/TokenContext';
import useAppStore from '../../../store/useStore';
import { ICommunityDiscordPlatfromProps } from '../../../utils/interfaces';
import { RiNftFill } from 'react-icons/ri';

const Sidebar = () => {
const router = useRouter();
Expand Down Expand Up @@ -78,6 +79,15 @@ const Sidebar = () => {
/>
),
},
{
name: 'Reputation NFT',
path: '/engagement/reputation-nft/mint/',
icon: (
<RiNftFill
style={{ fontSize: 20, color: 'black', margin: '0 auto' }}
/>
),
},
{
name: 'Community Settings',
path: '/community-settings',
Expand Down Expand Up @@ -135,8 +145,8 @@ const Sidebar = () => {
onClick={() => router.push('/centric/select-community')}
>
{connectedPlatform &&
connectedPlatform.metadata &&
connectedPlatform.metadata.icon ? (
connectedPlatform.metadata &&
connectedPlatform.metadata.icon ? (
<Image
src={`${conf.DISCORD_CDN}icons/${connectedPlatform.metadata.id}/${connectedPlatform.metadata.icon}`}
width='100'
Expand Down
109 changes: 109 additions & 0 deletions src/components/pages/engagement/TcIdentityPermissionContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import React, { useState } from 'react';
import TcBoxContainer from '../../shared/TcBox/TcBoxContainer';
import { Stack, Typography, Button, List, ListItem, ListItemText, ListItemIcon } from '@mui/material';
import { useAccount } from 'wagmi';
import TcButton from '../../shared/TcButton';
import TcCommunityPlatformIcon from '../../communitySettings/communityPlatforms/TcCommunityPlatformIcon';

interface Credential {
name: string;
granted: boolean;
connected: boolean;
}

function TcIdentityPermissionContainer() {
const { address, isConnected } = useAccount();
const [attestations, setAttestations] = useState<number>(0);
const [credentials, setCredentials] = useState<Credential[]>([
{ name: 'Telegram', granted: false, connected: false },
{ name: 'Discord', granted: false, connected: false },
]);

const handleConnect = (index: number, grant = false) => {
const newCredentials = [...credentials];
newCredentials[index].connected = true;
if (grant) {
newCredentials[index].granted = true;
}
setCredentials(newCredentials);
};

const handleRevoke = (index: number) => {
const newCredentials = [...credentials];
newCredentials[index].connected = false;
newCredentials[index].granted = false;
setCredentials(newCredentials);
};

return (
<TcBoxContainer
contentContainerChildren={
<div className={`relative space-y-4 p-4 ${!isConnected ? 'blur-sm' : ''}`}>
<Stack className='flex flex-row space-x-2 items-center'>
<span className='text-white bg-secondary rounded-full flex items-center justify-center h-8 w-8'>2</span>
<Typography variant='h6' fontWeight="bold">
{attestations === 0 ? 'Sign-up On-chain' : 'Your Attestations'}
</Typography>
</Stack>
<Typography variant='body2'>
TogetherCrew has partnered with <strong>OnchainID</strong> to securely create on-chain
attestations of user credentials. With <strong>OnchainID</strong>, you own your credentials and
get to decide which apps can view them.
</Typography>
{attestations === 0 ? (
<>
<Typography variant='body2'>
To mint a new token, you need to create a profile on <a href='https://onchainid.com?publicKey=togetherCrewPublicKey' target='_blank' rel='noopener noreferrer'>OnchainID</a>.
</Typography>
<Stack className='flex flex-row justify-end space-x-2 items-center'>
<TcButton text={'Register on OnchainID'} variant='contained' onClick={() => setAttestations(1)} />
</Stack>
</>
) : (
<>
<Typography variant='body2'>
You have the following credentials attested:
</Typography>
<List>
{credentials.map((credential, index) => (
<ListItem key={index} divider>
<ListItemIcon>
<TcCommunityPlatformIcon platform={credential.name} />
</ListItemIcon>
<ListItemText
primary={credential.name}
secondary={`Granted: ${credential.granted ? 'Yes' : 'No'}`}
/>
<div className='space-x-3'>
<TcButton
text="Connect"
variant='outlined'
onClick={() => handleConnect(index)}
disabled={credential.connected}
/>
<TcButton
text="Connect & Grant"
variant='contained'
onClick={() => handleConnect(index, true)}
disabled={credential.connected && credential.granted}
/>
<TcButton
text="Revoke"
variant='contained'
className='bg-error-500'
onClick={() => handleRevoke(index)}
disabled={!credential.connected}
/>
</div>
</ListItem>
))}
</List>
</>
)}
</div >
}
/>
);
}

export default TcIdentityPermissionContainer;
42 changes: 42 additions & 0 deletions src/components/pages/engagement/TcMintTokenContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react'
import TcBoxContainer from '../../shared/TcBox/TcBoxContainer';
import { Avatar, Stack, Typography } from '@mui/material';
import TcButton from '../../shared/TcButton';
import { useAccount } from 'wagmi';
import TcIconWithTooltip from '../../shared/TcIconWithTooltip';


interface ITcMintTokenContainer {
tokenDetails: {
name: string;
description: string;
}
}


function TcMintTokenContainer({ tokenDetails }: ITcMintTokenContainer) {
const { address, isConnected } = useAccount();

return (
<TcBoxContainer
contentContainerChildren={
<div className={`relative space-y-4 p-4 ${!isConnected ? 'blur-sm' : ''}`}>
<Stack className='flex flex-row space-x-2 items-center'>
<span className='text-white bg-secondary rounded-full flex items-center justify-center h-8 w-8'>3</span>
<Typography variant='h6' fontWeight="bold">
Mint your Reputation Score NFT
</Typography>
</Stack>
<Typography variant='body2' className='flex items-center'>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Dolorum, ducimus dolorem! Nisi consectetur delectus at. Error similique sint neque velit dignissimos distinctio consectetur illum perferendis, a omnis id, explicabo est.
</Typography>
<Stack className='flex flex-row justify-end space-x-2 items-center'>
<TcButton text={'Mint'} variant='contained' />
</Stack>
</div>
}
/>
)
}

export default TcMintTokenContainer;
Loading
Loading