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

feat: display sign on log #3193

Merged
merged 3 commits into from Feb 27, 2023
Merged

feat: display sign on log #3193

merged 3 commits into from Feb 27, 2023

Conversation

nunogois
Copy link
Member

@nunogois nunogois commented Feb 24, 2023

About the changes

https://linear.app/unleash/issue/2-719/display-basic-sign-on-log-in-frontend
Adds a basic, naïve way of displaying sign-on history.
We can be OK with merging this for now if we want, given that it's behind a feature flag, and then iterate over it and implement the features and improvements we need in the meantime.

image

Relates to roadmap item: #2951

@vercel
Copy link

vercel bot commented Feb 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
unleash-docs ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 24, 2023 at 4:16PM (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 24, 2023 at 4:16PM (UTC)

Copy link
Contributor

@gastonfournier gastonfournier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a small suggestion, but you can ignore it if you feel it's a premature optimization

@@ -10,19 +10,23 @@ interface ITimeAgoCellProps {
live?: boolean;
emptyText?: string;
title?: (date: string) => string;
timestamp?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about receiving the format function as with the title?

Suggested change
timestamp?: boolean;
dateFormat?: (value?: string | number | Date, locale?: string) => string;

Because timestamp as a boolean limits you to have 2 formats, if you want to add a third one things gets complicated. If the function is not provided you just use the default formatting function:

const fn = dateFormat || formatDateYMD;
const date = fn(value, locationSettings.locale);

Header: 'Created',
accessor: 'created_at',
Cell: ({ value }: { value: Date }) => (
<TimeAgoCell value={value} timestamp />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the change suggested this would become:

<TimeAgoCell value={value} dateFormat={formatDateYMDHMS} />

@nunogois nunogois merged commit a43542b into main Feb 27, 2023
@nunogois nunogois deleted the feat-display-sign-on-log branch February 27, 2023 08:07
@nunogois
Copy link
Member Author

Thanks @gastonfournier, I think this is a great optimization for TimeAgoCell we can implement right away. Addressed in #3202

nunogois added a commit that referenced this pull request Feb 27, 2023
Slight refactor to `TimeAgoCell` that allows passing in a date format
function.
Suggested by @gastonfournier in
#3193 (review)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants