mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(ui): Don't display empty dropdown when no trailer available (#804)
This commit is contained in:
@@ -92,8 +92,8 @@ const ButtonWithDropdown: React.FC<ButtonWithDropdownProps> = ({
|
||||
>
|
||||
{text}
|
||||
</button>
|
||||
<span className="relative z-10 block -ml-px">
|
||||
{children && (
|
||||
{children && (
|
||||
<span className="relative z-10 block -ml-px">
|
||||
<button
|
||||
type="button"
|
||||
className={`relative inline-flex items-center h-full px-2 py-2 text-sm font-medium leading-5 text-white transition duration-150 ease-in-out rounded-r-md focus:z-10 ${styleClasses.dropdownSideButtonClasses}`}
|
||||
@@ -117,25 +117,25 @@ const ButtonWithDropdown: React.FC<ButtonWithDropdownProps> = ({
|
||||
</svg>
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
<Transition
|
||||
show={isOpen}
|
||||
enter="transition ease-out duration-100 opacity-0"
|
||||
enterFrom="transform opacity-0 scale-95"
|
||||
enterTo="transform opacity-100 scale-100"
|
||||
leave="transition ease-in duration-75 opacity-100"
|
||||
leaveFrom="transform opacity-100 scale-100"
|
||||
leaveTo="transform opacity-0 scale-95"
|
||||
>
|
||||
<div className="absolute right-0 w-56 mt-2 -mr-1 origin-top-right rounded-md shadow-lg">
|
||||
<div
|
||||
className={`rounded-md ring-1 ring-black ring-opacity-5 ${styleClasses.dropdownClasses}`}
|
||||
>
|
||||
<div className="py-1">{children}</div>
|
||||
<Transition
|
||||
show={isOpen}
|
||||
enter="transition ease-out duration-100 opacity-0"
|
||||
enterFrom="transform opacity-0 scale-95"
|
||||
enterTo="transform opacity-100 scale-100"
|
||||
leave="transition ease-in duration-75 opacity-100"
|
||||
leaveFrom="transform opacity-100 scale-100"
|
||||
leaveTo="transform opacity-0 scale-95"
|
||||
>
|
||||
<div className="absolute right-0 w-56 mt-2 -mr-1 origin-top-right rounded-md shadow-lg">
|
||||
<div
|
||||
className={`rounded-md ring-1 ring-black ring-opacity-5 ${styleClasses.dropdownClasses}`}
|
||||
>
|
||||
<div className="py-1">{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</span>
|
||||
</Transition>
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
@@ -417,10 +417,17 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
|
||||
}
|
||||
}}
|
||||
>
|
||||
{data.mediaInfo?.plexUrl ||
|
||||
(data.mediaInfo?.plexUrl4k &&
|
||||
(hasPermission(Permission.REQUEST_4K) ||
|
||||
hasPermission(Permission.REQUEST_4K_MOVIE))) ? (
|
||||
{(
|
||||
trailerUrl
|
||||
? data.mediaInfo?.plexUrl ||
|
||||
(data.mediaInfo?.plexUrl4k &&
|
||||
(hasPermission(Permission.REQUEST_4K) ||
|
||||
hasPermission(Permission.REQUEST_4K_MOVIE)))
|
||||
: data.mediaInfo?.plexUrl &&
|
||||
data.mediaInfo?.plexUrl4k &&
|
||||
(hasPermission(Permission.REQUEST_4K) ||
|
||||
hasPermission(Permission.REQUEST_4K_MOVIE))
|
||||
) ? (
|
||||
<>
|
||||
{data.mediaInfo?.plexUrl &&
|
||||
data.mediaInfo?.plexUrl4k &&
|
||||
@@ -435,17 +442,16 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
|
||||
{intl.formatMessage(messages.play4konplex)}
|
||||
</ButtonWithDropdown.Item>
|
||||
)}
|
||||
{(data.mediaInfo?.plexUrl || data.mediaInfo?.plexUrl4k) &&
|
||||
trailerUrl && (
|
||||
<ButtonWithDropdown.Item
|
||||
onClick={() => {
|
||||
window.open(trailerUrl, '_blank');
|
||||
}}
|
||||
buttonType="ghost"
|
||||
>
|
||||
{intl.formatMessage(messages.watchtrailer)}
|
||||
</ButtonWithDropdown.Item>
|
||||
)}
|
||||
{trailerUrl && (
|
||||
<ButtonWithDropdown.Item
|
||||
onClick={() => {
|
||||
window.open(trailerUrl, '_blank');
|
||||
}}
|
||||
buttonType="ghost"
|
||||
>
|
||||
{intl.formatMessage(messages.watchtrailer)}
|
||||
</ButtonWithDropdown.Item>
|
||||
)}
|
||||
</>
|
||||
) : null}
|
||||
</ButtonWithDropdown>
|
||||
|
@@ -443,35 +443,41 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
|
||||
}
|
||||
}}
|
||||
>
|
||||
{data.mediaInfo?.plexUrl ||
|
||||
(data.mediaInfo?.plexUrl4k &&
|
||||
(hasPermission(Permission.REQUEST_4K) ||
|
||||
hasPermission(Permission.REQUEST_4K_TV))) ? (
|
||||
<>
|
||||
{data.mediaInfo?.plexUrl &&
|
||||
{(
|
||||
trailerUrl
|
||||
? data.mediaInfo?.plexUrl ||
|
||||
(data.mediaInfo?.plexUrl4k &&
|
||||
(hasPermission(Permission.REQUEST_4K) ||
|
||||
hasPermission(Permission.REQUEST_4K_TV)))
|
||||
: data.mediaInfo?.plexUrl &&
|
||||
data.mediaInfo?.plexUrl4k &&
|
||||
(hasPermission(Permission.REQUEST_4K) ||
|
||||
hasPermission(Permission.REQUEST_4K_TV)) && (
|
||||
<ButtonWithDropdown.Item
|
||||
onClick={() => {
|
||||
window.open(data.mediaInfo?.plexUrl4k, '_blank');
|
||||
}}
|
||||
buttonType="ghost"
|
||||
>
|
||||
{intl.formatMessage(messages.play4konplex)}
|
||||
</ButtonWithDropdown.Item>
|
||||
)}
|
||||
{(data.mediaInfo?.plexUrl || data.mediaInfo?.plexUrl4k) &&
|
||||
trailerUrl && (
|
||||
<ButtonWithDropdown.Item
|
||||
onClick={() => {
|
||||
window.open(trailerUrl, '_blank');
|
||||
}}
|
||||
buttonType="ghost"
|
||||
>
|
||||
{intl.formatMessage(messages.watchtrailer)}
|
||||
</ButtonWithDropdown.Item>
|
||||
)}
|
||||
hasPermission(Permission.REQUEST_4K_TV))
|
||||
) ? (
|
||||
<>
|
||||
{data.mediaInfo?.plexUrl &&
|
||||
data.mediaInfo?.plexUrl4k &&
|
||||
(hasPermission(Permission.REQUEST_4K) ||
|
||||
hasPermission(Permission.REQUEST_4K_TV)) ? (
|
||||
<ButtonWithDropdown.Item
|
||||
onClick={() => {
|
||||
window.open(data.mediaInfo?.plexUrl4k, '_blank');
|
||||
}}
|
||||
buttonType="ghost"
|
||||
>
|
||||
{intl.formatMessage(messages.play4konplex)}
|
||||
</ButtonWithDropdown.Item>
|
||||
) : null}
|
||||
{trailerUrl ? (
|
||||
<ButtonWithDropdown.Item
|
||||
onClick={() => {
|
||||
window.open(trailerUrl, '_blank');
|
||||
}}
|
||||
buttonType="ghost"
|
||||
>
|
||||
{intl.formatMessage(messages.watchtrailer)}
|
||||
</ButtonWithDropdown.Item>
|
||||
) : null}
|
||||
</>
|
||||
) : null}
|
||||
</ButtonWithDropdown>
|
||||
|
Reference in New Issue
Block a user