Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
#1410 #1660 - update copy
Browse files Browse the repository at this point in the history
  • Loading branch information
rupeshparab committed Feb 5, 2021
1 parent 4f8c5c4 commit 046fa30
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 44 deletions.
44 changes: 4 additions & 40 deletions src/components/Home/components/UpcomingMobile/index.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,18 @@
import React from 'react';
import { isMobile } from 'react-device-detect';
import { connect } from 'react-redux';
import classNames from 'classnames';
import * as dayjs from 'dayjs';
import upcoming from './styles.scss';
import Button from '../../../Button';
import { setMobileNotify } from '../../../../redux/userProfile/actions';
import { alertWarning } from '../../../../scripts/alert';
import Locales from '../../../../strings';
import { sessionStore } from '../../../../scripts/storage';

class UpcomingMobileHeader extends React.Component {
constructor(props) {
super(props);
const expiry = sessionStore.getItem('hide_mobile_support_banner');
let hide = !isMobile;
if (!hide && expiry && dayjs().isBefore(dayjs(expiry))) {
hide = true;
}
this.state = {
emailMode: false,
email: '',
hide,
};
}

static getDerivedStateFromProps(props, state) {
return {
...state,
hide: !isMobile
|| (!props.checking && (
(props.userProfile.service === null && state.hide)
|| props.userProfile.notifyForMobile !== null)
),
};
}

Expand All @@ -45,8 +25,8 @@ class UpcomingMobileHeader extends React.Component {
}

render() {
const { userProfile } = this.props;
if (this.state.hide) {
const { routerHooks } = this.props;
if (routerHooks.current !== '/#/app') {
return null;
}
return (
Expand All @@ -65,6 +45,7 @@ class UpcomingMobileHeader extends React.Component {
ariaHidden="false"
type="button"
icon="check"
ariaLabel={Locales.strings.mobile_view.trim()}
content={Locales.strings.mobile_view}
onClick={() => {
try {
Expand Down Expand Up @@ -102,24 +83,6 @@ class UpcomingMobileHeader extends React.Component {
/>
</div>
)}
<Button
id="close-upcoming-mobile"
className={classNames('btn', 'btn-warning')}
ariaHidden="false"
type="button"
icon="times"
onClick={() => {
if (userProfile.email) {
this.props.setMobileNotify(2);
} else {
this.setState({
hide: true,
}, () => {
sessionStore.setItem('hide_mobile_support_banner', dayjs().add(1, 'hour').toISOString());
});
}
}}
/>
</div>
</nav>
);
Expand All @@ -129,6 +92,7 @@ class UpcomingMobileHeader extends React.Component {
export default connect(
state => ({
userProfile: state.userProfile,
routerHooks: state.routerHooks,
}),
{
setMobileNotify,
Expand Down
4 changes: 2 additions & 2 deletions src/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ class Locales {
mathshare_supported_lms: 'several logos of several LMS vendors, including Canvas, Google Classroom, Schoology, Moodle, OneNote, and Blackboard',
mission: 'Our mission is to make math accessibility free and open to all students.',
mobile_not_supported: 'Mobile is not currently supported',
mobile_not_supported_v2: 'Mobile is not supported on this view: try the new mobile-compatible view.',
mobile_view: ' Mobile View',
mobile_not_supported_v2: 'Try Mathshare’s new look and feel, with mobile compatibility',
mobile_view: ' Switch to New Interface',
more_options: 'More Options',
more_options_for: 'More Options for {title}',
ms: 'Microsoft',
Expand Down
2 changes: 2 additions & 0 deletions v2/src/pages/SwitchToDesktop/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
.left {
margin: auto;
font-family: 'Source Sans Pro', sans-serif;
padding: 12px;
padding-bottom: 0;
}

.right {
Expand Down
4 changes: 2 additions & 2 deletions v2/src/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Locales {
delete_confirmation: 'This will permanently delete the problem set.',
describe_your_role: 'Which best describes your role?',
describe_your_work: 'Describe your work',
desktop_view: 'Desktop View',
desktop_view: 'Switch back to Original Interface',
disability: 'Do you have a disability or difficulties related to:',
duplicate: 'Duplicate',
example_sets: 'Example Sets',
Expand Down Expand Up @@ -112,7 +112,7 @@ class Locales {
type_the_problem: 'Type the problem here',
unable_to_switch_to_v1: 'Unable to switch, please check if your local storage access is enabled',
user_profile: 'User Profile',
welcome_to_mobile: 'Welcome to mobile!',
welcome_to_mobile: 'Welcome to the new interface! You can switch back to the original at any time.',
where_are_you_from: 'Where are you from?',
who_are_you: 'Who are you?',
year_of_birth: 'Year of Birth',
Expand Down

0 comments on commit 046fa30

Please sign in to comment.