refactor code
This commit is contained in:
parent
6b353c6d7c
commit
ee686d430b
|
@ -1,5 +1,4 @@
|
||||||
import { MappingList } from './mappingList';
|
import { MappingList } from './mappingList';
|
||||||
import { NoMappingsContent } from './noMappingsContent';
|
|
||||||
import React, { useContext, useEffect, useState } from 'react';
|
import React, { useContext, useEffect, useState } from 'react';
|
||||||
import { Button, Dialog, DialogContent, Stack } from '@mui/material';
|
import { Button, Dialog, DialogContent, Stack } from '@mui/material';
|
||||||
import watchFolderService from 'services/watchFolder/watchFolderService';
|
import watchFolderService from 'services/watchFolder/watchFolderService';
|
||||||
|
@ -98,17 +97,10 @@ export default function WatchFolder({ open, onClose }: Iprops) {
|
||||||
</DialogTitleWithCloseButton>
|
</DialogTitleWithCloseButton>
|
||||||
<DialogContent sx={{ flex: 1 }}>
|
<DialogContent sx={{ flex: 1 }}>
|
||||||
<Stack spacing={1} p={1.5} height={'100%'}>
|
<Stack spacing={1} p={1.5} height={'100%'}>
|
||||||
{mappings.length === 0 ? (
|
<MappingList
|
||||||
<NoMappingsContent />
|
mappings={mappings}
|
||||||
) : (
|
handleRemoveWatchMapping={handleRemoveWatchMapping}
|
||||||
<MappingList
|
/>
|
||||||
mappings={mappings}
|
|
||||||
handleRemoveWatchMapping={
|
|
||||||
handleRemoveWatchMapping
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
fullWidth
|
fullWidth
|
||||||
color="accent"
|
color="accent"
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { WatchMapping } from 'types/watchFolder';
|
import { WatchMapping } from 'types/watchFolder';
|
||||||
import { MappingEntry } from './mappingEntry';
|
import { MappingEntry } from '../mappingEntry';
|
||||||
import { MappingsContainer } from './styledComponents';
|
import { NoMappingsContent } from './noMappingsContent/noMappingsContent';
|
||||||
|
import { MappingsContainer } from '../styledComponents';
|
||||||
interface Iprops {
|
interface Iprops {
|
||||||
mappings: WatchMapping[];
|
mappings: WatchMapping[];
|
||||||
handleRemoveWatchMapping: (value: WatchMapping) => void;
|
handleRemoveWatchMapping: (value: WatchMapping) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MappingList({ mappings, handleRemoveWatchMapping }: Iprops) {
|
export function MappingList({ mappings, handleRemoveWatchMapping }: Iprops) {
|
||||||
return (
|
return mappings.length === 0 ? (
|
||||||
|
<NoMappingsContent />
|
||||||
|
) : (
|
||||||
<MappingsContainer>
|
<MappingsContainer>
|
||||||
{mappings.map((mapping) => {
|
{mappings.map((mapping) => {
|
||||||
return (
|
return (
|
|
@ -3,7 +3,7 @@ import { FlexWrapper } from 'components/Container';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import constants from 'utils/strings/constants';
|
import constants from 'utils/strings/constants';
|
||||||
import { CheckmarkIcon } from './checkmarkIcon';
|
import { CheckmarkIcon } from './checkmarkIcon';
|
||||||
import { NoMappingsContainer } from './styledComponents';
|
import { NoMappingsContainer } from '../../styledComponents';
|
||||||
export function NoMappingsContent() {
|
export function NoMappingsContent() {
|
||||||
return (
|
return (
|
||||||
<NoMappingsContainer>
|
<NoMappingsContainer>
|
Loading…
Reference in a new issue