@@ -281,6 +286,14 @@ const MobileNav = () => {
);
};
+MobileNav.propTypes = {
+ title: PropTypes.string
+};
+
+MobileNav.defaultProps = {
+ title: 'p5.js Web Editor'
+};
+
const StuffMenu = () => {
const { isOpen, handlers } = useMenuProps('stuff');
const { newSketch } = useSketchActions();
@@ -341,9 +354,8 @@ const AccountMenu = () => {
const MoreMenu = () => {
// TODO: use selectRootFile selector
- const rootFile = useSelector(
- (state) => state.files.filter((file) => file.name === 'root')[0]
- );
+ // DONE
+ const rootFile = useSelector(selectRootFile);
const language = useSelector((state) => state.preferences.language);
const dispatch = useDispatch();
@@ -367,8 +379,8 @@ const MoreMenu = () => {
{isLanguageModalVisible && (
setIsLanguageModalVisible(false)}
>
@@ -420,7 +432,8 @@ const MoreMenu = () => {
{t('Nav.Sketch.AddFolder')}
{/* TODO: Add Translations */}
- Settings
+ {/* DONE */}
+ {t('settings', { defaultValue: 'Settings' })}
{
dispatch(openPreferences());
diff --git a/client/modules/IDE/components/Header/Nav.jsx b/client/modules/IDE/components/Header/Nav.jsx
index 3492c4388a..1cf0df5bfc 100644
--- a/client/modules/IDE/components/Header/Nav.jsx
+++ b/client/modules/IDE/components/Header/Nav.jsx
@@ -31,11 +31,13 @@ import { CmControllerContext } from '../../pages/IDEView';
import MobileNav from './MobileNav';
import useIsMobile from '../../hooks/useIsMobile';
-const Nav = ({ layout }) => {
+const Nav = ({ layout, mobileTitle }) => {
const isMobile = useIsMobile();
+ // console.log('The updated mobile title is: ', mobileTitle);
+
return isMobile ? (
-
+
) : (
@@ -45,11 +47,13 @@ const Nav = ({ layout }) => {
};
Nav.propTypes = {
- layout: PropTypes.oneOf(['dashboard', 'project'])
+ layout: PropTypes.oneOf(['dashboard', 'project']),
+ mobileTitle: PropTypes.string
};
Nav.defaultProps = {
- layout: 'project'
+ layout: 'project',
+ mobileTitle: 'p5.js Web Editor'
};
const LeftLayout = (props) => {
diff --git a/client/modules/IDE/hooks/useWhatPage.js b/client/modules/IDE/hooks/useWhatPage.js
index 8126c596c0..ce551c055a 100644
--- a/client/modules/IDE/hooks/useWhatPage.js
+++ b/client/modules/IDE/hooks/useWhatPage.js
@@ -8,6 +8,7 @@ import { useLocation } from 'react-router-dom';
*/
const useWhatPage = () => {
const username = useSelector((state) => state.user.username);
+ const project = useSelector((state) => state.project);
const { pathname } = useLocation();
const pageName = useMemo(() => {
@@ -15,13 +16,13 @@ const useWhatPage = () => {
`(/${username}/(sketches/?$|collections|assets)/?)`
);
- if (myStuffPattern.test(pathname)) return 'myStuff';
- else if (pathname === '/login') return 'login';
- else if (pathname === '/signup') return 'signup';
- else if (pathname === '/account') return 'account';
+ if (myStuffPattern.test(pathname)) return 'My Stuff';
+ else if (pathname === '/login') return 'LoginView.Login';
+ else if (pathname === '/signup') return 'LoginView.SignUp';
+ else if (pathname === '/account') return 'AccountView.Settings';
else if (pathname === '/p5/collections' || pathname === '/p5/sketches')
- return 'examples';
- return 'home';
+ return 'Nav.File.Examples';
+ return project.name || 'home';
}, [pathname, username]);
return pageName;
diff --git a/client/modules/Legal/pages/Legal.jsx b/client/modules/Legal/pages/Legal.jsx
index 0e629f789a..946bb63bb4 100644
--- a/client/modules/Legal/pages/Legal.jsx
+++ b/client/modules/Legal/pages/Legal.jsx
@@ -10,6 +10,7 @@ import { remSize } from '../../../theme';
import Loader from '../../App/components/loader';
import Nav from '../../IDE/components/Header/Nav';
import PolicyContainer from '../components/PolicyContainer';
+import { useWhatPage } from '../../IDE/hooks';
const StyledTabList = styled.nav`
display: flex;
@@ -24,6 +25,8 @@ const StyledTabList = styled.nav`
function Legal({ policyFile, title }) {
const { t } = useTranslation();
+ const pageName = useWhatPage();
+ const pagetitle = String(t(pageName));
const [isLoading, setIsLoading] = useState(true);
const [policy, setPolicy] = useState('');
@@ -40,7 +43,7 @@ function Legal({ policyFile, title }) {
p5.js Web Editor | {title}
-
+
{t('Legal.PrivacyPolicy')}
diff --git a/client/modules/User/pages/AccountView.jsx b/client/modules/User/pages/AccountView.jsx
index e9b3da7c9a..f40ca4b1ba 100644
--- a/client/modules/User/pages/AccountView.jsx
+++ b/client/modules/User/pages/AccountView.jsx
@@ -12,6 +12,7 @@ import Nav from '../../IDE/components/Header/Nav';
import ErrorModal from '../../IDE/components/ErrorModal';
import Overlay from '../../App/components/Overlay';
import Toast from '../../IDE/components/Toast';
+import { useWhatPage } from '../../IDE/hooks';
function SocialLoginPanel() {
const { t } = useTranslation();
@@ -44,6 +45,8 @@ function SocialLoginPanel() {
function AccountView() {
const { t } = useTranslation();
+ const pageName = useWhatPage();
+ const pagetitle = String(t(pageName));
const location = useLocation();
const queryParams = parse(location.search);
@@ -59,7 +62,7 @@ function AccountView() {
-
+
{showError && (
{
const params = useParams();
+ const { t } = useTranslation();
+ const pageName = useWhatPage();
+ const pagetitle = String(t(pageName));
+
+ console.log('the pagename: ', pageName);
+ console.log('the pagename: ', t(pageName));
return (
-
+
{
const isMobile = useIsMobile();
const { t } = useTranslation();
+ const pageName = useWhatPage();
+ const pagetitle = String(t(pageName));
const params = useParams();
const location = useLocation();
@@ -117,7 +120,7 @@ const DashboardView = () => {
return (
-
+
diff --git a/client/modules/User/pages/EmailVerificationView.jsx b/client/modules/User/pages/EmailVerificationView.jsx
index 7ad9d2fa79..f7437ac676 100644
--- a/client/modules/User/pages/EmailVerificationView.jsx
+++ b/client/modules/User/pages/EmailVerificationView.jsx
@@ -6,9 +6,13 @@ import { useTranslation } from 'react-i18next';
import { verifyEmailConfirmation } from '../actions';
import RootPage from '../../../components/RootPage';
import Nav from '../../IDE/components/Header/Nav';
+import { useWhatPage } from '../../IDE/hooks';
const EmailVerificationView = () => {
const { t } = useTranslation();
+ const pageName = useWhatPage();
+ const pagetitle = String(t(pageName));
+
const location = useLocation();
const dispatch = useDispatch();
const browserHistory = useHistory();
@@ -38,7 +42,7 @@ const EmailVerificationView = () => {
return (
-
+
{t('EmailVerificationView.Title')}
diff --git a/client/modules/User/pages/LoginView.jsx b/client/modules/User/pages/LoginView.jsx
index 1847c84b50..9b2a248cfc 100644
--- a/client/modules/User/pages/LoginView.jsx
+++ b/client/modules/User/pages/LoginView.jsx
@@ -6,12 +6,16 @@ import LoginForm from '../components/LoginForm';
import SocialAuthButton from '../components/SocialAuthButton';
import Nav from '../../IDE/components/Header/Nav';
import RootPage from '../../../components/RootPage';
+import { useWhatPage } from '../../IDE/hooks';
function LoginView() {
const { t } = useTranslation();
+ const pageName = useWhatPage();
+ const pagetitle = String(t(pageName));
+
return (
-
+
{t('LoginView.Title')}
diff --git a/client/modules/User/pages/NewPasswordView.jsx b/client/modules/User/pages/NewPasswordView.jsx
index cb9d7cbe1d..3af05e5f82 100644
--- a/client/modules/User/pages/NewPasswordView.jsx
+++ b/client/modules/User/pages/NewPasswordView.jsx
@@ -8,9 +8,13 @@ import NewPasswordForm from '../components/NewPasswordForm';
import { validateResetPasswordToken } from '../actions';
import Nav from '../../IDE/components/Header/Nav';
import RootPage from '../../../components/RootPage';
+import { useWhatPage } from '../../IDE/hooks';
function NewPasswordView() {
const { t } = useTranslation();
+ const pageName = useWhatPage();
+ const pagetitle = String(t(pageName));
+
const params = useParams();
const resetPasswordToken = params.reset_password_token;
const resetPasswordInvalid = useSelector(
@@ -30,7 +34,7 @@ function NewPasswordView() {
});
return (
-
+
{t('NewPasswordView.Title')}
diff --git a/client/modules/User/pages/ResetPasswordView.jsx b/client/modules/User/pages/ResetPasswordView.jsx
index 9188a5e2c8..9cc58ad24d 100644
--- a/client/modules/User/pages/ResetPasswordView.jsx
+++ b/client/modules/User/pages/ResetPasswordView.jsx
@@ -7,9 +7,13 @@ import { useTranslation } from 'react-i18next';
import ResetPasswordForm from '../components/ResetPasswordForm';
import RootPage from '../../../components/RootPage';
import Nav from '../../IDE/components/Header/Nav';
+import { useWhatPage } from '../../IDE/hooks';
function ResetPasswordView() {
const { t } = useTranslation();
+ const pageName = useWhatPage();
+ const pagetitle = String(t(pageName));
+
const resetPasswordInitiate = useSelector(
(state) => state.user.resetPasswordInitiate
);
@@ -21,7 +25,7 @@ function ResetPasswordView() {
});
return (
-
+
{t('ResetPasswordView.Title')}
diff --git a/client/modules/User/pages/SignupView.jsx b/client/modules/User/pages/SignupView.jsx
index 6b1e1fff51..369b4fbafb 100644
--- a/client/modules/User/pages/SignupView.jsx
+++ b/client/modules/User/pages/SignupView.jsx
@@ -6,12 +6,15 @@ import SignupForm from '../components/SignupForm';
import SocialAuthButton from '../components/SocialAuthButton';
import Nav from '../../IDE/components/Header/Nav';
import RootPage from '../../../components/RootPage';
+import { useWhatPage } from '../../IDE/hooks';
function SignupView() {
const { t } = useTranslation();
+ const pageName = useWhatPage();
+ const pagetitle = String(t(pageName));
return (
-
+
{t('SignupView.Title')}