-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perms: refactor install flow to prompt user
also: - extract functions to hooks in docket - use routes to render perm dialog - add fake seal placeholder - iterate on
- Loading branch information
1 parent
b19c60a
commit 1ede094
Showing
10 changed files
with
336 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { useCallback } from 'react'; | ||
import { useHistory } from 'react-router-dom'; | ||
import { Dialog, DialogContent } from './Dialog'; | ||
import { PermissionsDialogInner } from '@/permissions/PermissionsDialog'; | ||
import { Spinner } from '@/components/Spinner'; | ||
import usePermissions from '@/permissions/usePermissions'; | ||
|
||
export const Permissions = () => { | ||
const { push } = useHistory(); | ||
const { | ||
appName, | ||
desk, | ||
docket, | ||
installStatus, | ||
passport, | ||
pike, | ||
ship, | ||
} = usePermissions(); | ||
|
||
const onInstall = useCallback(async () => { | ||
if (installStatus === 'installed') { | ||
return; | ||
} | ||
|
||
// await useDocketState.getState().approvePermissions(ship, desk); | ||
|
||
// await useDocketState.getState().installDocket(ship, desk); | ||
console.log(`installing ${ship}/${desk}...`); | ||
push(`/app/${desk}`); | ||
}, []); | ||
|
||
return ( | ||
<Dialog open onOpenChange={(open) => !open && push('/')}> | ||
<DialogContent | ||
showClose={false} | ||
containerClass="w-full max-w-xl z-[70]" | ||
> | ||
{ | ||
(docket || pike) && passport ? ( | ||
<PermissionsDialogInner | ||
appName={appName} | ||
passport={passport} | ||
onInstall={onInstall} | ||
/>) : ( | ||
<div className="dialog-inner-container flex justify-center text-black"> | ||
<Spinner className="h-10 w-10" /> | ||
</div> | ||
) | ||
} | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.