mirror of
https://github.com/mue/mue.git
synced 2026-07-18 06:24:17 +02:00
refactor(widgets): Continue move to feature based organisation
This commit is contained in:
49
src/features/background/ExcludeModal.jsx
Normal file
49
src/features/background/ExcludeModal.jsx
Normal file
@@ -0,0 +1,49 @@
|
||||
import variables from 'config/variables';
|
||||
import { memo } from 'react';
|
||||
import EventBus from 'utils/eventbus';
|
||||
import { Tooltip } from 'components/Elements';
|
||||
|
||||
import { MdClose, MdDone } from 'react-icons/md';
|
||||
|
||||
function ExcludeModal({ modalClose, info }) {
|
||||
const excludeImage = async () => {
|
||||
let backgroundExclude = JSON.parse(localStorage.getItem('backgroundExclude'));
|
||||
backgroundExclude.push(info.pun);
|
||||
backgroundExclude = JSON.stringify(backgroundExclude);
|
||||
localStorage.setItem('backgroundExclude', backgroundExclude);
|
||||
EventBus.emit('refresh', 'background');
|
||||
modalClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="smallModal">
|
||||
<div className="shareHeader">
|
||||
<span className="title">
|
||||
{variables.getMessage('modals.main.settings.sections.advanced.reset_modal.title')}
|
||||
</span>
|
||||
<Tooltip
|
||||
title={variables.getMessage('modals.main.settings.sections.advanced.reset_modal.cancel')}
|
||||
>
|
||||
<div className="close" onClick={modalClose}>
|
||||
<MdClose />
|
||||
</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<span className="subtitle">
|
||||
{variables.getMessage('widgets.background.exclude_confirm', { category: info.category })}
|
||||
</span>
|
||||
<div className="resetFooter">
|
||||
<button className="textButton" onClick={modalClose}>
|
||||
<MdClose />
|
||||
{variables.getMessage('modals.main.settings.sections.advanced.reset_modal.cancel')}
|
||||
</button>
|
||||
<button onClick={() => excludeImage()}>
|
||||
<MdDone />
|
||||
{variables.getMessage('widgets.background.confirm')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default memo(ExcludeModal);
|
||||
Reference in New Issue
Block a user