How to use the react-redux-firebase.isEmpty 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 prescottprue / redux-firestore / examples / complete / src / containers / Navbar / Navbar.enhancer.js View on Github external
withProps(({ auth, profile }) => ({
    authExists: isLoaded(auth) && !isEmpty(auth)
  })),
  // Flatten profile so that avatarUrl and displayName are props
github mapswipe / mapswipe / src / shared / views / RecommendedCards.js View on Github external
render() {
        const {
            navigation,
            projects,
        } = this.props;
        if (!isLoaded(projects)) {
            return (<LoadingIcon key="icon" />);
        }
        if (isLoaded(projects) && isEmpty(projects)) {
            return (<Text testID="recommended_cards_view">Nothing to work on!</Text>);
        }

        // since we can't completely filter projects by status AND projectType in firebase
        // we add a filter here to make sure we only display project types that the app can handle
        return (
            <ScrollView
                testID="recommended_cards_view"
                contentContainerStyle={style.listView}
                removeClippedSubviews
            >
                { this.renderAnnouncement() }
                { projects.filter(
                    p => p.value && p.value.projectType
                    && GLOBAL.SUPPORTED_PROJECT_TYPES.includes(p.value.projectType),
                )
github prescottprue / redux-firestore / examples / complete / src / containers / Navbar / Navbar.js View on Github external
function Navbar() {
  const classes = useStyles()

  // Get auth from redux state
  const auth = useSelector(state => state.firebase.auth)
  const authExists = isLoaded(auth) && !isEmpty(auth)

  return (
    <NavbarWithoutAuth brandPath={authExists ? LIST_PATH : '/'}>
      {authExists ? (
        <AccountMenu />
      ) : (
        <Button
          className={classes.signIn}
          component={Link}
          to={LOGIN_PATH}
          data-test="sign-in">
          Sign In
        </Button>
      )}
    </NavbarWithoutAuth>
  )
github prescottprue / generator-react-firebase / examples / react-firebase / src / routes / Login / containers / LoginContainer.js View on Github external
<div className={classes.or}>
          or
        </div>
        <div className={classes.providers}>
          <GoogleButton onClick={() => this.providerLogin('google')} />
        </div>
        <div className={classes.signup}>
          <span className={classes.signupLabel}>
            Need an account?
          </span>
          <Link className={classes.signupLink} to={SIGNUP_PATH}>
            Sign Up
          </Link>
        </div>
        {
          isLoaded(authError) && !isEmpty(authError) && snackCanOpen &&
            <Snackbar
              open={isLoaded(authError) && !isEmpty(authError) && snackCanOpen}
              message={authError ? authError.message : 'Signup error'}
              action='close'
              autoHideDuration={3000}
            />
        }
      </div>
    )
  }
}
github prescottprue / react-redux-firebase / examples / snippets / decorators / App.js View on Github external
render () {
    const { firebase, todos } = this.props

    const todosList = (!isLoaded(todos))
                        ? 'Loading'
                        : (isEmpty(todos))
                          ? 'Todo list is empty'
                          : map(todos, (todo, id) => (
                              <TodoItem key={id} id={id} todo={todo} />
                            ))
    return (
      <div>
        <div className="App-header">
          <h2>react-redux-firebase decorators demo</h2>
        </div>
        <div className="App-todos">
          <h4>Todos List</h4>
          {todosList}
        </div>
      </div>
    )
  }
github transmute-industries / eth-faucet / src / containers / Signup / SignupContainer.js View on Github external
</div>
        <div className={classes.providers}>
          <GoogleButton onClick={() => this.providerLogin('google')} />
        </div>
        <div className={classes.login}>
          <span className={classes['login-label']}>
            Already have an account?
          </span>
          <Link className={classes['login-link']} to={LOGIN_PATH}>
            Login
          </Link>
        </div>
        {
          isLoaded(authError) && !isEmpty(authError) && snackCanOpen &&
            <Snackbar
              open={isLoaded(authError) && !isEmpty(authError) && snackCanOpen}
              message={authError ? authError.message : 'Signup error'}
              action='close'
              autoHideDuration={3000}
              onRequestClose={() => this.setState({ snackCanOpen: false })}
            />
        }
      </div>
    )
  }
}
github prescottprue / react-redux-firebase / examples / complete / material / src / routes / Projects / routes / Project / containers / ProjectContainer.js View on Github external
render() {
    const { project, params } = this.props

    if (isEmpty(project)) {
      return <div>Project not found</div>
    }

    if (!isLoaded(project)) {
      return <LoadingSpinner />
    }

    return (
      <div className={classes.container}>
        <h2>Project Container</h2>
        <pre>Project Key: {params.projectname}</pre>
        <pre>{JSON.stringify(project, null, 2)}</pre>
      </div>
    )
  }
}
github prescottprue / generator-react-firebase / examples / react-firebase / src / routes / Signup / containers / SignupContainer.js View on Github external
<div className={classes.or}>
          or
        </div>
        <div className={classes.providers}>
          <GoogleButton onClick={() => this.providerLogin('google')} />
        </div>
        <div className={classes.login}>
          <span className={classes.loginLabel}>
            Already have an account?
          </span>
          <Link className={classes.loginLink} to={LOGIN_PATH}>
            Login
          </Link>
        </div>
        {
          isLoaded(authError) && !isEmpty(authError) && snackCanOpen &&
            <Snackbar
              open={isLoaded(authError) && !isEmpty(authError) && snackCanOpen}
              message={authError ? authError.message : 'Signup error'}
              action='close'
              autoHideDuration={3000}
              onRequestClose={() => this.setState({ snackCanOpen: false })}
            />
        }
      </div>
    )
  }
}
github prescottprue / react-redux-firebase / examples / complete / typescript / src / List.tsx View on Github external
function List() {
  useFirestoreConnect([{
    collection: "todos",
  }]);
  const todos = useSelector((state: SystemState) => state.firebase.data.todos);
  if (!isLoaded(todos)) { return "Loading..."; }
  if (isEmpty(todos)) { return null; }
  return (
    <ul>
      {todos.map((todo: any) => (
        <li key={todo.id}>{todo.name}</li>
      ))}
    </ul>
  );
}