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

List of Scheduled post in Scheduled post tab #8602

Open
wants to merge 10 commits into
base: add-create-at-column-scheduled-post
Choose a base branch
from

Conversation

Rajat-Dabade
Copy link
Contributor

@Rajat-Dabade Rajat-Dabade commented Feb 18, 2025

Summary

Ticket Link

Checklist

  • Added or updated unit tests (required for all new features)
  • Has UI changes
  • Includes text changes and localization file updates
  • Have tested against the 5 core themes to ensure consistency between them.
  • Have run E2E tests by adding label E2E iOS tests for PR.

Device Information

This PR was tested on:

Screenshots

Release Note


Note: Please do the code review, I am parallelly adding unit tests.

@Rajat-Dabade Rajat-Dabade force-pushed the add-create-at-column-scheduled-post branch from 6a284f4 to 68eff02 Compare February 21, 2025 07:16
@Rajat-Dabade Rajat-Dabade force-pushed the list-scheduled-post branch 2 times, most recently from de2b148 to 3a6f367 Compare February 21, 2025 09:15
const deleteDraft = useCallback(() => {
const deletePost = useCallback(() => {
if (draftType === DRAFT_TYPE_SCHEDULED) {
// TODO: Add swipeable delete for schedule post
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be handled in the subsequent PR. https://mattermost.atlassian.net/browse/MM-62200

maxToRenderPerBatch={10}
nativeID={location}
renderItem={renderItem}
ListEmptyComponent={DraftEmptyComponent} //TODO: Change this to ScheduledPostEmptyComponent
Copy link
Contributor Author

@Rajat-Dabade Rajat-Dabade Feb 21, 2025

Choose a reason for hiding this comment

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

Will handle this in subsequent PR. https://mattermost.atlassian.net/browse/MM-63142

@Rajat-Dabade Rajat-Dabade self-assigned this Feb 21, 2025
@Rajat-Dabade Rajat-Dabade added the 2: Dev Review Requires review by a core commiter label Feb 21, 2025
@Rajat-Dabade Rajat-Dabade requested a review from larkox February 21, 2025 09:47
@Rajat-Dabade Rajat-Dabade marked this pull request as ready for review February 21, 2025 09:47
Copy link
Contributor

@enahum enahum left a comment

Choose a reason for hiding this comment

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

Some questions non-blocking

@@ -34,7 +34,7 @@ const getStyleSheet = (width: number) => {
width,
},
hiddenTabContent: {
display: 'none',
opacity: 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I recall an issue with rendering the Scheduled Post list in the tab for the first time. Since @harshilsharma63 owns this code, he might have more context on it.

Copy link
Member

Choose a reason for hiding this comment

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

This is because the way we have tabs, we shift the tab contents left or right when navigating to a different tab. If you go from Tab A to Tab B, and you hide tab A by display: none, now it no longer takes any width and the Tab B immediately and abrubtly shows up in the screen and there is no way to smoothen it. But, if you set opacity 0 of tab A, it still occupies the width and you can smoothly transition tab B into screen. This is how all tabs work. I had set display none mistakenly earlier and this corrects it.

Copy link
Contributor

@larkox larkox left a comment

Choose a reason for hiding this comment

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

Please take a look to the date formatting issues. The rest is not so important from my side, but nice to haves.

@Rajat-Dabade Rajat-Dabade force-pushed the add-create-at-column-scheduled-post branch from 8ee12ac to 96f7359 Compare February 25, 2025 09:32
@Rajat-Dabade Rajat-Dabade requested a review from larkox February 26, 2025 10:05
Copy link
Contributor

@larkox larkox left a comment

Choose a reason for hiding this comment

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

I am going to pre-approve, but please extract to constants the size of the tooltip.

Comment on lines +4 to +5
export const DRAFT_TYPE_DRAFT = 'draft';
export const DRAFT_TYPE_SCHEDULED = 'scheduled';
Copy link
Contributor

Choose a reason for hiding this comment

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

In a different PR I was commenting that if you add here as const to both constants, you will probably have to use less castings.

Comment on lines +51 to +56
tooltipContentStyle: {
borderRadius: 8,
width: 247,
padding: 16,
height: 160,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

If it is constant across the platform, extract the constants to a common file, and use the constants.

I don't like it is constant (the container should accommodate the content) but I understand that is out of the scope right now.

const [layoutWidth, setLayoutWidth] = useState(0);
const [tooltipVisible, setTooltipVisible] = useState(false);
const onLayout = useCallback((e: LayoutChangeEvent) => {
setLayoutWidth(e.nativeEvent.layout.width - DRAFT_SCHEDULED_POST_LAYOUT_PADDING); // 40 is the padding of the container
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment is no longer needed, I think.

@@ -63,7 +63,7 @@ const GlobalDraftsList: React.FC<Props> = ({
const [tooltipVisible, setTooltipVisible] = useState(false);
const onLayout = useCallback((e: LayoutChangeEvent) => {
if (location === Screens.GLOBAL_DRAFTS) {
setLayoutWidth(e.nativeEvent.layout.width - 40); // 40 is the padding of the container
setLayoutWidth(e.nativeEvent.layout.width - DRAFT_SCHEDULED_POST_LAYOUT_PADDING); // 40 is the padding of the container
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment here is no longer needed.

@Rajat-Dabade Rajat-Dabade requested a review from larkox February 26, 2025 15:57
@larkox
Copy link
Contributor

larkox commented Feb 26, 2025

@Rajat-Dabade I don't see any changes since my last review. Did you miss a push?

/>,
);

fireEvent.press(getByTestId('draft.tooltip.close.button'));
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be inside an act, I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core commiter release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants