LF-5117: Disable prohibited flows#4003
Conversation
* Crops: Add to your farm, Add crop / variety / crop plan / delete crop plan * Animals: single animal view three-dot menu * Tasks: add custom harvest use for completion, already completed flow, manage your custom task * Inventory: floating button for adding product
(edit crop, edit / abandon / complete plan, retire / edit location)
|
This PR is ready for review, thank you! 🙏 Update: There was one thing I wanted to fix, so I made one more commit. No more changes will be added 🙇 |
There was a problem hiding this comment.
I love navStyles.hideWhenoffline so much!! With the alias config it's so perfect 👌
Thank you also for catching all those areas I missed on the Jira ticket! 🙇 Having clicked around for quite a while, I think I spotted just a few more:
- Crops: We need to also hide the three-dot menu for the "repeat crop plan" (sorry completely forgot that!)
- Finances (Main Page): We'll need to disable the "Report" feature. Loïc provided a disabled style here in Figma, but I think hiding is also totally fine
- Finances (Transactions): When a transaction is expanded, there is a "View & edit" option. I'm not sure what the best thing to do is here! Is it easiest to remove that link entirely? Otherwise the delete and edit options would need to be removed from the following pages. That seems like a little bit more work, but maybe more in the spirit of "readonly" finances?
While doing the offline testing, I also noticed that notifications... can't be clicked on while offline??! Do you see that behaviour? It's so weird; I wonder if there is some sort of API call dependency in that flow. I will probably ticket it, but if we can get Loïc's permission, it would definitely be easier to just flat-out disable notifications as well...!
| @include xs-breakpoint { | ||
| --global-navbar-height: calc(55px + 24px); | ||
| } | ||
|
|
There was a problem hiding this comment.
❤️🔥❤️🔥❤️🔥
Never thought to use the class like this when I set it up for the hight adjust 😁 Fantastic!
…ons View & edit button when offline
|
Thank you Joyce! I hid all the ones you spotted. The notification button works fine for me! Is it not always working? A patch tasks re-completion API test just failed: It may or may not be the same test that failed before (I couldn't find it on slack). I'm not going to investigate it now given the time constraint. |
There was a problem hiding this comment.
Oh, I love how easy it is to hide additional things with navStyles.hideWhenOffline 😁
The notification button works fine for me! Is it not always working?
It's not the notification list itself that isn't loading, but rather when you are viewing the list, you can't click on any notification entry to see its details. I just checked with the network tab, and indeed it is the case that every time you click on a notification tile, it's a PATCH to /notification_user. So when that fails, as it will when offline, the page transition also doesn't happen! Kind of wild.
(Totally fixable I'm sure -- that network request probably doesn't need to be blocking -- but disabling the list entirely is a pleasingly low-effort approach, and then we don't have to worry about re-synching up the read notification state, or the fact that new notifications aren't coming in while offline.)
|
Ah, okay... |
Description
Hide or disable buttons that trigger prohibited flows when offline.
@navStylesalias was introduced to make hiding elements easier.Changes:
@navStylesuseIsOfflinehookuseIsOfflinehookNote:
I went ahead and hid form buttons after confirming that buttons are being hidden as needed (e.g., edit / retire buttons for workers). If that’s not ideal, I’m open to disabling them, although disabling location form buttons would require prop drilling across many files.
Jira link: https://lite-farm.atlassian.net/browse/LF-5117
Type of change
How Has This Been Tested?
Checklist:
pnpm i18nto help with this)