Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(inbox): email send popup improvement (#4433)
- Loading branch information
1 parent
046bcb5
commit 105ca0f
Showing
8 changed files
with
318 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
packages/plugin-inbox-ui/src/inbox/containers/EmailWidget.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React, { useState } from 'react'; | ||
import MailForm from '@erxes/ui-inbox/src/settings/integrations/containers/mail/MailForm'; | ||
import { NotifButton } from '@erxes/ui-notifications/src/components/styles'; | ||
import Icon from '@erxes/ui/src/components/Icon'; | ||
import { WidgetWrapper } from '@erxes/ui-inbox/src/settings/integrations/components/mail/styles'; | ||
import Tip from '@erxes/ui/src/components/Tip'; | ||
import { __ } from '@erxes/ui/src/utils'; | ||
import { NewEmailHeader } from '@erxes/ui-inbox/src/settings/integrations/components/mail/styles'; | ||
|
||
const WidgetContainer = () => { | ||
const [shrink, setShrink] = useState(false); | ||
const [show, setShow] = useState(true); | ||
const [clear, setClear] = useState(false); | ||
|
||
const changeShrink = () => { | ||
setShrink(!shrink); | ||
}; | ||
|
||
const hideWidget = () => { | ||
setTimeout(() => { | ||
setShow(true); | ||
setShrink(false); | ||
}, 10); | ||
|
||
localStorage.setItem('emailWidgetShow', 'false'); | ||
}; | ||
|
||
const onClose = () => { | ||
hideWidget(); | ||
setClear(true); | ||
}; | ||
|
||
const showWidget = () => { | ||
setShrink(false); | ||
setShow(!show); | ||
setClear(false); | ||
|
||
localStorage.setItem('emailWidgetShow', show ? 'true' : 'false'); | ||
}; | ||
|
||
const isWidgetShow = localStorage.getItem('emailWidgetShow'); | ||
|
||
return ( | ||
<> | ||
<NotifButton> | ||
<Tip text={__('New Email')} placement="bottom"> | ||
<Icon icon="send" size={15} onClick={() => showWidget()} /> | ||
</Tip> | ||
</NotifButton> | ||
<WidgetWrapper show={isWidgetShow === 'true' ? true : false}> | ||
<NewEmailHeader shrink={shrink} onClick={changeShrink}> | ||
{__('New Email')} | ||
<div> | ||
<Icon size={10} icon={shrink ? 'plus' : 'minus'} /> | ||
<Icon size={10} icon="cancel" onClick={() => onClose()} /> | ||
</div> | ||
</NewEmailHeader> | ||
<MailForm | ||
shrink={shrink} | ||
changeShrink={changeShrink} | ||
clear={clear} | ||
clearOnSubmit={true} | ||
/> | ||
</WidgetWrapper> | ||
</> | ||
); | ||
}; | ||
|
||
export default WidgetContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.