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

Release August 16th, 2022 #1549

Merged
merged 27 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6561e44
fix: package.json & package-lock.json to reduce vulnerabilities
snyk-bot Jul 8, 2022
9cd9259
feat: add new query param back_icon
mohitb35 Aug 8, 2022
88d6e17
feat: add params to show project list & details
mohitb35 Aug 8, 2022
9c43f7b
feat: add logic for project_list query param
mohitb35 Aug 8, 2022
d9c42f4
fix: align ProjectContainer & ProjectList sidebar
mohitb35 Aug 8, 2022
23b2500
feat: add logic for project_details query param
mohitb35 Aug 8, 2022
2ea35d4
fix: hide project list by default in embed mode
mohitb35 Aug 9, 2022
f3eb677
fix: minor style update to display sidebar content
mohitb35 Aug 9, 2022
39b4f74
feat: replace Button with styled MuiButton
mohitb35 Aug 9, 2022
69cf566
fix: prevent scrolling for hidden list/details
mohitb35 Aug 9, 2022
a01192a
refactor: remove unused imports/variables
mohitb35 Aug 9, 2022
dcd6f87
refactor: remove redundant css
mohitb35 Aug 9, 2022
c0740df
fix: fix bug hiding project details without embed
mohitb35 Aug 9, 2022
a09c85e
fix: remove "Powered by" text from locale files
mohitb35 Aug 9, 2022
b4db150
fix: adjust position of Play Button/Sites dropdown
mohitb35 Aug 10, 2022
6e48177
Merge branch 'develop' into feature/embed-webapp-new-controls
mohitb35 Aug 10, 2022
893043d
Merge branch 'develop' into feature/powered-by-text-update
sagararyal Aug 10, 2022
e862c85
feat: open top item in payment history by default
mohitb35 Aug 11, 2022
224b577
fix: avoid redirect step on clicking "Me" (navbar)
mohitb35 Aug 11, 2022
86227f2
Merge pull request #1545 from Plant-for-the-Planet-org/feature/powere…
mariahosfeld Aug 11, 2022
ea949ba
fix: open top item (history) only on large screens
mohitb35 Aug 11, 2022
26afabf
Merge pull request #1548 from Plant-for-the-Planet-org/feature/minor-…
mariahosfeld Aug 11, 2022
64e6c0f
Resolve merge conflicts
Shreyaschorge Aug 11, 2022
b6d6a7a
Merge pull request #1524 from Plant-for-the-Planet-org/snyk-fix-067a3…
mariahosfeld Aug 11, 2022
0ae2c61
Merge pull request #1544 from Plant-for-the-Planet-org/feature/embed-…
mariahosfeld Aug 12, 2022
5ff1c10
removed extra space for width < 481px
prachigarg19 Aug 12, 2022
bc505d4
Merge pull request #1551 from Plant-for-the-Planet-org/feature/remove…
sagararyal Aug 12, 2022
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
12,115 changes: 6,241 additions & 5,874 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"luma.gl": "^7.3.2",
"mapbox-gl": "^1.13.0",
"mapbox-gl-compare": "^0.4.0",
"moment": "^2.29.2",
"moment": "^2.29.4",
"next": "^11.1.4",
"next-compose-plugins": "^2.2.1",
"next-i18next": "^6.0.3",
Expand Down
4 changes: 1 addition & 3 deletions public/static/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,5 @@
"forbidden": "You are not allowed to view this page!",
"internalServerError": "Internal Server Error - Please try again later!",
"validationFailed": "Validation Failed!",
"add": "Add",
"poweredBy": "Powered by",
"pftp": "Plant-for-the-Planet"
"add": "Add"
}
22 changes: 22 additions & 0 deletions src/features/common/InputTypes/MuiButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Button, styled } from '@mui/material';
import themeProperties from '../../../theme/themeProperties';

// replace styles here with theme when consolidating the Mui Themes. Use theme palette etc.
const MuiButton = styled(Button)({
'&.MuiButton-root': {
textTransform: 'capitalize',
borderRadius: 28,
fontWeight: 600,
},
'&.MuiButton-outlinedPrimary': {
backgroundColor: themeProperties.light.light,
color: themeProperties.primaryColor,
borderColor: themeProperties.primaryColor,
},
'&.MuiButton-containedPrimary': {
color: themeProperties.light.light,
background: themeProperties.primaryColor,
},
});

