Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cordova: Fixed path handling for "Followers" link on OrganizationVoterGuide #3773

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"wdio:upgrade": "ncu -u *wdio* webdriver*",
"build": "node node/buildDateFile.js && MINIMIZED=1 webpack --mode production",
"buildCordova": "node node/buildDateFile.js && node node/buildSrcCordova && CORDOVA=1 && webpack --mode development && node node/logCompileDate.js",
"buildCordovaAndLinks": "node node/buildDateFile.js && node node/buildSrcCordova && CORDOVA=1 && webpack --mode development && node node/buildSymLinksRemote.js && node node/logCompileDate.js && bash ./node/unSymLinkIOS.sh",
"buildCordovaAndLinks": "node node/buildDateFile.js && node node/buildSrcCordova && CORDOVA=1 && webpack --mode development && node node/buildSymLinksRemote.js && bash ./node/unSymLinkIOS.sh && node node/logCompileDate.js",
"lint": "eslint --format stylish --ext .jsx --ext .js src/js",
"lintCordova": "eslint --format stylish --ext .jsx --ext .js srcCordova/js",
"prod": "node node/buildDateFile.js && MINIMIZED=1 webpack --mode production",
Expand Down
3 changes: 2 additions & 1 deletion src/js/common/components/Style/CampaignDetailsStyles.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from 'styled-components';
import { isAndroid, isAndroidSizeWide, isIPad, isIPadMini } from '../../utils/cordovaUtils';
import { isAndroid, isAndroidSizeWide, isIPad, isIPadMini, isIPhoneMiniOrSmaller } from '../../utils/cordovaUtils';
import { isCordova, isWebApp } from '../../utils/isCordovaOrWebApp';

export const CampaignDescription = styled('div')`
Expand Down Expand Up @@ -282,6 +282,7 @@ export const SupportButtonFooterWrapperAboveFooterButtons = styled('div')`
if (isWebApp()) return '55px';
if (isIPad() || isAndroidSizeWide()) return '0px';
if (isAndroid()) return '68px';
if (isIPhoneMiniOrSmaller()) return '54px';
return '88px';
}};
`;
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Settings/VoterPhoneVerificationEntry.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ class VoterPhoneVerificationEntry extends Component {
autoFocus={false}
className={classes.input}
error={displayIncorrectPhoneNumberError}
helperText={(displayIncorrectPhoneNumberError) ? 'Enter valid phone number' : ''}
helperText={(displayIncorrectPhoneNumberError) ? 'Enter a valid phone number' : ''}
id="enterVoterPhone"
InputProps={{
startAdornment: (
Expand Down
143 changes: 73 additions & 70 deletions src/js/components/VoterGuide/VoterGuideFollowers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import VoterStore from '../../stores/VoterStore';
import { renderLog } from '../../common/utils/logging';
import LoadingWheel from '../../common/components/Widgets/LoadingWheel';
import SearchBar from '../Search/SearchBar';
import { PageContentContainer } from '../Style/pageLayoutStyles';
import GuideList from './GuideList';

const DelayedLoad = React.lazy(() => import(/* webpackChunkName: 'DelayedLoad' */ '../../common/components/Widgets/DelayedLoad'));
Expand Down Expand Up @@ -156,78 +157,80 @@ class VoterGuideFollowers extends Component {
}

return (
<Wrapper>
{/* Since VoterGuidePositions, VoterGuideFollowing, and VoterGuideFollowers are in tabs the title seems to use the Helmet values from the last tab */}
<Helmet title={`${organizationName} - We Vote`} />
<div className="card">
<ul className="card-child__list-group">
{((voterGuideFollowersList && voterGuideFollowersList.length > 0) ||
(voterGuideFollowersListFilteredBySearch && voterGuideFollowersListFilteredBySearch.length > 0)) ? (
<TitleWrapper>
{lookingAtSelf ? (
<>
Your Followers
</>
) : (
<>
Followers of
{' '}
{organizationName}
</>
)}
</TitleWrapper>
) : (
<Suspense fallback={<></>}>
<DelayedLoad showLoadingText waitBeforeShow={2000}>
<TitleWrapper>
{lookingAtSelf ? (
<>
No followers can be found.
</>
) : (
<>
No followers of
{' '}
{organizationName}
{' '}
can be found.
</>
)}
</TitleWrapper>
</DelayedLoad>
</Suspense>
<PageContentContainer>
<Wrapper>
{/* Since VoterGuidePositions, VoterGuideFollowing, and VoterGuideFollowers are in tabs the title seems to use the Helmet values from the last tab */}
<Helmet title={`${organizationName} - We Vote`} />
<div className="card">
<ul className="card-child__list-group">
{((voterGuideFollowersList && voterGuideFollowersList.length > 0) ||
(voterGuideFollowersListFilteredBySearch && voterGuideFollowersListFilteredBySearch.length > 0)) ? (
<TitleWrapper>
{lookingAtSelf ? (
<>
Your Followers
</>
) : (
<>
Followers of
{' '}
{organizationName}
</>
)}
</TitleWrapper>
) : (
<Suspense fallback={<></>}>
<DelayedLoad showLoadingText waitBeforeShow={2000}>
<TitleWrapper>
{lookingAtSelf ? (
<>
No followers can be found.
</>
) : (
<>
No followers of
{' '}
{organizationName}
{' '}
can be found.
</>
)}
</TitleWrapper>
</DelayedLoad>
</Suspense>
)}
{/* ********** */}
{/* Search Box */}
{voterGuideFollowersList && voterGuideFollowersList.length > 0 && (
<SearchInputWrapper>
<SearchBar
clearButton
clearFunction={this.clearSearchBarFunction}
placeholder="Search these followers"
searchButton
searchFunction={this.searchFollowers}
searchUpdateDelayTime={200}
/>
</SearchInputWrapper>
)}
{/* ********** */}
{/* Search Box */}
{voterGuideFollowersList && voterGuideFollowersList.length > 0 && (
<SearchInputWrapper>
<SearchBar
clearButton
clearFunction={this.clearSearchBarFunction}
placeholder="Search these followers"
searchButton
searchFunction={this.searchFollowers}
searchUpdateDelayTime={200}
{/* ***************** */}
{/* Results Not Found */}
{(searchTerm && (voterGuideFollowersListFilteredBySearch && voterGuideFollowersListFilteredBySearch.length === 0)) && (
<SearchResultsWrapper>
&quot;
{searchTerm}
&quot; not found
</SearchResultsWrapper>
)}
<span>
<GuideList
incomingVoterGuideList={searchTerm ? voterGuideFollowersListFilteredBySearch : voterGuideFollowersList}
/>
</SearchInputWrapper>
)}
{/* ***************** */}
{/* Results Not Found */}
{(searchTerm && (voterGuideFollowersListFilteredBySearch && voterGuideFollowersListFilteredBySearch.length === 0)) && (
<SearchResultsWrapper>
&quot;
{searchTerm}
&quot; not found
</SearchResultsWrapper>
)}
<span>
<GuideList
incomingVoterGuideList={searchTerm ? voterGuideFollowersListFilteredBySearch : voterGuideFollowersList}
/>
</span>
</ul>
</div>
</Wrapper>
</span>
</ul>
</div>
</Wrapper>
</PageContentContainer>
);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/js/pages/VoterGuide/OrganizationVoterGuide.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ export default class OrganizationVoterGuide extends Component {

goToVoterGuideDetailsPage (destinationTab) {
const { pathname: editLink, href: editLinkCordova } = window.location;
const editPathCordova = editLinkCordova.replace(/file:\/\/.*?Vote.app\/www\/index.html#\//, '');
const editPathCordova = editLinkCordova.replace(/file:\/\/.*?Vote.app\/www\/index.html#\//, '')
.replace(/app.*?index.html#/, '');
historyPush(`${isWebApp() ? editLink : editPathCordova}/m/${destinationTab}`);
}

Expand Down
6 changes: 5 additions & 1 deletion src/js/utils/cordovaCalculatedOffsets.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ export function headroomWrapperOffset (includePosition) {
const page = pageEnumeration();
if (page === 'candidatelist' || page === 'values') {
if (isIOS()) {
offset /= isIPad() ? 2 : 3;
if (page === 'values') {
offset /= 3 / 2;
} else {
offset /= isIPad() ? 2 : 3;
}
} else if (isAndroidSizeXL()) {
offset = 1;
} else {
Expand Down