mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(frontend): close request modals when complete
This commit is contained in:
@@ -99,7 +99,10 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
|
|||||||
show={showRequestModal}
|
show={showRequestModal}
|
||||||
type="movie"
|
type="movie"
|
||||||
requestId={data.mediaInfo?.requests?.[0]?.id}
|
requestId={data.mediaInfo?.requests?.[0]?.id}
|
||||||
onComplete={() => revalidate()}
|
onComplete={() => {
|
||||||
|
revalidate();
|
||||||
|
setShowRequestModal(false);
|
||||||
|
}}
|
||||||
onCancel={() => setShowRequestModal(false)}
|
onCancel={() => setShowRequestModal(false)}
|
||||||
/>
|
/>
|
||||||
<div className="flex flex-col items-center md:flex-row md:items-end pt-4">
|
<div className="flex flex-col items-center md:flex-row md:items-end pt-4">
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useToasts } from 'react-toast-notifications';
|
|
||||||
import type { MediaType } from '../../../server/models/Search';
|
import type { MediaType } from '../../../server/models/Search';
|
||||||
import Available from '../../assets/available.svg';
|
import Available from '../../assets/available.svg';
|
||||||
import Requested from '../../assets/requested.svg';
|
import Requested from '../../assets/requested.svg';
|
||||||
@@ -7,9 +6,6 @@ import Unavailable from '../../assets/unavailable.svg';
|
|||||||
import { withProperties } from '../../utils/typeHelpers';
|
import { withProperties } from '../../utils/typeHelpers';
|
||||||
import Transition from '../Transition';
|
import Transition from '../Transition';
|
||||||
import Placeholder from './Placeholder';
|
import Placeholder from './Placeholder';
|
||||||
import axios from 'axios';
|
|
||||||
import { MediaRequest } from '../../../server/entity/MediaRequest';
|
|
||||||
import MovieRequestModal from '../RequestModal/MovieRequestModal';
|
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { MediaStatus } from '../../../server/constants/media';
|
import { MediaStatus } from '../../../server/constants/media';
|
||||||
import RequestModal from '../RequestModal';
|
import RequestModal from '../RequestModal';
|
||||||
@@ -40,7 +36,6 @@ const TitleCard: React.FC<TitleCardProps> = ({
|
|||||||
const [currentStatus, setCurrentStatus] = useState(status);
|
const [currentStatus, setCurrentStatus] = useState(status);
|
||||||
const [showDetail, setShowDetail] = useState(false);
|
const [showDetail, setShowDetail] = useState(false);
|
||||||
const [showRequestModal, setShowRequestModal] = useState(false);
|
const [showRequestModal, setShowRequestModal] = useState(false);
|
||||||
const [showCancelModal, setShowCancelModal] = useState(false);
|
|
||||||
|
|
||||||
// Just to get the year from the date
|
// Just to get the year from the date
|
||||||
if (year) {
|
if (year) {
|
||||||
@@ -54,7 +49,10 @@ const TitleCard: React.FC<TitleCardProps> = ({
|
|||||||
show={showRequestModal}
|
show={showRequestModal}
|
||||||
type={mediaType === 'movie' ? 'movie' : 'tv'}
|
type={mediaType === 'movie' ? 'movie' : 'tv'}
|
||||||
requestId={requestId}
|
requestId={requestId}
|
||||||
onComplete={(newStatus) => setCurrentStatus(newStatus)}
|
onComplete={(newStatus) => {
|
||||||
|
setCurrentStatus(newStatus);
|
||||||
|
setShowRequestModal(false);
|
||||||
|
}}
|
||||||
onUpdating={(status) => setIsUpdating(status)}
|
onUpdating={(status) => setIsUpdating(status)}
|
||||||
onCancel={() => setShowRequestModal(false)}
|
onCancel={() => setShowRequestModal(false)}
|
||||||
/>
|
/>
|
||||||
@@ -129,7 +127,7 @@ const TitleCard: React.FC<TitleCardProps> = ({
|
|||||||
</Transition>
|
</Transition>
|
||||||
|
|
||||||
<Transition
|
<Transition
|
||||||
show={!image || showDetail || showRequestModal || showCancelModal}
|
show={!image || showDetail || showRequestModal}
|
||||||
enter="transition ease-in-out duration-300 transform opacity-0"
|
enter="transition ease-in-out duration-300 transform opacity-0"
|
||||||
enterFrom="opacity-0"
|
enterFrom="opacity-0"
|
||||||
enterTo="opacity-100"
|
enterTo="opacity-100"
|
||||||
@@ -215,10 +213,7 @@ const TitleCard: React.FC<TitleCardProps> = ({
|
|||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{currentStatus === MediaStatus.PENDING && (
|
{currentStatus === MediaStatus.PENDING && (
|
||||||
<button
|
<button className="w-full h-7 text-center text-white bg-orange-400 hover:bg-orange-300 rounded-sm ml-1 focus:border-orange-700 focus:shadow-outline-orange active:bg-orange-700 transition ease-in-out duration-150">
|
||||||
onClick={() => setShowCancelModal(true)}
|
|
||||||
className="w-full h-7 text-center text-white bg-orange-400 hover:bg-orange-300 rounded-sm ml-1 focus:border-orange-700 focus:shadow-outline-orange active:bg-orange-700 transition ease-in-out duration-150"
|
|
||||||
>
|
|
||||||
<svg
|
<svg
|
||||||
className="w-4 mx-auto"
|
className="w-4 mx-auto"
|
||||||
fill="none"
|
fill="none"
|
||||||
|
@@ -89,7 +89,10 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
|
|||||||
show={showRequestModal}
|
show={showRequestModal}
|
||||||
type="tv"
|
type="tv"
|
||||||
requestId={data.mediaInfo?.requests?.[0]?.id}
|
requestId={data.mediaInfo?.requests?.[0]?.id}
|
||||||
onComplete={() => revalidate()}
|
onComplete={() => {
|
||||||
|
revalidate();
|
||||||
|
setShowRequestModal(false);
|
||||||
|
}}
|
||||||
onCancel={() => setShowRequestModal(false)}
|
onCancel={() => setShowRequestModal(false)}
|
||||||
/>
|
/>
|
||||||
<div className="flex flex-col items-center md:flex-row md:items-end pt-4">
|
<div className="flex flex-col items-center md:flex-row md:items-end pt-4">
|
||||||
|
Reference in New Issue
Block a user