Closed nxtCoder19 closed 1 month ago
This pull request implements changes to improve the functionality of discarding changes when switching tabs in app settings. It introduces a new hook for checking owner status, updates the UnsavedChangesProvider to handle discarding changes, and refactors the use of action constants across multiple components.
classDiagram
class useIsOwner {
+boolean isOwner
+boolean isLoading
+useCallback()
}
useIsOwner --> useCustomSwr
useIsOwner --> useConsoleApi
useCustomSwr --> useConsoleApi
Change | Details | Files |
---|---|---|
Implement discard changes functionality in app settings |
|
src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx |
Refactor UnsavedChangesProvider and introduce DISCARD_ACTIONS constants |
|
lib/client/hooks/use-unsaved-changes.tsx |
Update app settings layout to use new DISCARD_ACTIONS constants |
|
src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx |
Refactor other components to use DISCARD_ACTIONS constants |
|
src/apps/console/page-components/app/general.tsx src/apps/iot-console/routes/_main+/$account+/$project+/deviceblueprint+/$deviceblueprint+/app+/$app+/settings+/_layout.tsx src/apps/console/page-components/app/compute.tsx |
Implement useIsOwner hook for checking account ownership |
|
src/apps/console/hooks/use-is-owner.tsx |
Summary by Sourcery
Implement a new hook to check account ownership and enhance the unsaved changes handling by introducing a callback mechanism and a standardized action management system.
New Features:
useIsOwner
to determine if the current user is the owner of an account by checking their role against the account's team members.Enhancements:
UnsavedChangesProvider
to accept anonProceed
callback, allowing actions to be performed when changes are discarded.DISCARD_ACTIONS
object to manage different discard actions consistently across components.