Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
12b0f109
Commit
12b0f109
authored
Nov 09, 2023
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new layout for app fullscreen mode
parent
f1c4d7a8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
48 deletions
+80
-48
[id].tsx
pages/apps/[id].tsx
+10
-0
MarketplaceApp.tsx
ui/pages/MarketplaceApp.tsx
+23
-42
LayoutApp.tsx
ui/shared/layout/LayoutApp.tsx
+33
-0
Content.tsx
ui/shared/layout/components/Content.tsx
+5
-4
Burger.tsx
ui/snippets/header/Burger.tsx
+1
-1
Header.tsx
ui/snippets/header/Header.tsx
+8
-1
No files found.
pages/apps/[id].tsx
View file @
12b0f109
...
...
@@ -6,6 +6,8 @@ import type { NextPageWithLayout } from 'nextjs/types';
import
type
{
Props
}
from
'
nextjs/getServerSideProps
'
;
import
PageNextJs
from
'
nextjs/PageNextJs
'
;
import
LayoutApp
from
'
ui/shared/layout/LayoutApp
'
;
const
MarketplaceApp
=
dynamic
(()
=>
import
(
'
ui/pages/MarketplaceApp
'
),
{
ssr
:
false
});
const
Page
:
NextPageWithLayout
<
Props
>
=
(
props
:
Props
)
=>
{
...
...
@@ -16,6 +18,14 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
);
};
Page
.
getLayout
=
function
getLayout
(
page
:
React
.
ReactElement
)
{
return
(
<
LayoutApp
>
{
page
}
</
LayoutApp
>
);
};
export
default
Page
;
export
{
marketplace
as
getServerSideProps
}
from
'
nextjs/getServerSideProps
'
;
ui/pages/MarketplaceApp.tsx
View file @
12b0f109
...
...
@@ -9,12 +9,10 @@ import { route } from 'nextjs-routes';
import
config
from
'
configs/app
'
;
import
type
{
ResourceError
}
from
'
lib/api/resources
'
;
import
{
useAppContext
}
from
'
lib/contexts/app
'
;
import
useApiFetch
from
'
lib/hooks/useFetch
'
;
import
*
as
metadata
from
'
lib/metadata
'
;
import
getQueryParamString
from
'
lib/router/getQueryParamString
'
;
import
ContentLoader
from
'
ui/shared/ContentLoader
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
const
feature
=
config
.
features
.
marketplace
;
const
configUrl
=
feature
.
isEnabled
?
feature
.
configUrl
:
''
;
...
...
@@ -30,7 +28,6 @@ const MarketplaceApp = () => {
const
ref
=
useRef
<
HTMLIFrameElement
>
(
null
);
const
apiFetch
=
useApiFetch
();
const
appProps
=
useAppContext
();
const
router
=
useRouter
();
const
id
=
getQueryParamString
(
router
.
query
.
id
);
...
...
@@ -91,46 +88,30 @@ const MarketplaceApp = () => {
throw
new
Error
(
'
Unable to load app
'
,
{
cause
:
error
});
}
const
backLink
=
React
.
useMemo
(()
=>
{
const
hasGoBackLink
=
appProps
.
referrer
.
includes
(
'
/apps
'
);
if
(
!
hasGoBackLink
)
{
return
;
}
return
{
label
:
'
Back to marketplace
'
,
url
:
appProps
.
referrer
,
};
},
[
appProps
.
referrer
]);
return
(
<>
{
!
isLoading
&&
<
PageTitle
title=
{
data
.
title
}
backLink=
{
backLink
}
/>
}
<
Center
h=
"100vh"
mx=
{
{
base
:
-
4
,
lg
:
-
12
}
}
>
{
(
isFrameLoading
)
&&
(
<
ContentLoader
/>
)
}
{
data
&&
(
<
Box
allow=
{
IFRAME_ALLOW_ATTRIBUTE
}
ref=
{
ref
}
sandbox=
{
IFRAME_SANDBOX_ATTRIBUTE
}
as=
"iframe"
h=
"100%"
w=
"100%"
display=
{
isFrameLoading
?
'
none
'
:
'
block
'
}
src=
{
data
.
url
}
title=
{
data
.
title
}
onLoad=
{
handleIframeLoad
}
/>
)
}
</
Center
>
</>
<
Center
h=
"100vh"
mx=
{
{
base
:
-
4
,
lg
:
-
6
}
}
>
{
(
isFrameLoading
)
&&
(
<
ContentLoader
/>
)
}
{
data
&&
(
<
Box
allow=
{
IFRAME_ALLOW_ATTRIBUTE
}
ref=
{
ref
}
sandbox=
{
IFRAME_SANDBOX_ATTRIBUTE
}
as=
"iframe"
h=
"100%"
w=
"100%"
display=
{
isFrameLoading
?
'
none
'
:
'
block
'
}
src=
{
data
.
url
}
title=
{
data
.
title
}
onLoad=
{
handleIframeLoad
}
/>
)
}
</
Center
>
);
};
...
...
ui/shared/layout/LayoutApp.tsx
0 → 100644
View file @
12b0f109
import
React
from
'
react
'
;
import
type
{
Props
}
from
'
./types
'
;
import
AppErrorBoundary
from
'
ui/shared/AppError/AppErrorBoundary
'
;
import
Header
from
'
ui/snippets/header/Header
'
;
import
HeaderAlert
from
'
ui/snippets/header/HeaderAlert
'
;
import
*
as
Layout
from
'
./components
'
;
const
LayoutDefault
=
({
children
}:
Props
)
=>
{
return
(
<
Layout
.
Container
>
<
Layout
.
MainArea
>
<
Layout
.
MainColumn
paddingTop=
{
{
base
:
'
138px
'
,
lg
:
6
}
}
paddingX=
{
{
base
:
4
,
lg
:
6
}
}
>
<
HeaderAlert
/>
<
Header
isAppPage
/>
<
AppErrorBoundary
>
<
Layout
.
Content
pt=
{
{
base
:
0
,
lg
:
6
}
}
>
{
children
}
</
Layout
.
Content
>
</
AppErrorBoundary
>
</
Layout
.
MainColumn
>
</
Layout
.
MainArea
>
<
Layout
.
Footer
/>
</
Layout
.
Container
>
);
};
export
default
LayoutDefault
;
ui/shared/layout/components/Content.tsx
View file @
12b0f109
import
{
Box
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
interface
Props
{
className
?:
string
;
children
:
React
.
ReactNode
;
}
const
Content
=
({
children
}:
Props
)
=>
{
const
Content
=
({
children
,
className
}:
Props
)
=>
{
return
(
<
Box
pt=
{
{
base
:
0
,
lg
:
'
52px
'
}
}
as=
"main"
>
<
Box
pt=
{
{
base
:
0
,
lg
:
'
52px
'
}
}
as=
"main"
className=
{
className
}
>
{
children
}
</
Box
>
);
};
export
default
React
.
memo
(
Content
);
export
default
React
.
memo
(
chakra
(
Content
)
);
ui/snippets/header/Burger.tsx
View file @
12b0f109
...
...
@@ -26,7 +26,7 @@ const Burger = () => {
return
(
<>
<
Box
padding=
{
2
}
onClick=
{
onOpen
}
>
<
Box
padding=
{
2
}
onClick=
{
onOpen
}
cursor=
"pointer"
>
<
Icon
as=
{
burgerIcon
}
boxSize=
{
6
}
...
...
ui/snippets/header/Header.tsx
View file @
12b0f109
...
...
@@ -14,10 +14,11 @@ import Burger from './Burger';
type
Props
=
{
isHomePage
?:
boolean
;
isAppPage
?:
boolean
;
renderSearchBar
?:
()
=>
React
.
ReactNode
;
}
const
Header
=
({
isHomePage
,
renderSearchBar
}:
Props
)
=>
{
const
Header
=
({
isHomePage
,
isAppPage
,
renderSearchBar
}:
Props
)
=>
{
const
bgColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
const
scrollDirection
=
useScrollDirection
();
...
...
@@ -62,6 +63,12 @@ const Header = ({ isHomePage, renderSearchBar }: Props) => {
justifyContent=
"center"
gap=
{
12
}
>
{
isAppPage
&&
(
<
Box
display=
"flex"
alignItems=
"center"
gap=
{
3
}
>
<
Burger
/>
<
NetworkLogo
isCollapsed
/>
</
Box
>
)
}
<
Box
width=
"100%"
>
{
searchBar
}
</
Box
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment