Show migration exclude/include button only with selected match

This commit is contained in:
schroda
2026-05-22 12:33:11 +02:00
parent 22c1a43725
commit 2db4651645
3 changed files with 32 additions and 25 deletions

View File

@@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- (**Migration**) Abort active search when selecting a match through the manual search - (**Migration**) Abort active search when selecting a match through the manual search
- (**Migration**) Sort unselected matched entries by 1. their latest chapter, 2. their source priority, 3. their title - (**Migration**) Sort unselected matched entries by 1. their latest chapter, 2. their source priority, 3. their title
- (**Migration**) Change migration match exclude/include icons - (**Migration**) Change migration match exclude/include icons
- (**Migration**) Show the exclude/include button only for an entry with a selected match
### Fixed ### Fixed

View File

@@ -91,7 +91,7 @@ const MigrationEntryMobile = memo(
{!isMigrating && ( {!isMigrating && (
<MigrationEntrySearchExcludeActions <MigrationEntrySearchExcludeActions
hasResults={!!destinationEntry} hasSelectedMatch={!!destinationEntry}
otherResultsCount={otherSearchMatches.length} otherResultsCount={otherSearchMatches.length}
isExpanded={isExpanded} isExpanded={isExpanded}
setIsExpanded={setIsExpanded} setIsExpanded={setIsExpanded}
@@ -153,7 +153,7 @@ export const MigrationEntryDesktop = memo(
{!isMigrating && ( {!isMigrating && (
<MigrationEntrySearchExcludeActions <MigrationEntrySearchExcludeActions
hasResults={!!destinationEntry} hasSelectedMatch={!!destinationEntry}
otherResultsCount={otherSearchMatches.length} otherResultsCount={otherSearchMatches.length}
isExpanded={isExpanded} isExpanded={isExpanded}
setIsExpanded={setIsExpanded} setIsExpanded={setIsExpanded}

View File

@@ -26,7 +26,7 @@ import RemoveCircleOutlineOutlinedIcon from '@mui/icons-material/RemoveCircleOut
import AddCircleOutlineOutlinedIcon from '@mui/icons-material/AddCircleOutlineOutlined'; import AddCircleOutlineOutlinedIcon from '@mui/icons-material/AddCircleOutlineOutlined';
export const MigrationEntrySearchExcludeActions = ({ export const MigrationEntrySearchExcludeActions = ({
hasResults, hasSelectedMatch,
otherResultsCount, otherResultsCount,
isExpanded, isExpanded,
setIsExpanded, setIsExpanded,
@@ -34,7 +34,7 @@ export const MigrationEntrySearchExcludeActions = ({
mangaId, mangaId,
mangaTitle, mangaTitle,
}: { }: {
hasResults: boolean; hasSelectedMatch: boolean;
otherResultsCount: number; otherResultsCount: number;
isExpanded: boolean; isExpanded: boolean;
setIsExpanded: (expanded: boolean) => void; setIsExpanded: (expanded: boolean) => void;
@@ -74,33 +74,39 @@ export const MigrationEntrySearchExcludeActions = ({
</CustomButtonIcon> </CustomButtonIcon>
</CustomTooltip> </CustomTooltip>
)} )}
<CustomTooltip title={isExcluded ? t`Include` : t`Exclude`}> {hasSelectedMatch && (
<CustomButtonIcon <CustomTooltip title={isExcluded ? t`Include` : t`Exclude`}>
sx={{ <CustomButtonIcon
flexGrow: Number(!otherResultsCount), sx={{
}} flexGrow: Number(!otherResultsCount),
onClick={() => }}
isExcluded ? MigrationManager.includeManga(mangaId) : MigrationManager.excludeManga(mangaId) onClick={() =>
} isExcluded
> ? MigrationManager.includeManga(mangaId)
{isExcluded ? <AddCircleOutlineOutlinedIcon /> : <RemoveCircleOutlineOutlinedIcon />} : MigrationManager.excludeManga(mangaId)
</CustomButtonIcon> }
</CustomTooltip> >
{isExcluded ? <AddCircleOutlineOutlinedIcon /> : <RemoveCircleOutlineOutlinedIcon />}
</CustomButtonIcon>
</CustomTooltip>
)}
</ButtonGroup> </ButtonGroup>
); );
} }
return ( return (
<Stack sx={{ gap: 1, justifyContent: 'center' }}> <Stack sx={{ gap: 1, justifyContent: 'center' }}>
<CustomTooltip title={isExcluded ? t`Include` : t`Exclude`} placement="auto"> {hasSelectedMatch && (
<IconButton <CustomTooltip title={isExcluded ? t`Include` : t`Exclude`} placement="auto">
onClick={() => <IconButton
isExcluded ? MigrationManager.includeManga(mangaId) : MigrationManager.excludeManga(mangaId) onClick={() =>
} isExcluded ? MigrationManager.includeManga(mangaId) : MigrationManager.excludeManga(mangaId)
> }
{isExcluded ? <AddIcon /> : <CloseIcon />} >
</IconButton> {isExcluded ? <AddIcon /> : <CloseIcon />}
</CustomTooltip> </IconButton>
</CustomTooltip>
)}
<CustomTooltip title={t`Manual search`} placement="auto"> <CustomTooltip title={t`Manual search`} placement="auto">
<IconButton <IconButton
onClick={() => { onClick={() => {