1
- import React , { Suspense } from "react" ;
1
+ import React from "react" ;
2
2
import { FormattedMessage } from "react-intl" ;
3
- import { Navigate , Route , Routes } from "react-router-dom" ;
4
3
import styled from "styled-components" ;
5
4
6
5
import { PageTitle } from "components" ;
7
6
import HeadTitle from "components/HeadTitle" ;
8
- import LoadingPage from "components/LoadingPage" ;
9
7
import MainPageWithScroll from "components/MainPageWithScroll" ;
10
- import SideMenu from "components/SideMenu" ;
11
- import { CategoryItem } from "components/SideMenu/SideMenu" ;
12
8
13
- import useRouter from "hooks/useRouter" ;
14
- import { CloudRoutes } from "packages/cloud/cloudRoutes" ;
15
9
import { useAuthService } from "packages/cloud/services/auth/AuthService" ;
16
10
17
- import CreditsUsagePage from "./components/CreditsUsagePage " ;
11
+ import CreditsUsage from "./components/CreditsUsage " ;
18
12
import { EmailVerificationHint } from "./components/EmailVerificationHint" ;
19
13
import RemainingCredits from "./components/RemainingCredits" ;
20
14
@@ -23,40 +17,13 @@ const Content = styled.div`
23
17
height: 100%;
24
18
` ;
25
19
26
- const MainInfo = styled . div `
27
- display: flex;
28
- flex-direction: row;
29
- margin-top: 29px;
30
- ` ;
31
-
32
- const MainView = styled . div `
33
- width: 100%;
34
- margin-left: 47px;
35
- ` ;
36
-
37
20
const EmailVerificationHintWithMargin = styled ( EmailVerificationHint ) `
38
21
margin-bottom: 8px;
39
22
` ;
40
23
41
24
const CreditsPage : React . FC = ( ) => {
42
- const { push, pathname } = useRouter ( ) ;
43
- const onSelectMenuItem = ( newPath : string ) => push ( newPath ) ;
44
25
const { emailVerified } = useAuthService ( ) ;
45
26
46
- const menuItems : CategoryItem [ ] = [
47
- {
48
- routes : [
49
- {
50
- path : `` ,
51
- name : < FormattedMessage id = "credits.creditUsage" /> ,
52
- component : CreditsUsagePage ,
53
- } ,
54
- ] ,
55
- } ,
56
- ] ;
57
-
58
- const firstRoute = menuItems ?. [ 0 ] . routes ?. [ 0 ] ?. path ;
59
-
60
27
return (
61
28
< MainPageWithScroll
62
29
headTitle = { < HeadTitle titles = { [ { id : "credits.credits" } ] } /> }
@@ -65,25 +32,7 @@ const CreditsPage: React.FC = () => {
65
32
< Content >
66
33
{ ! emailVerified && < EmailVerificationHintWithMargin /> }
67
34
< RemainingCredits selfServiceCheckoutEnabled = { emailVerified } />
68
- < MainInfo >
69
- < SideMenu data = { menuItems } onSelect = { onSelectMenuItem } activeItem = { pathname } />
70
- < MainView >
71
- < Suspense fallback = { < LoadingPage /> } >
72
- < Routes >
73
- { menuItems . flatMap ( ( menuItem ) =>
74
- menuItem . routes . map ( ( { path, component : Component } ) => (
75
- < Route key = { `${ path } ` } path = { `${ path } ` } element = { < Component /> } />
76
- ) )
77
- ) }
78
-
79
- < Route
80
- path = "*"
81
- element = { < Navigate to = { firstRoute ? `${ menuItems ?. [ 0 ] . routes ?. [ 0 ] ?. path } ` : CloudRoutes . Root } /> }
82
- />
83
- </ Routes >
84
- </ Suspense >
85
- </ MainView >
86
- </ MainInfo >
35
+ < CreditsUsage />
87
36
</ Content >
88
37
</ MainPageWithScroll >
89
38
) ;
0 commit comments