diff --git a/fs-dapp_2.0/package-lock.json b/fs-dapp_2.0/package-lock.json index 83016c9c..f1e35d9b 100644 --- a/fs-dapp_2.0/package-lock.json +++ b/fs-dapp_2.0/package-lock.json @@ -35,7 +35,7 @@ "react": "^18.2.0", "react-chartjs-2": "^5.0.0", "react-dom": "^18.2.0", - "react-hook-form": "^7.45.2", + "react-hook-form": "^7.51.2", "react-hot-toast": "^2.4.1", "react-icons": "^4.10.1", "react-infinite-scroll-component": "^6.1.0", @@ -50,7 +50,7 @@ }, "devDependencies": { "@babel/plugin-proposal-private-property-in-object": "", - "@tailwindcss/forms": "^0.5.4", + "@tailwindcss/forms": "^0.5.7", "autoprefixer": "^10.4.14", "postcss": "^8.4.26", "tailwindcss": "^3.3.3" @@ -4789,9 +4789,9 @@ } }, "node_modules/@tailwindcss/forms": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.4.tgz", - "integrity": "sha512-YAm12D3R7/9Mh4jFbYSMnsd6jG++8KxogWgqs7hbdo/86aWjjlIEvL7+QYdVELmAI0InXTpZqFIg5e7aDVWI2Q==", + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.7.tgz", + "integrity": "sha512-QE7X69iQI+ZXwldE+rzasvbJiyV/ju1FGHH0Qn2W3FKbuYtqp8LKcy6iSw79fVUT5/Vvf+0XgLCeYVG+UV6hOw==", "dev": true, "dependencies": { "mini-svg-data-uri": "^1.2.3" @@ -16579,9 +16579,9 @@ "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" }, "node_modules/react-hook-form": { - "version": "7.45.2", - "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.45.2.tgz", - "integrity": "sha512-9s45OdTaKN+4NSTbXVqeDITd/nwIg++nxJGL8+OD5uf1DxvhsXQ641kaYHk5K28cpIOTYm71O/fYk7rFaygb3A==", + "version": "7.51.2", + "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.51.2.tgz", + "integrity": "sha512-y++lwaWjtzDt/XNnyGDQy6goHskFualmDlf+jzEZvjvz6KWDf7EboL7pUvRCzPTJd0EOPpdekYaQLEvvG6m6HA==", "engines": { "node": ">=12.22.0" }, diff --git a/fs-dapp_2.0/package.json b/fs-dapp_2.0/package.json index 9ecfee47..c26afaad 100644 --- a/fs-dapp_2.0/package.json +++ b/fs-dapp_2.0/package.json @@ -30,7 +30,7 @@ "react": "^18.2.0", "react-chartjs-2": "^5.0.0", "react-dom": "^18.2.0", - "react-hook-form": "^7.45.2", + "react-hook-form": "^7.51.2", "react-hot-toast": "^2.4.1", "react-icons": "^4.10.1", "react-infinite-scroll-component": "^6.1.0", @@ -69,7 +69,7 @@ }, "devDependencies": { "@babel/plugin-proposal-private-property-in-object": "", - "@tailwindcss/forms": "^0.5.4", + "@tailwindcss/forms": "^0.5.7", "autoprefixer": "^10.4.14", "postcss": "^8.4.26", "tailwindcss": "^3.3.3" diff --git a/fs-dapp_2.0/public/INVESTOR.png b/fs-dapp_2.0/public/INVESTOR.png new file mode 100644 index 00000000..f2954c1a Binary files /dev/null and b/fs-dapp_2.0/public/INVESTOR.png differ diff --git a/fs-dapp_2.0/public/SELLER.png b/fs-dapp_2.0/public/SELLER.png new file mode 100644 index 00000000..fba12758 Binary files /dev/null and b/fs-dapp_2.0/public/SELLER.png differ diff --git a/fs-dapp_2.0/public/SERVICER.png b/fs-dapp_2.0/public/SERVICER.png new file mode 100644 index 00000000..4b9ce5ea Binary files /dev/null and b/fs-dapp_2.0/public/SERVICER.png differ diff --git a/fs-dapp_2.0/public/TENANT.png b/fs-dapp_2.0/public/TENANT.png new file mode 100644 index 00000000..e0a135d7 Binary files /dev/null and b/fs-dapp_2.0/public/TENANT.png differ diff --git a/fs-dapp_2.0/public/johndoe.png b/fs-dapp_2.0/public/johndoe.png new file mode 100644 index 00000000..33c38003 Binary files /dev/null and b/fs-dapp_2.0/public/johndoe.png differ diff --git a/fs-dapp_2.0/src/components/pages/Council.tsx b/fs-dapp_2.0/src/components/pages/Council.tsx index f491af9c..553bc2e2 100644 --- a/fs-dapp_2.0/src/components/pages/Council.tsx +++ b/fs-dapp_2.0/src/components/pages/Council.tsx @@ -20,7 +20,7 @@ export default function Council() { const { role, balance, dispatch0 } = useAccountContext(); const { session_closed,approved,role_in_session,nay,ayes,council_members,selectedProposal,proposals, datas,dispatch1 } = useConcilSessionContext(); - const[infos,setInfos]=useState('') + const getproposal= (item:MouseEvent)=>{ let txt=item.currentTarget.textContent @@ -41,6 +41,7 @@ export default function Council() { console.log(council_members); } } + function getDatas(){ let tdata:DataType[]=[]; @@ -61,7 +62,8 @@ export default function Council() { let status = Prop.approved.toString(); let referendum = Prop.sessionClosed.toString(); let hash = Prop.proposalHash.toString(); - let infos='Nothing yet'; + let infos = Prop.infos.toString(); + console.log(Prop.infos.split(`:`)[1]) api.query.backgroundCouncil.voting(hash,(data:any)=>{ let data1 = data.toHuman(); @@ -72,8 +74,9 @@ export default function Council() { dispatch1({ type: 'SET_NAY', payload: no }); } }) + let dtype:DataType={name:acc1.meta.name,role:r_session,address: Prop.accountId,status,referendum,hash,infos}; - let prop0:Proposal={voter_id:selectedAccount,Referendum_account:acc1,session_closed:referendum,approved:status,ayes,nay,hash} + let prop0:Proposal={voter_id:selectedAccount,Referendum_account:acc1,session_closed:referendum,approved:status,ayes,nay,hash,infos} props.push(prop0); tdata.push(dtype); } @@ -112,14 +115,14 @@ dispatch1({type:`SET_PROPOSALS`,payload:props}); }, [selectedAccount,blocks]); -const style1= { width: 410, height:150, background:`white`}; -const style2= { width: 410, height:150, background:`red`}; -const style3= { width: 410, height:150, background:`green`}; +const style1= { width: 410, height:400, background:`white`}; +const style2= { width: 410, height:400, background:`red`}; +const style3= { width: 410, height:400, background:`green`}; return((selectedAccount && council_members.includes(selectedAccount))?
} style={(item.status==="AWAITING" && item.referendum==="false")?style1: ((item.status==="AWAITING" && item.referendum==="true")?style2:style3)}> diff --git a/fs-dapp_2.0/src/components/pages/Roles.tsx b/fs-dapp_2.0/src/components/pages/Roles.tsx index afcb9aa3..6ecb64be 100644 --- a/fs-dapp_2.0/src/components/pages/Roles.tsx +++ b/fs-dapp_2.0/src/components/pages/Roles.tsx @@ -31,7 +31,7 @@ export default function Roles() { } }); - console.log(`role in session:${role_in_session}`) + //console.log(`role in session:${role_in_session}`) }, [role_in_session,selectedAccount, blocks, dispatch1, api]); useEffect(() => { diff --git a/fs-dapp_2.0/src/components/shared/InfosForm.tsx b/fs-dapp_2.0/src/components/shared/InfosForm.tsx new file mode 100644 index 00000000..329d6bb5 --- /dev/null +++ b/fs-dapp_2.0/src/components/shared/InfosForm.tsx @@ -0,0 +1,83 @@ +import {useForm,FieldError} from 'react-hook-form'; +import { useAccountContext } from '../../contexts/Account_Context'; +import { useAppContext } from '../../contexts/AppContext'; +import { Button } from 'flowbite-react'; + + +type Details = { + picture: string; + fullname: string; + email: string; + website: string; + reason: string; + notes: string; +} + + + +export function DetailsPage(){ + const {register,handleSubmit,formState:{errors}}= useForm
(); + const { api, selectedAccount } = useAppContext(); + const { role,infos,dispatch0 } = useAccountContext(); + + + + function onSubmit(details:Details){ + let pic=""; + if (!details.picture||details.picture===""){ + pic=`../../../johndoe.png` + + }else{pic=details.picture} + let all_infos:string = `${details.fullname}:${pic}:${details.email}:${details.website}:${details.reason}:${details.notes}`; + dispatch0({type:`SET_INFOS`,payload:all_infos}); + //console.log(infos.split(`:`)[1]); + + } + + function getEditorStyle(fieldError: FieldError|undefined){ + return fieldError?'border-red-500':``; + } + + const fieldstyle = "flex flex-col mb-2" + return( +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+ ) +} \ No newline at end of file diff --git a/fs-dapp_2.0/src/components/shared/modal.tsx b/fs-dapp_2.0/src/components/shared/modal.tsx index a0ed006f..84440f75 100644 --- a/fs-dapp_2.0/src/components/shared/modal.tsx +++ b/fs-dapp_2.0/src/components/shared/modal.tsx @@ -6,6 +6,7 @@ import { ROLES } from '../../contexts/types'; import { web3FromAddress } from '@polkadot/extension-dapp'; import { Toast } from 'flowbite-react'; import { NotificationTwoTone, WarningTwoTone } from '@ant-design/icons'; +import { DetailsPage } from './InfosForm'; const RolesApp: React.FC = () => { const [open, setOpen] = useState(false); @@ -13,7 +14,8 @@ const RolesApp: React.FC = () => { const [showToast, setShowToast] = useState(false); const [warning, setWarning] = useState(false); const { api, selectedAccount } = useAppContext(); - const { role,infos } = useAccountContext(); + const { role,infos,dispatch0 } = useAccountContext(); + const [acbutton,setAcbutton] = useState(true); const showDrawer = () => { setOpen(true); @@ -28,6 +30,8 @@ const RolesApp: React.FC = () => { console.log('No Roles possible!'); } else { let who = selectedAccount.address; + console.log(`User infos: ${infos}`) + let enc= new TextEncoder() const tx = await api.tx.rolesModule.setRole(who, ROLES[num].toString(),infos); const fees = await tx.paymentInfo(who); const injector = await web3FromAddress(who); @@ -65,17 +69,25 @@ const RolesApp: React.FC = () => { useEffect(() => { if (event !== 'No Roles') console.log(event); - }, [event]); + if (infos!=="No Information Provided"){ + let all= infos.split(`:`) + console.log(all[1]); + setAcbutton(false) + console.log(infos) + } + }, [event,infos,dispatch0]); return (

- + {!(showToast === false) ? (