Skip to content

Commit

Permalink
Merge pull request #401 from dOrgTech/develop
Browse files Browse the repository at this point in the history
Merge Develop to Master with Lambda DAO Changes
  • Loading branch information
EightRice authored Dec 17, 2022
2 parents 52b8670 + 8795ad3 commit 4bfe020
Show file tree
Hide file tree
Showing 78 changed files with 5,496 additions and 764 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@taquito/tzip12": "13.0.1",
"@taquito/tzip16": "13.0.1",
"@types/mixpanel-browser": "^2.35.7",
"@types/prismjs": "^1.26.0",
"bignumber.js": "^9.0.1",
"blockies-ts": "^1.0.0",
"dayjs": "^1.10.4",
Expand All @@ -41,6 +42,8 @@
"launchdarkly-react-client-sdk": "2.27.0",
"mixpanel-browser": "^2.42.0",
"notistack": "^1.0.3",
"prism-themes": "^1.9.0",
"prismjs": "^1.28.0",
"react": "^17.0.1",
"react-customizable-progressbar": "^1.0.2",
"react-dom": "^17.0.2",
Expand All @@ -51,6 +54,7 @@
"react-query": "^3.13.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-simple-code-editor": "^0.11.2",
"react-spring-bottom-sheet": "^3.4.0",
"rehype-raw": "^6.1.1",
"remark-breaks": "^3.0.2",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/img/lambda.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/modules/common/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react"
import { Box, styled } from "@material-ui/core"
import { ArrowBack } from "@material-ui/icons"

const BackIcon = styled(ArrowBack)({
cursor: "pointer",
width: "18px",
color: "#ffff",
marginTop: "-5px"
})

export const CloseButton: React.FC<{ onGoBack?: () => void }> = ({ onGoBack }) => {
return (
<Box onClick={onGoBack}>
<BackIcon />
</Box>
)
}

export default CloseButton
4 changes: 2 additions & 2 deletions src/modules/common/CopyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const CopyIcon = styled(FileCopyOutlined)({
cursor: "pointer"
})

