Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into fix-add-grey-filte…
Browse files Browse the repository at this point in the history
…r-for-sources
  • Loading branch information
Adeodonne committed Sep 13, 2023
2 parents 53d845f + 00c2fb0 commit bc3a605
Show file tree
Hide file tree
Showing 25 changed files with 496 additions and 352 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pipeline {
steps {
script {
withCredentials([usernamePassword(credentialsId: 'docker-login-streetcode', passwordVariable: 'password', usernameVariable: 'username')]){
sh "docker build -t ${username}/streetcode_client:latest ."
sh "docker build --no-cache -t ${username}/streetcode_client:latest ."
}
}
}
Expand Down
8 changes: 1 addition & 7 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,10 @@
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css" />

<script src="https://cdn.tiny.cloud/1/8orzv8u2ay8ccowdk5xnlgwzumtgiebf0sio35i8lqk0jbe9/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>


<script src="https://cdn.tiny.cloud/1/8orzv8u2ay8ccowdk5xnlgwzumtgiebf0sio35i8lqk0jbe9/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>

<script src="https://cdn.tiny.cloud/1/8orzv8u2ay8ccowdk5xnlgwzumtgiebf0sio35i8lqk0jbe9/tinymce/6.6.2-27/tinymce.min.js" referrerpolicy="origin"></script>
<!-- Google map API -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCr5712Z86_z29W9biaPj8DcaggjbUAy7M&libraries=places"></script>


<script src="https://cdn.tiny.cloud/1/8orzv8u2ay8ccowdk5xnlgwzumtgiebf0sio35i8lqk0jbe9/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2RHY04JKG0"></script>
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import { observer } from 'mobx-react-lite';
import { useState } from 'react';
import useMobx, { useModalContext } from '@stores/root-store';

import { Button, Form, Input, Modal, Popover } from 'antd';
import { Button, Form, Input, Modal, Popover, message } from 'antd';

import EmailApi from '@/app/api/email/email.api';
import { partnersClickEvent } from '@/app/common/utils/googleAnalytics.unility';
import ReCAPTCHA from 'react-google-recaptcha';
import Email from '@/models/email/email.model';

const MAX_SYMBOLS = 500;
Expand All @@ -19,19 +20,52 @@ const PartnersModal = () => {
const { setModal, modalsState: { partners } } = modalStore;
const [form] = Form.useForm();
const [formData, setFormData] = useState({ email: '', message: '' });
const [messageApi, messageContextHolder] = message.useMessage();
const [isVerified, setIsVerified] = useState(false);
const handleChange = (e) => setFormData({ ...formData, [e.target.name]: e.target.value });

const newEmail: Email = { from: formData.email, content: formData.message };
const onFinish = () => EmailApi.send(newEmail);
const onFinish = () => {
if(isVerified){
EmailApi.send(newEmail)
.then(() => {
onCancel();
successMessage();
})
.catch(e => {
onCancel();
errorMessage();
})
}
}

const onClear = () => {
partners.isOpen = false;
form.resetFields();
};

const onCancel = () => {
partners.isOpen = false;
}

const handleVerify = () => {
setIsVerified(true);
};

const successMessage = () => {
messageApi.open({
type: 'success',
content: 'Лист успішно надісланий',
});
};

const errorMessage = () => {
messageApi.open({
type: 'error',
content: 'Щось пішло не так...',
});
};

return (
<Modal
className="partnersModal"
Expand All @@ -43,6 +77,7 @@ const PartnersModal = () => {
closeIcon={<Popover><CancelBtn className='iconSize' onClick={onClear} />
</Popover>}
>
{messageContextHolder}
<div className="partnersModalContent">
<div className="formContainer">
<div className="formTitle">
Expand All @@ -58,9 +93,11 @@ const PartnersModal = () => {
<Form.Item
className="textareaBlock required-input"
name="message"
rules={[{ required: true,
min: 1,
max: MAX_SYMBOLS }]}
rules={[{
required: true,
min: 1,
max: MAX_SYMBOLS
}]}
>
<Input.TextArea
className="textarea"
Expand All @@ -76,8 +113,10 @@ const PartnersModal = () => {
name="email"
className="required-input"
rules={[
{ required: true,
type: 'email' },
{
required: true,
type: 'email'
},
]}
>
<Input
Expand All @@ -87,9 +126,16 @@ const PartnersModal = () => {
onChange={handleChange}
/>
</Form.Item>
<div className="captchaBlock ">
<ReCAPTCHA
className="required-input"
sitekey="6Lf0te8mAAAAAN47cZDXrIUk0kjdoCQO9Jl0DtI4"
onChange={handleVerify}
/>
</div>
<Form.Item>
<Button type="primary" htmlType="submit" onClick={() => partnersClickEvent()}>
Відправити
Відправити
</Button>
</Form.Item>
</Form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ $CancelBtn: "/src/assets/images/utils/Cancel_btn.svg";
font-weight: 300;
font-size: 15px;

ul, ol {
list-style: auto;
padding-inline-start: revert;
}

>h1 {
@include mut.with-font($font-family: ft.$closer-text-font, $font-weight: 500, $font-size: 24px, $font-style: light);
line-height: pxToRem(26.4px);
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout/header/HeaderBlock.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const HeaderBlock = () => {
setIsPageDimmed(false);
setIsPopoverVisible(false);

}, 100);
}, 500);

}
}, [setIsPageDimmed, setIsPopoverVisible, off]);
Expand Down
87 changes: 58 additions & 29 deletions src/app/layout/header/HeaderDrawer/HeaderDrawer.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ const menuOptions = [
FRONTEND_ROUTES.OTHER_PAGES.ERROR404,
];

const MENU_ID = {
HOME: 1,
CATALOG: 2,
ABOUT: 3,
PARTNERS: 4,
DONATE: 5,
CONTACTS: 6,
PRIVACY_POLICY: 7,
FEEDBACK: 8,
};

const HeaderDrawer = () => {
const { toggleState: drawerState, handlers: { toggle } } = useToggle();
const [active, setActive] = useState(1);
Expand All @@ -52,8 +63,26 @@ const HeaderDrawer = () => {
query: '(max-width: 1024px)',
});

const setCatalogForStreetcodePage = (currentPath: string) => {
let optionId = menuOptions.indexOf(currentPath);

const isExcluded = currentPath !== FRONTEND_ROUTES.BASE
&& menuOptions
.filter((option, index) => index !== 0)
.some((option) => currentPath.startsWith(option));

if (currentPath && !isExcluded) {
if (currentPath !== FRONTEND_ROUTES.BASE) {
optionId = 1;
}
}
return optionId;
};

useEffect(() => {
const optionId = menuOptions.indexOf(location.pathname);
const currentPath = location.pathname;
const optionId = setCatalogForStreetcodePage(currentPath);

if (isSmall) {
setScalingCooficient(scaleMobile);
setOptions(mobileOptions);
Expand Down Expand Up @@ -89,71 +118,71 @@ const HeaderDrawer = () => {
<div>
<div className="headerDrawerContainer">
<HeaderDrawerItem
id={1}
id={MENU_ID.HOME}
parentActive={active}
text="Головна"
link={FRONTEND_ROUTES.BASE}
toggleState={toggle}
/>
<HeaderDrawerItem
id={2}
id={MENU_ID.CATALOG}
parentActive={active}
text="Стріткоди"
link={FRONTEND_ROUTES.OTHER_PAGES.CATALOG}
toggleState={toggle}
/>
<HeaderDrawerItem
id={3}
id={MENU_ID.ABOUT}
parentActive={active}
text="Про нас"
link={FRONTEND_ROUTES.OTHER_PAGES.ERROR404}
toggleState={toggle}
/>
<HeaderDrawerItem
id={4}
id={MENU_ID.PARTNERS}
parentActive={active}
text="Партнери"
link={FRONTEND_ROUTES.OTHER_PAGES.PARTNERS}
toggleState={toggle}
/>
<HeaderDrawerItem
id={5}
id={MENU_ID.DONATE}
parentActive={active}
text="Донати"
link={FRONTEND_ROUTES.OTHER_PAGES.SUPPORT_US}
toggleState={toggle}
/>
<HeaderDrawerItem
id={6}
id={MENU_ID.CONTACTS}
parentActive={active}
text="Контакти"
link={FRONTEND_ROUTES.OTHER_PAGES.CONTACT_US}
toggleState={toggle}
/>
</div>
{isSmall
&& (
<>
<br />
<div className="headerDrawerContainer">
<HeaderDrawerItem
id={7}
parentActive={active}
toggleState={toggle}
text="Політика конфіденційності"
link={FRONTEND_ROUTES.OTHER_PAGES.PRIVACY_POLICY}
/>
<HeaderDrawerItem
id={8}
parentActive={active}
toggleState={toggle}
text="Зворотний зв'язок"
link={FRONTEND_ROUTES.OTHER_PAGES.ERROR404}
/>
</div>
<SocialMediaLinks />
</>
)}
&& (
<>
<br />
<div className="headerDrawerContainer">
<HeaderDrawerItem
id={MENU_ID.PRIVACY_POLICY}
parentActive={active}
toggleState={toggle}
text="Політика конфіденційності"
link={FRONTEND_ROUTES.OTHER_PAGES.PRIVACY_POLICY}
/>
<HeaderDrawerItem
id={MENU_ID.FEEDBACK}
parentActive={active}
toggleState={toggle}
text="Зворотний зв'язок"
link={FRONTEND_ROUTES.OTHER_PAGES.ERROR404}
/>
</div>
<SocialMediaLinks />
</>
)}
</div>
</div>
</Drawer>
Expand Down
11 changes: 9 additions & 2 deletions src/app/stores/streetcodes-catalog-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@ import { StreetcodeCatalogRecord } from '@/models/streetcode/streetcode-types.mo
export default class StreetcodesCatalogStore {
public catalog = new Array<StreetcodeCatalogRecord>();

public isNotEightorZero = false;

constructor() {
makeAutoObservable(this);
}

public fetchCatalogStreetcodes = async (page: number, count = 8) => {
try {
const array = await StreetcodesApi.getAllCatalog(page, count);
if (this.catalog.length === 0
|| !array.some((item) => item.id === this.catalog.at(0)?.id)) {
if (
this.catalog.length === 0
|| !array.some((item) => item.id === this.catalog.at(0)?.id)
) {
this.catalog = this.catalog.concat(array);
if (array.length !== 0 && array.length < count) {
this.isNotEightorZero = true;
}
}
} catch (error) {}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './ContactBlock.styles.scss';
import Email from '@images/contact-us/email.webp';
import Facebook from '@images/contact-us/Facebook.webp';
import Instagram from '@images/contact-us/Instagram.webp';
import Logo from '@images/contact-us/Logo-2.webp';
import Logo from '@images/contact-us/logo-2.webp';
import TikTok from '@images/contact-us/TikTok.webp';
import Twitter from '@images/contact-us/Twitter.webp';
import YouTube from '@images/contact-us/Youtube.webp';
Expand Down
Loading

0 comments on commit bc3a605

Please sign in to comment.