export default MuiButton;
8 changes: 7 additions & 1 deletion src/features/common/LandingVideo/PlayButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement } from 'react';
import { useRouter } from 'next/router';
import PlayIcon from '../../../../public/assets/images/icons/PlayIcon';
import styles from './styles.module.scss';
import i18next from '../../../../i18n';
Expand All @@ -13,11 +14,16 @@ interface Props {
export default function PlayButton({ setshowVideo }: Props): ReactElement {
const { embed } = React.useContext(ParamsContext);
const { t } = useTranslation(['common']);
const { pathname } = useRouter();

const playButtonClasses = `${
embed === 'true' ? styles.embed_playButton : styles.playButton
} ${pathname === '/[p]' ? styles['playButton--reduce-right-offset'] : ''}`;
return (
<div
title={t('howDoesThisWork')}
onClick={() => setshowVideo(true)}
className={embed === 'true' ? styles.embed_playButton : styles.playButton}
className={playButtonClasses}
>
<PlayIcon />
</div>
Expand Down
18 changes: 15 additions & 3 deletions src/features/common/LandingVideo/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,14 @@
line-height: 16px;
cursor: pointer;
z-index: 11;

> svg {
width: 15px;
}

&.playButton--reduce-right-offset {
right: 10px;
}
}

.playButton {
Expand All @@ -136,14 +141,21 @@
}
}
@include mdTabletView {
.playButton {
top: 110px;
.playButton,
.embed_playButton {
right: 125px;
flex-direction: row;

&.playButton--reduce-right-offset {
right: 20px;
}
}

.playButton {
top: 110px;
}

.embed_playButton {
right: 125px;
top: 30px;
}
}
2 changes: 1 addition & 1 deletion src/features/common/Layout/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function NavbarComponent(props: any) {
async function gotoUserPage() {
if (user) {
if (typeof window !== 'undefined') {
router.push(`/t/${user.slug}`);
router.push(`/profile`);
}
} else {
//----------------- To do - redirect to slug -----------------
Expand Down
32 changes: 26 additions & 6 deletions src/features/common/Layout/QueryParamsContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,32 @@ const { useTranslation } = i18next;
type QueryParamType = string | undefined | string[] | null;
export interface ParamsContextType {
embed: QueryParamType;
singleProject: QueryParamType;
showBackIcon: QueryParamType;
callbackUrl: QueryParamType;
language: QueryParamType;
showProjectDetails: QueryParamType;
showProjectList: QueryParamType;
}
export const ParamsContext = createContext<ParamsContextType>({
embed: undefined,
singleProject: undefined,
showBackIcon: undefined,
callbackUrl: undefined,
language: undefined,
showProjectDetails: undefined,
showProjectList: undefined,
});

const QueryParamsProvider: FC = ({ children }) => {
const { i18n } = useTranslation();

const [embed, setEmbed] = useState<QueryParamType>(undefined);
const [singleProject, setSingleProject] = useState<QueryParamType>(undefined);
const [showBackIcon, setShowBackIcon] = useState<QueryParamType>(undefined);
const [callbackUrl, setCallbackUrl] = useState<QueryParamType>(undefined);
const [language, setLanguage] = useState<QueryParamType>(undefined);
const [showProjectDetails, setShowProjectDetails] =
useState<QueryParamType>(undefined);
const [showProjectList, setShowProjectList] =
useState<QueryParamType>(undefined);
const router = useRouter();
const { query } = router;

Expand All @@ -33,8 +41,8 @@ const QueryParamsProvider: FC = ({ children }) => {
}, [query.embed]);

useEffect(() => {
if (query.singleProject) setSingleProject(query.singleProject);
}, [query.singleProject]);
if (query.back_icon) setShowBackIcon(query.back_icon);
}, [query.back_icon]);

useEffect(() => {
if (query.callback) setCallbackUrl(query.callback);
Expand All @@ -44,6 +52,16 @@ const QueryParamsProvider: FC = ({ children }) => {
if (query.locale) setLanguage(query.locale);
}, [query.locale]);

useEffect(() => {
if (query.project_details === 'true' || query.project_details === 'false')
setShowProjectDetails(query.project_details);
}, [query.project_details]);

useEffect(() => {
if (query.project_list === 'true' || query.project_list === 'false')
setShowProjectList(query.project_list);
}, [query.project_list]);

useEffect(() => {
if (i18n && i18n.isInitialized && language) {
i18n.changeLanguage(language as string);
Expand All @@ -55,9 +73,11 @@ const QueryParamsProvider: FC = ({ children }) => {
<ParamsContext.Provider
value={{
embed,
singleProject,
showBackIcon,
callbackUrl,
language,
showProjectDetails,
showProjectList,
}}
>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}
@include xsPhoneView {
padding-left: 0;
margin-left: 0;
& .hamburgerIcon {
display: block;
position: fixed;
Expand Down
4 changes: 2 additions & 2 deletions src/features/projects/components/maps/Credits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ export default function Credits({ setCurrencyCode }: Props): ReactElement {

{isEmbed && (
<span>
{t('common:poweredBy')}
Powered by
<a href="https://www.plant-for-the-planet.org" target="_top">
{' '}
{t('common:pftp')}
Plant-for-the-Planet
</a>
</span>
)}
Expand Down
17 changes: 9 additions & 8 deletions src/features/projects/components/maps/ImageDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function ImageDropdown({
setSelectedSource2,
isMobile,
}: Props): ReactElement {
const { embed } = React.useContext(ParamsContext);
const { embed, showProjectDetails } = React.useContext(ParamsContext);

const [isSource1MenuOpen, setIsSource1MenuOpen] = React.useState(
isMobile ? false : true
Expand Down Expand Up @@ -59,15 +59,16 @@ export default function ImageDropdown({
if (isMobile) setIsSource2MenuOpen(false);
};

const containerClasses =
embed !== 'true'
? styles.dropdownContainer
: showProjectDetails === 'false'
? `${styles.embed_dropdownContainer} ${styles['no-project-details']}`
: styles.embed_dropdownContainer;

return (
<>
<div
className={
embed === 'true'
? styles.embed_dropdownContainer
: styles.dropdownContainer
}
>
<div className={containerClasses}>
<div className={styles.beforeYear}>
<FormControl variant="standard">
<NativeSelect
Expand Down
20 changes: 12 additions & 8 deletions src/features/projects/components/maps/ProjectTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement } from 'react';
import { useRouter } from 'next/router';
import i18next from '../../../../../i18n';
import LocationIcon from '../../../../../public/assets/images/icons/LocationIcon';
import ResearchIcon from '../../../../../public/assets/images/icons/ResearchIcon';
Expand All @@ -10,20 +11,23 @@ import { ParamsContext } from '../../../common/Layout/QueryParamsContext';
interface Props {}

export default function ProjectTabs({}: Props): ReactElement {
const { embed } = React.useContext(ParamsContext);
const { embed, showProjectDetails } = React.useContext(ParamsContext);
const { pathname } = useRouter();
const { useTranslation } = i18next;
const { i18n, t } = useTranslation(['maps']);
const { selectedMode, setSelectedMode, rasterData } =
React.useContext(ProjectPropsContext);

const containerClasses =
embed !== 'true'
? styles.VegetationChangeContainer
: pathname === '/[p]' && showProjectDetails === 'false'
? `${styles.embed_VegetationChangeContainer} ${styles['no-project-details']}`
: styles.embed_VegetationChangeContainer;

return (
<>
<div
className={
embed === 'true'
? styles.embed_VegetationChangeContainer
: styles.VegetationChangeContainer
}
>
<div className={containerClasses}>
<div
onClick={() => {
setSelectedMode('location');
Expand Down
33 changes: 20 additions & 13 deletions src/features/projects/components/maps/SitesDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FormControl, NativeSelect } from '@mui/material';
import React, { ReactElement } from 'react';
import { useRouter } from 'next/router';
import PolygonIcon from '../../../../../public/assets/images/icons/PolygonIcon';
import styles from '../../styles/ProjectsMap.module.scss';
import BootstrapInput from '../../../common/InputTypes/BootstrapInput';
Expand All @@ -16,12 +17,28 @@ export default function SitesDropdown(): ReactElement {
isPolygonMenuOpen,
setIsPolygonMenuOpen,
} = React.useContext(ProjectPropsContext);
const { embed } = React.useContext(ParamsContext);
const { pathname } = useRouter();

const handleChangeSite = (event: React.ChangeEvent<{ value: unknown }>) => {
setSelectedSite(event.target.value as string);
if (isMobile) setIsPolygonMenuOpen(false);
};
const { embed } = React.useContext(ParamsContext);

const dropdownContainerClasses = `${
embed === 'true' ? styles.embed_dropdownContainer : styles.dropdownContainer
} ${
pathname === '/[p]' ? styles['dropdownContainer--reduce-right-offset'] : ''
}`;

const projectSitesButtonClasses = `${
embed === 'true'
? styles.embed_projectSitesButton
: styles.projectSitesButton
} ${
pathname === '/[p]' ? styles['projectSitesButton--reduce-right-offset'] : ''
}`;

return (
<>
{geoJson.features.length > 1 && (
Expand All @@ -34,23 +51,13 @@ export default function SitesDropdown(): ReactElement {
onClick={() => {
if (!isMobile) setIsPolygonMenuOpen(true);
}}
className={
embed === 'true'
? styles.embed_projectSitesButton
: styles.projectSitesButton
}
className={projectSitesButtonClasses}
>
<PolygonIcon />
</div>
) : null}
{isPolygonMenuOpen ? (
<div
className={
embed === 'true'
? styles.embed_dropdownContainer
: styles.dropdownContainer
}
>
<div className={dropdownContainerClasses}>
<div className={styles.projectSitesDropdown}>
<FormControl variant="standard">
<div className={styles.polygonIcon}>
Expand Down
Loading