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**) Sort unselected matched entries by 1. their latest chapter, 2. their source priority, 3. their title
- (**Migration**) Change migration match exclude/include icons
- (**Migration**) Show the exclude/include button only for an entry with a selected match
### Fixed

View File

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

View File

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