-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Dashboard Cards: Display 3 latest pages card #18337
Conversation
+ Adds: the logic to get the status text + Adds: the string resources for status text in pages card
+ Adds: the logic to get the status icon + Adds: the drawable resources for status icon in pages card * Refactors: the status icon to be nullable in case status is not identified
Updates: the status icon and text mapping of the pages card item with correct PagesCardContentType.kt
Updates: the logic of building the create page card with mapped page items instead of api response Updates: the params of create page card with footer click function instead of the entire params
Updates: the logic of creating the pages items from api response by filtering the supported status in pages card
📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
|
Adds: the logic for getting the last edited or scheduled time using date or modified time depending on status Adds: the logic in PagesItemViewHolder to show the data
* Makes test statement shorter to fix lint errors + Adds mock for date time utils wrapper dependancy
} | ||
} | ||
|
||
private fun createNewPageCardWithAddPageMessage(params: PagesCardBuilderParams): CreatNewPageItem { | ||
private fun createNewPageCardWithAddPageMessage(onFooterLinkClick: () -> Unit): CreatNewPageItem { | ||
return CreatNewPageItem( | ||
label = UiString.UiStringRes(R.string.dashboard_pages_card_no_pages_create_page_button), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(early np - since this is a draft) but you could statically import the namespace and drop the UiString
prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, Thanks. Done in 574b12e
tools:text="@string/dashboard_card_page_item_status_published" | ||
android:drawablePadding="@dimen/margin_medium" | ||
app:layout_constraintStart_toStartOf="parent" | ||
android:paddingStart="10dp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np (again, a bit early) - just a reminder to use android:paddingHorizontal
and android:paddingVertical
. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, Thanks for point it out. Done in b4269b0
} | ||
|
||
private fun getCreatePageCard(params: PagesCardBuilderParams): CreatNewPageItem { | ||
private fun getCreatePageCard(pages: List<PageContentItem>, onFooterLinkClick: () -> Unit): CreatNewPageItem { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactor ❤️
+ Adds: the logic to return relative time span for future dates in DateTimeUtilsWrapper.kt
- Removes: redundant UiString in all the usages
+ Adds: test for scheduled and published page relative time shown
* Updates: test statements by moving the common mock to setUpMocks function * Updates: Models used in tests with status identifier
- Removes: redundant MySiteCardAndItemBuilderParams in all the usages
- Removes: PagesCardBuilderParams in tests with helper function * Updates: the test statement to invoke BuilderParams generator function to only build with relevant model(Scheduled/Published/Drafts) instead of all the models
+ Adds: the list divider element to the xml for pages item in card * Updates: the padding attributes and margin attributes with paddingHorizontal, paddingVertical and marginHorizontal
* Implements: the light/dark text color for status and last modified text * Updates: the status icon color on light and dark mode
Adds: dimension values for pages item components Replaces: the hardcoded references with values from dimens.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AjeshRPai - All works as expected. Dark/light mode, dates + relative time (future and past). 👍
Once CI finishes I am going to merge. @osullivanchris - any UI issues you may find will be addressed in a separate PR - we want to keep development moving along. Thanks for understanding.
* Use getRelativeTimeSpanString function if the date is in the future. | ||
* Time spans in future are formatted like "In 42 minutes | In 2 days". | ||
* */ | ||
fun getRelativeTimeSpanString(date: Date): String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
@zwarm @AjeshRPai this looks great 👍 3 small details (which are fine for another PR as mentioned)
|
Hey @osullivanchris I will implement these changes in a separate PR by tomorrow. I have added the improvements you mentioned in this issue. cc: @zwarm |
Related Issue
Closes #18212
Description
This PR adds support for showing the Pages item in pages card.
Explanation of Changes
📷 Screenshots
Pages card
Scheduled relative time
👁️ Note the relative time in Scheduled Page item in Card
Test
Prerequisite
◐ Toggle the
dashboard_card_pages
flagMe
→App Settings
→Debug settings
Features in development
sectionRESTART THE APP
buttonCard UI is as expected in the Project spec and Designs
Project spec - pe7hp4-gi-p2
Design p2 - pcdRpT-2bP-p2
Design ref Figma - YSMw2nbFAgPpjZLLbYvTfT-fi-310_3783
💡 Note: To test the relative time, modify or schedule a page and go to Settings on device and change the device time.
Verify the Unit tests
Code review the unit tests in PagesCardBuilderTest.kt pass, sufficient and doesn't miss any scenario
Regression Notes
Potential unintended areas of impact
Pages card is not shown as expected
What I did to test those areas of impact (or what existing automated tests I relied on)
Manual testing and Unit tests
What automated tests I added (or what prevented me from doing so)
N/A
PR submission checklist:
PR submission checklist:
RELEASE-NOTES.txt
if necessary.UI Changes testing checklist: