Skip to content

[General] UX improvements in loading screens #1112

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

Merged
merged 1 commit into from
Mar 16, 2022

Conversation

dawidgarus
Copy link
Contributor

Various UX improvements in loading screens:

  • Default "Loading" message can now be translated
  • Loading message is now displayed in the foreground when opening install popups
  • Loading indicator is now displayed inside the container with logs to prevent "jumping" when switching between current and last log
  • Loading indicator in the library is now vertically centered

Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

@dawidgarus dawidgarus marked this pull request as draft March 13, 2022 15:39
@dawidgarus dawidgarus marked this pull request as ready for review March 13, 2022 15:46
@flavioislima flavioislima self-requested a review March 15, 2022 16:26
@@ -28,7 +34,7 @@ export default function ToggleSwitch(props: Props) {
aria-label={title}
/>

<span {...props} className="checkmark" />
<span {...checkmarkProps} className="checkmark" />
Copy link
Member

Choose a reason for hiding this comment

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

What is this change doing exactly?
I believe that if we pass a prop that is not listed, it will be ignored.
so we need to check the props we use when calling this 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.

const {
    handleChange,
    value,
    disabled,
    title,
    dataTestId = 'toggleSwitch',
    ...rest
  } = props

are by any chance thinking of something like rest property? Because destructuring an object doesn't remove destrustured properties.
anyway, I removed properties which caused errors: handleChange and disabled, but I kept the rest just in case the attributes are used somewhere and I didn't want to break anything.

}: UpdateComponentProps) {
const componentRef = useRef<HTMLDivElement>(null)
const wrapperRef = useRef<HTMLDivElement>(null)
const observer = useMemo(() => {
Copy link
Member

Choose a reason for hiding this comment

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

Interesting, so like this we can check the size of the component and render always in the center?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.UpdateComponent element has always height of 100%. Then we change how much of the .UpdateComponent is visible on the screen (ratio) and then change .UpdateComponent__wrapper's height to the ratio.

@@ -422,12 +422,12 @@ export default function GamePage(): JSX.Element | null {
</div>
</>
) : (
<UpdateComponent />
<UpdateComponent message={t('loading.default')} />
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we could use the default message directly into the component in case message is undefined. And make the message a optional prop (I believe might be already)

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've tried that, but it's not possible (or at least I don't see a simple way to do this), because the UpdateComponent is rendered as the translations are loading.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad, it's actually is possible. Commited the change

@flavioislima flavioislima added the pr:ready-for-review Feature-complete, ready for the grind! :P label Mar 15, 2022
...rest
}: UpdateComponentProps) {
const { t } = useTranslation()
if (message === undefined) {
Copy link
Member

Choose a reason for hiding this comment

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

I believe a better check would be:
if (!message) {

because then it would use the default also if we send an empty string, null or any other falsy value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's deliberate:
a) It's inline with current behavior because default value only work if the property is missing (undefined). You can pass empty string to the component and it won't display default message.
b) I can't see any reason to restrict ability to pass empty string and display icon without any message
c) You can't pass any falsy value, because type checking won't allow it. You can either pass no value, which will cause displaying default value or empty string which will display no message

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see. Makes sense to load only the icon.
Good then.

Copy link
Member

@flavioislima flavioislima left a comment

Choose a reason for hiding this comment

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

Thanks for that as well

@flavioislima flavioislima reopened this Mar 16, 2022
@flavioislima flavioislima merged commit 40e9ba3 into Heroic-Games-Launcher:main Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:ready-for-review Feature-complete, ready for the grind! :P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants