mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
fix: notification adapter modal improvements (#230)
* fix: fix notification modal
This commit is contained in:
@@ -11,7 +11,15 @@ import { useNavigate, useParams } from 'react-router-dom';
|
|||||||
import { Divider, Input, Switch, Button, TagInput, Toast, Select } from '@douyinfe/semi-ui';
|
import { Divider, Input, Switch, Button, TagInput, Toast, Select } from '@douyinfe/semi-ui';
|
||||||
import './JobMutation.less';
|
import './JobMutation.less';
|
||||||
import { SegmentPart } from '../../../components/segment/SegmentPart';
|
import { SegmentPart } from '../../../components/segment/SegmentPart';
|
||||||
import { IconBell, IconBriefcase, IconPaperclip, IconPlayCircle, IconPlusCircle, IconUser } from '@douyinfe/semi-icons';
|
import {
|
||||||
|
IconBell,
|
||||||
|
IconBriefcase,
|
||||||
|
IconPaperclip,
|
||||||
|
IconPlayCircle,
|
||||||
|
IconPlusCircle,
|
||||||
|
IconUser,
|
||||||
|
IconClear,
|
||||||
|
} from '@douyinfe/semi-icons';
|
||||||
|
|
||||||
export default function JobMutator() {
|
export default function JobMutator() {
|
||||||
const jobs = useSelector((state) => state.jobs.jobs);
|
const jobs = useSelector((state) => state.jobs.jobs);
|
||||||
@@ -160,7 +168,7 @@ export default function JobMutator() {
|
|||||||
</SegmentPart>
|
</SegmentPart>
|
||||||
<Divider margin="1rem" />
|
<Divider margin="1rem" />
|
||||||
<SegmentPart
|
<SegmentPart
|
||||||
Icon={IconBell}
|
Icon={IconClear}
|
||||||
name="Blacklist"
|
name="Blacklist"
|
||||||
helpText="If a listing contains one of these words, it will be filtered out. Type in a word, then hit enter."
|
helpText="If a listing contains one of these words, it will be filtered out. Type in a word, then hit enter."
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { useSelector } from '../../../../../services/state/store';
|
|||||||
import { Banner, Button, Form, Modal, Select, Switch } from '@douyinfe/semi-ui';
|
import { Banner, Button, Form, Modal, Select, Switch } from '@douyinfe/semi-ui';
|
||||||
|
|
||||||
import './NotificationAdapterMutator.less';
|
import './NotificationAdapterMutator.less';
|
||||||
|
import { useScreenWidth } from '../../../../../hooks/screenWidth.js';
|
||||||
|
|
||||||
const sortAdapter = (a, b) => {
|
const sortAdapter = (a, b) => {
|
||||||
if (a.name < b.name) {
|
if (a.name < b.name) {
|
||||||
@@ -70,6 +71,9 @@ export default function NotificationAdapterMutator({
|
|||||||
const [validationMessage, setValidationMessage] = useState(null);
|
const [validationMessage, setValidationMessage] = useState(null);
|
||||||
const [successMessage, setSuccessMessage] = useState(null);
|
const [successMessage, setSuccessMessage] = useState(null);
|
||||||
|
|
||||||
|
const width = useScreenWidth();
|
||||||
|
const isMobile = width <= 850;
|
||||||
|
|
||||||
const onSubmit = (doStore) => {
|
const onSubmit = (doStore) => {
|
||||||
if (doStore) {
|
if (doStore) {
|
||||||
const validationResults = validate(selectedAdapter);
|
const validationResults = validate(selectedAdapter);
|
||||||
@@ -170,18 +174,19 @@ export default function NotificationAdapterMutator({
|
|||||||
<Modal
|
<Modal
|
||||||
title="Adding a new Notification Adapter"
|
title="Adding a new Notification Adapter"
|
||||||
visible={visible}
|
visible={visible}
|
||||||
style={{ width: '95%' }}
|
style={{ width: isMobile ? '95%' : '50rem' }}
|
||||||
|
onCancel={() => onSubmit(false)}
|
||||||
footer={
|
footer={
|
||||||
<div>
|
<div>
|
||||||
<Button type="secondary" disabled={selectedAdapter == null} style={{ float: 'left' }} onClick={() => onTry()}>
|
<Button type="secondary" disabled={selectedAdapter == null} style={{ float: 'left' }} onClick={onTry}>
|
||||||
Try
|
Try
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="danger" onClick={() => onSubmit(true)}>
|
<Button theme="light" type="tertiary" onClick={() => onSubmit(false)}>
|
||||||
Save
|
|
||||||
</Button>
|
|
||||||
<Button type="primary" onClick={() => onSubmit(false)}>
|
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button theme="solid" type="primary" onClick={() => onSubmit(true)}>
|
||||||
|
Save
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -207,9 +212,9 @@ export default function NotificationAdapterMutator({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
When Fredy found new listings, we like to report them to you. To do so, notification adapter can be configured.{' '}
|
When Fredy finds new listings, we like to report them to you. To do so, the notification adapter can be
|
||||||
<br />
|
configured. <br />
|
||||||
There are multiple ways how Fredy can send new listings to you. Chose your weapon...
|
There are multiple ways Fredy can send new listings to you. Choose your weapon...
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { transform } from '../../../../../services/transformer/providerTransform
|
|||||||
import { useSelector } from '../../../../../services/state/store';
|
import { useSelector } from '../../../../../services/state/store';
|
||||||
import { IconLikeHeart } from '@douyinfe/semi-icons';
|
import { IconLikeHeart } from '@douyinfe/semi-icons';
|
||||||
import './ProviderMutator.less';
|
import './ProviderMutator.less';
|
||||||
|
import { useScreenWidth } from '../../../../../hooks/screenWidth.js';
|
||||||
|
|
||||||
const sortProvider = (a, b) => {
|
const sortProvider = (a, b) => {
|
||||||
if (a.key < b.key) {
|
if (a.key < b.key) {
|
||||||
@@ -21,6 +22,10 @@ export default function ProviderMutator({ onVisibilityChanged, visible = false,
|
|||||||
const [selectedProvider, setSelectedProvider] = useState(null);
|
const [selectedProvider, setSelectedProvider] = useState(null);
|
||||||
const [providerUrl, setProviderUrl] = useState(null);
|
const [providerUrl, setProviderUrl] = useState(null);
|
||||||
const [validationMessage, setValidationMessage] = useState(null);
|
const [validationMessage, setValidationMessage] = useState(null);
|
||||||
|
|
||||||
|
const width = useScreenWidth();
|
||||||
|
const isMobile = width <= 850;
|
||||||
|
|
||||||
const validate = () => {
|
const validate = () => {
|
||||||
if (selectedProvider == null || selectedProvider.length === 0 || providerUrl == null || providerUrl.length === 0) {
|
if (selectedProvider == null || selectedProvider.length === 0 || providerUrl == null || providerUrl.length === 0) {
|
||||||
return 'Please select a provider and copy the browser url into the textfield after configuring your search parameter.';
|
return 'Please select a provider and copy the browser url into the textfield after configuring your search parameter.';
|
||||||
@@ -67,7 +72,7 @@ export default function ProviderMutator({ onVisibilityChanged, visible = false,
|
|||||||
visible={visible}
|
visible={visible}
|
||||||
onOk={() => onSubmit(true)}
|
onOk={() => onSubmit(true)}
|
||||||
onCancel={() => onSubmit(false)}
|
onCancel={() => onSubmit(false)}
|
||||||
style={{ width: '50rem' }}
|
style={{ width: isMobile ? '95%' : '50rem' }}
|
||||||
okText="Save"
|
okText="Save"
|
||||||
>
|
>
|
||||||
{validationMessage != null && (
|
{validationMessage != null && (
|
||||||
|
|||||||
Reference in New Issue
Block a user