Feature/tracking unbind use new mutation (#688)
* [Codegen] Update generated files * Use new "unbindTrack" mutation * Add option to delete remote track on unbind * [VersionMapping] Require server version "r1510" for preview
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
Divider,
|
||||
FormGroup,
|
||||
IconButton,
|
||||
Link,
|
||||
ListItemButton,
|
||||
@@ -28,7 +29,7 @@ import {
|
||||
} from '@mui/material';
|
||||
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
||||
import PopupState, { bindDialog, bindMenu, bindTrigger } from 'material-ui-popup-state';
|
||||
import { useMemo } from 'react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||
import { Trackers, TTrackRecord, UNSET_DATE } from '@/lib/data/Trackers.ts';
|
||||
import { ListPreference } from '@/components/sourceConfiguration/ListPreference.tsx';
|
||||
@@ -39,6 +40,7 @@ import { Menu } from '@/components/menu/Menu';
|
||||
import { CARD_STYLING } from '@/components/tracker/constants.ts';
|
||||
import { TypographyMaxLines } from '@/components/atoms/TypographyMaxLines.tsx';
|
||||
import { SelectSetting, SelectSettingValue } from '@/components/settings/SelectSetting.tsx';
|
||||
import { CheckboxInput } from '@/components/atoms/CheckboxInput';
|
||||
|
||||
const TrackerActiveLink = ({ children, url }: { children: React.ReactNode; url: string }) => (
|
||||
<Link href={url} rel="noreferrer" target="_blank" underline="none" color="inherit">
|
||||
@@ -57,13 +59,12 @@ const TrackerActiveRemoveBind = ({
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
// TODO - enable once server supports removing track binding on tracker source
|
||||
// const [removeRemoteTracking, setRemoveRemoteTracking] = useState(false);
|
||||
const [removeRemoteTracking, setRemoveRemoteTracking] = useState(false);
|
||||
|
||||
const removeBind = () => {
|
||||
onClose();
|
||||
requestManager
|
||||
.updateTrackerBind(trackRecord.id, { unbind: true })
|
||||
.unbindTracker(trackRecord.id, removeRemoteTracking)
|
||||
.response.then(() => makeToast(t('manga.action.track.remove.label.success'), 'success'))
|
||||
.catch(() => makeToast(t('manga.action.track.remove.label.error'), 'error'));
|
||||
};
|
||||
@@ -97,15 +98,16 @@ const TrackerActiveRemoveBind = ({
|
||||
</DialogTitle>
|
||||
<DialogContent dividers>
|
||||
<Typography>{t('manga.action.track.remove.dialog.label.description')}</Typography>
|
||||
{/* TODO - enable once server supports removing track binding on tracker source */}
|
||||
{/* <FormGroup> */}
|
||||
{/* <CheckboxInput */}
|
||||
{/* disabled={false} */}
|
||||
{/* label={t('chapter.title')} */}
|
||||
{/* checked={removeRemoteTracking} */}
|
||||
{/* onChange={(_, checked) => setRemoveRemoteTracking(checked)} */}
|
||||
{/* /> */}
|
||||
{/* </FormGroup> */}
|
||||
{tracker.supportsTrackDeletion && (
|
||||
<FormGroup>
|
||||
<CheckboxInput
|
||||
disabled={false}
|
||||
label={t('chapter.title')}
|
||||
checked={removeRemoteTracking}
|
||||
onChange={(_, checked) => setRemoveRemoteTracking(checked)}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
|
||||
Reference in New Issue
Block a user