Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3510108
landing.react.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
landing.react.js
View Options
// @flow
import
*
as
React
from
'react'
;
import
{
useLocation
,
useRouteMatch
}
from
'react-router-dom'
;
import
AppLanding
from
'./app-landing.react'
;
import
Footer
from
'./footer.react'
;
import
Header
from
'./header.react'
;
import
Keyservers
from
'./keyservers.react'
;
import
Privacy
from
'./privacy.react'
;
import
Support
from
'./support.react'
;
import
Terms
from
'./terms.react'
;
export
type
LandingPageName
=
|
'app'
|
'keyservers'
|
'privacy'
|
'terms'
|
'support'
;
type
ActivePage
=
{
name
:
LandingPageName
,
node
:
React
.
Node
};
function
Landing
()
:
React
.
Node
{
const
{
pathname
}
=
useLocation
();
React
.
useEffect
(()
=>
{
window
?
.
scrollTo
(
0
,
0
);
},
[
pathname
]);
const
onPrivacy
=
useRouteMatch
({
path
:
'/privacy'
});
const
onTerms
=
useRouteMatch
({
path
:
'/terms'
});
const
onSupport
=
useRouteMatch
({
path
:
'/support'
});
const
onKeyservers
=
useRouteMatch
({
path
:
'/keyservers'
});
const
isLegalPage
:
boolean
=
React
.
useMemo
(
()
=>
!!
(
onPrivacy
||
onTerms
||
onSupport
),
[
onPrivacy
,
onSupport
,
onTerms
],
);
const
activePage
:
ActivePage
=
React
.
useMemo
(()
=>
{
if
(
onPrivacy
)
{
return
{
name
:
'privacy'
,
node
:
<
Privacy
/>
};
}
else
if
(
onTerms
)
{
return
{
name
:
'terms'
,
node
:
<
Terms
/>
};
}
else
if
(
onSupport
)
{
return
{
name
:
'support'
,
node
:
<
Support
/>
};
}
else
if
(
onKeyservers
)
{
return
{
name
:
'keyservers'
,
node
:
<
Keyservers
/>
};
}
else
{
return
{
name
:
'app'
,
node
:
<
AppLanding
/>
};
}
},
[
onKeyservers
,
onPrivacy
,
onSupport
,
onTerms
]);
return
(
<
div
>
<
Header
isLegalPage
=
{
isLegalPage
}
activePageName
=
{
activePage
.
name
}
/>
{
activePage
.
node
}
<
Footer
isLegalPage
=
{
isLegalPage
}
activePageName
=
{
activePage
.
name
}
/>
<
/div>
);
}
export
default
Landing
;
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Mon, Dec 23, 11:52 AM (18 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690841
Default Alt Text
landing.react.js (1 KB)
Attached To
Mode
rCOMM Comm
Attached
Detach File
Event Timeline
Log In to Comment