How to use olymp-utils - 10 common examples

To help you get started, we’ve selected a few olymp-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github olymp / olymp / packages / google / analytics / route.tsx View on Github external
CartesianGrid,
  XAxis,
  YAxis,
  Legend,
  Tooltip,
} from 'recharts';

const StyledLineChart = createComponent(
  () => ({
    '& svg': {},
  }),
  LineChart,
  p => Object.keys(p)
);

export const queryTemplate = graphql(
  gql`
    query analyticsPageviews {
      item: analyticsPageviews(
        start: "180daysAgo"
        end: "today"
        time: MONTH
        sort: DATE
      ) {
        id
        pageviews
        sessions
        rows {
          id
          pageTitle
          pageviews
          sessions
github olymp / olymp / packages / athena / templates / gql / query.tsx View on Github external
import { graphql, gql } from 'olymp-utils';

export const queryTemplate = graphql(
  gql`
  query template($id: String) {
    item: template(id: $id) {
      id name text
    }
  }
`,
  {
    options: ({ id }) => ({ variables: { id } }),
    props: ({ ownProps, data }) => ({
      ...ownProps,
      data,
      item: data.item || {},
    }),
  }
);
github olymp / olymp / packages / google / analytics / route.js View on Github external
CartesianGrid,
  XAxis,
  YAxis,
  Legend,
  Tooltip,
} from 'recharts';

const StyledLineChart = createComponent(
  () => ({
    '& svg': {},
  }),
  LineChart,
  p => Object.keys(p)
);

export const queryTemplate = graphql(
  gql`
    query analyticsPageviews {
      item: analyticsPageviews(
        start: "180daysAgo"
        end: "today"
        time: MONTH
        sort: DATE
      ) {
        id
        pageviews
        sessions
        rows {
          id
          pageTitle
          pageviews
          sessions
github olymp / olymp / packages / athena / templates / gql / query.js View on Github external
import { graphql, gql } from 'olymp-utils';

export const queryTemplate = graphql(
  gql`
  query template($id: String) {
    item: template(id: $id) {
      id name text
    }
  }
`,
  {
    options: ({ id }) => ({ variables: { id } }),
    props: ({ ownProps, data }) => ({
      ...ownProps,
      data,
      item: data.item || {},
    }),
  }
);
github olymp / olymp / packages / pages / gql / mutation.tsx View on Github external
mutation reorderPage($id: String, $sorting: [String]) {
      item: page(id: $id, input: { sorting: $sorting }) {
        id
        sorting
      }
    }
  `,
  {
    props: ({ ownProps, mutate }) => ({
      ...ownProps,
      reorder: mutate,
    }),
  }
);

export const movePage = graphql(
  gql`
    mutation movePage($id: String, $parentId: String, $sorting: [String]) {
      item: page(id: $parentId, input: { sorting: $sorting }) {
        id
        sorting
      }
      item2: page(id: $id, input: { parentId: $parentId }) {
        id
        parentId
      }
    }
  `,
  {
    props: ({ ownProps, mutate }) => ({
      ...ownProps,
      move: mutate,
github olymp / olymp / packages / pages / gql / mutation.js View on Github external
.catch(onError);
    });
}; };
export default graphql((_a = ["\n    mutation page($id: String, $input: PageInput) {\n      item: page(id: $id, input: $input) {\n        id\n        slug\n        order\n        name\n        type\n        binding {\n          id\n          type\n          query\n          fields\n        }\n        aliasId\n        href\n        sorting\n        parentId\n        blocks\n        state\n      }\n    }\n  "], _a.raw = ["\n    mutation page($id: String, $input: PageInput) {\n      item: page(id: $id, input: $input) {\n        id\n        slug\n        order\n        name\n        type\n        binding {\n          id\n          type\n          query\n          fields\n        }\n        aliasId\n        href\n        sorting\n        parentId\n        blocks\n        state\n      }\n    }\n  "], gql(_a)), {
    props: function (_a) {
        var ownProps = _a.ownProps, mutate = _a.mutate;
        return (__assign({}, ownProps, { save: ok(ownProps, mutate), mutate: mutate }));
    },
});
export var reorderPage = graphql((_b = ["\n    mutation reorderPage($id: String, $sorting: [String]) {\n      item: page(id: $id, input: { sorting: $sorting }) {\n        id\n        sorting\n      }\n    }\n  "], _b.raw = ["\n    mutation reorderPage($id: String, $sorting: [String]) {\n      item: page(id: $id, input: { sorting: $sorting }) {\n        id\n        sorting\n      }\n    }\n  "], gql(_b)), {
    props: function (_a) {
        var ownProps = _a.ownProps, mutate = _a.mutate;
        return (__assign({}, ownProps, { reorder: mutate }));
    },
});
export var movePage = graphql((_c = ["\n    mutation movePage($id: String, $parentId: String, $sorting: [String]) {\n      item: page(id: $parentId, input: { sorting: $sorting }) {\n        id\n        sorting\n      }\n      item2: page(id: $id, input: { parentId: $parentId }) {\n        id\n        parentId\n      }\n    }\n  "], _c.raw = ["\n    mutation movePage($id: String, $parentId: String, $sorting: [String]) {\n      item: page(id: $parentId, input: { sorting: $sorting }) {\n        id\n        sorting\n      }\n      item2: page(id: $id, input: { parentId: $parentId }) {\n        id\n        parentId\n      }\n    }\n  "], gql(_c)), {
    props: function (_a) {
        var ownProps = _a.ownProps, mutate = _a.mutate;
        return (__assign({}, ownProps, { move: mutate }));
    },
});
var _a, _b, _c;
//# sourceMappingURL=mutation.js.map
github olymp / olymp / example / olymp / app / tree.js View on Github external
data.item.children &&
            data.item.children.map(this.renderNode)}
        
      );
    }
    return null;
  }
}

export const TreeItem = graphql(query, {
  options: ({ id }) => ({
    variables: { id },
  }),
})(TreeCore);

const Tree = graphql(query, {
  options: ({ type }) => ({
    variables: {
      id: type,
    },
  }),
})(TreeCore);

export default Tree;
github olymp / olymp / packages / pages / gql / query.js View on Github external
binding {
        id
        type
        query
        fields
      }
      parentId
      sorting
      aliasId
      href
      blocks
      state
    }
  }
`;
export default graphql(queryOne, {
  options: ({ id, pageId, query }) => ({
    variables: { id: pageId || getId(id, query) },
    fetchPolicy: isNew({ query }) ? 'cache-only' : undefined,
  }),
  props: ({ ownProps, data }) => ({
    ...ownProps,
    item: (isNew(ownProps) ? {} : data.item) || {},
    data,
  }),
});

export const prefetchPage = (client, id) =>
  client.query({
    query: queryOne,
    variables: { id },
  });
github olymp / olymp / packages / pages / gql / query.tsx View on Github external
binding {
        id
        type
        query
        fields
      }
      parentId
      sorting
      aliasId
      href
      blocks
      state
    }
  }
`;
export default graphql(queryOne, {
  options: ({ id, pageId, query }) => ({
    variables: { id: pageId || getId(id, query) },
    fetchPolicy: isNew({ query }) ? 'cache-only' : undefined,
  }),
  props: ({ ownProps, data }) => ({
    ...ownProps,
    item: (isNew(ownProps) ? {} : data.item) || {},
    data,
  }),
});

export const prefetchPage = (client, id) =>
  client.query({
    query: queryOne,
    variables: { id },
  });
github olymp / olymp / packages / athena-gz / blocks / news.tsx View on Github external
accent={org.color}
      title={name}
      subtitle={`${art} vom ${moment(date).format('DD.MM.YYYY')}`}
    >
      <img width="{100}" value="{image}">
      <content>
        <p>
          {description}
        </p>
        {slug &amp;&amp; Weiterlesen...}
      </content>
    
  );
};

@graphql(
  gql`
    query newsList {
      news: newsList(
        sort: { date: DESC }
        query: { state: { eq: PUBLISHED } }
      ) {
        id
        date
        art
        name
        description
        text
        slug
        image {
          id
          width

olymp-utils

MIT
Latest version published 7 years ago

Package Health Score

43 / 100
Full package analysis

Popular olymp-utils functions

Similar packages