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

fix: horizontal scroll for big conditions #207

Merged
merged 4 commits into from
Sep 6, 2024
Merged

Conversation

ShubhranshuSanjeev
Copy link
Collaborator

@ShubhranshuSanjeev ShubhranshuSanjeev commented Aug 20, 2024

Problem

Conditions on Overrides and Resolve page overflowed the screen width forcing to horizontally scroll to check the content.

Solution Screenshots

Default view - content is truncated
image

Expanded view - on clicking the pills it will expanded to show the wrapped content.
image

@ShubhranshuSanjeev ShubhranshuSanjeev marked this pull request as ready for review August 21, 2024 06:25
@ShubhranshuSanjeev ShubhranshuSanjeev requested a review from a team as a code owner August 21, 2024 06:25
@ShubhranshuSanjeev ShubhranshuSanjeev force-pushed the fix/horizontal-scroll branch 2 times, most recently from 1cd9ed7 to 552a695 Compare August 21, 2024 09:31
Copy link
Collaborator

@ayushjain17 ayushjain17 left a comment

Choose a reason for hiding this comment

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

partial review

crates/frontend/src/pages/home.rs Outdated Show resolved Hide resolved
crates/frontend/src/components/context_card.rs Outdated Show resolved Hide resolved
@@ -86,3 +87,12 @@
.min-w-48 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we can use tailwind config file to add such requirements

Copy link
Collaborator

Choose a reason for hiding this comment

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

pending

@@ -27,6 +27,7 @@