export const CopyButton: React.FC<{ text: string }> = ({ text }) => {
export const CopyButton: React.FC<{ text: string; style?: any }> = ({ text, style }) => {
const [copied, setCopied] = useState(false)
return (
<Box
Expand All @@ -22,7 +22,7 @@ export const CopyButton: React.FC<{ text: string }> = ({ text }) => {
}, 2000)
}}
>
<Tooltip placement="bottom" title={!copied ? "Copy to Clipboard" : "Copied!"}>
<Tooltip style={style} placement="bottom" title={!copied ? "Copy to Clipboard" : "Copied!"}>
<CopyIcon color="secondary" fontSize="small" />
</Tooltip>
</Box>
Expand Down
10 changes: 8 additions & 2 deletions src/modules/common/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export const Navbar: React.FC<{
<StyledToolbar>
<Header container alignItems="center" wrap="wrap" justifyContent={"space-between"}>
<Grid item>
<Box onClick={() => history.push("/explorer")}>
<Box onClick={() => (location.href = "https://tezos-homebase.io/explorer")}>
<ToolbarContainer container alignItems="center" wrap="nowrap">
<Grid item>
<LogoItem src={HomeButton} />
Expand Down Expand Up @@ -329,7 +329,13 @@ export const Navbar: React.FC<{
</Grid>
</Grid>
<BackButtonContainer container justifyContent="flex-start">
<BackButtonText container item xs={6} md={2} onClick={() => history.push("/explorer")}>
<BackButtonText
container
item
xs={6}
md={2}
onClick={() => (location.href = "https://tezos-homebase.io/explorer")}
>
<BackButtonIcon />
<BackButton>Back</BackButton>
</BackButtonText>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/creator/state/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface NavigationBarProps {
}
}

export type DAOTemplate = "treasury" | "registry" | ""
export type DAOTemplate = "lambda" | ""

type DeploymentStatus = {
deploying: boolean
Expand Down
5 changes: 4 additions & 1 deletion src/modules/creator/steps/DaoSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,10 @@ const DaoSettingsForm = withRouter(({ submitForm, values, setFieldValue, errors,
InputProps={{
endAdornment: (
<InputAdornment position="start">
<Tooltip placement="bottom" title="Address that can drop/cancel any proposals">
<Tooltip
placement="bottom"
title="Address that can drop/cancel any proposals, Should be a contract like multisig or another DAO"
>
<InfoIconInput color="secondary" />
</Tooltip>
</InputAdornment>
Expand Down
1 change: 1 addition & 0 deletions src/modules/creator/steps/Review.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const Review: React.FC = () => {
activeState
} = useOriginate(state.data.template)
const history = useHistory()
console.log("statesss: ", states)

// TODO: Fix infinite calling here
useEffect(() => {
Expand Down
62 changes: 29 additions & 33 deletions src/modules/creator/steps/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,39 +329,35 @@ export const Summary = (): JSX.Element => {
</Grid>
</ThirdContainerLastRow>

{state.data.template === "treasury" && (
<ThirdContainerSpecialRow item xs={12}>
<Grid item container direction="row" alignItems="center">
<Grid item xs={7}>
<Typography variant="subtitle2" color="textSecondary">
Transfer maximum XTZ amount
</Typography>
</Grid>
<Grid item xs={5}>
<Typography variant="subtitle2" color="textSecondary" align="right">
{state.data.votingSettings.maxXtzAmount} XTZ
</Typography>
</Grid>
</Grid>
</ThirdContainerSpecialRow>
)}

{state.data.template === "treasury" && (
<ThirdContainerLastRow item xs={12}>
<Grid item container direction="row" alignItems="center">
<Grid item xs={7}>
<Typography variant="subtitle2" color="textSecondary">
Transfer minimum XTZ amount
</Typography>
</Grid>
<Grid item xs={5}>
<Typography variant="subtitle2" color="textSecondary" align="right">
{state.data.votingSettings.minXtzAmount} XTZ
</Typography>
</Grid>
</Grid>
</ThirdContainerLastRow>
)}
<ThirdContainerSpecialRow item xs={12}>
<Grid item container direction="row" alignItems="center">
<Grid item xs={7}>
<Typography variant="subtitle2" color="textSecondary">
Transfer maximum XTZ amount
</Typography>
</Grid>
<Grid item xs={5}>
<Typography variant="subtitle2" color="textSecondary" align="right">
{state.data.votingSettings.maxXtzAmount} XTZ
</Typography>
</Grid>
</Grid>
</ThirdContainerSpecialRow>

<ThirdContainerLastRow item xs={12}>
<Grid item container direction="row" alignItems="center">
<Grid item xs={7}>
<Typography variant="subtitle2" color="textSecondary">
Transfer minimum XTZ amount
</Typography>
</Grid>
<Grid item xs={5}>
<Typography variant="subtitle2" color="textSecondary" align="right">
{state.data.votingSettings.minXtzAmount} XTZ
</Typography>
</Grid>
</Grid>
</ThirdContainerLastRow>
</ThirdContainer>

<ThirdContainer container direction="row">
Expand Down
66 changes: 42 additions & 24 deletions src/modules/creator/steps/Template.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Grid, styled, Typography, Box, useMediaQuery, useTheme, makeStyles } from "@material-ui/core"
import React, { useContext, useEffect, useState } from "react"
import { useHistory, withRouter } from "react-router"
import { ReactComponent as LambdaIcon } from "assets/img/lambda.svg"

import { AccountBalance, FormatListBulleted } from "@material-ui/icons"
import { ActionTypes, CreatorContext, DAOTemplate } from "modules/creator/state"
Expand All @@ -13,23 +14,47 @@ const CustomBox = styled(Grid)(({ theme }) => ({
"borderRadius": 8,
"maxWidth": 320,
"width": "-webkit-fill-available",
"padding": "40px 50px",
"padding": "40px 44px",
"textAlign": "start",
"cursor": "pointer",
"paddingBottom": 0,
"&:hover": {
border: "3px solid rgba(129, 254, 183, 0.4)",
padding: "37px 47px"
padding: "37px 41px"
},
["@media (max-width:1167px)"]: {
marginBottom: 20
}
}))

const LambdaCustomBox = styled(Grid)(({ theme }) => ({
"height": 273,
"marginTop": 30,
"background": "#2F3438",
"borderRadius": 8,
"maxWidth": 320,
"width": "-webkit-fill-available",
"padding": "40px 44px",
"textAlign": "start",
"cursor": "pointer",
"paddingBottom": 0,
"&:hover": {
border: "3px solid rgba(129, 254, 183, 0.4)",
paddingTop: 37,
paddingBottom: 0,
paddingRight: 41,
paddingLeft: 41
},
["@media (max-width:1167px)"]: {
marginBottom: 20,
marginTop: 0
}
}))

const styles = makeStyles({
selected: {
border: "3px solid rgba(129, 254, 183, 0.4)",
padding: "37px 47px"
padding: "37px 41px"
}
})

Expand All @@ -54,6 +79,13 @@ const CustomList = styled(FormatListBulleted)(({ theme }) => ({
marginBottom: 16
}))

const Lambda = styled(LambdaIcon)(({ theme }) => ({
width: 64,
height: 64,
color: theme.palette.secondary.light,
marginBottom: 16
}))

const BoxTitle = styled(Typography)({
fontSize: 18,
fontWeight: 500,
Expand Down Expand Up @@ -114,36 +146,22 @@ export const Template = (): JSX.Element => {
<Box>
<TitleBlock title={"DAO Creator"} description={"Create an organization by picking a template below."} />
<Grid container justifyContent={isMobileSmall ? "center" : "space-between"} direction="row">
<CustomBox
item
container
direction="column"
justifyContent="flex-start"
alignItems="center"
xs={isMobileSmall ? 12 : 6}
onClick={() => update("treasury")}
className={selectedTemplate === "treasury" ? style.selected : ""}
>
<CustomBalance />
<BoxTitle color="textSecondary">Treasury</BoxTitle>
<BoxDescription color="textSecondary">Manage resources (tez, FA2, NFT) collectively</BoxDescription>
</CustomBox>
<CustomBox
<LambdaCustomBox
item
container
direction="column"
justifyContent="flex-start"
alignItems="center"
xs={isMobileSmall ? 12 : 6}
onClick={() => update("registry")}
className={selectedTemplate === "registry" ? style.selected : ""}
onClick={() => update("lambda")}
className={selectedTemplate === "lambda" ? style.selected : ""}
>
<CustomList />
<BoxTitle color="textSecondary">Registry</BoxTitle>
<Lambda />
<BoxTitle color="textSecondary">Lambda</BoxTitle>
<BoxDescription color="textSecondary">
Govern arbitrary smart contracts, curate marketplaces, and more
Safe with multi-sig. List of key-value pairs. Contract interaction.
</BoxDescription>
</CustomBox>{" "}
</LambdaCustomBox>{" "}
</Grid>
{error ? <ErrorText>{"Must select a template in order to continue"}</ErrorText> : null}
</Box>
Expand Down
2 changes: 0 additions & 2 deletions src/modules/explorer/components/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export const BottomSheet: React.FC<BottomSheetProps> = ({ children, ...props })
return (
<SpringBottomSheet
snapPoints={({ minHeight }) => {
console.log(minHeight)

return minHeight
}}
{...props}
Expand Down
83 changes: 83 additions & 0 deletions src/modules/explorer/components/CodeCollapse.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { Collapse, Grid, IconButton, Typography } from "@material-ui/core"
import { styled } from "@material-ui/styles"
import { ProposalItem } from "modules/explorer/pages/User"
import React, { useState } from "react"
import { Link } from "react-router-dom"
import { Proposal } from "services/indexer/dao/mappers/proposal/types"
import { ContentContainer } from "./ContentContainer"
import KeyboardArrowDownIcon from "@material-ui/icons/KeyboardArrowDown"
import KeyboardArrowUpIcon from "@material-ui/icons/KeyboardArrowUp"
import { ProposalCodeEditorInput } from "./ProposalFormInput"
import Prism, { highlight } from "prismjs"

const TableContainer = styled(ContentContainer)({
width: "100%"
})

const TableHeader = styled(Grid)({
padding: "16px 46px",
minHeight: 34
})

const ProposalsFooter = styled(Grid)({
padding: "16px 46px",
borderTop: ".6px solid rgba(125,140,139, 0.2)",
minHeight: 34
})

interface Props {
code: string
}

export const CodeCollapse: React.FC<Props> = ({ code }) => {
const [open, setopen] = useState(false)

return (
<TableContainer item>
<Grid container direction="column" wrap={"nowrap"}>
<TableHeader item container justifyContent="space-between">
<Grid item>
<Typography variant="body2" style={{ fontWeight: "500" }} color="textPrimary">
View Lambda Parameter Code
</Typography>
</Grid>
<Grid item>
<IconButton aria-label="expand row" size="small" onClick={() => setopen(!open)}>
{open ? <KeyboardArrowUpIcon htmlColor="#FFF" /> : <KeyboardArrowDownIcon htmlColor="#FFF" />}
</IconButton>
</Grid>
</TableHeader>
<Grid
item
container
wrap={"nowrap"}
component={Collapse}
in={open}
timeout="auto"
unmountOnExit
direction="column"
>
<ProposalCodeEditorInput
label=""
containerStyle={{ marginTop: "8px" }}
insertSpaces
ignoreTabKey={false}
tabSize={4}
padding={10}
style={{
minHeight: 500,
fontFamily: "Roboto Mono",
fontSize: 14,
fontWeight: 400,
outlineWidth: 0
}}
value={code}
onValueChange={code => true}
highlight={code => highlight(code, Prism.languages.javascript, "javascript")}
title={""}
/>
</Grid>
</Grid>
</TableContainer>
)
}
Loading

0 comments on commit 4bfe020

Please sign in to comment.