diff --git a/src/components/header/account-bar/account-bar.tsx b/src/components/header/account-bar/account-bar.tsx index 0d94b860..99510bb9 100644 --- a/src/components/header/account-bar/account-bar.tsx +++ b/src/components/header/account-bar/account-bar.tsx @@ -1,11 +1,20 @@ import { useTranslation } from 'react-i18next'; -import { Link } from 'react-router-dom'; +import { Link, useLocation, useParams } from 'react-router-dom'; import styles from './account-bar.module.css'; import { useAccount } from '@plebbit/plebbit-react-hooks'; const AccountBar = () => { const account = useAccount(); const { t } = useTranslation(); + const location = useLocation(); + const { subplebbitAddress } = useParams(); + let submitLink; + + if (location.pathname.startsWith(`/p/${subplebbitAddress}/`)) { + submitLink = `/p/${subplebbitAddress}/submit`; + } else { + submitLink = '/submit'; + } return (