-
Notifications
You must be signed in to change notification settings - Fork 0
Add coloring to ItemTable dates to indicate age #90
Comments
React Relative Time does not accept the use of |
The ReactRelativeTime component is just a function that takes a time string and returns a relative time string. If we were to put the styling on that, it would only highlight the text inside the table cell as opposed to the cell itself. Since we want the styling on the cell itself, we'll need to modify the TableCell's component to change styling based on the value fo the different in time between the last modified date and the current date. This might be best done by creating a modified TableCell component for the last updated column and using that component in the ItemTable loop that generated columns. |
To do this:
|
To style the last updated cells I created a component called In the The Example: if (timeDelta > day && timeDelta < week && timeDelta < month)//more than one day since last
{
setCellBackgroundColor("yellow");
} else if (timeDelta > week && timeDelta < month) // more than a week since last update
{
setCellBackgroundColor("purple");
} else if (timeDelta > month) //more than a month since last update
{
setCellBackgroundColor("green");
} We then return a Last, we use the The next step to solving this issue is calculating the color value based on the |
Rather than using a state variable, since we wont' be be changing the background color of the cell after first render, we should use a local variable inside the component that gets sets based on the same logic you're already using to get a color. |
To render this component we moved away from using a state variable and instead used react-table's In order to properly style the |
#135 needs to be merged before this can be closed. |
In the old webqueue, the Grease monkey/Tampermonkey script added shades of red to the "last modified" cell of an item in the item table. This logic should be implemented in the new ItemTable component.
The text was updated successfully, but these errors were encountered: