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

In timeline, filter out dates we don't use somehow #167

Open
evoskamp opened this issue Jan 22, 2024 · 4 comments
Open

In timeline, filter out dates we don't use somehow #167

evoskamp opened this issue Jan 22, 2024 · 4 comments
Assignees
Labels
Core Shared issues enhancement New feature or request

Comments

@evoskamp
Copy link
Collaborator

It'd be nice to have a list of dates from config settings, but not display ones that have a magical value (1/1/1970, null) or are before a certain date or such.

@evoskamp
Copy link
Collaborator Author

Mmm, it seems the Welcome.tsx view should use a component to display with class deadline or deadlineExpired

    <li>
      <span className={classes.deadline}>
        Registration Open: <ConfigDate name='registrationOpen' format={MDY} />
      </span>
    </li>

@ggascoigne
Copy link
Owner

yeah, I thought about that, but we regularly left the date visible without emphasizing that it had expires for NW. I was intentional, but perhaps it's not really such a good pattern. It would be pretty simple to change.

@evoskamp
Copy link
Collaborator Author

I'm noodling with something, basically added a tab to settings with prefix config.timelineDates. Label, type date. Pull it into configuration so I can grab it wherever I need. That bit I have working and flipping it to an aray, sort, filter, I already have showing up fine.

There are already two styles (deadline, deadlineExpired), so I figure on writing a component that takes a config date to show/not show the card with the "if you access this after X date, contact ContactEmail" and can contextually show that, and then take all the dates in timelineDates, optionally check at a equal to or before date to filter out (e.g. 1/1/1970), though you could just delete them in config, and optionally the two classes to use for past and current/future dates.

Then whack all of the bottom half of Welcome for that component.

@evoskamp
Copy link
Collaborator Author

Like we dropped a few dates last year, dropped another date this year. And it makes it easy to create a role for that tab, rather than the explicit ones in Config.

Oh, and I use the name of the code entry as the label, as the database doesn't care about spaces, and other formatting for the code column.

@evoskamp evoskamp self-assigned this Jan 24, 2024
@evoskamp evoskamp added enhancement New feature or request Core Shared issues labels Jan 24, 2024
evoskamp added a commit that referenced this issue Jan 24, 2024
Changed the Settings to add a second exclusion so the main config page
can ignore the timeline dates (they begin with 'config.timelineDates.')
and to add a tab for Timeline Dates filtering on the same. The config
values are meant all to be dates. As code and value are both 100
characters and the database doesn't care I use the code as the label to
display. Finally added an entry to the configuration to read the
config.timelineDates values and add an array of label and date entries.

Created a CutoffDateWarning component that takes a date key (i.e. the
label) and if the date value of that is in the past it shows a warning
not to register without first contacting registration by email to the
email in ContactEmail configuration. If that date is in the future it
shows nothing.

Created a TimelineList component that takes the array of lable/date
values, and an optional ignore before date. Again, it's a label of any
of the dates. It takes the array, filters out any dates before the date
with that label, sorts it in ascending order on the dates and displays
them. If the date is in the past it uses the class deadlineExpired,
otherwise deadline.

Changed the class deadlineExpired from red (error.main) to a 700 gray
with strike through.

In use it cleans up the Welcome page.

ACUS' is now:

    <Page title='Welcome' titleElement={titleElement}>
      <MdxWithExternalLinks>
        <WelcomeContent />
      </MdxWithExternalLinks>
      <DynamicMemberContent />
      <CutoffDateWarning cutoffDateConfig='Membership Payment In Full Due' />
      <TimelineList ignoreBeforeDateConfig='Registration Open' />
    </Page>

More imortantly, the cutoff date warning doesn't require reading and
interpreting, but shows as needed.

And the timeline dates are easily maintained in settings and ones can
be added/removed, or, for this year, left out, by leaving their value
set to last year's.

Resolves: #166, #167
@evoskamp evoskamp linked a pull request Jan 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Shared issues enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants