edited default routing page for activity and headers

This commit is contained in:
Martina 2021-06-08 12:42:29 -07:00
parent 9f2fc343cd
commit 6a4ff37059
4 changed files with 19 additions and 123 deletions

View File

@ -34,6 +34,10 @@ export const getByHref = (href, viewer) => {
return { page: { ...activityPage } };
}
if (viewer && pathname === "/_/auth") {
return { page: { ...activityPage } }; //NOTE(martina): authenticated users should be redirected to the home page rather than the
}
let page = navigation.find((each) => pathname.startsWith(each.pathname));
let details;

View File

@ -195,7 +195,7 @@ const WebsitePrototypeHeader = (props) => {
};
const communityURL = "https://github.com/filecoin-project/slate";
const signInURL = "/_/auth";
const signInURL = "/_/auth?tab=signin";
const styleMenu = open ? openMenu : null;
const styleBurgerBun = open ? openBurgerBun : null;
const styleBurgerBun2 = open ? openBurgerBun2 : null;
@ -227,7 +227,7 @@ const WebsitePrototypeHeader = (props) => {
Get involved
</a>
<a css={STYLES_NAVLINK} style={styleNavLink} href={signInURL}>
Sign in
Use Slate
</a>
</div>
</div>

View File

@ -1,104 +0,0 @@
import * as React from "react";
import * as Constants from "~/common/constants";
import * as SVGLogo from "~/common/logo";
import { css } from "@emotion/react";
const STYLES_ROOT = css`
padding: 24px 88px 24px 64px;
width: 100%;
margin: 0 auto;
z-index: ${Constants.zindex.header};
@media (max-width: ${Constants.sizes.mobile}px) {
padding: 16px 24px;
}
`;
const STYLES_CONTAINER = css`
max-width: 1440px;
margin: 0 auto;
font-family: ${Constants.font.text};
font-weight: 400;
font-size: ${Constants.typescale.lvl1};
width: 100%;
`;
const STYLES_NAV_CONTAINER = css`
display: flex;
justify-content: space-between;
margin-bottom: 8px;
`;
const STYLES_LINK = css`
color: ${Constants.system.grayBlack};
text-decoration: none;
transition: 200ms ease color;
text-align: left;
display: block;
:hover {
color: ${Constants.system.brand};
}
`;
const STYLES_PARAGRAPH = css`
font-family: ${Constants.font.text};
color: ${Constants.system.pitchBlack};
text-decoration: none;
transition: 200ms ease color;
overflow-wrap: break-word;
max-width: 50%;
min-width: 10%;
text-align: left;
margin-left: 30px;
display: block;
@media (max-width: ${Constants.sizes.mobile}px) {
max-width: 100%;
}
`;
const STYLES_LEFT = css`
flex-shrink: 0;
display: flex;
max-width: 70%;
`;
const STYLES_RIGHT = css`
min-width: 10%;
width: 100%;
display: flex;
justify-content: flex-end;
text-align: left;
`;
const WebsitePrototypeHeaderGeneric = (props) => {
return (
<div css={STYLES_ROOT}>
<div css={STYLES_CONTAINER}>
<div css={STYLES_NAV_CONTAINER} style={props.style}>
<div css={STYLES_LEFT}>
<a css={STYLES_LINK} href={props.href} style={{ marginRight: 12 }}>
<SVGLogo.Symbol height={`20px`} style={{ transform: "translateY(-1px)" }} />
</a>
<a css={STYLES_LINK} href={props.href}>
{props.title}
</a>
</div>
<div css={STYLES_RIGHT}>
<a css={STYLES_LINK} href="/_/auth?tab=signup" style={{ marginRight: 24 }}>
Sign up
</a>
<a css={STYLES_LINK} href="/_/auth?tab=signin">
Sign in
</a>
</div>
</div>
<div css={STYLES_PARAGRAPH}>{props.children}</div>
</div>
</div>
);
};
export default WebsitePrototypeHeaderGeneric;

View File

@ -216,6 +216,17 @@ export default class SceneActivity extends React.Component {
window.removeEventListener("scroll", this.scrollDebounceInstance);
}
getTab = () => {
const tab = this.props.page.params?.tab;
if (tab) {
return tab;
}
if (this.props.viewer.following?.length || this.props.viewer.subscriptions?.length) {
return "activity";
}
return "explore";
};
_handleScroll = (e) => {
if (this.state.loading) {
return;
@ -239,14 +250,7 @@ export default class SceneActivity extends React.Component {
fetchActivityItems = async (update = false) => {
if (this.state.loading === "loading") return;
let tab = this.props.page.params?.tab || "explore";
// if (!tab) {
// if (this.props.viewer) {
// tab = "activity";
// } else {
// tab = "explore";
// }
// }
let tab = this.getTab();
const isExplore = tab === "explore";
this.setState({ loading: "loading" });
let activity;
@ -359,16 +363,8 @@ export default class SceneActivity extends React.Component {
};
render() {
let tab = this.props.page.params?.tab || "explore";
// if (!tab) {
// if (this.props.viewer) {
// tab = "activity";
// } else {
// tab = "explore";
// }
// }
let tab = this.getTab();
let activity;
if (this.props.viewer) {
activity =
tab === "activity" ? this.props.viewer?.activity || [] : this.props.viewer?.explore || [];