-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gaming dashboard - API keys as cards (#1575)
* Dashboard cards done * lingui extract * extra padding * Apply suggestions from code review Co-authored-by: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * lingui extract * Feedback * Removed link * Apply suggestions from code review * Made warning bigger * lingui extract Co-authored-by: GitHub Actions <actions@github.com> Co-authored-by: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> Co-authored-by: Michael Yankelev <12774278+FSM1@users.noreply.github.com>
- Loading branch information
1 parent
e049d76
commit 5d3ac19
Showing
9 changed files
with
170 additions
and
253 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,86 @@ | ||
import React from "react" | ||
import { AccessKey } from "@chainsafe/files-api-client" | ||
import { makeStyles, createStyles } from "@chainsafe/common-theme" | ||
import { CSGTheme } from "../../Themes/types" | ||
import { Button, Typography, Paper } from "@chainsafe/common-components" | ||
import { Trans } from "@lingui/macro" | ||
import dayjs from "dayjs" | ||
|
||
|
||
const useStyles = makeStyles(({ constants }: CSGTheme) => | ||
createStyles({ | ||
root: { | ||
position: "relative", | ||
margin: constants.generalUnit, | ||
borderRadius: constants.generalUnit / 2, | ||
maxWidth: 250, | ||
padding: `${constants.generalUnit * 2}px ${constants.generalUnit}px` | ||
}, | ||
button: { | ||
marginTop: constants.generalUnit * 2 | ||
} | ||
}) | ||
) | ||
|
||
interface IApiKeyCard { | ||
apiKey: AccessKey | ||
deleteKey: () => void | ||
} | ||
|
||
const ApiKeyCard = ({ apiKey, deleteKey }: IApiKeyCard) => { | ||
const classes = useStyles() | ||
|
||
return ( | ||
<Paper className={classes.root}> | ||
<Typography variant="h4" | ||
component="h4"> | ||
<Trans> | ||
Id: | ||
</Trans> | ||
</Typography> | ||
<Typography | ||
variant="body1" | ||
component="p" | ||
> | ||
{ apiKey.id } | ||
</Typography> | ||
<Typography variant="h4" | ||
component="h4"> | ||
<Trans> | ||
Status: | ||
</Trans> | ||
</Typography> | ||
<Typography | ||
variant="body1" | ||
component="p"> | ||
{ apiKey.status } | ||
</Typography> | ||
<Typography | ||
variant="h4" | ||
component="h4" | ||
> | ||
<Trans> | ||
Created on: | ||
</Trans> | ||
</Typography> | ||
<Typography | ||
variant="body1" | ||
component="p" | ||
> | ||
{ dayjs(apiKey.created_at).format("DD MMM YYYY h:mm a") } | ||
</Typography> | ||
<Button | ||
className={classes.button} | ||
variant="secondary" | ||
fullsize={true} | ||
onClick={deleteKey} | ||
> | ||
<Trans> | ||
Delete key | ||
</Trans> | ||
</Button> | ||
</Paper> | ||
) | ||
} | ||
|
||
export default ApiKeyCard |
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.