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

Support mobile display #822

Merged
merged 15 commits into from
Aug 11, 2023
Merged

Support mobile display #822

merged 15 commits into from
Aug 11, 2023

Conversation

pavloburchak
Copy link
Contributor

This PR...

Changes

Fixes

How to test it

screenshots

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

@vercel
Copy link

vercel bot commented Aug 8, 2023

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

Name Status Preview Comments Updated (UTC)
testkube-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 11, 2023 2:04pm

Copy link
Member

@rangoo94 rangoo94 left a comment

Choose a reason for hiding this comment

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

The most important thing is that we should:

  • avoid depending on JS for displaying on different devices (always when it's possible), and
  • avoid setting direct dimensions of elements (unless it's part of their geometry, or would be much harder otherwise)
    This way, we may depend on browser mechanisms, ensuring that the behavior is smooth; mobile devices are worse than desktop, so it's even more important for them.

Besides code review, I've checked how it works in real, and works nicely 👍

Screenshot Description
Zrzut ekranu 2023-08-9 o 08 37 52 Priority: High
May be worth to delete help for creating executors on mobile, or make it smaller
Zrzut ekranu 2023-08-9 o 08 37 23 Priority: Medium
Modal for creating the test should be constrained to maximum width
Zrzut ekranu 2023-08-9 o 08 37 02 Priority: High
May be worth deleting the creating tests help on mobile
Zrzut ekranu 2023-08-9 o 08 36 41 Priority: Low
It should wrap (or at least truncate?) for some minimum size of these items
Zrzut ekranu 2023-08-9 o 08 34 11 Priority: Low
I'm thinking about this one - would it be possible to move the graph to right side of labels? If that would require some bigger effort - ignore it 🙂
Zrzut ekranu 2023-08-9 o 08 38 06 Priority: Low
Should "Condition" / "Actions" steps list wrap?
Zrzut ekranu 2023-08-9 o 08 40 30 Priority: High
The tabs are strangely positioned - the tab content should be scrollable, but tabs rather always visible
Zrzut ekranu 2023-08-9 o 08 41 33 Priority: Very Low
Completely minor - maybe it's worth to change minimum size for official executors, to make them 2 in a row on mobile?

Comment on lines 67 to 73
@media ${maxDevice.tablet} {
max-width: 75vw;
}

@media ${maxDevice.mobileL} {
max-width: 60vw;
}
Copy link
Member

Choose a reason for hiding this comment

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

  • ItemRow is a content of grid item, not a grid item itself, therefore it's width should be full grid item
  • The contents of ItemRow are px based, and the container is local, so it shouldn't be based on vw
  • The contents of ItemRow differ, so it shouldn't be generic
  • You may use minItemWidth prop of EntityGrid to define minimum size of item if it's needed

Comment on lines 75 to 76
const {width} = useWindowSize();
const isDisplayExecutionTime = width > size.mobileL;
Copy link
Member

Choose a reason for hiding this comment

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

This should be done with CSS - will be more performant, and will always work; the JS here may not necessarily work nicely, especially given that it's pure component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you mean with display none?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, exactly 🙂

import LabelsFilter from './LabelsFilter';
import StatusFilter from './StatusFilter';
import TextSearchFilter from './TextSearchFilter';

const EntityListFilters: FC<FilterProps> = props => {
const {isFiltersDisabled, ...rest} = props;

const isMobile = useIsMobile();

const filtersWidth = isMobile ? 'inherit' : '296px';
Copy link
Member

Choose a reason for hiding this comment

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

inherit is incorrect here, as you don't want to copy the property from parent. Most likely you've meant either initial or 100%.

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 think I do want it, but ok, I can change it

Copy link
Member

@rangoo94 rangoo94 Aug 9, 2023

Choose a reason for hiding this comment

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

initial would make the container use its default behavior, while inherit would "copy" the same value as the parent container - not the computed one, but the relative one.

As an example, if you'll have HTML (codesandbox):

<style>
div {width: 30%;height: 20px;background: rgba(0, 0, 0, .1);}
.inherit {width: inherit;}
.initial {width: initial;}
</style>

<div><div class="inherit"><div class="inherit"></div></div></div>
<br />
<div><div class="initial"><div class="initial"></div></div></div>
Zrzut ekranu 2023-08-9 o 12 11 26

The first container will get smaller and smaller (as it will copy 30%), and the other one will take the parent's container size (as it will reset to defaults).

Therefore, I believe that you did rather want initial, but I may be wrong 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, will update it

gap: 16px;
align-items: center;

${props => (props.isMobile ? `width: 100%;` : '')}
Copy link
Member

Choose a reason for hiding this comment

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

  • Stretching items for all dimensions will work well instead (it may require adjusting the parent container too, but it may be worth it)
  • We should control CSS without JS, using media queries only

position: relative;
display: flex;
justify-content: space-between;
align-items: center;

width: 296px;
width: ${props => props.$width || '296px'};
Copy link
Member

Choose a reason for hiding this comment

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

Looking at the FiltersContainer code above, we should be able to easily get rid of width at all here

@@ -44,7 +44,7 @@ const TextSearchFilter: React.FC<FilterProps> = props => {
value={inputValue}
data-cy="search-filter"
disabled={isFiltersDisabled}
style={{width: '296px'}}
style={{width}}
Copy link
Member

Choose a reason for hiding this comment

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

We may get rid of width, making it flexible instead

position: fixed;
display: flex;
flex-direction: column;
justify-content: space-between;

padding-top: 30px;
width: 100px;
width: ${props => props.$width}px;
Copy link
Member

Choose a reason for hiding this comment

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

I would consider zoom instead, applied via media queries. I don't think there would be any edge cases, but what do you think?

.ant-layout-sider {
  zoom: 0.6;
}

.ant-layout-sider-children > div > div {
  zoom: 1.35;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haven't seen this approach later, this one is not looking perfectly in mobile

@pavloburchak
Copy link
Contributor Author

image for me these tabs display ok, could you provide more details?

@rangoo94
Copy link
Member

for me these tabs display ok, could you provide more details?

Zrzut ekranu 2023-08-10 o 08 50 20

The tabs may not be visible, as the whole container (along with tabs) becomes scrollable on smaller heights (= mobile). The tabs should be rather always visible though, while only content (i.e. Log Output) should scroll.

Copy link
Member

@rangoo94 rangoo94 left a comment

Choose a reason for hiding this comment

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

Screenshot Description
Zrzut ekranu 2023-08-11 o 08 19 45 Displaying the message - the buttons should wrap, and optionally we could make it smaller
Zrzut ekranu 2023-08-11 o 08 23 23 Full screen Log Output doesn't work
Zrzut ekranu 2023-08-11 o 08 24 33 Optional: it would be great if the full screen icon would go down. Also, probably the "AI Insights" tooltip could have fixed position, but I can do that in a separate PR.

@rangoo94 rangoo94 merged commit 44517da into develop Aug 11, 2023
7 checks passed
@rangoo94 rangoo94 deleted the pavlo/support-mobile-display branch August 11, 2023 14:11
haneabogdan pushed a commit that referenced this pull request Aug 14, 2023
* mobile support for filters, sider and list
* entity details and settings optimization
* remove unused
* some pr fixes
* hind adjustment
* more mobile improvements
* fix tabs
* fix navigation for cloud
* cloud message fix
* fix: log output display / sider
* fix: scrolling log output / positioning AI hints promo
* simplify scrolling further
* fix: full screen log output
* fixup stylelint
* chore: delete unused parts

---------

Co-authored-by: Dawid Rusnak <[email protected]>
@rangoo94 rangoo94 mentioned this pull request Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants