mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
tweak(phone): remove bank & twitter notification components
This commit is contained in:
1 parent
fef876d9a6
commit
a9ba633241
5 files changed
-228
No files matched your search
@@ -1,48 +0,0 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
|
||||||
import Notification from '../../../../ui/components/Notification';
|
|
||||||
import { usePhone } from '../../../../os/phone/hooks/usePhone';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import useStyles from './notification.style';
|
|
||||||
import { useBankNotification } from '../../hooks/useBankNotification';
|
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
||||||
import { faWonSign } from '@fortawesome/free-solid-svg-icons';
|
|
||||||
|
|
||||||
export const BankNotification = () => {
|
|
||||||
const { notification } = useBankNotification();
|
|
||||||
const classes = useStyles();
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const [visible, setVisible] = useState(false);
|
|
||||||
const { config } = usePhone();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (notification && notification.id) {
|
|
||||||
setVisible(true);
|
|
||||||
}
|
|
||||||
}, [notification]);
|
|
||||||
|
|
||||||
if (!config?.bank.showNotifications || !notification) return null;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Notification
|
|
||||||
key={notification.id}
|
|
||||||
open={visible}
|
|
||||||
handleClose={() => setVisible(false)}
|
|
||||||
>
|
|
||||||
<div className={classes.content}>
|
|
||||||
<div className={classes.title}>
|
|
||||||
<div className={classes.titleLeft}>
|
|
||||||
<div className={classes.icon}>
|
|
||||||
<FontAwesomeIcon icon={faWonSign} />
|
|
||||||
</div>
|
|
||||||
<div className={classes.heading}>{notification.type}</div>
|
|
||||||
</div>
|
|
||||||
<div className={classes.justNow}>{t('APPS_BANK_TIME_JUST_NOW')}</div>
|
|
||||||
</div>
|
|
||||||
<div className={classes.message}>
|
|
||||||
{notification.source} sent you ${notification.transferAmount}.{' '}
|
|
||||||
<br></br> {notification.message}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Notification>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
|
||||||
createStyles({
|
|
||||||
content: {
|
|
||||||
padding: theme.spacing(2),
|
|
||||||
overflowY: 'hidden',
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
display: 'flex',
|
|
||||||
flexFlow: 'row nowrap',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
alignItems: 'center',
|
|
||||||
},
|
|
||||||
titleLeft: {
|
|
||||||
display: 'flex',
|
|
||||||
flexFlow: 'row nowrap',
|
|
||||||
justifyContent: 'flex-start',
|
|
||||||
alignItems: 'center',
|
|
||||||
},
|
|
||||||
icon: {
|
|
||||||
marginTop: '3px',
|
|
||||||
marginRight: '5px',
|
|
||||||
},
|
|
||||||
heading: {
|
|
||||||
marginBottom: '3px',
|
|
||||||
},
|
|
||||||
justNow: {
|
|
||||||
fontSize: '18px',
|
|
||||||
fontStyle: 'italic',
|
|
||||||
paddingRight: '3px',
|
|
||||||
},
|
|
||||||
message: {
|
|
||||||
fontSize: '16px',
|
|
||||||
overflow: 'hidden',
|
|
||||||
display: '-webkit-box',
|
|
||||||
WebkitLineClamp: 2,
|
|
||||||
WebkitBoxOrient: 'vertical',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
export default useStyles;
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { shallow } from 'enzyme';
|
|
||||||
import TwitterNotification from './TwitterNotification';
|
|
||||||
|
|
||||||
jest.mock('react-i18next', () => ({
|
|
||||||
useTranslation: () => ({ t: (key) => key }),
|
|
||||||
}));
|
|
||||||
|
|
||||||
jest.mock('../../../../os/phone/hooks/usePhone', () => ({
|
|
||||||
usePhone: jest.fn().mockReturnValue({
|
|
||||||
config: {
|
|
||||||
twitter: {
|
|
||||||
showNotifications: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
}));
|
|
||||||
|
|
||||||
jest.mock('../../hooks/useTwitterNotification', () => ({
|
|
||||||
useTwitterNotification: jest.fn().mockReturnValue({
|
|
||||||
notification: {
|
|
||||||
profile_name: 'test',
|
|
||||||
message: 'test message',
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('TwitterNotification', () => {
|
|
||||||
let wrapper;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
wrapper = shallow(<TwitterNotification />);
|
|
||||||
});
|
|
||||||
it('renders', () => {
|
|
||||||
expect(wrapper).toBeDefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('renders profile name', () => {
|
|
||||||
expect(wrapper.find('.makeStyles-profileName-5').text()).toEqual('@test');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('renders message', () => {
|
|
||||||
expect(wrapper.find('.makeStyles-message-7').text()).toEqual(
|
|
||||||
'test message'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
|
|
||||||
import TwitterIcon from '@material-ui/icons/Twitter';
|
|
||||||
import { useTwitterNotification } from '../../hooks/useTwitterNotification';
|
|
||||||
import Notification from '../../../../ui/components/Notification';
|
|
||||||
import { usePhone } from '../../../../os/phone/hooks/usePhone';
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
|
||||||
createStyles({
|
|
||||||
content: {
|
|
||||||
padding: theme.spacing(2),
|
|
||||||
overflowY: 'hidden',
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
display: 'flex',
|
|
||||||
flexFlow: 'row nowrap',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
alignItems: 'center',
|
|
||||||
},
|
|
||||||
titleLeft: {
|
|
||||||
display: 'flex',
|
|
||||||
flexFlow: 'row nowrap',
|
|
||||||
justifyContent: 'flex-start',
|
|
||||||
alignItems: 'center',
|
|
||||||
},
|
|
||||||
icon: {
|
|
||||||
marginTop: '3px',
|
|
||||||
marginRight: '5px',
|
|
||||||
},
|
|
||||||
profileName: {
|
|
||||||
marginBottom: '3px',
|
|
||||||
},
|
|
||||||
justNow: {
|
|
||||||
fontSize: '18px',
|
|
||||||
fontStyle: 'italic',
|
|
||||||
paddingRight: '3px',
|
|
||||||
},
|
|
||||||
message: {
|
|
||||||
fontSize: '16px',
|
|
||||||
overflow: 'hidden',
|
|
||||||
display: '-webkit-box',
|
|
||||||
WebkitLineClamp: 2,
|
|
||||||
WebkitBoxOrient: 'vertical',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
function TwitterNotification() {
|
|
||||||
const classes = useStyles();
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const [visible, setVisible] = useState(false);
|
|
||||||
const { notification } = useTwitterNotification();
|
|
||||||
const { config } = usePhone();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (notification && notification.id) {
|
|
||||||
setVisible(true);
|
|
||||||
}
|
|
||||||
}, [notification]);
|
|
||||||
|
|
||||||
if (!config?.twitter.showNotifications || !notification) return null;
|
|
||||||
|
|
||||||
const profileName = `@${notification.profile_name?.trim()}`;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Notification
|
|
||||||
key={notification.id}
|
|
||||||
open={visible}
|
|
||||||
handleClose={() => setVisible(false)}
|
|
||||||
>
|
|
||||||
<div className={classes.content}>
|
|
||||||
<div className={classes.title}>
|
|
||||||
<div className={classes.titleLeft}>
|
|
||||||
<div className={classes.icon}>
|
|
||||||
<TwitterIcon />
|
|
||||||
</div>
|
|
||||||
<div className={classes.profileName}>{profileName}</div>
|
|
||||||
</div>
|
|
||||||
<div className={classes.justNow}>{t('APPS_TWITTER_JUST_NOW')}</div>
|
|
||||||
</div>
|
|
||||||
<div className={classes.message}>{notification.message}</div>
|
|
||||||
</div>
|
|
||||||
</Notification>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default TwitterNotification;
|
|
||||||
@@ -29,8 +29,6 @@ if (PhoneConfig.SentryErrorMetrics) {
|
|||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<HashRouter>
|
<HashRouter>
|
||||||
<RecoilRoot>
|
<RecoilRoot>
|
||||||
<TwitterNotification />
|
|
||||||
<BankNotification />
|
|
||||||
<SnackbarProvider>
|
<SnackbarProvider>
|
||||||
<NotificationsProvider>
|
<NotificationsProvider>
|
||||||
<Phone />
|
<Phone />
|
||||||
|
|||||||
Reference in new issue
Block a user