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

Niloofar/ Footer component #76

Merged
merged 4 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
35 changes: 26 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@babel/preset-env": "^7.24.5",
"@deriv-com/api-hooks": "^0.1.19",
"@deriv-com/translations": "^1.2.3",
"@deriv-com/ui": "^1.21.1",
"@deriv-com/ui": "^1.26.0",
"@deriv-com/utils": "latest",
"@deriv/deriv-api": "^1.0.15",
"@deriv/quill-design": "^1.2.24",
Expand Down
16 changes: 16 additions & 0 deletions src/components/AppFooter/AccountLimits.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { LegacyAccountLimitsIcon } from '@deriv/quill-icons';
import { localize } from '@deriv-com/translations';
niloofar-deriv marked this conversation as resolved.
Show resolved Hide resolved
import { TooltipMenuIcon } from '@deriv-com/ui';

const AccountLimits = () => (
<TooltipMenuIcon
as='a'
className='app-footer__icon'
href='https://app.deriv.com/account/account-limits'
tooltipContent={localize('Account limits')}
>
<LegacyAccountLimitsIcon iconSize='xs' />
</TooltipMenuIcon>
);

export default AccountLimits;
42 changes: 35 additions & 7 deletions src/components/AppFooter/AppFooter.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,41 @@
.app-footer {
padding: 2.4rem;
height: 32px;
display: flex;
flex-direction: row-reverse;
align-items: center;
position: fixed;
bottom: 0;
right: 0;
left: 0;
border-top: 1px solid #f2f3f4;
box-shadow: 0px 1px 0px 0px #f2f3f4 inset;
background: #fff;

&__language-btn {
&:hover {
background-color: transparent !important;
&__icon {
padding: 8px;
}

&__vertical-line {
width: 1px;
height: 16px;
background-color: #f2f3f4;
margin: 0 8px;
}

span {
color: #000 !important;
}
&__language {
display: flex;
align-items: center;
padding: 8px;

& span {
margin-left: 4px;
}
}

&__network-status {
width: 8px;
height: 8px;
border-radius: 100%;
background-color: #4bb4b3;
}
}
63 changes: 43 additions & 20 deletions src/components/AppFooter/AppFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,54 @@
import { LanguagesModal } from '@/components/Modals';
import { LANGUAGES } from '@/constants';
import { useModalManager } from '@/hooks/custom-hooks';
import { IconTypes } from '@deriv/quill-icons';
import { useModalManager } from '@/hooks';
import { useTranslations } from '@deriv-com/translations';
import { Button, Footer } from '@deriv-com/ui';
import { DesktopLanguagesModal } from '@deriv-com/ui';
import AccountLimits from './AccountLimits';
import ChangeTheme from './ChangeTheme';
import Deriv from './Deriv';
import FullScreen from './FullScreen';
import HelpCentre from './HelpCentre';
import LanguageSettings from './LanguageSettings';
import Livechat from './Livechat';
import { NetworkStatus } from './NetworkStatus';
import ResponsibleTrading from './ResponsibleTrading';
import { ServerTime } from './ServerTime';
import WhatsApp from './WhatsApp';
import './AppFooter.scss';

// TODO: handle local storage values not updating after changing local storage values
const AppFooter = () => {
const { currentLang } = useTranslations();
const { currentLang, localize, switchLanguage } = useTranslations();
const { hideModal, isModalOpenFor, showModal } = useModalManager();
const CountryIcon = LANGUAGES.find(lang => lang.code === currentLang)?.icon as IconTypes;

const openLanguageSettingModal = () => showModal('DesktopLanguagesModal');

return (
<Footer className='app-footer'>
<Button
className='app-footer__language-btn'
color='black'
icon={<CountryIcon iconSize='sm' />}
onClick={() => showModal('LanguagesModal')}
size='sm'
variant='ghost'
>
{currentLang}
</Button>
{isModalOpenFor('LanguagesModal') && <LanguagesModal isModalOpen onClose={hideModal} />}
</Footer>
<footer className='app-footer'>
<FullScreen />
<LanguageSettings openLanguageSettingModal={openLanguageSettingModal} />
<HelpCentre />
<div className='app-footer__vertical-line' />
<ChangeTheme />
<AccountLimits />
<ResponsibleTrading />
<Deriv />
<Livechat />
<WhatsApp />
<div className='app-footer__vertical-line' />
<ServerTime />
<div className='app-footer__vertical-line' />
<NetworkStatus />

{isModalOpenFor('DesktopLanguagesModal') && (
<DesktopLanguagesModal
headerTitle={localize('Select Language')}
isModalOpen
languages={LANGUAGES}
onClose={hideModal}
onLanguageSwitch={code => switchLanguage(code)}
selectedLanguage={currentLang}
/>
)}
</footer>
);
};

Expand Down
11 changes: 11 additions & 0 deletions src/components/AppFooter/ChangeTheme.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { LegacySettings1pxIcon } from '@deriv/quill-icons';
import { localize } from '@deriv-com/translations';
import { TooltipMenuIcon } from '@deriv-com/ui';

const ChangeTheme = () => (
<TooltipMenuIcon as='button' className='app-footer__icon' tooltipContent={localize('Change theme')}>
<LegacySettings1pxIcon iconSize='xs' />
</TooltipMenuIcon>
);

export default ChangeTheme;
17 changes: 17 additions & 0 deletions src/components/AppFooter/Deriv.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { LegacyDerivIcon } from '@deriv/quill-icons';
import { localize } from '@deriv-com/translations';
import { TooltipMenuIcon } from '@deriv-com/ui';

const Deriv = () => (
<TooltipMenuIcon
as='a'
className='app-footer__icon'
href='https://deriv.com/'
target='_blank'
tooltipContent={localize('Go to deriv.com')}
>
<LegacyDerivIcon iconSize='xs' />
</TooltipMenuIcon>
);

export default Deriv;
21 changes: 21 additions & 0 deletions src/components/AppFooter/FullScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { useFullScreen } from '@/hooks';
import { LegacyFullscreen1pxIcon } from '@deriv/quill-icons';
import { localize } from '@deriv-com/translations';
import { TooltipMenuIcon } from '@deriv-com/ui';

const FullScreen = () => {
const { toggleFullScreenMode } = useFullScreen();

return (
<TooltipMenuIcon
as='button'
className='app-footer__icon'
onClick={toggleFullScreenMode}
tooltipContent={localize('Full screen')}
>
<LegacyFullscreen1pxIcon iconSize='xs' />
</TooltipMenuIcon>
);
};

export default FullScreen;
17 changes: 17 additions & 0 deletions src/components/AppFooter/HelpCentre.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { LegacyHelpCentreIcon } from '@deriv/quill-icons';
import { localize } from '@deriv-com/translations';
import { TooltipMenuIcon } from '@deriv-com/ui';

const HelpCentre = () => (
<TooltipMenuIcon
as='a'
className='app-footer__icon'
href='https://deriv.com/help-centre/'
target='_blank'
tooltipContent={localize('Help centre')}
>
<LegacyHelpCentreIcon iconSize='xs' />
</TooltipMenuIcon>
);

export default HelpCentre;
30 changes: 30 additions & 0 deletions src/components/AppFooter/LanguageSettings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { LANGUAGES } from '@/constants';
import { localize, useTranslations } from '@deriv-com/translations';
import { Text, TooltipMenuIcon } from '@deriv-com/ui';
import './AppFooter.scss';

type TLanguageSettings = {
openLanguageSettingModal: () => void;
};

const LanguageSettings = ({ openLanguageSettingModal }: TLanguageSettings) => {
const { currentLang } = useTranslations();

const countryIcon = LANGUAGES.find(({ code }) => code == currentLang)?.icon;

return (
<TooltipMenuIcon
as='button'
className='app-footer__language'
onClick={openLanguageSettingModal}
tooltipContent={localize('Language')}
>
{countryIcon}
<Text size='xs' weight='bold'>
{currentLang}
</Text>
</TooltipMenuIcon>
);
};

export default LanguageSettings;
11 changes: 11 additions & 0 deletions src/components/AppFooter/Livechat.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { LegacyLiveChatOutlineIcon } from '@deriv/quill-icons';
import { localize } from '@deriv-com/translations';
import { TooltipMenuIcon } from '@deriv-com/ui';

const Livechat = () => (
<TooltipMenuIcon as='button' className='app-footer__icon' tooltipContent={localize('Live chat')}>
<LegacyLiveChatOutlineIcon iconSize='xs' />
</TooltipMenuIcon>
);

export default Livechat;
15 changes: 15 additions & 0 deletions src/components/AppFooter/NetworkStatus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { localize } from '@deriv-com/translations';
import { TooltipMenuIcon } from '@deriv-com/ui';

export const NetworkStatus = () => {
return (
<TooltipMenuIcon
as='div'
className='app-footer__icon'
disableHover
tooltipContent={localize('Network status: Online')}
>
<div className='app-footer__network-status' />
</TooltipMenuIcon>
);
};
17 changes: 17 additions & 0 deletions src/components/AppFooter/ResponsibleTrading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { LegacyResponsibleTradingIcon } from '@deriv/quill-icons';
import { localize } from '@deriv-com/translations';
import { TooltipMenuIcon } from '@deriv-com/ui';

const ResponsibleTrading = () => (
<TooltipMenuIcon
as='a'
className='app-footer__icon'
href='https://deriv.com/responsible/'
target='_blank'
tooltipContent={localize('Responsible trading')}
>
<LegacyResponsibleTradingIcon iconSize='xs' />
</TooltipMenuIcon>
);

export default ResponsibleTrading;
15 changes: 15 additions & 0 deletions src/components/AppFooter/ServerTime.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { localize } from '@deriv-com/translations';
import { Text, TooltipMenuIcon } from '@deriv-com/ui';

export const ServerTime = () => {
return (
<TooltipMenuIcon
as='div'
className='app-footer__icon'
disableHover
tooltipContent={localize('01 Jan 2021 00:00:00 GMT')}
>
<Text size='xs'>01 Jan 2021 00:00:00 GMT</Text>
</TooltipMenuIcon>
);
};
Loading
Loading