Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Dec 31, 2023
1 parent a235e0e commit c417ab4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
13 changes: 7 additions & 6 deletions client/dist/js/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions client/src/components/ElementEditor/AddElementPopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AddElementPopover extends Component {
* @param {object} elementType in the shape of types/elmementTypeType
* @returns {function}
*/
getElementButtonClickHandler(elementType) {
getGraphQLElementButtonClickHandler(elementType) {
return (event) => {
const {
actions: { handleAddElementToArea },
Expand All @@ -50,7 +50,7 @@ class AddElementPopover extends Component {
* - then call read blocks from area endpoint (areaID)
* - also then update the preview via jquery/entwine
*/
handleButtonOnClick(elementType) {
getElementButtonClickHandler(elementType) {
// todo
}

Expand Down Expand Up @@ -79,13 +79,14 @@ class AddElementPopover extends Component {
);

const globalUseGraphQL = true;
const buttonOnClickHandler = globalUseGraphQL ? this.getElementButtonClickHandler : this.handleButtonOnClick;

const buttons = elementTypes.map((elementType) => ({
content: elementType.title,
key: elementType.name,
className: classNames(elementType.icon, 'btn--icon-xl', 'element-editor-add-element__button'),
onClick: buttonOnClickHandler(elementType),
onClick: globalUseGraphQL
? this.getGraphQLElementButtonClickHandler(elementType)
: this.getElementButtonClickHandler(elementType),
}));

return (
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/ElementEditor/ElementEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class ElementEditor extends PureComponent {
} else {
// # rpc
// make a call to a sort endpoint with (ID, afterBlocKID)
// after that is done, get ElementList to refetch the list of blocks
// after sort there is NOT a call to readAll elements, GraphQL will only do a fairly pointless
// call to read the element that was moved
// (strange code for sorting is in this component and not ElementList, however do not refator it)
// update the preview via jquery/entwine (see graphql code above)
}
Expand Down

0 comments on commit c417ab4

Please sign in to comment.