How to use the react-redux-firebase.firestoreConnect function in react-redux-firebase

To help you get started, we’ve selected a few react-redux-firebase 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 google / ground-platform / web / src / datastore.js View on Github external
firestoreConnect((props) => [
    {
      collection: 'projects',
      doc: props.match.params.projectId,
      storeAs: 'activeProject',
    },
    {
      collection: `projects/${props.match.params.projectId}/features`,
      storeAs: 'mapFeatures',
    },
  ]);

// Mount feature data onto store based on current projectId and featureId in
// path.
const connectFeature =
  firestoreConnect((props) => [
    {
      collection: `projects/${props.match.params.projectId}/records`,
      where: [
        ['featureId', '==', props.match.params.featureId],
      ],
      storeAs: 'featureRecords',
    },
  ]);

const exportKml = () => (projectId, featureTypeId) => {
  window.location.href = `${
    firebaseConfig.functionsURL
  }/exportKml?project=${projectId}&featureType=${featureTypeId}`;
};

export {
github Sv1nnet / mario-plan-migrated-on-redux601-and-firebase300-alpha / src / components / projects / ProjectDetails.jsx View on Github external
};

const mapStateToProps = (state, ownProps) => {
  const { id } = ownProps.match.params;
  const { projects } = state.firestore.data;
  const project = projects ? projects[id] : null;

  return {
    project,
    auth: state.firebase.auth,
  };
};

export default compose(
  connect(mapStateToProps),
  firestoreConnect([
    { collection: 'projects' },
  ]),
)(ProjectDetails);
github nwplus / nwhacks2019 / web / containers / auth / Login / AfterLogin.js View on Github external
AfterLoginContainer.propTypes = {
  hackerApplication: PropTypes.object.isRequired,
  storeHackerApplication: PropTypes.func.isRequired,
};

const mapDispatchToProps = (dispatch) => {
  return {
    storeHackerApplication: (application) => {
      dispatch(addHackerApplication(application));
    },
  };
};

export default compose(
  firebaseConnect(),
  firestoreConnect((props) => {
    const { firebase } = props;
    const auth = firebase.auth();
    const { currentUser: { uid } } = auth;
    return [
      {
        collection: 'applications_hacker',
        doc: uid,
        storeAs: 'hackerApplication',
      },
    ];
  }),
  connect(mapStateToProps, mapDispatchToProps),
)(AfterLoginContainer);
github NUS-ALSET / achievements / src / containers / Paths / Paths.js View on Github external
joinedPaths: state.paths.joinedPaths,
  publicPaths: publicPathSelector(state),
  currentPathTab: state.paths.currentPathTab,
  pathStats:state.firestore.data.pathStats
});

const mapDispatchToProps = dispatch => ({
  pathsOpen: () => dispatch(pathsOpen()),
  pathDialogShow: pathInfo => dispatch(pathDialogShow(pathInfo)),
  pathChangeRequest: pathInfo => dispatch(pathChangeRequest(pathInfo)),
  pathDialogHide: () => dispatch(pathDialogHide()),
  handleSwitchPathTab: tabIndex => dispatch(switchPathTab(tabIndex))
});

export default compose(  
  firestoreConnect((ownProps, store)=>[
    {
      path: "/path_statistics",
      collection:"path_statistics",
      storeAs: "pathStats",
      orderBy: ['endDate', 'desc'],
      limit:1
    }]),
  firebaseConnect((ownProps, store) => {
    const firebaseAuth = store.getState().firebase.auth;
    return [
      {
        path: "/paths",
        storeAs: "publicPaths",
        queryParams: ["orderByChild=isPublic", "equalTo=true"]
      }      
    ].concat(
github bradtraversy / clientpanel_react / src / components / clients / ClientDetails.js View on Github external
</div>
          </div>
        </div>
      );
    } else {
      return <Spinner />;
    }
  }
}

ClientDetails.propTypes = {
  firestore: PropTypes.object.isRequired
};

export default compose(
  firestoreConnect(props => [
    { collection: 'clients', storeAs: 'client', doc: props.match.params.id }
  ]),
  connect(({ firestore: { ordered } }, props) => ({
    client: ordered.client && ordered.client[0]
  }))
)(ClientDetails);
github NeoWu1216 / firebase-blog / src / components / blogs / BlogListSummary.js View on Github external
const mapStateToProps = (state, oldProps) => {
  return {
    auth: state.firebase.auth,
  }
}

const mapDispatchToProps = (dispatch) => {
  return {
    deleteBlog : (id) => dispatch(deleteBlog(id)),
    like : (p1,p2,p3,p4) => dispatch(likeBlog(p1,p2,p3,p4)),
  }
}

export default withRouter(compose(
  connect(mapStateToProps, mapDispatchToProps),
  firestoreConnect([
    {collection : 'likes'},
  ])
)(BlogSummary));
github bradtraversy / clientpanel_react / src / components / clients / EditClient.js View on Github external
</div>
          </div>
        </div>
      );
    } else {
      return <Spinner />;
    }
  }
}

EditClient.propTypes = {
  firestore: PropTypes.object.isRequired
};

export default compose(
  firestoreConnect(props => [
    { collection: 'clients', storeAs: 'client', doc: props.match.params.id }
  ]),
  connect(({ firestore: { ordered }, settings }, props) => ({
    client: ordered.client && ordered.client[0],
    settings
  }))
)(EditClient);
github hamsahmedansari / React-Realtime-Chat / src / components / common / messageBox / index.jsx View on Github external
changeSelectedUser: (uid, roomId) => {
      dispatch(ChangeSelectedUser(uid, roomId));
    }
  };
};
const mapStateToProps = (state, ownProps) => {
  return {
    selectedUser: state.chat
  };
};
export default compose(
  connect(
    mapStateToProps,
    mapDispatchToProps
  ),
  firestoreConnect()
)(MessageBox);
github nwplus / nwhacks2019 / web / components / admin / ApplicantInfo / index.js View on Github external
</div>
    );
  }
}

ApplicantInfo.propTypes = {
  firestore: PropTypes.object,
  applicantType: PropTypes.string,
  applicantId: PropTypes.string,
  showAssessmentFieldsOnly: PropTypes.bool,
  className: PropTypes.string,
};

export default compose(
  firebaseConnect(),
  firestoreConnect(mapPropsToQueries),
  connect((state) => {
    return {
      firestore: state.firestore,
    };
  }),
)(ApplicantInfo);