Skip to content

Issue#5123 : Migrated the offline alert bar in Settings from Vuetify to Kolibri Design System. #5162

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

Open
wants to merge 5 commits into
base: unstable
Choose a base branch
from

Conversation

AadarshM07
Copy link

@AadarshM07 AadarshM07 commented Jul 8, 2025

Summary

Migrated the OfflineText Vuetify component with a new StudioOfflineAlert component that uses Kolibri Design System by following the guidelines .

KDS components used:

  • KTransition : for smooth transition of alertbar
  • KIcon : disconnect icon used for alert
  • KLiveRegion : Screen reader accessability

Manual verification steps performed:

  • Switched network offline and back online to overview the behaviour.
  • Verified the alert appears with transition and UI consistency.
  • Confirmed accessibility messages are announced via useKLiveRegion
  • Checked responsiveness across viewports

UI screenshots:

Desktop:

image

Mobile:

image

References

Reviewer guidance

  • Toggle the app offline and online to test the component behaviour.
  • Ensure if the new component is visually appealing.

@MisRob
Copy link
Member

MisRob commented Jul 10, 2025

Thank you @AadarshM07, I will review soon.

@MisRob MisRob self-requested a review July 10, 2025 08:30
@MisRob MisRob self-assigned this Jul 10, 2025
Copy link
Member

@MisRob MisRob left a comment

Choose a reason for hiding this comment

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

Very nice work @AadarshM07! I successfully tested on multiple screen sizes, on both RTL and LTR, and with screen reader too. Thanks for following the guidance, much appreciated.

Leaving few notes, let me know what you think.

icon="disconnected"
class="mx-3"
/>
<span class="notranslate">{{ $tr('offlineText') }}</span>
Copy link
Member

Choose a reason for hiding this comment

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

notranslate needs to be removed here - its only for texts that shouldn't be translated. Here we are translating.

Copy link
Author

Choose a reason for hiding this comment

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

Sure, thanks for clarifying — I will remove it.

v-if="offline && !libraryMode"
class="studio-offline-alert"
:style="computedstyle"
data-test="studio-offline-alert"
Copy link
Member

Choose a reason for hiding this comment

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

We typically use data-test for unit testing and when there is no other way to find an element we need to test. I don't see it being used from anywhere so it could be removed. Alternatively, would you be able to cover the component with few basic unit tests?

Copy link
Author

@AadarshM07 AadarshM07 Jul 12, 2025

Choose a reason for hiding this comment

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

Sure, I noticed that OfflineText.vue already has unit tests that cover similar offline detection logic here. I can take that as a reference and write a separate test suite for StudioOfflineAlert.vue. Would it be alright if I add the unit tests in a follow-up PR?

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! Generally it's good to have a test together with the logic it tests in a single PR since it's related. If you don't have time now, that's fine. I wouldn't mind waiting a bit before we merge, or if it'd be a long time then yes, a follow-up pull request is an option too.

Copy link
Member

Choose a reason for hiding this comment

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

Also note that for new tests, we'd want to use Vue Testing Library as it has several benefits. It is installed in Studio. We have a guide for it here in Kolibri documentation, but it applies to Studio testing as well. I forgot to mention it in the issue, will update.

Copy link
Author

Choose a reason for hiding this comment

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

Sure, it won't take a long time - I will include the tests in this PR.

}

.alert-content span {
vertical-align: bottom;
Copy link
Member

Choose a reason for hiding this comment

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

This style doesn't have any effect.

Screenshot from 2025-07-10 11-58-54

Can be removed.

Copy link
Author

Choose a reason for hiding this comment

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

It was a mistake. I’ll remove it 👍

Copy link
Member

Choose a reason for hiding this comment

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

No problem, thanks

:style="computedstyle"
data-test="studio-offline-alert"
>
<div class="alert-content">
Copy link
Member

Choose a reason for hiding this comment

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

.studio-offline-alert is too flex and in styles I don't see anything that would require having this another flex wrapper .alert-content around KIcon and offline text. Can it be simplified and .alert-content div removed, or was there any need for it?

Copy link
Author

Choose a reason for hiding this comment

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

Initially, I added it to maintain the layout structure, but it's not necessary since the parent container already handles the spacing well. Happy to remove it to keep things cleaner

data-test="studio-offline-alert"
>
<div class="alert-content">
<KIcon
Copy link
Member

Choose a reason for hiding this comment

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

As I resize my browser screen to smaller, the icon gets smaller too. I would expect it to be the same size on all screens. I think it gets smaller because it's default flex behavior. Let's keep using flex, it's good solution for this task, I think you will just need to tweak it a bit, probably with flex-shrink?
Screenshot from 2025-07-10 12-11-56

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the guide — I will make the changes👍

@@ -0,0 +1,95 @@
<template>

<KTransition kind="component-vertical-slide-out-in">
Copy link
Member

Choose a reason for hiding this comment

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

There's a little visual hiccup - when transition is disappearing, it gradually moves too high over the yellow navigation bar. We've recently encountered the same issue here when attempting to apply component-vertical-slide-out-in on opening / closing this form.

In this particular case it's not so apparent, so I don't think it's blocking this PR. However I think it should be relatively simple fix in KDS repo that would update KTransition to transition in a similar way that Vuetify does. Let me know if that's something you'd like to fine-tune, or if I should rather open a follow-up issue.

Copy link
Author

Choose a reason for hiding this comment

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

I checked on the issue — it’s caused by this line in KTransition, where transform: translateY(-50%) shifts the element up by 50% of its height . Replacing it with a smaller fixed value like -10px gives a much smoother effect without overlapping. If that works, I'm happy to make a PR to KDS with fix 👍

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense. KDS fix PR would be much appreciated.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, should I create an issue for this, or can I go ahead without one?

Copy link
Member

Choose a reason for hiding this comment

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

Feel free to go ahead without creating an issue - just reference my handle and this conversation, so it doesn't come out out of nothing in case other team members would preview :)! Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants