+const useStyles = makeStyles(({ breakpoints, constants, palette, zIndex }: CSGTheme) =>
createStyles({
root: {
- position: "relative"
+ position: "relative",
+ margin: constants.generalUnit
},
header: {
display: "flex",
@@ -48,41 +31,30 @@ const useStyles = makeStyles(({ constants, breakpoints, animation, zIndex, palet
marginLeft: constants.generalUnit
}
},
- tableHead: {
- marginTop: 24
- },
- tableRow: {
- border: "2px solid transparent",
- transitionDuration: `${animation.transform}ms`,
- [breakpoints.up("md")]: {
- gridTemplateColumns: desktopGridSettings
- },
- [breakpoints.down("md")]: {
- gridTemplateColumns: mobileGridSettings
- }
- },
- dropdownIcon: {
- "& svg": {
- fill: constants.fileSystemItemRow.dropdownIcon
- }
- },
- dropdownOptions: {
- backgroundColor: constants.fileSystemItemRow.optionsBackground,
- color: constants.fileSystemItemRow.optionsColor,
- border: `1px solid ${constants.fileSystemItemRow.optionsBorder}`
- },
- dropdownItem: {
- backgroundColor: constants.fileSystemItemRow.itemBackground,
- color: constants.fileSystemItemRow.itemColor
- },
- menuIcon: {
+ dataArea: {
+ marginTop: constants.generalUnit * 2,
display: "flex",
- justifyContent: "center",
- alignItems: "center",
- width: 20,
- marginRight: constants.generalUnit * 1.5,
- "& svg": {
- fill: constants.fileSystemItemRow.menuIcon
+ flexDirection: "row",
+ justifyContent: "space-between",
+ flexWrap: "wrap",
+ "& > *": {
+ margin: constants.generalUnit,
+ width:"100%",
+ [breakpoints.up("xs")]: {
+ maxWidth: `calc(100% - ${constants.generalUnit * 2}px)`
+ },
+ [breakpoints.up("sm")]: {
+ maxWidth: `calc(50% - ${constants.generalUnit * 2}px)`
+ },
+ [breakpoints.up("md")]: {
+ maxWidth: `calc(33% - ${constants.generalUnit * 2}px)`
+ },
+ [breakpoints.up("lg")]: {
+ maxWidth: `calc(25% - ${constants.generalUnit * 2}px)`
+ },
+ [breakpoints.up("xl")]: {
+ maxWidth: `calc(20% - ${constants.generalUnit * 2}px)`
+ }
}
},
modalRoot: {
@@ -137,7 +109,7 @@ const useStyles = makeStyles(({ constants, breakpoints, animation, zIndex, palet
})
)
-const ApiKeys = () => {
+const DashboardModule = () => {
const classes = useStyles()
const { gamingApiClient } = useGamingApi()
const [keys, setKeys] = useState
([])
@@ -161,15 +133,17 @@ const ApiKeys = () => {
const fetchAccessKeys = useCallback(() => {
gamingApiClient.listAccessKeys()
- .then(setKeys)
+ .then(keys => setKeys(keys.filter(key => key.type === "gaming")))
.catch(console.error)
}, [gamingApiClient])
- const createStorageAccessKey = useCallback(() => {
+ const createGamingAccessKey = useCallback(() => {
gamingApiClient.createAccessKey({ type: "gaming" })
- .then(setNewKey)
- .then(fetchAccessKeys)
- .then(() => setIsNewKeyModalOpen(true))
+ .then((key) => {
+ setNewKey(key)
+ fetchAccessKeys()
+ setIsNewKeyModalOpen(true)
+ })
.catch(console.error)
}, [fetchAccessKeys, gamingApiClient])
@@ -193,16 +167,16 @@ const ApiKeys = () => {
data-cy="api-keys-header"
>
- API Keys
+ Dashboard
-
-
-
-
- Id
-
-
- Type
-
-
- Status
-
-
- Created At
-
- {/* Menu */}
-
-
-
- {keys.map(k =>
-
-
-
- {k.id}
-
-
-
-
- {k.type}
-
-
-
-
- {k.status}
-
-
-
-
- {dayjs(k.created_at).format("DD MMM YYYY h:mm a")}
-
-
-
-
-
-
- Delete Key
-
- >
- ),
- onClick: () => deleteAccessKey(k.id)
- }]}
- classNames={{
- icon: classes.dropdownIcon,
- options: classes.dropdownOptions,
- item: classes.dropdownItem
- }}
- indicator={MoreIcon}
- />
-
- )}
-
-
+
+ {
+ keys.map((key: AccessKey, index: number) => (
+ deleteAccessKey(key.id)}
+ apiKey={key} />))
+ }
+