-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e03e5f3
commit a317eac
Showing
7 changed files
with
138 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/components/Collection/Series/EditSeriesTabs/Action.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import { mdiPlayCircleOutline } from '@mdi/js'; | ||
import { Icon } from '@mdi/react'; | ||
|
||
import Button from '@/components/Input/Button'; | ||
|
||
const Action = ({ description, name, onClick }: { name: string, description: string, onClick: () => void }) => ( | ||
<div className="mr-4 flex flex-row justify-between gap-y-2 border-b border-panel-border pb-4 last:border-0"> | ||
<div className="flex w-full max-w-[35rem] flex-col gap-y-2"> | ||
<div>{name}</div> | ||
<div className="text-sm opacity-65">{description}</div> | ||
</div> | ||
<Button onClick={onClick} className="text-panel-text-primary"> | ||
<Icon path={mdiPlayCircleOutline} size={1} /> | ||
</Button> | ||
</div> | ||
); | ||
|
||
export default Action; |
58 changes: 58 additions & 0 deletions
58
src/components/Collection/Series/EditSeriesTabs/DeleteActionsTab.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import Action from '@/components/Collection/Series/EditSeriesTabs/Action'; | ||
import toast from '@/components/Toast'; | ||
import { useDeleteSeriesMutation } from '@/core/react-query/series/mutations'; | ||
|
||
type Props = { | ||
seriesId: number; | ||
}; | ||
|
||
const DeleteActionsTab = ({ seriesId }: Props) => { | ||
const navigate = useNavigate(); | ||
|
||
const { mutate: deleteSeries } = useDeleteSeriesMutation(); | ||
|
||
const navigateToCollection = () => navigate('/webui/collection'); | ||
|
||
return ( | ||
<div className="flex h-[22rem] grow flex-col gap-y-4 overflow-y-auto"> | ||
<Action | ||
name="Delete Series - Keep Files" | ||
description="Deletes the series from Shoko but does not delete the files" | ||
onClick={() => | ||
deleteSeries({ seriesId, deleteFiles: false }, { | ||
onSuccess: () => { | ||
toast.success('Series deleted!'); | ||
navigateToCollection(); | ||
}, | ||
})} | ||
/> | ||
<Action | ||
name="Delete Series - Remove Files" | ||
description="Deletes the series from Shoko along with the files" | ||
onClick={() => | ||
deleteSeries({ seriesId, deleteFiles: true }, { | ||
onSuccess: () => { | ||
toast.success('Series and files deleted!'); | ||
navigateToCollection(); | ||
}, | ||
})} | ||
/> | ||
<Action | ||
name="Delete Series - Complete" | ||
description="Removes all records relating to the series. Use with caution, as you may get banned if it's abused" | ||
onClick={() => | ||
deleteSeries({ seriesId, deleteFiles: true, completelyRemove: true }, { | ||
onSuccess: () => { | ||
toast.success('Series deleted completely!'); | ||
navigateToCollection(); | ||
}, | ||
})} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DeleteActionsTab; |
37 changes: 37 additions & 0 deletions
37
src/components/Collection/Series/EditSeriesTabs/FileActionsTab.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
|
||
import Action from '@/components/Collection/Series/EditSeriesTabs/Action'; | ||
import toast from '@/components/Toast'; | ||
import { useRehashSeriesFilesMutation, useRescanSeriesFilesMutation } from '@/core/react-query/series/mutations'; | ||
|
||
type Props = { | ||
seriesId: number; | ||
}; | ||
|
||
const FileActionsTab = ({ seriesId }: Props) => { | ||
const { mutate: rehashSeriesFiles } = useRehashSeriesFilesMutation(); | ||
const { mutate: rescanSeriesFiles } = useRescanSeriesFilesMutation(); | ||
|
||
return ( | ||
<div className="flex h-[22rem] grow flex-col gap-y-4 overflow-y-auto"> | ||
<Action | ||
name="Rescan Files" | ||
description="Rescans every file associated with the series." | ||
onClick={() => | ||
rescanSeriesFiles(seriesId, { | ||
onSuccess: () => toast.success('Series files rescan queued!'), | ||
})} | ||
/> | ||
<Action | ||
name="Rehash Files" | ||
description="Rehashes every file associated with the series." | ||
onClick={() => | ||
rehashSeriesFiles(seriesId, { | ||
onSuccess: () => toast.success('Series files rehash queued!'), | ||
})} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FileActionsTab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters