-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Using files to store pid and refactor processes termination (#2) * Using files to store pid and refactor processes termination * Refactor process termination * Update logging message during IPFS daemon termination * Refactor process termination and returned getPid async * Deleting a file before processes are terminated * Fix review comments * Add to fs.readFile to catch errors handler * Add authentication flow - first commit * Add authentication flow - first commit * Fix signMessage * Add if condition for signedMessage * Add token management and UI signing feedback * Add application mutation hooks and AccessControl component * Remove unused icon URL and adjust footer alignment * Add FormControl for input validation * Add localhost API URL and success callbacks * Refactor fetch logic to a reusable function * Remove unused approval/rejection logic * Refactor headers * Remove boxShadow * Add environment variable support with dotenv * Add React Router for navigation * Add RPC URL * Add NetworkMismatch component * Remove unused URL and adjust main window height * Apply suggestions from code review --------- Co-authored-by: Noisekit <[email protected]>
- Loading branch information
Showing
16 changed files
with
2,548 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
API_URL=http://localhost:3005/ | ||
PROJECTID= |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
const React = require('react'); | ||
const { usePermissions } = require('./usePermissions'); | ||
const { useSubmitApplicationMutation } = require('./useSubmitApplicationMutation'); | ||
const { useWithdrawApplicationMutation } = require('./useWithdrawApplicationMutation'); | ||
const { Skeleton, Button, Box, Stack, Heading, VStack } = require('@chakra-ui/react'); | ||
|
||
function AccessControl() { | ||
const permissions = usePermissions(); | ||
const submitApplicationMutation = useSubmitApplicationMutation(); | ||
const withdrawApplicationMutation = useWithdrawApplicationMutation(); | ||
|
||
const isLoading = | ||
permissions.isFetching || | ||
submitApplicationMutation.isPending || | ||
withdrawApplicationMutation.isPending; | ||
|
||
let content; | ||
switch (true) { | ||
case isLoading: | ||
content = ( | ||
<Skeleton | ||
height="20px" | ||
width="100%" | ||
bg="gray.600" | ||
startColor="gray.500" | ||
endColor="gray.700" | ||
/> | ||
); | ||
break; | ||
case permissions.data.isPending: | ||
content = ( | ||
<VStack spacing={4} align="start"> | ||
<Heading size="md">Please wait for approval</Heading> | ||
<Button | ||
colorScheme="teal" | ||
variant="outline" | ||
onClick={() => withdrawApplicationMutation.mutate()} | ||
> | ||
Renounce assigned role | ||
</Button> | ||
</VStack> | ||
); | ||
break; | ||
default: | ||
content = ( | ||
<VStack spacing={4} align="start"> | ||
<Heading size="md">Access Control</Heading> | ||
<Button | ||
colorScheme="teal" | ||
variant="outline" | ||
onClick={() => submitApplicationMutation.mutate()} | ||
> | ||
Apply for whitelist | ||
</Button> | ||
</VStack> | ||
); | ||
} | ||
|
||
return ( | ||
<Stack spacing={6} padding={5} borderRadius="md"> | ||
<Box>{content}</Box> | ||
</Stack> | ||
); | ||
} | ||
|
||
module.exports = { AccessControl }; |
Oops, something went wrong.