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

This PR adds Project creation functionality #2

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
12 changes: 12 additions & 0 deletions debug.log
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@
[0527/213826.031:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0528/151733.993:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0528/151734.019:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0529/140617.768:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0529/140617.771:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0601/221346.435:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0601/221346.456:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0602/164611.913:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0602/164611.915:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0602/190943.213:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0602/190943.215:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0602/192715.867:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0602/192715.870:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0603/212048.026:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0603/212048.028:ERROR:crash_report_database_win.cc(469)] failed to stat report
8 changes: 8 additions & 0 deletions src/components/Activity/activity-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ const ACTIVITY_TYPES = new Map(
`,
}
},
newProject({ name, budget }) {
return {
icon: execute,
title: 'Added Project',
description: ` Created Project ${name} , ${budget}
`,
}
},
transaction({ transactionHash }) {
return {
title: 'Transaction',
Expand Down
2 changes: 2 additions & 0 deletions src/components/Dashboard/APIcall.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function APIcall() {

const onFailure = (response) => console.error(response)

const TokenContext = React.createContext(localStorage.getItem('ACCESS TOKEN'))

return (
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Button mode='normal'>
Expand Down
90 changes: 64 additions & 26 deletions src/components/Disputes/Import.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
/* eslint-disable */
import React, { useState, useEffect } from 'react'
import {
SidePanel,
Button,
DropDown,
TextInput,
textStyle,
Main,
GU,
} from '@aragon/ui'
import React, { useState, useRef } from 'react'
import { SidePanel, Button, DropDown, TextInput, LoadingRing } from '@aragon/ui'
import { Octokit } from '@octokit/rest'
import { useWallet } from 'use-wallet'
import { useProjectCreationActions } from '../../hooks/useProjectCreation'

// import { useProjectCreationActions } from './useProjectCreation'

function Import() {
const wallet = useWallet()
Expand All @@ -21,6 +16,10 @@ function Import() {

const [list, setList] = useState([])

// const [loading, setLoading] = useState(false)

const { create } = useProjectCreationActions()

const TOKEN = localStorage.getItem('ACCESS TOKEN')

const octokit = new Octokit({
Expand All @@ -34,9 +33,9 @@ function Import() {
setPublicRepos(num - 1)
return data
}

async function listUserRepos() {
setOpened(true)

let repoList = []
const user = await userInfo()
for (let page = 1; page <= Math.ceil(user.public_repos / 100); page++) {
Expand Down Expand Up @@ -65,29 +64,68 @@ function Import() {
setSelected(index)
}

const inputBudget = useRef(null)
const inputName = useRef(null)

async function handleProjectCreationn() {
let nameInput = inputName.current.value
let budgetInput = inputBudget.current.value
let dropdownInput = inputDropdown.current.value
console.log(nameInput, budgetInput)
await create(dropdownInput, nameInput, budgetInput)
}

return (
<>
{wallet.account !== null ? (
{wallet.account !== null &&
localStorage.getItem('ACCESS TOKEN') !== null ? (
abhinav-anshul marked this conversation as resolved.
Show resolved Hide resolved
<Button mode='strong' onClick={listUserRepos}>
Import Project
</Button>
) : null}

<SidePanel onClose={handleClose} title='Repository' opened={opened}>
<DropDown
selected={selected}
onChange={handleOnChange}
items={[...list]}
style={{ marginTop: '4rem' }}
/>

<TextInput style={{ marginTop: '2rem' }} placeholder='Provide a Name' />

<TextInput style={{ marginTop: '2rem' }} placeholder='Budget' />

<Button style={{ marginTop: '4rem' }} mode='positive'>
Import Project
</Button>
{list.length === 0 ? (
<div
style={{
display: 'flex',
justifyContent: 'center',
marginTop: '4rem',
}}
>
<LoadingRing mode='half-circle' />
</div>
) : (
<>
<DropDown
selected={selected}
onChange={handleOnChange}
items={[...list]}
ref={inputDropdown}
abhinav-anshul marked this conversation as resolved.
Show resolved Hide resolved
style={{
marginTop: '4rem',
}}
/>
{console.log(selected)}
<TextInput
ref={inputName}
style={{ marginTop: '2rem' }}
placeholder='Provide a Name'
/>
<TextInput
ref={inputBudget}
style={{ marginTop: '2rem' }}
placeholder='Budget'
/>
<Button
onClick={handleProjectCreationn}
style={{ marginTop: '4rem' }}
mode='positive'
>
Import Project
</Button>
</>
)}
</SidePanel>
</>
)
Expand Down
10 changes: 10 additions & 0 deletions src/components/Disputes/ProjectCreation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable */
import { useProjectCreationActions } from '../../hooks/useProjectCreation'

export function handleProjectCreation() {
// useProjectCreationActions(id, name, budget)
}

/////

/////
21,183 changes: 21,183 additions & 0 deletions src/contracts/AddressUtils.json

Large diffs are not rendered by default.

Loading