├── src
├── login
│ ├── style.css
│ └── index.js
├── validate
│ ├── wrapper.js
│ ├── style.css
│ └── index.js
├── work
│ ├── wrapper.js
│ ├── style.css
│ └── index.js
├── agentPlans
│ ├── style.css
│ ├── index.js
│ └── wrapper.js
├── agentRelationships
│ ├── style.css
│ └── index.js
├── images
│ ├── bg.png
│ └── sample.png
├── index.css
├── fragmentTypes.json
├── components
│ ├── alert
│ │ ├── index.js
│ │ └── style.css
│ ├── button
│ │ ├── index.js
│ │ └── index.css
│ ├── textarea
│ │ ├── index.js
│ │ └── index.css
│ ├── title
│ │ ├── index.js
│ │ └── index.css
│ ├── loading
│ │ ├── style.css
│ │ └── index.js
│ ├── cardModal
│ │ ├── modalNote.js
│ │ ├── modalTitle
│ │ │ ├── modalTitle.js
│ │ │ └── index.js
│ │ ├── modalMembers
│ │ │ └── modalMembers.js
│ │ ├── modalStatus.js
│ │ ├── modalDue.js
│ │ ├── index.js
│ │ ├── CardModal.js
│ │ ├── logEvent
│ │ │ └── logEvent.js
│ │ └── modalActivities
│ │ │ └── editWrapper.js
│ ├── bin
│ │ ├── style.css
│ │ ├── editNote.js
│ │ ├── editTitle.js
│ │ ├── archive.js
│ │ ├── editStart.js
│ │ └── editScope.js
│ ├── flag
│ │ ├── index.js
│ │ ├── flag.js
│ │ └── style.css
│ ├── inventoryItem
│ │ ├── index.js
│ │ └── style.css
│ ├── modal
│ │ ├── index.js
│ │ ├── modal.js
│ │ └── style.css
│ ├── planModal
│ │ ├── index.js
│ │ └── style.css
│ ├── newCommitmentModal
│ │ ├── wrapper.js
│ │ └── style.css
│ ├── cards
│ │ ├── index.js
│ │ └── style.css
│ ├── feed
│ │ ├── feed.js
│ │ ├── index.css
│ │ └── index.js
│ ├── newBin
│ │ └── style.css
│ └── sidebar
│ │ ├── index.js
│ │ └── style.css
├── overview
│ ├── wrapper.js
│ └── style.css
├── queries
│ ├── getNotifications.js
│ ├── getUnits.js
│ ├── getAgentPlans.js
│ ├── getResources.js
│ ├── getOrganizations.js
│ ├── getPlans.js
│ ├── getInventory.js
│ ├── getRelationships.js
│ ├── getEvents.js
│ ├── getProcess.js
│ ├── getCommitment.js
│ ├── getEventClaim.js
│ ├── getCommitmentClaim.js
│ ├── getAgent.js
│ ├── getClaim.js
│ ├── getProcessClaim.js
│ ├── getPlan.js
│ └── getClaims.js
├── mutations
│ ├── deleteNotification.js
│ ├── login.js
│ ├── deletePlan.js
│ ├── deleteProcess.js
│ ├── deleteEvent.js
│ ├── updateNotification.js
│ ├── CreatePlan.js
│ ├── updatePlan.js
│ ├── updateCommitmentTitle.js
│ ├── updateCommitmentStatus.js
│ ├── deleteCommitment.js
│ ├── createValidation.js
│ ├── deleteValidation.js
│ ├── updateProcess.js
│ ├── updateEvent.js
│ ├── createProcess.js
│ ├── createEvent.js
│ ├── updateCommitment.js
│ └── CreateCommitment.js
├── helpers
│ ├── index.js
│ └── router.js
├── AuthenticatedOnly.js
├── mixins.css
├── plan
│ ├── style.css
│ ├── wrapper.js
│ └── index.js
├── inventory
│ ├── index.js
│ ├── wrapper.js
│ └── style.css
├── postcss.config.js
├── agent
│ ├── wrapper.js
│ ├── index.js
│ └── style.css
├── variables.css
├── store
│ ├── index.js
│ └── resolvers.js
├── network
│ ├── wrapper.js
│ └── index.js
├── canvas
│ ├── style.css
│ └── index.js
├── planCanvas
│ └── index.js
├── index.js
├── templates
│ └── AppTemplate
│ │ ├── style.css
│ │ └── index.js
├── settings
│ └── index.js
└── registerServiceWorker.js
├── postcss.config.js
├── .vscode
└── settings.json
├── public
├── manifest.json
└── index.html
├── config
├── jest
│ ├── fileTransform.js
│ └── cssTransform.js
├── polyfills.js
├── paths.js
├── env.js
└── webpackDevServer.config.js
├── .gitignore
├── .github
└── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
├── scripts
├── test.js
└── start.js
├── app.test.js
├── README.md
└── package.json
/src/login/style.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/validate/wrapper.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/work/wrapper.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {};
2 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "standard.enable": false
3 | }
--------------------------------------------------------------------------------
/src/agentPlans/style.css:
--------------------------------------------------------------------------------
1 | .container {
2 | display: initial;
3 | }
--------------------------------------------------------------------------------
/src/agentRelationships/style.css:
--------------------------------------------------------------------------------
1 | .container {
2 | display: initial;
3 | }
--------------------------------------------------------------------------------
/src/images/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opencooperativeecosystem/agent/HEAD/src/images/bg.png
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 10px;
4 | font-family: sans-serif;
5 | }
6 |
--------------------------------------------------------------------------------
/src/images/sample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opencooperativeecosystem/agent/HEAD/src/images/sample.png
--------------------------------------------------------------------------------
/src/fragmentTypes.json:
--------------------------------------------------------------------------------
1 | {"__schema":{"types":[{"kind":"INTERFACE","name":"Agent","possibleTypes":[{"name":"Organization"},{"name":"Person"}]}]}}
--------------------------------------------------------------------------------
/src/components/alert/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import style from './style.css'
3 | const Alert = ({children}) => (
4 |
{children}
5 | )
6 |
7 | export default Alert
--------------------------------------------------------------------------------
/src/components/alert/style.css:
--------------------------------------------------------------------------------
1 | .alert {
2 | border-radius: 4px;
3 | height: 26px;
4 | line-height: 26px;
5 | color: white;
6 | background: red;
7 | padding: 0 10px;
8 | font-size: 14px;
9 | }
--------------------------------------------------------------------------------
/src/overview/wrapper.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Component from '../agent/wrapper'
3 |
4 | const Overview = ({id}) => {
5 | return
6 | }
7 |
8 | export default Overview
9 |
--------------------------------------------------------------------------------
/src/queries/getNotifications.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | export default gql`
4 | query {
5 | notifications @client {
6 | id
7 | message
8 | type
9 | }
10 | }
11 | `
12 |
--------------------------------------------------------------------------------
/src/mutations/deleteNotification.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | export default gql`
4 | mutation deleteNotification($id: String!){
5 | deleteNotification(id: $id) @client {
6 | message
7 | }
8 | }
9 | `
--------------------------------------------------------------------------------
/src/components/button/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import style from './index.css'
3 |
4 | const Button = ({action, type, title}) => (
5 |
6 | )
7 |
8 | export default Button
--------------------------------------------------------------------------------
/src/mutations/login.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const loginMutation = gql`
4 | mutation($username: String! $password: String!) {
5 | createToken(username: $username, password: $password) {
6 | token
7 | }
8 | }
9 | `
10 |
11 | export default loginMutation
12 |
--------------------------------------------------------------------------------
/src/mutations/deletePlan.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const deletePlan = gql`
4 | mutation ($token: String!, $id: Int!) {
5 | deletePlan(token: $token, id: $id) {
6 | plan {
7 | name
8 | }
9 | }
10 | }`
11 |
12 | export default deletePlan
13 |
--------------------------------------------------------------------------------
/src/helpers/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { branch, renderComponent } from 'recompose'
3 |
4 | const Loading = () => (
5 | Loading....
6 | )
7 |
8 | export const withLoadingComponent = branch(
9 | props => props.loading,
10 | renderComponent(Loading)
11 | )
12 |
--------------------------------------------------------------------------------
/src/components/textarea/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import style from './index.css'
3 |
4 | const TextArea = ({action, type, title, placeholder}) => (
5 |
6 | )
7 |
8 | export default TextArea
9 |
--------------------------------------------------------------------------------
/src/mutations/deleteProcess.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const deleteProcess = gql`
4 | mutation ($token: String!, $id: Int!) {
5 | deleteProcess(token: $token, id: $id) {
6 | process {
7 | name
8 | }
9 | }
10 | }`
11 |
12 | export default deleteProcess
13 |
--------------------------------------------------------------------------------
/src/queries/getUnits.js:
--------------------------------------------------------------------------------
1 | import gql from "graphql-tag";
2 |
3 | const getUnitsQuery = gql`
4 | query($token: String!) {
5 | viewer(token: $token) {
6 | allUnits {
7 | id
8 | name
9 | symbol
10 | }
11 | }
12 | }
13 | `;
14 |
15 | export default getUnitsQuery;
16 |
--------------------------------------------------------------------------------
/src/components/title/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import style from './index.css'
3 |
4 | const Title = ({icon, title}) => (
5 |
6 | {icon ? {icon} : ''}
7 | {title}
8 |
9 | )
10 |
11 | export default Title
--------------------------------------------------------------------------------
/src/mutations/deleteEvent.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | export default gql`
4 | mutation ($token: String!, $id: Int!) {
5 | deleteEconomicEvent(
6 | token: $token,
7 | id: $id
8 | ) {
9 | economicEvent {
10 | action
11 | start
12 | }
13 | }
14 | }
15 | `
--------------------------------------------------------------------------------
/src/mutations/updateNotification.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | export default gql`
4 | mutation addNotification($message: String!, $type: String){
5 | addNotification(message: $message, type: $type) @client {
6 | id,
7 | type,
8 | message
9 | }
10 | }
11 | `
--------------------------------------------------------------------------------
/src/queries/getAgentPlans.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const agentPlans = gql`
4 | query($token: String) {
5 | viewer(token: $token) {
6 | myAgent {
7 | id
8 | agentPlans {
9 | id
10 | }
11 | }
12 | }
13 | }
14 | `;
15 |
16 | export default agentPlans
--------------------------------------------------------------------------------
/src/AuthenticatedOnly.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | class AuthenticatedOnly extends React.Component {
4 | render () {
5 | let isLoggedIn = localStorage.getItem('oce_token')
6 | return (isLoggedIn ? this.props.children : this.props.unauthenticatedComponent)
7 | }
8 | }
9 |
10 | export default AuthenticatedOnly
11 |
--------------------------------------------------------------------------------
/src/components/loading/style.css:
--------------------------------------------------------------------------------
1 | .wrapper {
2 | margin-top: 20px;
3 | text-align: center;
4 | }
5 |
6 | .wrapperLoader h1 {
7 | display: inline-block;
8 | margin-left: 10px;
9 | color: #606984;
10 | font-size: 16px;
11 | vertical-align: middle;
12 | }
13 |
14 | .loaderIcon {
15 | vertical-align: sub;
16 | }
--------------------------------------------------------------------------------
/src/components/cardModal/modalNote.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import style from "./index.css";
3 |
4 | const Note = ({ note }) => (
5 |
6 |
7 |
8 | {note}
9 |
10 |
11 | );
12 |
13 | export default Note;
14 |
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "192x192",
8 | "type": "image/png"
9 | }
10 | ],
11 | "start_url": "./index.html",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/src/queries/getResources.js:
--------------------------------------------------------------------------------
1 | import gql from "graphql-tag";
2 |
3 | const getResourcesQuery = gql`
4 | query ($token: String, $action: Action) {
5 | viewer(token: $token) {
6 | resourceClassificationsByAction(action: $action) {
7 | name
8 | category
9 | processCategory
10 | id
11 | }
12 | }
13 | }`;
14 |
15 | export default getResourcesQuery;
16 |
--------------------------------------------------------------------------------
/config/jest/fileTransform.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const path = require('path');
4 |
5 | // This is a custom Jest transformer turning file imports into filenames.
6 | // http://facebook.github.io/jest/docs/tutorial-webpack.html
7 |
8 | module.exports = {
9 | process(src, filename) {
10 | return `module.exports = ${JSON.stringify(path.basename(filename))};`;
11 | },
12 | };
13 |
--------------------------------------------------------------------------------
/src/mutations/CreatePlan.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag';
2 |
3 | const createPlan = gql`
4 | mutation($token: String!, $name: String!, $due: String!, $note: String) {
5 | createPlan(token: $token, name: $name, due: $due, note: $note) {
6 | plan {
7 | id
8 | name
9 | due
10 | note
11 | }
12 | }
13 | }
14 | `;
15 |
16 | export default createPlan
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 |
6 | # testing
7 | /coverage
8 |
9 | # production
10 | /build
11 |
12 | # misc
13 | .DS_Store
14 | .env.local
15 | .env.development.local
16 | .env.test.local
17 | .env.production.local
18 |
19 | npm-debug.log*
20 | yarn-debug.log*
21 | yarn-error.log*
22 | yarn.lock
--------------------------------------------------------------------------------
/config/jest/cssTransform.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // This is a custom Jest transformer turning style imports into empty objects.
4 | // http://facebook.github.io/jest/docs/tutorial-webpack.html
5 |
6 | module.exports = {
7 | process() {
8 | return 'module.exports = {};';
9 | },
10 | getCacheKey() {
11 | // The output is always the same.
12 | return 'cssTransform';
13 | },
14 | };
15 |
--------------------------------------------------------------------------------
/src/validate/style.css:
--------------------------------------------------------------------------------
1 | .container {
2 | user-select: none;
3 | white-space: nowrap;
4 | overflow-x: auto;
5 | overflow-y: hidden;
6 | position: absolute;
7 | top: 0;
8 | right: 0;
9 | bottom: 0;
10 | left: 0;
11 | }
12 |
13 | .container_link {
14 | position: relative;
15 | margin: 10px;
16 | }
17 |
18 | .active > div {
19 | border: 2px solid #419bf9;
20 | }
21 |
--------------------------------------------------------------------------------
/src/work/style.css:
--------------------------------------------------------------------------------
1 | .container {
2 | user-select: none;
3 | white-space: nowrap;
4 | overflow-x: auto;
5 | overflow-y: hidden;
6 | position: absolute;
7 | top: 0;
8 | right: 0;
9 | bottom: 0;
10 | left: 0;
11 | }
12 |
13 | .container_link {
14 | position: relative;
15 | margin: 10px;
16 | }
17 |
18 | .active > div {
19 | border: 2px solid #419bf9;
20 | }
21 |
--------------------------------------------------------------------------------
/src/queries/getOrganizations.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const allOrganizations = gql`
4 | query($token: String) {
5 | viewer(token: $token) {
6 | fcOrganizations (visibility:"public", joiningStyle:"moderated") {
7 | id
8 | name
9 | image
10 | note
11 | type
12 | __typename
13 | }
14 | }
15 | }`
16 |
17 | export default allOrganizations
18 |
--------------------------------------------------------------------------------
/src/components/bin/style.css:
--------------------------------------------------------------------------------
1 | .form_note {
2 | display: block;
3 | height: 135px;
4 | }
5 |
6 | .h5 {
7 | font-size: 14px;
8 | font-weight: 600;
9 | margin: 0;
10 | margin-bottom: 10px;
11 | }
12 |
13 | .inputTitle {
14 | font-weight: 500;
15 | font-size: 13px;
16 | letter-spacing: .5;
17 | margin-top: 16px;
18 | color: #99ADC6;
19 | margin-bottom: 8px;
20 | text-transform: capitalize;
21 | }
--------------------------------------------------------------------------------
/src/mutations/updatePlan.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag';
2 |
3 | const updatePlan = gql`
4 | mutation ($token: String!, $id: Int!, $name: String, $note: String, $due: String) {
5 | updatePlan(token: $token, id:$id, name: $name, note: $note, due: $due) {
6 | plan {
7 | id
8 | name
9 | due
10 | note
11 | plannedOn
12 | }
13 | }
14 | }
15 | `;
16 |
17 | export default updatePlan
18 |
--------------------------------------------------------------------------------
/src/components/flag/index.js:
--------------------------------------------------------------------------------
1 | import {deleteCurrentFlagAction} from '../../store/actions/flags'
2 | import {connect} from 'react-redux'
3 | import Flag from './flag'
4 |
5 | const mapStateToProps = state => ({
6 | data: state.flags
7 | })
8 |
9 | const mapDispatchToProps = dispatch => {
10 | return {
11 | deleteFlag: () => dispatch(deleteCurrentFlagAction())
12 | }
13 | }
14 |
15 | export default connect(mapStateToProps, mapDispatchToProps)(Flag)
16 |
--------------------------------------------------------------------------------
/src/components/loading/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import {Icons} from 'oce-components/build'
3 | import style from './style.css'
4 |
5 | export const LoadingMini = () => (
6 |
7 |
8 |
9 |
Loading...
10 |
11 |
12 | )
13 |
14 |
--------------------------------------------------------------------------------
/src/mutations/updateCommitmentTitle.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const UpdateCommitmentTitle = gql`
4 | mutation ($token: String!, $id: Int!, $note: String, $due: String, $isFinished: Boolean ) {
5 | updateCommitment(token: $token, note: $note, id: $id, due: $due, isFinished:$isFinished ) {
6 | commitment {
7 | id
8 | note
9 | isFinished,
10 | due
11 | }
12 | }
13 | }
14 | `
15 |
16 | export default UpdateCommitmentTitle
17 |
--------------------------------------------------------------------------------
/src/mutations/updateCommitmentStatus.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const UpdateCommitmentStatus = gql`
4 | mutation ($token: String!, $id: Int!, $isFinished: Boolean ) {
5 | updateCommitment(
6 | token: $token,
7 | id: $id,
8 | isFinished: $isFinished
9 | ) {
10 | commitment {
11 | id
12 | isFinished
13 | inputOf {
14 | id
15 | }
16 | }
17 | }
18 | }`
19 |
20 | export default UpdateCommitmentStatus
21 |
--------------------------------------------------------------------------------
/src/components/inventoryItem/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import style from './style.css'
3 |
4 | const Item = ({item}) => (
5 |
6 |
7 | {item.currentQuantity.numericValue + ' ' + item.currentQuantity.unit.name } of {item.resourceClassifiedAs.name}
8 |
9 |
{item.resourceClassifiedAs.category}
10 |
11 | )
12 |
13 | export default Item
14 |
--------------------------------------------------------------------------------
/src/queries/getPlans.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const agentQuery = gql`
4 | query ($token: String, $id: Int) {
5 | viewer(token: $token) {
6 | agent(id: $id) {
7 | agentPlans (isFinished: false) {
8 | name
9 | id
10 | note
11 | due
12 | plannedOn
13 | planProcesses {
14 | isStarted
15 | isFinished
16 | name
17 | }
18 | }
19 | }
20 | }
21 | }
22 | `
23 |
24 | export default agentQuery
25 |
--------------------------------------------------------------------------------
/src/components/title/index.css:
--------------------------------------------------------------------------------
1 | .header_title {
2 | font-size: 18px;
3 | margin: 0 0 9px;
4 | color: #444444;
5 | position: relative;
6 | /* margin-left: 10px; */
7 | display: inline-block;
8 | width: 400px;
9 | vertical-align: middle;
10 | }
11 |
12 | .header_title .content_icon {
13 | position: absolute;
14 | left: -34px;
15 | }
16 |
17 | /* .content_module .content_icon {
18 | left: -38px;
19 | position: absolute;
20 | top: 8px;
21 | } */
22 |
23 | .content_icon svg {
24 | stroke: 2;
25 | }
--------------------------------------------------------------------------------
/src/mutations/deleteCommitment.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | export default gql`
4 | mutation ($token: String!, $id: Int!) {
5 | deleteCommitment(token: $token, id: $id) {
6 | commitment {
7 | action
8 | fulfilledBy {
9 | fulfilledBy {
10 | action
11 | start
12 | id
13 | requestDistribution
14 | note
15 | provider {
16 | id
17 | name
18 | image
19 | }
20 | }
21 | }
22 | }
23 | }
24 | }`
--------------------------------------------------------------------------------
/src/queries/getInventory.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const GetCommitment = gql`
4 | query ($token: String) {
5 | viewer(token: $token) {
6 | myAgent {
7 | ownedEconomicResources {
8 | id
9 | resourceClassifiedAs {
10 | name
11 | category
12 | }
13 | trackingIdentifier
14 | currentQuantity {
15 | numericValue
16 | unit {
17 | name
18 | }
19 | }
20 | image
21 | note
22 | }
23 | }
24 | }
25 | }
26 | `
27 |
28 | export default GetCommitment
29 |
--------------------------------------------------------------------------------
/src/components/cardModal/modalTitle/modalTitle.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import style from '../index.css'
3 | import Title from '../../title'
4 | // import {Cross, More} from '../../../icons'
5 | import {Icons} from 'oce-components/build'
6 |
7 | export default function ModalTitle ({action, unit, amount, resource }) {
8 | return (
9 |
10 |
11 |
{action + ' ' + amount + ' ' + unit}of{resource}
12 |
13 | )
14 | }
--------------------------------------------------------------------------------
/src/queries/getRelationships.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const relationshipQuery = gql`
4 | query ($token: String) {
5 | viewer(token: $token) {
6 | myAgent {
7 | id
8 | agentRelationships {
9 | relationship {
10 | label
11 | category
12 | }
13 | object {
14 | id
15 | name
16 | note
17 | image
18 | }
19 | subject {
20 | name
21 | image
22 | id
23 | }
24 | }
25 | }
26 | }
27 | }
28 | `
29 |
30 | export default relationshipQuery
31 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 |
5 | ---
6 |
7 | **Is your feature request related to a problem? Please describe.**
8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9 |
10 | **Describe the solution you'd like**
11 | A clear and concise description of what you want to happen.
12 |
13 | **Describe alternatives you've considered**
14 | A clear and concise description of any alternative solutions or features you've considered.
15 |
16 | **Additional context**
17 | Add any other context or screenshots about the feature request here.
18 |
--------------------------------------------------------------------------------
/src/mutations/createValidation.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const createValidation = gql`
4 | mutation ($token: String!, $validatedById: Int!, $economicEventId: Int!) {
5 | createValidation(token: $token,
6 | validatedById: $validatedById,
7 | economicEventId: $economicEventId
8 | ) {
9 | validation {
10 | id
11 | validatedBy {
12 | name
13 | id
14 | }
15 | economicEvent {
16 | id
17 | inputOf {
18 | id
19 | processPlan {
20 | id
21 | }
22 | }
23 | }
24 | validationDate
25 | }
26 | }
27 | }`
28 |
29 | export default createValidation
30 |
--------------------------------------------------------------------------------
/config/polyfills.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (typeof Promise === 'undefined') {
4 | // Rejection tracking prevents a common issue where React gets into an
5 | // inconsistent state due to an error, but it gets swallowed by a Promise,
6 | // and the user has no idea what causes React's erratic future behavior.
7 | require('promise/lib/rejection-tracking').enable();
8 | window.Promise = require('promise/lib/es6-extensions.js');
9 | }
10 |
11 | // fetch() polyfill for making API calls.
12 | require('whatwg-fetch');
13 |
14 | // Object.assign() is commonly used with React.
15 | // It will use the native implementation if it's present and isn't buggy.
16 | Object.assign = require('object-assign');
17 |
--------------------------------------------------------------------------------
/src/components/modal/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import Modal from "./modal";
4 | const modalRoot = document.getElementById('modal');
5 |
6 | class Portal extends React.Component {
7 | constructor(props) {
8 | super(props);
9 | this.el = document.createElement('div');
10 | }
11 |
12 | componentDidMount() {
13 | modalRoot.appendChild(this.el);
14 | }
15 |
16 | componentWillUnmount() {
17 | modalRoot.removeChild(this.el);
18 | }
19 |
20 | render() {
21 | return ReactDOM.createPortal(
22 | this.props.children,
23 | this.el
24 | );
25 | }
26 | }
27 |
28 | export default (props) => ;
--------------------------------------------------------------------------------
/src/components/textarea/index.css:
--------------------------------------------------------------------------------
1 | textarea {
2 | outline: none;
3 | box-sizing: border-box;
4 | -webkit-appearance: none;
5 | background-color: #E2E4E6;
6 | border: 1px solid #CDD2D4;
7 | border-radius: 3px;
8 | display: block;
9 | margin-bottom: 9pt;
10 | min-height: 2pc;
11 | padding: 7px;
12 | resize: vertical;
13 | width: 100%;
14 | font-size: 14px;
15 | line-height: 20px;
16 | clear: both;
17 | font-weight: 400;
18 | margin: 0 0 4px;
19 | overflow: hidden;
20 | word-wrap: break-word;
21 | color: #4d4d4d;
22 | font-family: 'Fira Sans';
23 |
24 | }
25 | textarea.white {
26 | background: transparent;
27 | border: none;
28 | }
--------------------------------------------------------------------------------
/src/components/planModal/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import Component from "./PlanModal";
3 | import Modal from "../modal";
4 |
5 | const PlanModal = ({
6 | toggleModal,
7 | isOpen,
8 | planId,
9 | match,
10 | scopeId,
11 | isDeletable,
12 | title,
13 | note,
14 | history,
15 | due,
16 | start
17 | }) => (
18 |
19 |
30 |
31 | );
32 |
33 | export default PlanModal;
34 |
--------------------------------------------------------------------------------
/src/components/inventoryItem/style.css:
--------------------------------------------------------------------------------
1 |
2 | .list_item {
3 | background: rgba(65, 155, 249, .2);
4 | border: 1px solid rgba(65, 155, 249, .6);
5 | border-radius: 2px;
6 | margin-bottom: 10px;
7 | lost-utility: clearfix;
8 | padding: 10px;
9 | }
10 |
11 | .list_item .item_desc {
12 | float: left;
13 | color: #f0f0f0;
14 | font-weight: 400;
15 | font-size: 15px;
16 | line-height: 22px;
17 | }
18 |
19 | .list_item .item_desc b {
20 | font-weight: 500
21 | }
22 |
23 | .list_item .type {
24 | float: right;
25 | background: rgba(65, 155, 249, 1);
26 | padding: 2px 10px;
27 | border-radius: 30px;
28 | font-size: 12px;
29 | color: white;
30 | letter-spacing: .5px;
31 | }
32 |
--------------------------------------------------------------------------------
/src/components/cardModal/modalMembers/modalMembers.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import style from '../index.css'
3 | import {Icons} from 'oce-components/build'
4 |
5 | export default function ModalMembers ({members}) {
6 | return (
7 |
8 |
9 |
10 | {members.map((member, i) => (
11 |
12 |
13 |
14 |
15 |
16 | )
17 | )}
18 |
19 |
20 | )
21 | }
22 |
--------------------------------------------------------------------------------
/src/components/modal/modal.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import {Icons} from 'oce-components/build'
3 | import style from './style.css'
4 |
5 | const Modal = ({ isOpen, toggleModal, content, children }) => {
6 | return isOpen ? (
7 |
8 |
9 |
10 |
13 |
14 | {children}
15 |
16 |
17 |
18 | ) : null;
19 | };
20 |
21 | export default Modal;
22 |
--------------------------------------------------------------------------------
/src/agentPlans/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Icons, Panel } from "oce-components/build";
3 | import Cards from "../components/cards";
4 | import style from "./style.css";
5 |
6 | const AgentPlans = props => {
7 | return (
8 |
9 |
}
11 | title="Plans"
12 | >
13 | {props.data.agentPlans.length > 0 ? (
14 |
18 | ) : (
19 |
No item in this section
20 | )}
21 |
22 |
23 | );
24 | };
25 |
26 | export default AgentPlans;
27 |
--------------------------------------------------------------------------------
/src/mixins.css:
--------------------------------------------------------------------------------
1 | /* MEDIA QUERY */
2 |
3 | @define-mixin for-phone-only {
4 | @media (max-width: 599px) { @mixin-content; }
5 | }
6 |
7 | @define-mixin for-tablet-portrait-up {
8 | @media (min-width: 600px) { @mixin-content; }
9 | }
10 |
11 | @define-mixin for-tablet-landscape-up {
12 | @media (min-width: 900px) { @mixin-content; }
13 | }
14 |
15 | @define-mixin for-desktop-up {
16 | @media (min-width: 1200px) { @mixin-content; }
17 | }
18 |
19 | @define-mixin for-big-desktop-up {
20 | @media (min-width: 1800px) { @mixin-content; }
21 | }
22 |
23 |
24 | /* UTILITY */
25 | @define-mixin clearfix {
26 | &:before, &:after {
27 | content: " ";
28 | display: table; }
29 | &:after {
30 | clear: both; }
31 | }
32 |
--------------------------------------------------------------------------------
/src/mutations/deleteValidation.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const deleteValidation = gql`
4 | mutation ($token: String!, $id: Int!) {
5 | deleteValidation(token: $token, id: $id) {
6 | validation {
7 | validatedBy {
8 | name
9 | id
10 | }
11 | economicEvent {
12 | id
13 | inputOf {
14 | id
15 | processPlan {
16 | id
17 | }
18 | }
19 | action
20 | affectedQuantity {
21 | numericValue
22 | unit {
23 | name
24 | }
25 | }
26 | }
27 | validationDate
28 | }
29 | }
30 | }`
31 |
32 | export default deleteValidation
33 |
--------------------------------------------------------------------------------
/src/queries/getEvents.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | export default gql`
4 | query ($token: String!, $id: Int!) {
5 | viewer(token: $token) {
6 | commitment(id: $id) {
7 | id
8 | fulfilledBy {
9 | fulfilledBy {
10 | action
11 | requestDistribution
12 | start
13 | id
14 | note
15 | provider {
16 | name
17 | image
18 | id
19 | }
20 | }
21 | fulfilledQuantity {
22 | numericValue
23 | unit {
24 | id
25 | name
26 | }
27 | }
28 | }
29 | }
30 | }
31 | }
32 | `
--------------------------------------------------------------------------------
/src/components/newCommitmentModal/wrapper.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import CardModal from './index'
3 | import Modal from '../modal'
4 | import { ApolloConsumer } from "react-apollo";
5 |
6 | const NCModal = ({toggleNewCommitmentModal, modalIsOpen, closeModal, planId, match, scopeId, processId}) => (
7 |
11 |
12 | {client => (
13 |
21 | )}
22 |
23 |
24 | )
25 |
26 | export default NCModal
27 |
--------------------------------------------------------------------------------
/src/components/cardModal/modalStatus.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Icons } from "oce-components/build";
3 | import style from "./index.css";
4 |
5 | const Status = ({ isFinished }) => (
6 |
7 |
14 |
15 | {isFinished ? (
16 |
17 | ) : (
18 |
19 | )}
20 |
21 |
{isFinished ? "Completed" : "Incompleted"}
22 |
23 |
24 | );
25 |
26 | export default Status;
27 |
--------------------------------------------------------------------------------
/src/plan/style.css:
--------------------------------------------------------------------------------
1 | .container {
2 | user-select: none;
3 | white-space: nowrap;
4 | overflow-x: auto;
5 | overflow-y: hidden;
6 | position: absolute;
7 | top: 0;
8 | right: 0;
9 | bottom: 0;
10 | left: 0;
11 | }
12 |
13 | .panel_container {
14 | padding: 10px;
15 | }
16 |
17 | .container span {
18 | display: block;
19 | margin-bottom: 10px;
20 | }
21 |
22 | .form_note {
23 | height: 250px;
24 | }
25 |
26 | .dates {
27 | lost-utility: clearfix;
28 | }
29 |
30 | .item_date {
31 | float: left;
32 | margin-right: 10px;
33 | }
34 |
35 | .item_date h5 {
36 | font-size: 14px;
37 | margin: 0;
38 | margin-bottom: 5px;
39 | font-weight: 500;
40 | text-transform: uppercase;
41 | color: white;
42 | }
43 |
44 | .item_date:last-of-type {
45 | margin-right: 0;
46 | }
--------------------------------------------------------------------------------
/src/components/flag/flag.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import style from './style.css'
3 | // import {Shield} from '../../icons'
4 | import {Icons} from 'oce-components/build'
5 |
6 | const Flag = ({data, deleteFlag}) => {
7 | return (
8 |
9 |
10 |
11 |
12 |
{data.title || ''}
13 | {data.message || ''}
14 |
15 |
16 |
17 |
18 | )
19 | }
20 |
21 | export default Flag
22 |
--------------------------------------------------------------------------------
/src/components/cardModal/modalDue.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Icons } from "oce-components/build";
3 | import moment from 'moment'
4 | import style from './index.css'
5 |
6 | const Due = ({due}) => {
7 | let duration = moment
8 | .duration(moment(due).diff(moment()))
9 | .asHours();
10 | let deadline = duration < 0 ? 'expired' : duration < 48 ? 'soon' : ''
11 | return (
12 |
13 |
14 |
15 |
16 | {moment(due).format("DD MMM YYYY")}
17 |
18 |
19 |
20 | )};
21 |
22 |
23 | export default Due
--------------------------------------------------------------------------------
/scripts/test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // Do this as the first thing so that any code reading it knows the right env.
4 | process.env.BABEL_ENV = 'test';
5 | process.env.NODE_ENV = 'test';
6 | process.env.PUBLIC_URL = '';
7 |
8 | // Makes the script crash on unhandled rejections instead of silently
9 | // ignoring them. In the future, promise rejections that are not handled will
10 | // terminate the Node.js process with a non-zero exit code.
11 | process.on('unhandledRejection', err => {
12 | throw err;
13 | });
14 |
15 | // Ensure environment variables are read.
16 | require('../config/env');
17 |
18 | const jest = require('jest');
19 | const argv = process.argv.slice(2);
20 |
21 | // Watch unless on CI or in coverage mode
22 | if (!process.env.CI && argv.indexOf('--coverage') < 0) {
23 | argv.push('--watch');
24 | }
25 |
26 |
27 | jest.run(argv);
28 |
--------------------------------------------------------------------------------
/src/mutations/updateProcess.js:
--------------------------------------------------------------------------------
1 | import gql from "graphql-tag";
2 |
3 | export const UpdateProcess = gql`
4 | mutation(
5 | $token: String!
6 | $id: Int!
7 | $isFinished: Boolean
8 | $name: String
9 | $scopeId: Int
10 | $note: String
11 | $start: String
12 | ) {
13 | updateProcess(
14 | token: $token
15 | id: $id
16 | isFinished: $isFinished
17 | name: $name
18 | scopeId: $scopeId
19 | note: $note
20 | plannedStart: $start
21 | ) {
22 | process {
23 | processPlan {
24 | id
25 | }
26 | id
27 | name
28 | scope{
29 | id
30 | name
31 | }
32 | note
33 | isDeletable
34 | plannedStart
35 | isFinished
36 | }
37 | }
38 | }
39 | `;
40 |
41 | export default UpdateProcess;
42 |
--------------------------------------------------------------------------------
/src/components/modal/style.css:
--------------------------------------------------------------------------------
1 | .Background {
2 | position: fixed;
3 | top: 0;
4 | left: 0;
5 | right: 0;
6 | bottom: 0;
7 | background-color: rgba(51, 60, 69, .95);
8 | z-index: 10000000;
9 | height: 100%;
10 | justify-content: center;
11 | overflow: auto;
12 | cursor: pointer;
13 | }
14 |
15 |
16 | .Dialog {
17 | width: 700px;
18 | box-shadow: 0 2px 8px 3px rgba(0, 0, 0, 0.3);
19 | z-index: 9999999999;
20 | background-color: #edeff0;
21 | padding: 0;
22 | margin: 40px auto;
23 | position: relative;
24 | border-radius: 3px;
25 | padding-bottom: 20px;
26 | outline: none;
27 | }
28 |
29 |
30 | .Actions {
31 | lost-utility: clearfix;
32 | padding-top: 10px;
33 | padding-right: 10px;
34 | margin-bottom: -50px;
35 | }
36 | .Content {
37 | lost-utility: clearfix;
38 | }
39 | .Close {
40 | float: right;
41 | cursor: pointer;
42 | }
--------------------------------------------------------------------------------
/src/overview/style.css:
--------------------------------------------------------------------------------
1 | .panel {
2 | width: 320px;
3 | background: #292D37;
4 | border-radius: 3px;
5 | min-height: 100vh;
6 | flex: 1;
7 | margin-right: 10px;
8 | margin: 0 5px;
9 | margin-left: 5px;
10 | height: 100%;
11 | -webkit-box-sizing: border-box;
12 | box-sizing: border-box;
13 | display: inline-block;
14 | vertical-align: top;
15 | white-space: nowrap;
16 | position: relative;
17 | border: 3px;
18 | }
19 |
20 | .panel_title {
21 | height: 40px;
22 | background: #313542;
23 | lost-utility: clearfix;
24 | }
25 |
26 | .panel_title h1 {
27 | font-size: 14px;
28 | color: #F0F0F0;
29 | font-weight: 500;
30 | float: left;
31 | margin: 0;
32 | line-height: 40px;
33 | margin-left: 10px;
34 | }
35 |
36 | .panel_title span {
37 | float: left;
38 | margin-left: 10px;
39 | vertical-align: sub;
40 | margin-top: 6px;
41 | }
--------------------------------------------------------------------------------
/src/inventory/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import style from './style.css'
3 | import Item from '../components/inventoryItem'
4 |
5 | const Network = ({data}) => (
6 |
7 |
8 |
9 |
10 |
Inventory
11 | Internet Advertising Trends You Won T Be Disappointed Internet Advertising Trends You Won T Be Disappointed
12 |
13 |
14 |
15 |
16 | {data.ownedEconomicResources.map((item, i) => (
17 |
18 | ))}
19 |
20 |
21 |
22 |
23 | )
24 |
25 | export default Network
26 |
--------------------------------------------------------------------------------
/src/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | 'postcss-import': {},
4 | 'postcss-font-magician' : {
5 | variants: {
6 | 'Fira Sans': {
7 | '300': [],
8 | '500': [],
9 | '700': []
10 | }
11 | },
12 | foundries: ['google']
13 | },
14 | 'postcss-cssnext': {
15 | browsers: ['last 2 versions', '> 5%'],
16 | },
17 | 'postcss-custom-media': {},
18 | 'postcss-flexbugs-fixes': {},
19 | // 'postcss-simple-vars': {
20 | // variables: function variables() {
21 | // return require('../src/variables')
22 | // },
23 | // unknown: function unknown(node, name, result) {
24 | // node.warn(result, 'Unknown variable ' + name)
25 | // }
26 | // },
27 | // 'postcss-mixins': {
28 | // mixins: require('../src/mixins')
29 | // },
30 | 'lost': {},
31 | 'postcss-utilities': {}
32 | },
33 | };
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 |
5 | ---
6 |
7 | **Describe the bug**
8 | A clear and concise description of what the bug is.
9 |
10 | **To Reproduce**
11 | Steps to reproduce the behavior:
12 | 1. Go to '...'
13 | 2. Click on '....'
14 | 3. Scroll down to '....'
15 | 4. See error
16 |
17 | **Expected behavior**
18 | A clear and concise description of what you expected to happen.
19 |
20 | **Screenshots**
21 | If applicable, add screenshots to help explain your problem.
22 |
23 | **Desktop (please complete the following information):**
24 | - OS: [e.g. iOS]
25 | - Browser [e.g. chrome, safari]
26 | - Version [e.g. 22]
27 |
28 | **Smartphone (please complete the following information):**
29 | - Device: [e.g. iPhone6]
30 | - OS: [e.g. iOS8.1]
31 | - Browser [e.g. stock browser, safari]
32 | - Version [e.g. 22]
33 |
34 | **Additional context**
35 | Add any other context about the problem here.
36 |
--------------------------------------------------------------------------------
/src/components/cardModal/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import CardModal from "./CardModal";
3 | import Modal from '../modal'
4 |
5 | const CommitmentModal = ({
6 | param,
7 | loading,
8 | actionPopup,
9 | toggleActions,
10 | modalIsOpen,
11 | error,
12 | commitment,
13 | units,
14 | modalDescription,
15 | allPlanAgents,
16 | agentId,
17 | processId,
18 | closeModal,
19 | toggleModal,
20 | id
21 | }) => {
22 | return (
23 |
27 |
40 |
41 | )};
42 |
43 | export default CommitmentModal;
44 |
--------------------------------------------------------------------------------
/src/mutations/updateEvent.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | export default gql`
4 | mutation ($token: String!, $id: Int!, $start: String!, $requestDistribution: Boolean, $scopeId: Int!, $note: String, $affectedNumericValue: String!, $affectedUnitId: Int! ) {
5 | updateEconomicEvent(
6 | token: $token,
7 | id: $id,
8 | start: $start,
9 | scopeId: $scopeId,
10 | requestDistribution: $requestDistribution,
11 | note: $note,
12 | affectedNumericValue: $affectedNumericValue,
13 | affectedUnitId: $affectedUnitId,
14 | ) {
15 | economicEvent {
16 | action
17 | note
18 | start
19 | id
20 | requestDistribution
21 | scope {
22 | id
23 | }
24 | provider {
25 | name
26 | id
27 | image
28 | }
29 | affectedQuantity {
30 | unit {
31 | id
32 | name
33 | }
34 | numericValue
35 | }
36 | }
37 | }
38 | }`
--------------------------------------------------------------------------------
/src/mutations/createProcess.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const createProcess = gql`
4 | mutation ($token: String!, $planId: Int! $name: String!, $planned: String!, $plannedFinish: String!, $scope: Int!, $note: String ) {
5 | createProcess(
6 | token: $token,
7 | name: $name,
8 | plannedStart: $planned,
9 | plannedFinish: $plannedFinish,
10 | scopeId: $scope,
11 | planId: $planId,
12 | note: $note) {
13 | process {
14 | id
15 | name
16 | note
17 | isDeletable
18 | plannedStart
19 | plannedFinish
20 | isFinished
21 | scope {
22 | id
23 | name
24 | }
25 | committedOutputs {
26 | id
27 | }
28 | committedInputs {
29 | id
30 | }
31 | inputs {
32 | id
33 | }
34 | workingAgents {
35 | id
36 | }
37 | }
38 | }
39 | }`
40 |
41 | export default createProcess
42 |
--------------------------------------------------------------------------------
/src/inventory/wrapper.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { graphql } from 'react-apollo'
3 | import Component from './index'
4 | import InventoryQuery from '../queries/getInventory'
5 | import {compose} from 'recompose'
6 |
7 | class Inventory extends React.Component {
8 | render () {
9 | const {loading, error, data} = this.props
10 | return (
11 | loading ? Loading... : (
12 | error ? API error
: (
13 |
14 | ))
15 | )
16 | }
17 | }
18 |
19 | export default compose(
20 | graphql(InventoryQuery, {
21 | options: (props) => ({ variables: {
22 | token: localStorage.getItem('oce_token')
23 | }}),
24 | props: ({ ownProps, data: { viewer, loading, error, refetch } }) => ({
25 | loading: loading,
26 | error: error,
27 | refetchAgent: refetch, // :NOTE: call this in the component to force reload the data
28 | data: viewer ? viewer.myAgent : null
29 | })})
30 | )(Inventory)
31 |
--------------------------------------------------------------------------------
/src/queries/getProcess.js:
--------------------------------------------------------------------------------
1 | import gql from "graphql-tag";
2 |
3 | const getProcess = gql`
4 | query($token: String, $id: String) {
5 | viewer(token: $token) {
6 | process(id: $id) {
7 | id
8 | name
9 | scope {
10 | name
11 | }
12 | processPlan {
13 | name
14 | due
15 | }
16 | plannedStart
17 | plannedDuration
18 | isFinished
19 | note
20 | userIsAuthorizedToUpdate
21 | userIsAuthorizedToDelete
22 | workingAgents {
23 | id
24 | name
25 | image
26 | }
27 | committedInputs {
28 | note
29 | id
30 | action
31 | resourceClassifiedAs {
32 | name
33 | }
34 | committedQuantity {
35 | unit {
36 | id
37 | name
38 | }
39 | numericValue
40 | }
41 | }
42 | }
43 | }
44 | }
45 | `;
46 |
47 | export default getProcess;
48 |
--------------------------------------------------------------------------------
/src/queries/getCommitment.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const GetCommitment = gql`
4 | query ($token: String, $id: Int!) {
5 | viewer(token: $token) {
6 | commitment(id: $id) {
7 | action
8 | id
9 | note
10 | scope {
11 | id
12 | }
13 |
14 | provider {
15 | id
16 | name
17 | image
18 | }
19 | inputOf {
20 | name
21 | id
22 | }
23 | due
24 | isFinished
25 | involvedAgents {
26 | image
27 | id
28 | name
29 | }
30 | committedQuantity {
31 | unit {
32 | name
33 | id
34 | }
35 | numericValue
36 | }
37 | resourceClassifiedAs {
38 | category
39 | name
40 | }
41 | }
42 | }
43 | viewer(token: $token) {
44 | allUnits {
45 | id
46 | name
47 | symbol
48 | }
49 | }
50 | }`
51 |
52 | export default GetCommitment
53 |
--------------------------------------------------------------------------------
/src/agentPlans/wrapper.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { graphql } from 'react-apollo'
3 | import Component from './index'
4 | import plansQuery from '../queries/getPlans'
5 | import {LoadingMini} from '../components/loading'
6 |
7 | class AgentWrapper extends React.Component {
8 | render () {
9 | const {loading, error, data} = this.props
10 | return (
11 | loading ? : (
12 | error ? API error
: (
13 |
14 | ))
15 | )
16 | }
17 | }
18 |
19 | export default graphql(plansQuery, {
20 | options: (props) => ({ variables: {
21 | token: localStorage.getItem('oce_token'),
22 | id: props.agentProfile ? props.agentProfile : props.match.params.id
23 | }}),
24 | props: ({ ownProps, data: { viewer, loading, error, refetch } }) => ({
25 | loading: loading,
26 | error: error,
27 | refetchAgent: refetch, // :NOTE: call this in the component to force reload the data
28 | data: viewer ? viewer.agent : null
29 | })
30 | })(AgentWrapper)
31 |
--------------------------------------------------------------------------------
/src/components/cardModal/modalTitle/index.js:
--------------------------------------------------------------------------------
1 | import { compose, withState, withHandlers } from 'recompose'
2 | import {graphql} from 'react-apollo'
3 | import UpdateCommitmentTitle from '../../../mutations/updateCommitmentTitle'
4 | import ModalTitle from './modalTitle'
5 | // import {connect} from 'react-redux'
6 |
7 | // const mapStateToProps = state => ({
8 | // state
9 | // })
10 |
11 | export default compose(
12 | graphql(UpdateCommitmentTitle, {
13 | props: ({mutate, ownProps: {id, note}}) => ({
14 | mutate: mutate,
15 | id: id,
16 | note: note
17 | })
18 | }),
19 | withState('isVisible', 'toggleVis', false),
20 | withHandlers({
21 | toggleVisibility: ({ toggleVis, isVisible }) => (event) => toggleVis(!isVisible),
22 | editTitle: ({mutate, id, note}) => (event) => mutate({
23 | variables: {
24 | token: localStorage.getItem('oce_token'),
25 | id: id,
26 | note: event.target.value
27 | }
28 | })
29 | .then(data => console.log(data))
30 | .catch(e => (console.log(e)))
31 | })
32 | )(ModalTitle)
33 |
34 |
--------------------------------------------------------------------------------
/src/agent/wrapper.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { graphql } from "react-apollo";
3 | import Component from "./index";
4 | import agentQuery from "../queries/getAgent";
5 | import { LoadingMini } from "../components/loading";
6 |
7 | class AgentWrapper extends React.Component {
8 | render() {
9 | const { loading, error, data } = this.props;
10 | return loading ? (
11 |
12 | ) : error ? (
13 | API error
14 | ) : (
15 |
16 | );
17 | }
18 | }
19 |
20 | export default graphql(agentQuery, {
21 | options: props => ({
22 | variables: {
23 | token: localStorage.getItem("oce_token"),
24 | id: props.agentProfile ? props.agentProfile : props.match.params.id
25 | }
26 | }),
27 | props: ({ ownProps, data: { viewer, loading, error, refetch } }) => ({
28 | loading: loading,
29 | error: error,
30 | refetchAgent: refetch, // :NOTE: call this in the component to force reload the data
31 | data: viewer ? viewer.agent : null
32 | })
33 | })(AgentWrapper);
34 |
--------------------------------------------------------------------------------
/src/helpers/router.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Route, Redirect } from "react-router-dom";
3 |
4 | export const renderMergedProps = (component, ...rest) => {
5 | const finalProps = Object.assign({}, ...rest);
6 | return React.createElement(component, finalProps);
7 | };
8 |
9 | export const PropsRoute = ({ component, ...rest }) => {
10 | return (
11 | {
14 | return renderMergedProps(component, routeProps, rest);
15 | }}
16 | />
17 | );
18 | };
19 |
20 | export const PrivateRoute = ({ component, redirectTo, ...rest }) => {
21 | const isLoggedIn = localStorage.getItem('oce_token')
22 | return (
23 | {
26 | return isLoggedIn ? (
27 | renderMergedProps(component, routeProps, rest)
28 | ) : (
29 |
35 | );
36 | }}
37 | />
38 | );
39 | };
40 |
--------------------------------------------------------------------------------
/src/agentRelationships/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Icons, Panel, NavigationItem } from "oce-components/build";
3 | import style from "./style.css";
4 | import { NavLink } from "react-router-dom";
5 | import {PropsRoute} from '../helpers/router'
6 | import AgentPlans from '../agentPlans/wrapper'
7 |
8 | const AgentRelationships = props => (
9 |
10 |
} title="Network">
11 |
12 | {props.relationships.map((item, i) => (
13 |
14 |
18 |
19 |
20 |
21 | ))}
22 |
23 |
24 |
25 |
26 | );
27 |
28 | export default AgentRelationships;
29 |
--------------------------------------------------------------------------------
/src/variables.css:
--------------------------------------------------------------------------------
1 | /* COLORS PALETTE */
2 |
3 | $blue_500: #35558F;
4 | $blue_600: #324D7D;
5 |
6 | // NEUTRALS
7 | $n0: #fff;
8 | $n10: #FAFBFC;
9 | $n20: #F4F5F7;
10 | $n30: #EBECF0;
11 | $n40: #DFE1E5;
12 | $n50: #C1C7D0;
13 | $n60: #B3BAC5;
14 | $n70: #A5ADBA;
15 | $n80: #97A0AF;
16 | $n90: #8993A4;
17 | $n100: #7A869A;
18 | $n200: #6C798F;
19 | $n300: #5E6C84;
20 | $n400: #505F79;
21 | $n500: #42526E;
22 | $n600: #344563;
23 | $n700: #253858;
24 | $n800: #172B4D;
25 | $n900: #091E42;
26 |
27 | // BLUES
28 | $b50: #DEEBFF;
29 | $b75: #B2D4FF;
30 | $b100: #4C9AFF;
31 | $b200: #2684FF;
32 | $b300: #0065FF;
33 | $b400: #0052CC;
34 | $b500: #0747A6;
35 |
36 | // GREENS
37 | $g50: #E3FCEF;
38 | $g75: #ABF5D1;
39 | $g100: #79F2C0;
40 | $g200: #57D9A3;
41 | $g300: #36B37E;
42 | $g400: #00875A;
43 | $g500: #006644;
44 |
45 | // YELLOWS
46 | $y50: #FFFAE5;
47 | $y75: #FFF0B2;
48 | $y100: #FFE380;
49 | $y200: #FFC400;
50 | $y300: #FFAB00;
51 | $y400: #FF991F;
52 | $y500: #FF8B00;
53 |
54 | // REDS
55 | $r50: #FFEBE5;
56 | $r75: #FFBDAD;
57 | $r100: #FF8F73;
58 | $r200: #FF7452;
59 | $r300: #FF5630;
60 | $r400: #DE350B;
61 | $r500: #BF2600;
62 |
63 |
--------------------------------------------------------------------------------
/src/components/button/index.css:
--------------------------------------------------------------------------------
1 | /* button {
2 | background: -webkit-linear-gradient(top,#fff 0,#F8F9F9 100%);
3 | background: linear-gradient(to bottom,#fff 0,#F8F9F9 100%);
4 | -moz-box-sizing: border-box;
5 | box-sizing: border-box;
6 | border: 1px solid #E2E4E6;
7 | border-bottom-color: #CDD2D4;
8 | cursor: pointer;
9 | display: block;
10 | font-weight: 700;
11 | height: 34px;
12 | margin-top: 6px;
13 | max-width: 300px;
14 | padding: 7px;
15 | position: relative;
16 | user-select: none;
17 | white-space: nowrap;
18 | border-radius: 3px;
19 | text-decoration: none;
20 | outline: 0;
21 | width: 100%;
22 | } */
23 |
24 | /* .good {
25 | background: #5AAC44 !important;
26 | border-color: 0 1px 0 #519839 !important;
27 | color: #fff !important;
28 | -webkit-transition: backgroun .3s ease !important;
29 | transition: background .3s ease !important;
30 | }
31 |
32 | .negate {
33 | background: #EB5A46 !important;
34 | border-color: #EB5A46 #EB5A46 #B04632 !important;
35 | color: white !important;
36 | }
37 |
38 | .inline {
39 | display: inline-block;
40 | } */
--------------------------------------------------------------------------------
/src/mutations/createEvent.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag';
2 |
3 | export default gql`
4 | mutation ($token: String!, $providerId: Int, $receiverId: Int, $action: String!, $requestDistribution: Boolean, $start: String, $scopeId: Int!, $commitmentId: Int!, $note: String, $affectedNumericValue: String!, $affectedUnitId: Int! ) {
5 | createEconomicEvent(
6 | token: $token,
7 | action: $action,
8 | start: $start,
9 | providerId: $providerId,
10 | receiverId: $receiverId,
11 | scopeId: $scopeId,
12 | requestDistribution: $requestDistribution,
13 | fulfillsCommitmentId: $commitmentId,
14 | note: $note,
15 | affectedNumericValue: $affectedNumericValue,
16 | affectedUnitId: $affectedUnitId,
17 | ) {
18 | economicEvent {
19 | action
20 | requestDistribution
21 | start
22 | id
23 | note
24 | provider {
25 | name
26 | image
27 | id
28 | }
29 | scope {
30 | id
31 | }
32 | affectedQuantity {
33 | numericValue
34 | unit {
35 | id
36 | name
37 | }
38 | }
39 | }
40 | }
41 | }
42 | `
--------------------------------------------------------------------------------
/src/validate/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import {Icons, Panel, NavigationItem} from 'oce-components/build'
3 | import style from './style.css'
4 | import { BrowserRouter as Router, Route, NavLink } from "react-router-dom"
5 |
6 | // ROUTES
7 | import AgentPlans from '../agentValidationPlans/wrapper'
8 |
9 | const Validate = (props) => {
10 | return (
11 |
12 |
13 |
} title='Network'>
14 |
15 | {props.agentData.data.agentRelationships.map((item, i) => (
16 |
17 |
18 |
19 |
20 |
21 | ))}
22 |
23 |
24 |
25 |
26 |
27 | )
28 | }
29 |
30 | export default Validate
31 |
--------------------------------------------------------------------------------
/src/work/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import {Icons, Panel, NavigationItem} from 'oce-components/build'
3 | import style from './style.css'
4 | import { BrowserRouter as Router, Route, NavLink } from "react-router-dom"
5 | import Canvas from '../canvas/wrapper'
6 | import AgentRelationships from '../agentRelationships'
7 | import {PropsRoute} from '../helpers/router'
8 |
9 | // ROUTES
10 | import AgentPlans from '../agentPlans/wrapper'
11 |
12 | const Work = (props) => {
13 | return (
14 |
15 |
16 |
17 | {/*
*/}
18 |
19 | {/*
*/}
20 | {/*
} /> */}
21 |
22 |
23 | )
24 | }
25 |
26 | export default Work
27 |
--------------------------------------------------------------------------------
/src/store/index.js:
--------------------------------------------------------------------------------
1 | import {ApolloClient} from 'apollo-client'
2 | import {HttpLink} from 'apollo-link-http'
3 | import {InMemoryCache, IntrospectionFragmentMatcher} from 'apollo-cache-inmemory'
4 | import introspectionQueryResultData from '../fragmentTypes.json'
5 | import { defaults, resolvers } from "./resolvers";
6 | import {withClientState} from 'apollo-link-state'
7 | import {ApolloLink} from 'apollo-link'
8 |
9 | const fragmentMatcher = new IntrospectionFragmentMatcher({
10 | introspectionQueryResultData
11 | })
12 |
13 | const cache = new InMemoryCache({
14 | dataIdFromObject: object => {
15 | const dataId = object.id ? `${object.__typename}-${object.id}` : null
16 | return dataId},
17 | addTypename: true,
18 | fragmentMatcher
19 | })
20 |
21 | const stateLink = withClientState({
22 | cache,
23 | defaults: defaults,
24 | resolvers: resolvers
25 | })
26 |
27 | const link = ApolloLink.from([
28 | stateLink,
29 | new HttpLink({
30 | // uri: 'https://ocp.freedomcoop.eu/api/graph'
31 | uri: 'https://testocp.freedomcoop.eu/api/graph'
32 | })
33 | ])
34 |
35 | export const client = new ApolloClient({
36 | link,
37 | cache: cache.restore(window.__APOLLO_CLIENT__),
38 | ssrMode: true,
39 | ssrForceFetchDelay: 100,
40 | connectToDevTools: true,
41 | queryDeduplication: true
42 | })
43 |
44 |
--------------------------------------------------------------------------------
/src/store/resolvers.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag';
2 |
3 | export const defaults = {
4 | notifications: [],
5 | };
6 |
7 |
8 | let nextNotifId = 0;
9 |
10 | export const resolvers = {
11 | Mutation: {
12 | addNotification: (_, {message, type}, {cache}) => {
13 | let newId = nextNotifId++
14 | const query = gql`
15 | query GetNotifications {
16 | notifications @client {
17 | __typename
18 | id
19 | message
20 | type
21 | }
22 | }
23 | `
24 | const previousState = cache.readQuery({query})
25 | const newNotif = {
26 | id: newId,
27 | message,
28 | type,
29 | __typename: 'Notification'
30 | }
31 | const data = {
32 | notifications: previousState.notifications.concat([newNotif])
33 | }
34 | cache.writeQuery({query, data: data})
35 | return newNotif
36 | },
37 | deleteNotification: (_, {id}, {cache}) => {
38 | const query = gql`
39 | query GetNotifications {
40 | notifications @client {
41 | __typename
42 | id
43 | message
44 | type
45 | }
46 | }
47 | `
48 | const previousState = cache.readQuery({query})
49 | const data = {
50 | notifications: previousState.notifications.filter(item => item.id !== id)
51 | }
52 | cache.writeQuery({query, data})
53 | return data
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/src/components/cards/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import style from './style.css'
3 | import { Link } from 'react-router-dom'
4 | import moment from 'moment'
5 | import {withRouter} from 'react-router-dom'
6 | const Cards = ({data, link, match, location}) => {
7 | let newData = data.map(x => ({...x, date: moment(x.plannedOn).unix()}))
8 | return (
9 |
10 | {newData
11 | .sort((a, b) => b.date - a.date)
12 | .map((org, i) => (
13 |
14 |
15 |
{org.name.length > 0 ? org.name : org.planProcesses[0].name}
16 |
{org.note}
17 |
18 | Due {moment(org.due).format('DD MMM YYYY')}
19 | {/*
20 | {org.planProcesses[0].isFinished ? 'Completed' : org.planProcesses[0].isStarted ? 'In Progress' : 'To do' }
21 | */}
22 |
23 |
24 |
25 | ))}
26 |
27 | )
28 | }
29 |
30 | export default withRouter(Cards)
31 |
--------------------------------------------------------------------------------
/src/mutations/updateCommitment.js:
--------------------------------------------------------------------------------
1 | import gql from "graphql-tag";
2 |
3 | const updateCommitment = gql`
4 | mutation(
5 | $token: String!
6 | $id: Int!
7 | $note: String
8 | $due: String
9 | $committedResourceClassifiedAsId: Int
10 | $committedUnitId: Int
11 | $committedNumericValue: String
12 | $action: String
13 | $isFinished: Boolean
14 | ) {
15 | updateCommitment(
16 | token: $token
17 | note: $note
18 | id: $id
19 | due: $due
20 | isFinished: $isFinished
21 | action: $action
22 | committedResourceClassifiedAsId: $committedResourceClassifiedAsId
23 | committedUnitId: $committedUnitId
24 | committedNumericValue: $committedNumericValue
25 | ) {
26 | commitment {
27 | id
28 | note
29 | isFinished
30 | due
31 | committedQuantity {
32 | unit {
33 | name
34 | }
35 | numericValue
36 | }
37 | resourceClassifiedAs {
38 | category
39 | name
40 | }
41 | fulfilledBy {
42 | fulfilledBy {
43 | action
44 | start
45 | id
46 | requestDistribution
47 | note
48 | provider {
49 | id
50 | name
51 | image
52 | }
53 | }
54 | }
55 | inputOf {
56 | id
57 | }
58 | }
59 | }
60 | }
61 | `;
62 |
63 | export default updateCommitment;
64 |
--------------------------------------------------------------------------------
/src/inventory/style.css:
--------------------------------------------------------------------------------
1 |
2 | .agent {
3 | padding: 20px;
4 | lost-utility: clearfix;
5 | /* margin-top: 40px; */
6 | }
7 |
8 | .agent_profile {
9 | lost-column: 6/12;
10 | lost-offset: 3/12;
11 | }
12 |
13 | .section_wrapper {
14 | margin-top: 40px;
15 | }
16 |
17 | .info_data {
18 | float: left;
19 | }
20 |
21 |
22 | .info_note {
23 | font-size: 14px;
24 | margin:0;
25 | line-height: 22px;
26 | display: grid;
27 | }
28 |
29 | .info_data {
30 | float: left;
31 | }
32 |
33 |
34 | .info_title {
35 | /* float: left; */
36 | /* lost-column:1/1; */
37 | /* display: table-cell; */
38 | font-size: 26px;
39 | font-weight: 500;
40 | letter-spacing: .5px;
41 | height: 40px;
42 | line-height: 40px;
43 | margin: 0;
44 | color: #161515;
45 | margin-bottom: 10px;
46 | }
47 |
48 | .agent_menu {
49 | margin-top: 40px;
50 | lost-column: 8/10;
51 | lost-offset: 1/10;
52 | padding-bottom: 10px;
53 | border-bottom: 1px solid #DEDEDE;
54 | }
55 |
56 |
57 | .agent_sidebar {
58 | background: white;
59 | box-shadow: 0 1px 2px rgba(0,0,0,.25);
60 | border-radius: 2px;
61 | padding: 10px;
62 | }
63 |
64 |
65 | .agent_sidebar_wrapper {
66 | lost-column: 2/12;
67 | lost-offset: 1/12;
68 |
69 | }
70 |
71 | .agent_info {
72 | /* lost-column: 8/10;
73 | lost-offset: 1/10; */
74 | lost-utility:clearfix;
75 | display: table;
76 | }
77 |
78 | .item_member {
79 | lost-column: 1/5;
80 | margin-bottom: 20px;
81 | }
82 |
--------------------------------------------------------------------------------
/src/network/wrapper.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { graphql } from 'react-apollo'
3 | import Component from './index'
4 | import agentQuery from '../queries/getRelationships'
5 | import orgsQuery from '../queries/getOrganizations'
6 | import {compose} from 'recompose'
7 |
8 | class NetworkWrapper extends React.Component {
9 | render () {
10 | const {loading, orgsloading, orgserror, error, data, orgs} = this.props
11 | return (
12 | loading || orgsloading ? Loading... : (
13 | error || orgserror ? API error
: (
14 |
15 | ))
16 | )
17 | }
18 | }
19 |
20 | export default compose(
21 | graphql(orgsQuery, {
22 | options: (props) => ({ variables: {
23 | token: localStorage.getItem('oce_token')
24 | }}),
25 | props: ({ ownProps, data: { viewer, loading, error, refetch } }) => ({
26 | orgsloading: loading,
27 | orgserror: error,
28 | refetchAgent: refetch, // :NOTE: call this in the component to force reload the data
29 | orgs: viewer ? viewer.fcOrganizations : null
30 | })}),
31 | graphql(agentQuery, {
32 | options: (props) => ({ variables: {
33 | token: localStorage.getItem('oce_token')
34 | }}),
35 | props: ({ ownProps, data: { viewer, loading, error, refetch } }) => ({
36 | loading: loading,
37 | error: error,
38 | refetchAgent: refetch, // :NOTE: call this in the component to force reload the data
39 | data: viewer ? viewer.myAgent : null
40 | })}
41 | ))(NetworkWrapper)
42 |
--------------------------------------------------------------------------------
/src/canvas/style.css:
--------------------------------------------------------------------------------
1 | .canvasWrapper {
2 | position: relative;
3 | min-height: 100vh;
4 | margin-bottom: 20px;
5 | }
6 |
7 | .wrapperContainer {
8 | user-select: text;
9 | white-space: nowrap;
10 | overflow-x: auto;
11 | overflow-y: hidden;
12 | position: absolute;
13 | top: 0;
14 | right: 0;
15 | bottom: 0;
16 | left: 0;
17 | }
18 |
19 | .right_button {
20 | background: #1c1d1f;
21 | border-radius: 4px;
22 | padding: 0 15px;
23 | height: 30px;
24 | display: inline-block;
25 | margin-top: 5px;
26 | margin-right: 10px;
27 | line-height: 30px;
28 | color: #fafafa;
29 | text-decoration: none;
30 | font-size: 14px;
31 | margin-left: 10px;
32 | }
33 |
34 | .right_button span {
35 | margin-right: 5px;
36 | vertical-align: sub;
37 | }
38 |
39 | .headerLink {
40 | color: #f0f0f0;
41 | }
42 |
43 | .buttonIcon {
44 | line-height: 28px;
45 | vertical-align: sub;
46 | }
47 |
48 |
49 | .errorEmoji {
50 | text-align: center;
51 | }
52 |
53 | .errorWrapper {
54 | margin-top: 100px;
55 | }
56 |
57 | .errorWrapperTitle {
58 | text-align: center;
59 | font-size: 28px;
60 | color: #fafafa;
61 | }
62 |
63 | .errorWrapperDesc {
64 | text-align: center;
65 | font-size: 18px;
66 | color: #fafafacc;
67 | font-weight: 400;
68 | }
69 |
70 | .errorLink {
71 | background: #2588d0;
72 | padding: 0 10px;
73 | height: 40px;
74 | display: block;
75 | width: 100px;
76 | line-height: 40px;
77 | text-align: center;
78 | margin: 0 auto;
79 | margin-top: 40px;
80 | text-decoration: none;
81 | border-radius: 4px;
82 | color: white;
83 | }
--------------------------------------------------------------------------------
/src/queries/getEventClaim.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const GetEventClaim = gql`
4 | query ($token: String, $id: Int!) {
5 | viewer(token: $token) {
6 | economicEvent(id: $id) {
7 | scope {
8 | id
9 | name
10 | }
11 | fulfills {
12 | fulfills {
13 | id
14 | note
15 | action
16 | committedQuantity {
17 | numericValue
18 | unit {
19 | name
20 | }
21 | }
22 | }
23 | }
24 | inputOf {
25 | name
26 | id
27 | processPlan {
28 | id
29 | name
30 | }
31 | }
32 | id
33 | action
34 | validations {
35 | id
36 | validatedBy {
37 | name
38 | id
39 | }
40 | }
41 | start
42 | affectedQuantity {
43 | numericValue
44 | unit {
45 | name
46 | }
47 | }
48 | affects {
49 | resourceClassifiedAs {
50 | name
51 | category
52 | }
53 | trackingIdentifier
54 | }
55 | provider {
56 | id
57 | name
58 | image
59 | }
60 | receiver {
61 | id
62 | name
63 | }
64 | note
65 | }
66 |
67 | }
68 | }`
69 |
70 | export default GetEventClaim
71 |
--------------------------------------------------------------------------------
/src/mutations/CreateCommitment.js:
--------------------------------------------------------------------------------
1 | import gql from "graphql-tag";
2 |
3 | const createCommitment = gql`
4 | mutation(
5 | $token: String!
6 | $inputOfId: Int
7 | $outputOfId: Int
8 | $committedUnitId: Int!
9 | $due: String!
10 | $action: String!
11 | $planId: Int
12 | $note: String
13 | $committedNumericValue: String!
14 | $committedResourceClassifiedAsId: Int!
15 | $providerId: Int
16 | $scopeId: Int
17 | ) {
18 | createCommitment(
19 | token: $token
20 | inputOfId: $inputOfId
21 | outputOfId: $outputOfId
22 | committedUnitId: $committedUnitId
23 | due: $due
24 | action: $action
25 | note: $note
26 | committedResourceClassifiedAsId: $committedResourceClassifiedAsId
27 | planId: $planId
28 | scopeId: $scopeId
29 | committedNumericValue: $committedNumericValue
30 | providerId: $providerId
31 | ) {
32 | commitment {
33 | action
34 | id
35 | note
36 | fulfilledBy {
37 | fulfilledQuantity {
38 | numericValue
39 | }
40 | }
41 | inputOf {
42 | id
43 | name
44 | }
45 | outputOf {
46 | id
47 | name
48 | }
49 | due
50 | isFinished
51 | involvedAgents {
52 | image
53 | id
54 | name
55 | }
56 | committedQuantity {
57 | unit {
58 | id
59 | name
60 | }
61 | numericValue
62 | }
63 | resourceClassifiedAs {
64 | category
65 | name
66 | }
67 | }
68 | }
69 | }
70 | `;
71 |
72 | export default createCommitment;
73 |
--------------------------------------------------------------------------------
/src/queries/getCommitmentClaim.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const GetCommitmentClaim = gql`
4 | query ($token: String, $id: Int!) {
5 | viewer(token: $token) {
6 | commitment(id: $id) {
7 | inputOf {
8 | name
9 | id
10 | processPlan {
11 | id
12 | name
13 | }
14 | }
15 | note
16 | id
17 | scope {
18 | id
19 | name
20 | }
21 | action
22 | resourceClassifiedAs{
23 | name
24 | }
25 | committedQuantity {
26 | unit {
27 | name
28 | }
29 | numericValue
30 | }
31 | fulfilledBy(requestDistribution: true) {
32 | fulfilledBy {
33 | id
34 | action
35 | validations {
36 | id
37 | validatedBy {
38 | name
39 | id
40 | }
41 | }
42 | start
43 | inputOf {
44 | name
45 | }
46 | affectedQuantity {
47 | numericValue
48 | unit {
49 | name
50 | }
51 | }
52 | affects {
53 | resourceClassifiedAs {
54 | name
55 | category
56 | }
57 | trackingIdentifier
58 | }
59 | provider {
60 | id
61 | name
62 | image
63 | }
64 | receiver {
65 | id
66 | name
67 | }
68 | note
69 | }
70 | }
71 | }
72 | }
73 | }`
74 |
75 | export default GetCommitmentClaim
76 |
--------------------------------------------------------------------------------
/src/queries/getAgent.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const agentQuery = gql`
4 | query ($token: String, $id: Int) {
5 | viewer(token: $token) {
6 | agent(id: $id) {
7 | id
8 | name
9 | image
10 | note
11 | type
12 | agentRelationships {
13 | object {
14 | id
15 | name
16 | image
17 | }
18 | subject {
19 | name
20 | image
21 | id
22 | }
23 | }
24 | ownedEconomicResources {
25 | resourceClassifiedAs {
26 | name
27 | category
28 | }
29 | currentQuantity {
30 | numericValue
31 | unit {
32 | name
33 | }
34 | }
35 | }
36 | agentEconomicEvents(latestNumberOfDays: 30) {
37 | note
38 | action
39 | provider {
40 | image
41 | name
42 | }
43 | inputOf {
44 | name
45 | }
46 | receiver {
47 | name
48 | }
49 | start
50 | requestDistribution
51 | note
52 | affectedQuantity {
53 | numericValue
54 | unit {
55 | name
56 | }
57 | }
58 | }
59 | agentPlans (isFinished: false) {
60 | name
61 | id
62 | note
63 | due
64 | plannedOn
65 | planProcesses {
66 | isStarted
67 | isFinished
68 | name
69 | workingAgents {
70 | id
71 | name
72 | image
73 | }
74 | }
75 | }
76 | }
77 | }
78 | }
79 | `
80 |
81 | export default agentQuery
82 |
--------------------------------------------------------------------------------
/src/components/planModal/style.css:
--------------------------------------------------------------------------------
1 | .planModal {
2 | padding: 20px;
3 | padding-bottom: 0;
4 | }
5 |
6 | .form_input {
7 | margin-bottom: 10px;
8 | }
9 |
10 | .form_note {
11 | height: 150px;
12 | margin-bottom: 10px;
13 | }
14 |
15 | .archiveTitle {
16 | font-size: 16px;
17 | font-weight: 600;
18 | margin-top: 0px;
19 | }
20 |
21 | .archiveDesc {
22 | font-size: 14px;
23 | margin: 0;
24 | margin-bottom: 10px;
25 | }
26 |
27 | .formWrapper {
28 | padding-bottom: 20px;
29 | }
30 |
31 | .deletePlanWrapper {
32 | background: gainsboro;
33 | border-radius: 4px;
34 | padding: 10px;
35 | }
36 |
37 | .message {
38 | font-size: 14px;
39 | }
40 |
41 | .message span {
42 | margin-right: 10px;
43 | vertical-align: sub;
44 | }
45 |
46 |
47 |
48 | .dates {
49 | background: #ebebeb;
50 | height: 50px;
51 | border-bottom-left-radius: 3px;
52 | border-bottom-right-radius: 3px;
53 | }
54 |
55 | .dateWrapper {
56 | margin-top: 6px;
57 | margin-left: 5px;
58 | display: inline-block;
59 | }
60 |
61 | .dateName {
62 | margin: 0;
63 | /* float: left; */
64 | margin-left: 5px;
65 | padding-right: 0px;
66 | /* border-right: 1px solid rgba(255, 255, 255, .32157); */
67 | /* line-height: 40px; */
68 | font-weight: 400;
69 | color: #707b97;
70 | letter-spacing: .5px;
71 | font-size: 13px;
72 | }
73 |
74 | .dateWrapper > div:first-of-type {
75 | float: left;
76 | border: none;
77 | }
78 |
79 | .dateWrapper div input {
80 | border: none;
81 | background: none;
82 | text-indent: 10px;
83 | font-size: 13px;
84 | color: #707b97;
85 | font-weight: 600;
86 | text-align: left;
87 | width: 100px;
88 | padding: 0;
89 | margin: 0;
90 | text-indent: 0;
91 | margin-left: 5px;
92 | }
--------------------------------------------------------------------------------
/src/queries/getClaim.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const GetClaim = gql`
4 | query ($token: String, $id: Int) {
5 | viewer(token: $token) {
6 | plan(id: $id) {
7 | name
8 | id
9 | plannedOn
10 | scope {
11 | id
12 | name
13 | }
14 | planProcesses {
15 | name
16 | id
17 | committedInputs(action: WORK) {
18 | note
19 | id
20 | action
21 | resourceClassifiedAs{
22 | name
23 | }
24 | committedQuantity {
25 | unit {
26 | name
27 | }
28 | numericValue
29 | }
30 | fulfilledBy(requestDistribution: true) {
31 | fulfilledBy {
32 | id
33 | action
34 | validations {
35 | id
36 | validatedBy {
37 | name
38 | id
39 | }
40 | }
41 | start
42 | inputOf {
43 | id
44 | name
45 | }
46 | affectedQuantity {
47 | numericValue
48 | unit {
49 | name
50 | }
51 | }
52 | affects {
53 | resourceClassifiedAs {
54 | name
55 | category
56 | }
57 | trackingIdentifier
58 | }
59 | provider {
60 | id
61 | name
62 | image
63 | }
64 | receiver {
65 | id
66 | name
67 | }
68 | note
69 | }
70 | }
71 | }
72 | }
73 | }
74 | }
75 | }
76 | `
77 |
78 | export default GetClaim
79 |
--------------------------------------------------------------------------------
/src/queries/getProcessClaim.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const GetProcessClaim = gql`
4 | query ($token: String, $id: Int) {
5 | viewer(token: $token) {
6 | process(id: $id) {
7 | name
8 | id
9 | processPlan {
10 | id
11 | name
12 | }
13 | scope {
14 | id
15 | name
16 | }
17 | committedInputs(action: WORK) {
18 | note
19 | id
20 | action
21 | resourceClassifiedAs{
22 | name
23 | }
24 | committedQuantity {
25 | unit {
26 | name
27 | }
28 | numericValue
29 | }
30 | fulfilledBy(requestDistribution: true) {
31 | fulfilledBy {
32 | id
33 | action
34 | validations {
35 | id
36 | validatedBy {
37 | name
38 | id
39 | }
40 | }
41 | start
42 | inputOf {
43 | name
44 | }
45 | affectedQuantity {
46 | numericValue
47 | unit {
48 | name
49 | }
50 | }
51 | affects {
52 | resourceClassifiedAs {
53 | name
54 | category
55 | }
56 | trackingIdentifier
57 | }
58 | provider {
59 | id
60 | name
61 | image
62 | }
63 | receiver {
64 | id
65 | name
66 | }
67 | note
68 | }
69 | }
70 | }
71 | }
72 | }
73 | }
74 | `
75 |
76 | export default GetProcessClaim
77 |
--------------------------------------------------------------------------------
/src/planCanvas/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import {Panel, Icons} from 'oce-components/build'
3 | import Bin from '../components/bin'
4 |
5 | export default () => (
6 |
7 |
} title='Processes flow'>
8 |
console.log('hello')}
14 | actionPopup={() => console.log('hello')}
15 | actionPopupId={() => console.log('hello')}
16 | toggleActions={() => console.log('hello')}
17 | cards={[]}
18 | outputs={[]}
19 | status={false}
20 | openModal={() => console.log('hello')}
21 | />
22 | console.log('hello')}
28 | actionPopup={() => console.log('hello')}
29 | actionPopupId={() => console.log('hello')}
30 | toggleActions={() => console.log('hello')}
31 | cards={[]}
32 | outputs={[]}
33 | status={false}
34 | openModal={() => console.log('hello')}
35 | />
36 | console.log('hello')}
42 | actionPopup={() => console.log('hello')}
43 | actionPopupId={() => console.log('hello')}
44 | toggleActions={() => console.log('hello')}
45 | cards={[]}
46 | outputs={[]}
47 | status={false}
48 | openModal={() => console.log('hello')}
49 | />
50 |
51 |
52 | )
53 |
--------------------------------------------------------------------------------
/src/components/feed/feed.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import style from "./index.css";
3 | import moment from "moment";
4 |
5 | export default function({ feed }) {
6 | console.log(feed);
7 | return (
8 |
9 | {feed.map((item, i) => (
10 |
11 |
12 |
13 |
20 |
21 |
22 |
23 |
{item.provider.name}{" "}
24 | {item.action + " " + item.affectedQuantity.numericValue + " "}
of {item
25 | .affectedQuantity.unit
26 | ? item.affectedQuantity.unit.name
27 | : ""}
28 |
{item.note}
29 |
30 | {moment(item.start).format("DD MMM")} -{" "}
31 | {item.requestDistribution ? (
32 |
33 | Payed
34 |
35 | ) : (
36 |
39 | Voluntary
40 |
41 | )} -{" "}
42 | {item.receiver ?
43 | {item.receiver.name}
44 | : null}
45 |
46 |
47 |
48 | ))}
49 |
50 | );
51 | }
52 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
11 |
12 |
13 |
14 |
23 | 🌎 | Economic Dashboard
24 |
25 |
26 |
29 |
30 |
31 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/queries/getPlan.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const Plan = gql`
4 | query ($token: String, $planId: Int) {
5 | viewer(token: $token) {
6 | plan(id: $planId) {
7 | id
8 | name
9 | note
10 | due
11 | plannedOn
12 | isDeletable
13 | scope {
14 | id
15 | name
16 | }
17 | planProcesses {
18 | note
19 | id
20 | isFinished
21 | name
22 | isDeletable
23 | plannedStart
24 | plannedFinish
25 | scope {
26 | id
27 | name
28 | }
29 | committedOutputs {
30 | id
31 | action
32 | note
33 | due
34 | involvedAgents {
35 | image
36 | id
37 | name
38 | }
39 | inputOf {
40 | id
41 | name
42 | }
43 | outputOf {
44 | id
45 | name
46 | }
47 | committedQuantity {
48 | unit {
49 | name
50 | id
51 | }
52 | numericValue
53 | }
54 | resourceClassifiedAs {
55 | name
56 | }
57 | }
58 | committedInputs {
59 | action
60 | id
61 | note
62 | inputOf {
63 | id
64 | name
65 | }
66 | outputOf {
67 | id
68 | name
69 | }
70 | due
71 | isFinished
72 | involvedAgents {
73 | image
74 | id
75 | name
76 | }
77 | committedQuantity {
78 | unit {
79 | id
80 | name
81 | }
82 | numericValue
83 | }
84 | resourceClassifiedAs {
85 | category
86 | name
87 | }
88 | }
89 | }
90 | }
91 | }
92 | }
93 | `
94 | export default Plan
95 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import Login from './login/'
4 | import { Query, graphql } from 'react-apollo';
5 | import registerServiceWorker from './registerServiceWorker'
6 | import {BrowserRouter as Router,
7 | Route,
8 | Switch
9 | } from 'react-router-dom'
10 | import { compose, withHandlers } from "recompose";
11 | import {ApolloProvider} from 'react-apollo'
12 | import {client} from './store'
13 | import AppTemplate from './templates/AppTemplate'
14 | import style from './base.css'
15 | import {PrivateRoute} from './helpers/router'
16 | import {Notifications} from 'oce-components/build'
17 | import getNotification from './queries/getNotifications';
18 | import updateNotification from "./mutations/updateNotification";
19 | import deleteNotification from "./mutations/deleteNotification";
20 | const NoMatch = ({ location }) => (
21 |
22 |
23 | No match for {location.pathname}
24 |
25 |
26 | )
27 |
28 | const NotificationsTemplate = (props) => {
29 | return (
30 |
31 |
35 |
36 | )}
37 |
38 | const EhnanchedNotifications = compose(
39 | graphql(updateNotification, {name: 'updateNotification'}),
40 | graphql(deleteNotification, {name: 'deleteNotification'}),
41 | )(NotificationsTemplate)
42 |
43 | ReactDOM.render(
44 |
45 |
46 |
47 |
48 | {({ data: {notifications} }) => {
49 | return (
50 |
51 | )}}
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | ,
61 | document.getElementById('root')
62 | )
63 | registerServiceWorker()
64 |
--------------------------------------------------------------------------------
/config/paths.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const path = require('path');
4 | const fs = require('fs');
5 | const url = require('url');
6 |
7 | // Make sure any symlinks in the project folder are resolved:
8 | // https://github.com/facebookincubator/create-react-app/issues/637
9 | const appDirectory = fs.realpathSync(process.cwd());
10 | const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
11 |
12 | const envPublicUrl = process.env.PUBLIC_URL;
13 |
14 | function ensureSlash(path, needsSlash) {
15 | const hasSlash = path.endsWith('/');
16 | if (hasSlash && !needsSlash) {
17 | return path.substr(path, path.length - 1);
18 | } else if (!hasSlash && needsSlash) {
19 | return `${path}/`;
20 | } else {
21 | return path;
22 | }
23 | }
24 |
25 | const getPublicUrl = appPackageJson =>
26 | envPublicUrl || require(appPackageJson).homepage;
27 |
28 | // We use `PUBLIC_URL` environment variable or "homepage" field to infer
29 | // "public path" at which the app is served.
30 | // Webpack needs to know it to put the right