KhronosGroup / glTF-Project-Explorer

Tool to provide a filterable registry of glTF community projects.
Apache License 2.0
87 stars 46 forks source link

Project info generalization drafts #154

Closed javagl closed 2 years ago

javagl commented 2 years ago

An early DRAFT of how some FIRST steps for https://github.com/KhronosGroup/glTF-Project-Explorer/issues/151 could be addressed.

An attempt of a summary what has been done:

The IProjectInfo structure was generalized.

Originally, it contained several properties:

The latter have been moved into a Record<string, string[]>. The keys are just the former property names. The values are the same that they had in the original structure. There is a bunch of questions that arise from that. Some of them are mentioned in https://github.com/KhronosGroup/glTF-Project-Explorer/issues/151 , and to avoid scattering the discussion, I'd suggest to talk about further details there (and not so much in this PR)

The IFilter-related classes have been generalized

There had been several places where the fixed set of IProjectInfo properties had been used. For example, in the FilterDimension, and in large parts of the UI, most importantly in the FilterBar. This has been updated to work with the IProjectInfo#properties.

Cleanups

Removed unused export declarations. Added some comments. Still far too few comments, though...


The current state seems to work like before (from a basic test), but it contains some hard-coded parts, and some parts that should be reviewed. There are a few places marked with TODO_GENERALIZATION - a quick full-text search should reveal some points that may warrant a closer look. Beyond that, it's mainly a marker for myself, for places that are in a draft state.

javagl commented 2 years ago

Thanks @weegeekps for the feedback. I'll address the inlined comments and mark them resolved as soon as they are done.

High level:

Regarding the latter, I have to admit that when I have the choice between

  1. a solution that may be "idiomatic" for the library, but cryptic and totally incomprehensible for someone who doesn't know the guts of that library and
  2. a solution that can be understood by everybody (even if it takes 2 more lines of code, but for example, gives names to intermediate results)

then I tend to do option 2. Code is written (at most) once, but potentially read dozens of times. It may be possible to solve this particular thing with some magic promise(all(reduce(mapper(y => consume), spread(functor(x => create)), dispatch(receiver())))) one-liner. But when someone who already is familiar with that library couldn't find a solution in 20 minutes, then I'd rather try to find a simple solution first - even if it involves some old-fashioned for-loop ;-)

javagl commented 2 years ago

For the formatting, we should consider some config and think about how to handle eslint and prettier. There is some eslintConfig section in the package.json - apparently, as part of "react-app" - but I think this might be moved into a config file.

Regarding the most recent changes:

javagl commented 2 years ago

The inlined comment has been addressed.

weegeekps commented 2 years ago

This looks great. Feel free to merge it when you're ready.