@@ -115,14 +115,22 @@ export function HeaderProfile(props: { user: User }) {
115
115
const { user } = props ;
116
116
const fetchingUser = useSelector ( isFetchingUser ) ;
117
117
const templateId = useSelector ( getTemplateId ) ;
118
+ const isPublicApp = useSelector ( isPublicApplication ) ;
119
+
118
120
if ( fetchingUser ) {
119
121
return < Skeleton . Avatar shape = "circle" size = { 28 } /> ;
120
122
}
121
123
return (
122
124
< div >
123
125
{ user . isAnonymous ? (
124
126
! templateId ? (
125
- < LoginBtn buttonType = "primary" onClick = { ( ) => history . push ( AUTH_LOGIN_URL ) } >
127
+ < LoginBtn buttonType = "primary" onClick = { ( ) => {
128
+ if ( isPublicApp ) {
129
+ window . top ?. open ( 'https://app.lowcoder.cloud/user/auth/login' ) ;
130
+ } else {
131
+ history . push ( AUTH_LOGIN_URL )
132
+ }
133
+ } } >
126
134
{ trans ( "userAuth.login" ) }
127
135
</ LoginBtn >
128
136
) : null
@@ -147,7 +155,7 @@ const PreviewHeaderComp = () => {
147
155
148
156
const headerStart = (
149
157
< >
150
- < StyledLink onClick = { ( ) => history . push ( ALL_APPLICATIONS_URL ) } >
158
+ < StyledLink onClick = { ( ) => ! isPublicApp && history . push ( ALL_APPLICATIONS_URL ) } >
151
159
< LogoIcon branding = { true } />
152
160
</ StyledLink >
153
161
{ isViewMarketplaceMode && (
@@ -204,36 +212,44 @@ const PreviewHeaderComp = () => {
204
212
</ Wrapper >
205
213
) ;
206
214
207
- const headerMiddle = (
208
- < >
209
- { /* Devices */ }
210
- < Segmented < DeviceType >
211
- options = { [
212
- { value : 'mobile' , icon : < MobileOutlined /> } ,
213
- { value : 'tablet' , icon : < TabletOutlined /> } ,
214
- { value : 'desktop' , icon : < DesktopOutlined /> } ,
215
- ] }
216
- value = { editorState . deviceType }
217
- onChange = { ( value ) => {
218
- editorState . setDeviceType ( value ) ;
219
- } }
220
- />
221
-
222
- { /* Orientation */ }
223
- { editorState . deviceType !== 'desktop' && (
224
- < Segmented < DeviceOrientation >
215
+ const headerMiddle = useMemo ( ( ) => {
216
+ if ( isPublicApp ) return null ;
217
+
218
+ return (
219
+ < >
220
+ { /* Devices */ }
221
+ < Segmented < DeviceType >
225
222
options = { [
226
- { value : 'portrait' , label : "Portrait" } ,
227
- { value : 'landscape' , label : "Landscape" } ,
223
+ { value : 'mobile' , icon : < MobileOutlined /> } ,
224
+ { value : 'tablet' , icon : < TabletOutlined /> } ,
225
+ { value : 'desktop' , icon : < DesktopOutlined /> } ,
228
226
] }
229
- value = { editorState . deviceOrientation }
227
+ value = { editorState . deviceType }
230
228
onChange = { ( value ) => {
231
- editorState . setDeviceOrientation ( value ) ;
229
+ editorState . setDeviceType ( value ) ;
232
230
} }
233
231
/>
234
- ) }
235
- </ >
236
- ) ;
232
+
233
+ { /* Orientation */ }
234
+ { editorState . deviceType !== 'desktop' && (
235
+ < Segmented < DeviceOrientation >
236
+ options = { [
237
+ { value : 'portrait' , label : "Portrait" } ,
238
+ { value : 'landscape' , label : "Landscape" } ,
239
+ ] }
240
+ value = { editorState . deviceOrientation }
241
+ onChange = { ( value ) => {
242
+ editorState . setDeviceOrientation ( value ) ;
243
+ } }
244
+ />
245
+ ) }
246
+ </ >
247
+ ) ;
248
+ } , [
249
+ isPublicApp ,
250
+ editorState . deviceType ,
251
+ editorState . deviceOrientation ,
252
+ ] ) ;
237
253
238
254
return (
239
255
< Header
0 commit comments