Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify timelines UI/reuse UI elements #2629

Merged
merged 49 commits into from
Feb 23, 2023
Merged

Simplify timelines UI/reuse UI elements #2629

merged 49 commits into from
Feb 23, 2023

Commits on Jan 9, 2023

  1. Configuration menu
    Copy the full SHA
    b514517 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3648259 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5d35dda View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    26e6918 View commit details
    Browse the repository at this point in the history
  5. Use temporal extent to render start/end dates

    This allows us to render entities of any type in timelines, not only entities that have `date`/`startDate`/`endDate` properties
    tillprochaska committed Jan 9, 2023
    Configuration menu
    Copy the full SHA
    e297833 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    a6ca505 View commit details
    Browse the repository at this point in the history

Commits on Jan 29, 2023

  1. Configuration menu
    Copy the full SHA
    376300f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e50ab1b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3f69a56 View commit details
    Browse the repository at this point in the history
  4. Handle updates to timeline state

    This might be a very good idea and a step towards eliminating Redux in our app in most cases where it's not really required (i.e. most CRUD operations.) Or it's a very dumb idea (if we keep using Redux and now have inconsistent state management.)
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    8fd8217 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d636196 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    36c2642 View commit details
    Browse the repository at this point in the history
  7. Emphasize timeline item color

    The item background is now a shade of the item color
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    d548c96 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    c5d0770 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    4cbdd68 View commit details
    Browse the repository at this point in the history
  10. Handle timelines without layout

    New entitysets do not have a layout by default.
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    3ac5a93 View commit details
    Browse the repository at this point in the history
  11. Fix jerky scrollbar in entity select autocomplete

    The loading spinner is implemented using CSS transitions, animating the rotate transform of a rectangle. Depending on the rotation angle, the rectangle will create an overflow and scrollbars will be displayed shortly, then disappear again.
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    f370285 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    e33f4c2 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    e4b0fbd View commit details
    Browse the repository at this point in the history
  14. Improve keyboard navigability

    * Allows users to focus prev/next list items using arrow keys
    * Focuses list items on click
    * Selects focused list item by pressing space/enter
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    d06822c View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    f9d876a View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    fd6e3cb View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    cb74955 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    9187c33 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    1916710 View commit details
    Browse the repository at this point in the history
  20. Do not reset properties when changing schema

    This copies the property values that are present in the old and the new schema.
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    b24b850 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    29822f5 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    10ffaec View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    2331d1e View commit details
    Browse the repository at this point in the history
  24. Refactor: Introduce TimelineItem, a wrapper class for entities

    `TimelineItem` encapsulates logic commonly required when displaying entities in a timeline, e.g. determining which color to use or what the earliest and latest date the entity covers are. This is in preparation for a new chart view, to ensure common display logic can be shared with the existing list view.
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    26fe059 View commit details
    Browse the repository at this point in the history
  25. Refactor: Extract keyboard navigation logic into custom hook

    This allows sharing the logic across list and chart renderers.
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    59e5cd2 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    caf3d0b View commit details
    Browse the repository at this point in the history
  27. Add basic chart renderer for timelines

    This isn't enabled/visible to users at the moment.
    
    * Supports displaying timeline items in a Gantt-chart like view.
    * Supports single-day and multi-day items.
    * Supports different degrees of precision (e.g. `2022`, `2022-01`, `2022-01-15`).
    * Right now, there's no way to change the scale/resolution of the chart (day/week/month/quarter/year view).
    
    I've added a new dependency, `date-fns`, to work with date intervals. We already use a date utility library (Moment.js), however, the project authors recommend not using Moment.js for new projects and Moment.js doesn't have out-of-the-box support for what I needed (e.g. calculating all the months, quarters, etc. within an interval). `date-fns` is a very modular library and allows us to use only what we need, so this adds less than 1kB to the bundle size.
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    79d3967 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    533733c View commit details
    Browse the repository at this point in the history
  29. Make timeline item captions sticky

    … so they stay visible even if the timeline item is wider than the viewport
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    1aed501 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    412e6bc View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    4023889 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    cd882d6 View commit details
    Browse the repository at this point in the history
  33. Extract logic to fetch entity suggestions into custom hook

    This makes the component code less complex and allows us to reuse logic in the future.
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    4328b32 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    9aa0304 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    7361f7b View commit details
    Browse the repository at this point in the history
  36. Refactor: Reduce use of optional props

    Initially, I kept types a little more relaxed, allowing component consumers to omit certain event handlers. This is handy especially in tests. For example, a test case may not be dependent on passing a real `onChange` handler to a component. When rendering the component in that test, it's convenient to simply omit the `onChange` property rather than passing a no-op event handler.
    
    However, this requires at least some conditional logic in the components. This logic exists only to make writing tests easier. In order to keep the components and prop types as simple as possible, I've marked all props required that are only option for testing purposes. In order to avoid cluttering tests with the same boilerplate props over and over again, I've simply created `defaultProps` objects that can be spread into the components.
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    79b5c44 View commit details
    Browse the repository at this point in the history
  37. Use full entity ID when creating new timeline items

    This fixes a bug where creating and removing an entity (without reloading the page between both actions) would result in an error. When a user creates a new entity in a timeline, an ID for the entity is auto-generated. When creating a new entity, Aleph appends a HMAC signature (based on dataset ID and entity ID). The auto-generated ID and the signature form the full ID. In order to remove an entity, the full ID needs to be supplied.
    
    Previously, when creating a new timeline item, only the auto-generated ID was stored. As a consequence, trying to remove an entity using this ID failed. Now, when creating a new item, we wait for the API response that includes the full entity ID and use that for subsequent requests.
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    bbedac2 View commit details
    Browse the repository at this point in the history
  38. Add read-only mode

    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    5e6bb5d View commit details
    Browse the repository at this point in the history
  39. Translate UI copy

    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    87e9156 View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    5409e53 View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    64f4b11 View commit details
    Browse the repository at this point in the history
  42. Replace old Timeline component

    I have kept the old implementation around while developing and have selectively used bits and pieces of the existing implementation. That is why there was a src/components/Timeline directory with the old implementation and a src/components/Timeline2 directory with the new implementation.
    tillprochaska committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    f59e1df View commit details
    Browse the repository at this point in the history
  43. Configuration menu
    Copy the full SHA
    3a45add View commit details
    Browse the repository at this point in the history