+
+
+ {isLoading && }
);
}
+Legal.propTypes = {
+ /**
+ * Used in the HTML tag.
+ * TODO: pass this to the Nav to use as the mobile title.
+ */
+ title: PropTypes.string.isRequired,
+ /**
+ * Path of the markdown '.md' file, relative to the /public directory.
+ */
+ policyFile: PropTypes.string.isRequired
+};
+
export default Legal;
diff --git a/client/modules/Legal/pages/PrivacyPolicy.jsx b/client/modules/Legal/pages/PrivacyPolicy.jsx
index 6927d1e8d3..ef39ed876c 100644
--- a/client/modules/Legal/pages/PrivacyPolicy.jsx
+++ b/client/modules/Legal/pages/PrivacyPolicy.jsx
@@ -1,22 +1,12 @@
-import React, { useEffect, useState } from 'react';
-import Helmet from 'react-helmet';
-import axios from 'axios';
-import PolicyContainer from '../components/PolicyContainer';
+import React from 'react';
+import { useTranslation } from 'react-i18next';
+import Legal from './Legal';
function PrivacyPolicy() {
- const [privacyPolicy, setPrivacyPolicy] = useState('');
- useEffect(() => {
- axios.get('privacy-policy.md').then((response) => {
- setPrivacyPolicy(response.data);
- });
- }, []);
+ const { t } = useTranslation();
+
return (
- <>
-
- p5.js Web Editor | Privacy Policy
-
-
- >
+
);
}
diff --git a/client/modules/Legal/pages/TermsOfUse.jsx b/client/modules/Legal/pages/TermsOfUse.jsx
index 69299ae0ee..6b3b553942 100644
--- a/client/modules/Legal/pages/TermsOfUse.jsx
+++ b/client/modules/Legal/pages/TermsOfUse.jsx
@@ -1,23 +1,11 @@
-import React, { useEffect, useState } from 'react';
-import Helmet from 'react-helmet';
-import axios from 'axios';
-import PolicyContainer from '../components/PolicyContainer';
+import React from 'react';
+import { useTranslation } from 'react-i18next';
+import Legal from './Legal';
function TermsOfUse() {
- const [termsOfUse, setTermsOfUse] = useState('');
- useEffect(() => {
- axios.get('terms-of-use.md').then((response) => {
- setTermsOfUse(response.data);
- });
- }, []);
- return (
- <>
-
- p5.js Web Editor | Terms of Use
-
-
- >
- );
+ const { t } = useTranslation();
+
+ return ;
}
export default TermsOfUse;
diff --git a/client/modules/User/components/DashboardTabSwitcher.jsx b/client/modules/User/components/DashboardTabSwitcher.jsx
index 5c4b2e3fc6..c3c288d3c8 100644
--- a/client/modules/User/components/DashboardTabSwitcher.jsx
+++ b/client/modules/User/components/DashboardTabSwitcher.jsx
@@ -4,9 +4,9 @@ import { useTranslation } from 'react-i18next';
import MediaQuery from 'react-responsive';
import { useDispatch } from 'react-redux';
import styled from 'styled-components';
-import { Link } from 'react-router-dom';
import { FilterIcon } from '../../../common/icons';
import IconButton from '../../../common/IconButton';
+import RouterTab from '../../../common/RouterTab';
import { Options } from '../../IDE/components/Header/MobileNav';
import { toggleDirectionForField } from '../../IDE/actions/sorting';
@@ -16,28 +16,6 @@ export const TabKey = {
sketches: 'sketches'
};
-const Tab = ({ children, isSelected, to }) => {
- const selectedClassName = 'dashboard-header__tab--selected';
-
- const location = { pathname: to, state: { skipSavingPath: true } };
- const content = isSelected ? (
- {children}
- ) : (
- {children}
- );
- return (
-
-
{content}
-
- );
-};
-
-Tab.propTypes = {
- children: PropTypes.string.isRequired,
- isSelected: PropTypes.bool.isRequired,
- to: PropTypes.string.isRequired
-};
-
// It is good for right now, because we need to separate the nav dropdown logic from the navBar before we can use it here
const FilterOptions = styled(Options)`
> div > button:focus + ul,
@@ -52,29 +30,20 @@ const DashboardTabSwitcher = ({ currentTab, isOwner, username }) => {
const dispatch = useDispatch();
return (
-