diff --git a/components/header.js b/components/header.js index af513114..66593564 100644 --- a/components/header.js +++ b/components/header.js @@ -27,6 +27,8 @@ export default function Header ({ sub }) { const [fired, setFired] = useState() const me = useMe() const prefix = sub ? `/~${sub}` : '' + // there's always at least 2 on the split, e.g. '/' yields ['',''] + const topNavKey = path.split('/')[sub ? 2 : 1] const { data: subLatestPost } = useQuery(gql` query subLatestPost($name: ID!) { subLatestPost(name: $name) @@ -53,7 +55,7 @@ export default function Header ({ sub }) { - + {me?.hasNewNotes && @@ -65,12 +67,12 @@ export default function Header ({ sub }) { - e.preventDefault()}>{`@${me?.name}`} + e.preventDefault()}>{`@${me?.name}`} } alignRight > - + profile {me && !me.bioId && @@ -79,14 +81,14 @@ export default function Header ({ sub }) { - wallet + wallet - satistics + satistics - invites + invites {me && !me.hasInvites && {' '} @@ -96,7 +98,7 @@ export default function Header ({ sub }) { - settings + settings @@ -110,7 +112,7 @@ export default function Header ({ sub }) { {me && - + } @@ -132,13 +134,13 @@ export default function Header ({ sub }) { <> - recent + recent {!prefix && - top + top } @@ -157,7 +159,7 @@ export default function Header ({ sub }) { {me && - post + post } > @@ -170,7 +172,7 @@ export default function Header ({ sub }) { @@ -194,7 +196,7 @@ export default function Header ({ sub }) { diff --git a/components/recent-header.js b/components/recent-header.js new file mode 100644 index 00000000..0d932913 --- /dev/null +++ b/components/recent-header.js @@ -0,0 +1,35 @@ +import { Nav, Navbar } from 'react-bootstrap' +import styles from './header.module.css' +import Link from 'next/link' + +export default function RecentHeader ({ itemType }) { + return ( + + + + + + posts + + + + + + + comments + + + + + + ) +} diff --git a/package.json b/package.json index 7cd276a1..878aed14 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "NODE_OPTIONS='--trace-warnings' next dev", + "dev": "NODE_OPTIONS='--trace-warnings --inspect' next dev", "build": "next build", "migrate": "prisma migrate deploy", "start": "NODE_OPTIONS='--trace-warnings' next start -p $PORT" @@ -87,4 +87,4 @@ "eslint-plugin-compat": "^3.9.0", "standard": "^16.0.3" } -} +} \ No newline at end of file diff --git a/pages/recent/comments.js b/pages/recent/comments.js index f2179b94..651ed16e 100644 --- a/pages/recent/comments.js +++ b/pages/recent/comments.js @@ -2,6 +2,7 @@ import Layout from '../../components/layout' import { getGetServerSideProps } from '../../api/ssrApollo' import { MORE_FLAT_COMMENTS } from '../../fragments/comments' import CommentsFlat from '../../components/comments-flat' +import RecentHeader from '../../components/recent-header' const variables = { sort: 'recent' } export const getServerSideProps = getGetServerSideProps(MORE_FLAT_COMMENTS, variables) @@ -9,6 +10,7 @@ export const getServerSideProps = getGetServerSideProps(MORE_FLAT_COMMENTS, vari export default function Index ({ data: { moreFlatComments: { comments, cursor } } }) { return ( + +