forked from dyne/zenpub-client
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from oksanasalohubova/138-create-economic-event
138 create economic event
- Loading branch information
Showing
58 changed files
with
1,227 additions
and
828 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import * as React from 'react'; | ||
import { Dropdown } from '../../../ui/modules/Dropdown'; | ||
import { Plus, PlusSquare, Users, X } from 'react-feather'; | ||
import { Flex, Text } from 'rebass/styled-components'; | ||
import { Trans } from '@lingui/macro'; | ||
import styled from '../../../ui/themes/styled'; | ||
|
||
type TCreateDropdown = { | ||
toggleDropdown: () => void; | ||
createCommunity: () => void; | ||
createIntent: () => void; | ||
createResource: () => void; | ||
}; | ||
|
||
export const CreateDropdown: React.FC<TCreateDropdown> = ({ | ||
toggleDropdown, | ||
createCommunity, | ||
createIntent, | ||
createResource | ||
}) => { | ||
return ( | ||
<Dropdown orientation={'top'} close={toggleDropdown}> | ||
<Action> | ||
<StyledClose onClick={toggleDropdown}> | ||
<X color="#05244F" /> | ||
</StyledClose> | ||
</Action> | ||
<List lined> | ||
<Item variant="link" onClick={() => createCommunity()}> | ||
<span> | ||
<Users size={16} color={'#333'} /> | ||
</span> | ||
<Text variant="text"> | ||
<Trans>New Community</Trans> | ||
</Text> | ||
</Item> | ||
<Item variant="link" onClick={() => createIntent()}> | ||
<span> | ||
<PlusSquare size={16} color={'#333'} /> | ||
</span> | ||
<Text variant="text"> | ||
<Trans>Create a new intent</Trans> | ||
</Text> | ||
</Item> | ||
<Item variant="link" onClick={() => createResource()}> | ||
<span> | ||
<Plus size={16} color={'#333'} /> | ||
</span> | ||
<Text variant="text"> | ||
<Trans>Create a new resource</Trans> | ||
</Text> | ||
</Item> | ||
</List> | ||
</Dropdown> | ||
); | ||
}; | ||
|
||
const List = styled.div<{ lined?: boolean }>` | ||
padding: 8px; | ||
`; | ||
|
||
const Action = styled(Flex)` | ||
justify-content: flex-end; | ||
padding: 12px 20px; | ||
`; | ||
const Item = styled(Flex)` | ||
line-height: 50px; | ||
height: 50px; | ||
cursor: pointer; | ||
align-items: center; | ||
& span { | ||
display: inline-block; | ||
margin-right: 8px; | ||
.--rtl & { | ||
margin-right: 0px; | ||
margin-left: 8px; | ||
} | ||
& svg { | ||
vertical-align: sub; | ||
} | ||
} | ||
& a { | ||
color: inherit !important; | ||
text-decoration: none; | ||
} | ||
&:hover { | ||
color: ${props => props.theme.colors.primary}; | ||
} | ||
`; | ||
|
||
export const StyledClose = styled.button` | ||
width: 18px; | ||
height: 18px; | ||
position: relative; | ||
background: transparent; | ||
border: none; | ||
cursor: pointer; | ||
padding: 0; | ||
z-index: 10; | ||
margin: 0; | ||
&:focus { | ||
outline: none; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import React, { useReducer } from 'react'; | ||
import { CreateDropdown } from './CreateDropdown'; | ||
import Modal from '../../../ui/modules/Modal'; | ||
import { CreateCommunityPanelHOC } from '../CreateCommunityPanel/createCommunityPanelHOC'; | ||
import { CreateIntentPanelHOC } from '../CreateIntentPanel/createIntentPanelHOC'; | ||
import { CreateLocationPanelHOC } from '../CreateLocationPanel/CreateLocationPanelHOK'; | ||
import { CreateResourcePanelHOC } from '../CreateResourcePanel/CreateResourcePanelHOC'; | ||
import { useNotifyMustLogin } from '../../lib/notifyMustLogin'; | ||
|
||
export type Props = { | ||
open: boolean; | ||
openHandler: (open: boolean) => void; | ||
}; | ||
|
||
export const CreateMenuHOK: React.FC<Props> = ({ open, openHandler }: Props) => { | ||
const notifiedMustLogin = useNotifyMustLogin(); | ||
const [showCreateLocation, toggleShowCreateLocation] = React.useState(false); | ||
const [showCreateCommunity, toggleShowCreateCommunity] = useReducer( | ||
is => (notifiedMustLogin() ? false : !is), | ||
false | ||
); | ||
|
||
const [showCreateIntent, toggleShowCreateIntent] = useReducer( | ||
is => (notifiedMustLogin() ? false : !is), | ||
false | ||
); | ||
|
||
const [showCreateResource, toggleShowCreateResource] = useReducer( | ||
is => (notifiedMustLogin() ? false : !is), | ||
false | ||
); | ||
|
||
const CreateCommunityModal = showCreateCommunity ? ( | ||
<Modal closeModal={toggleShowCreateCommunity}> | ||
<CreateCommunityPanelHOC done={toggleShowCreateCommunity} /> | ||
</Modal> | ||
) : null; | ||
|
||
const CreateIntentModal = showCreateIntent ? ( | ||
<Modal closeModal={toggleShowCreateIntent}> | ||
<CreateIntentPanelHOC done={toggleShowCreateIntent} /> | ||
</Modal> | ||
) : null; | ||
|
||
const CreateResourceModal = showCreateResource ? ( | ||
<Modal closeModal={toggleShowCreateResource}> | ||
{showCreateLocation ? ( | ||
<CreateLocationPanelHOC done={toggleShowCreateLocation} /> | ||
) : ( | ||
<CreateResourcePanelHOC | ||
done={toggleShowCreateResource} | ||
toggleCreateLocation={toggleShowCreateLocation} | ||
/> | ||
)} | ||
</Modal> | ||
) : null; | ||
|
||
return ( | ||
<> | ||
{CreateCommunityModal} | ||
{CreateIntentModal} | ||
{CreateResourceModal} | ||
{open && ( | ||
<CreateDropdown | ||
createCommunity={toggleShowCreateCommunity} | ||
createResource={toggleShowCreateIntent} | ||
createIntent={toggleShowCreateResource} | ||
toggleDropdown={() => { | ||
openHandler(!open); | ||
}} | ||
/> | ||
)} | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,6 @@ query unitsPages {unitsPages(limit: 30) { | |
} | ||
} | ||
|
||
|
||
query users {users { | ||
edges { | ||
id | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.