.context_condition{
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we not move these to tailwind itself ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

pending

crates/frontend/src/pages/home.rs Outdated Show resolved Hide resolved
class:text-gray-300={striked}
>{key}</span>
</td>
<td class="min-w-48 max-w-72 font-mono" style="word-break: break-word;">
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we keep all styles in one single format, (preferably all in tailwind - break-words for this case)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I mostly just moved the code out of that big component function this just an old code when we were building the first cut for UI and never it touched it again, but sure I will make the change since we already made a class for that style.

crates/frontend/src/pages/home.rs Show resolved Hide resolved
crates/frontend/src/components/condition_pills.rs Outdated Show resolved Hide resolved
@Datron
Copy link
Collaborator

Datron commented Aug 21, 2024

@ShubhranshuSanjeev few issues I saw in my testing

  • Control variants aren't fully displayed
Screenshot 2024-08-21 at 3 24 35 PM
  • It is not evident that the context pills can be clicked on. We should change the mouse pointer on hover

  • Single context elements don't need the And, the and sort of doesn't make sense since that is the default and only option.

Screenshot 2024-08-21 at 3 29 54 PM
  • I'm not sure about this redesign, arranging items horizontally isn't a safe bet for smaller screens, can we check this on a macbook air? I see a lot of white space wasted. I was hoping we would truncate the config key values as well until clicked on.
Screenshot 2024-08-21 at 3 37 16 PM

@Datron
Copy link
Collaborator

Datron commented Aug 21, 2024

Screenshot 2024-08-21 at 3 41 44 PM We made this full screen as well?

@ShubhranshuSanjeev
Copy link
Collaborator Author

  • I'm not sure about this redesign, arranging items horizontally isn't a safe bet for smaller screens, can we check this on a macbook air? I see a lot of white space wasted. I was hoping we would truncate the config key values as well until clicked on.

About the smaller screen, I have tested it on my side already it handles that, the table becomes horizontally scrollable, and there is no overflow of content.

@ShubhranshuSanjeev
Copy link
Collaborator Author

  • Single context elements don't need the And, the and sort of doesn't make sense since that is the default and only option.

Yes that is given its an and, but won't removing this will make UI bit inconsistent.

@ShubhranshuSanjeev
Copy link
Collaborator Author

  • It is not evident that the context pills can be clicked on. We should change the mouse pointer on hover

Sure, will change to pointer.

@ShubhranshuSanjeev
Copy link
Collaborator Author

ShubhranshuSanjeev commented Aug 21, 2024

  • Control variants aren't fully displayed
Screenshot 2024-08-21 at 3 24 35 PM

This works perfectly on my side, but let me check again.

@ShubhranshuSanjeev
Copy link
Collaborator Author

Screenshot 2024-08-21 at 3 41 44 PM We made this full screen as well?

Didn't really change any styles for this page, but let me check

@ShubhranshuSanjeev
Copy link
Collaborator Author

ShubhranshuSanjeev commented Aug 21, 2024

  • I'm not sure about this redesign, arranging items horizontally isn't a safe bet for smaller screens, can we check this on a macbook air? I see a lot of white space wasted. I was hoping we would truncate the config key values as well until clicked on.

About the smaller screen, I have tested it on my side already it handles that, the table becomes horizontally scrollable, and there is no overflow of content.

Also for screens smaller than normal laptops the table and the conditions will be vertically arranged.

image

@ShubhranshuSanjeev ShubhranshuSanjeev force-pushed the fix/horizontal-scroll branch 3 times, most recently from 1834df8 to b24728b Compare August 22, 2024 13:52
@@ -36,7 +36,7 @@ pub fn Layout(children: Children) -> impl IntoView {
<div>
<SideNav resolved_path=path original_path=original_path.to_string()/>
// params_map=params_map
<main class="ease-soft-in-out xl:ml-96 relative h-full max-h-screen rounded-xl transition-all duration-200 overflow-y-auto">
<main class="ease-soft-in-out xl:ml-[350px] relative h-full max-h-screen rounded-xl transition-all duration-200 overflow-y-auto">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would rem and em instead of px be better?

Comment on lines 29 to 31
#[prop(into, default = String::new())] cell_style: String,
#[prop(into, default = String::new())] style: String,
#[prop(into, default = String::new())] head_style: String,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we have some reasonable defaults or is empty string fine?

Copy link
Collaborator

@mahatoankitkumar mahatoankitkumar left a comment

Choose a reason for hiding this comment

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

Remaining: Disabling actions on experiment's context.

Copy link
Collaborator

@ayushjain17 ayushjain17 left a comment

Choose a reason for hiding this comment

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

minor suggestions and few other changes

@@ -37,37 +45,41 @@ pub fn context_card(
];

view! {
<div class="rounded-lg shadow bg-base-100 p-6 shadow">
<div class="rounded-lg shadow bg-base-100 p-6 shadow flex flex-col gap-4">
Copy link
Collaborator

Choose a reason for hiding this comment

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

preferred order for classes:
"custom-non-tailwind classes"
"hidden"
"position z top/left/.."
"h w"
"m"
"p"
"flex props"
"text props"
"bg props"
"border props/rounded"
"shadow"
"transition/animation"

crates/frontend/src/components/condition_pills.rs Outdated Show resolved Hide resolved
crates/frontend/src/components/table.rs Outdated Show resolved Hide resolved
let TablePaginationProps { current_page, total_pages, on_prev, on_next, .. } = pagination_props
.get_value();
view! {
<div class="mt-2 flex justify-end">
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we pass these class styles to the Component itself?
redundant div, wrapping only one child

crates/frontend/src/pages/home.rs Show resolved Hide resolved
class:text-gray-300={striked}
>{key}</span>
</td>
<td class="min-w-48 max-w-72 font-mono" style="word-break: break-word;">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<td class="min-w-48 max-w-72 font-mono" style="word-break: break-word;">
<td class="min-w-48 max-w-72 font-mono break-words">

id=context.id.clone()
class="xl:w-[400px] h-fit"
/>
<div class="overflow-auto pt-5">
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we pass these props to the table itself ?

.collect::<Vec<_>>()
}
</ConditionCollapseProvider>
<div class="card bg-base-100 shadow m-6">
Copy link
Collaborator

Choose a reason for hiding this comment

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

same, can we pass these props to the following div

@@ -86,3 +87,12 @@
.min-w-48 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

pending

@@ -27,6 +27,7 @@

.context_condition{
Copy link
Collaborator

Choose a reason for hiding this comment

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

pending

@Datron Datron dismissed ayushjain17’s stale review September 6, 2024 05:44

changes requested have been addressed

@Datron Datron merged commit f6519ef into main Sep 6, 2024
4 checks passed
@Datron Datron deleted the fix/horizontal-scroll branch September 6, 2024 05:45
@ShubhranshuSanjeev ShubhranshuSanjeev linked an issue Sep 22, 2024 that may be closed by this pull request
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.

Set condition pills width to fit content
4 participants