Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Bring back QuickStart #315

Open
michsa opened this issue Sep 9, 2019 · 1 comment
Open

Bring back QuickStart #315

michsa opened this issue Sep 9, 2019 · 1 comment

Comments

@michsa
Copy link
Contributor

michsa commented Sep 9, 2019

QuickStart was an API for initializing a contexture tree using react components, with no config object necessary. It was taken before its time 😢

The API relied on mobx-react's Provider (now deprecated) to inject the contexture tree into the components, along with functionality in the old injectTreeNode HOC (now contexturify) that would automatically generate tree nodes if certain parameters were given. That functionality was only useful for QuickStart, and is being removed in 2.0 along with Provider support.

To restore QuickStart, we'll need to:

  1. reimplement the tree injection using React context, and
  2. add a new HOC to handle the auto-add functionality (should be composable with withLoader).

Here is the old story to illustrate how the API worked:

export default () => (
  <ContextureProvider schema="movies" types={types} service={service}>
    <DarkBox>
      <SpacedList>
        <Query field="title" />
        <Grid gap="5px" columns="1fr 4fr">
          <div>
            <SpacedList>
              <div>
                <b>MetaScore</b>
                <Number field="metaScore" min={0} max={100} />
              </div>
              <div>
                <b>Genre</b>
                <Facet field="genres" />
              </div>
              <div>
                <b>Actors</b>
                <Facet field="actors" />
              </div>
            </SpacedList>
          </div>
          <div>
            <DateHistogram
              key_field="released"
              value_field="imdbVotes"
              interval="3650d"
              format={formatYear}
            />
            <Flex style={{ justifyContent: 'space-around' }}>
              <h3>
                <ResultCount pageSize={6} />
              </h3>
            </Flex>
            <IMDBCards path={['root', 'results']} />
            <Flex style={{ justifyContent: 'space-around' }}>
              <Pager path={['root', 'results']} />
            </Flex>
          </div>
        </Grid>
      </SpacedList>
    </DarkBox>
  </ContextureProvider>
)
@daedalus28
Copy link
Member

daedalus28 commented Feb 25, 2021

Now that we have SearchTree as a component (which is a noop props container consumed by the filter list), we can add similar components inside it to recreate this API.

We should avoid doing this in the existing components as it complicates their implementation considerably, but we can do this entirely within SearchTree. This won’t cover the results, etc cases, but is the right direction to head in

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants