mirror of
https://github.com/sct/overseerr.git
synced 2025-09-28 13:04:23 +02:00
feat(frontend): add more tooltips (#2961)
* feat(frontend): add more tooltips * fix: remove styling from Tooltip * refactor: tooltip expects a single child
This commit is contained in:
@@ -1,29 +1,31 @@
|
||||
import React from 'react';
|
||||
import type { Config } from 'react-popper-tooltip';
|
||||
import { usePopperTooltip } from 'react-popper-tooltip';
|
||||
|
||||
type TooltipProps = {
|
||||
content: React.ReactNode;
|
||||
children: React.ReactNode;
|
||||
tooltipConfig?: Config;
|
||||
children: React.ReactElement;
|
||||
tooltipConfig?: Partial<Config>;
|
||||
};
|
||||
|
||||
const Tooltip = ({ children, content, tooltipConfig }: TooltipProps) => {
|
||||
const { getTooltipProps, setTooltipRef, setTriggerRef, visible } =
|
||||
usePopperTooltip({
|
||||
followCursor: true,
|
||||
placement: 'left-end',
|
||||
offset: [-28, 6],
|
||||
placement: 'auto-end',
|
||||
...tooltipConfig,
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<div ref={setTriggerRef}>{children}</div>
|
||||
{React.cloneElement(children, { ref: setTriggerRef })}
|
||||
{visible && (
|
||||
<div
|
||||
ref={setTooltipRef}
|
||||
{...getTooltipProps({
|
||||
className:
|
||||
'bg-gray-800 px-2 py-1 rounded border border-gray-600 shadow text-gray-100',
|
||||
'z-50 text-sm font-normal bg-gray-800 px-2 py-1 rounded border border-gray-600 shadow text-gray-100',
|
||||
})}
|
||||
>
|
||||
{content}
|
||||
|
@@ -78,6 +78,8 @@ const messages = defineMessages({
|
||||
theatricalrelease: 'Theatrical Release',
|
||||
digitalrelease: 'Digital Release',
|
||||
physicalrelease: 'Physical Release',
|
||||
reportissue: 'Report an Issue',
|
||||
managemovie: 'Manage Movie',
|
||||
});
|
||||
|
||||
interface MovieDetailsProps {
|
||||
@@ -388,38 +390,42 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
|
||||
type: 'or',
|
||||
}
|
||||
) && (
|
||||
<Button
|
||||
buttonType="warning"
|
||||
className="ml-2 first:ml-0"
|
||||
onClick={() => setShowIssueModal(true)}
|
||||
>
|
||||
<ExclamationIcon />
|
||||
</Button>
|
||||
<Tooltip content={intl.formatMessage(messages.reportissue)}>
|
||||
<Button
|
||||
buttonType="warning"
|
||||
onClick={() => setShowIssueModal(true)}
|
||||
className="ml-2 first:ml-0"
|
||||
>
|
||||
<ExclamationIcon />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
{hasPermission(Permission.MANAGE_REQUESTS) && data.mediaInfo && (
|
||||
<Button
|
||||
buttonType="default"
|
||||
className="relative ml-2 first:ml-0"
|
||||
onClick={() => setShowManager(true)}
|
||||
>
|
||||
<CogIcon className="!mr-0" />
|
||||
{hasPermission(
|
||||
[Permission.MANAGE_ISSUES, Permission.VIEW_ISSUES],
|
||||
{
|
||||
type: 'or',
|
||||
}
|
||||
) &&
|
||||
(
|
||||
data.mediaInfo?.issues.filter(
|
||||
(issue) => issue.status === IssueStatus.OPEN
|
||||
) ?? []
|
||||
).length > 0 && (
|
||||
<>
|
||||
<div className="absolute -right-1 -top-1 h-3 w-3 rounded-full bg-red-600" />
|
||||
<div className="absolute -right-1 -top-1 h-3 w-3 animate-ping rounded-full bg-red-600" />
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
<Tooltip content={intl.formatMessage(messages.managemovie)}>
|
||||
<Button
|
||||
buttonType="default"
|
||||
onClick={() => setShowManager(true)}
|
||||
className="relative ml-2 first:ml-0"
|
||||
>
|
||||
<CogIcon className="!mr-0" />
|
||||
{hasPermission(
|
||||
[Permission.MANAGE_ISSUES, Permission.VIEW_ISSUES],
|
||||
{
|
||||
type: 'or',
|
||||
}
|
||||
) &&
|
||||
(
|
||||
data.mediaInfo?.issues.filter(
|
||||
(issue) => issue.status === IssueStatus.OPEN
|
||||
) ?? []
|
||||
).length > 0 && (
|
||||
<>
|
||||
<div className="absolute -right-1 -top-1 h-3 w-3 rounded-full bg-red-600" />
|
||||
<div className="absolute -right-1 -top-1 h-3 w-3 animate-ping rounded-full bg-red-600" />
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import Badge from '@app/components/Common/Badge';
|
||||
import Button from '@app/components/Common/Button';
|
||||
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
|
||||
import SensitiveInput from '@app/components/Common/SensitiveInput';
|
||||
import SettingsBadge from '@app/components/Settings/SettingsBadge';
|
||||
import globalMessages from '@app/i18n/globalMessages';
|
||||
import { BeakerIcon, SaveIcon } from '@heroicons/react/outline';
|
||||
import axios from 'axios';
|
||||
@@ -382,9 +382,7 @@ const NotificationsEmail = () => {
|
||||
<span className="mr-2">
|
||||
{intl.formatMessage(messages.pgpPrivateKey)}
|
||||
</span>
|
||||
<Badge badgeType="danger">
|
||||
{intl.formatMessage(globalMessages.advanced)}
|
||||
</Badge>
|
||||
<SettingsBadge badgeType="advanced" />
|
||||
<span className="label-tip">
|
||||
{intl.formatMessage(messages.pgpPrivateKeyTip, {
|
||||
OpenPgpLink: OpenPgpLink,
|
||||
@@ -414,9 +412,7 @@ const NotificationsEmail = () => {
|
||||
<span className="mr-2">
|
||||
{intl.formatMessage(messages.pgpPassword)}
|
||||
</span>
|
||||
<Badge badgeType="danger">
|
||||
{intl.formatMessage(globalMessages.advanced)}
|
||||
</Badge>
|
||||
<SettingsBadge badgeType="advanced" />
|
||||
<span className="label-tip">
|
||||
{intl.formatMessage(messages.pgpPasswordTip, {
|
||||
OpenPgpLink: OpenPgpLink,
|
||||
|
54
src/components/Settings/SettingsBadge.tsx
Normal file
54
src/components/Settings/SettingsBadge.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
import Badge from '@app/components/Common/Badge';
|
||||
import Tooltip from '@app/components/Common/Tooltip';
|
||||
import globalMessages from '@app/i18n/globalMessages';
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
|
||||
const messages = defineMessages({
|
||||
advancedTooltip:
|
||||
'Incorrectly configuring this setting may result in broken functionality',
|
||||
experimentalTooltip:
|
||||
'Enabling this setting may result in unexpected application behavior',
|
||||
restartrequiredTooltip:
|
||||
'Overseerr must be restarted for changes to this setting to take effect',
|
||||
});
|
||||
|
||||
const SettingsBadge = ({
|
||||
badgeType,
|
||||
className,
|
||||
}: {
|
||||
badgeType: 'advanced' | 'experimental' | 'restartRequired';
|
||||
className?: string;
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
|
||||
switch (badgeType) {
|
||||
case 'advanced':
|
||||
return (
|
||||
<Tooltip content={intl.formatMessage(messages.advancedTooltip)}>
|
||||
<Badge badgeType="danger" className={className}>
|
||||
{intl.formatMessage(globalMessages.advanced)}
|
||||
</Badge>
|
||||
</Tooltip>
|
||||
);
|
||||
case 'experimental':
|
||||
return (
|
||||
<Tooltip content={intl.formatMessage(messages.experimentalTooltip)}>
|
||||
<Badge badgeType="warning">
|
||||
{intl.formatMessage(globalMessages.experimental)}
|
||||
</Badge>
|
||||
</Tooltip>
|
||||
);
|
||||
case 'restartRequired':
|
||||
return (
|
||||
<Tooltip content={intl.formatMessage(messages.restartrequiredTooltip)}>
|
||||
<Badge badgeType="primary" className={className}>
|
||||
{intl.formatMessage(globalMessages.restartRequired)}
|
||||
</Badge>
|
||||
</Tooltip>
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export default SettingsBadge;
|
@@ -4,6 +4,7 @@ import LoadingSpinner from '@app/components/Common/LoadingSpinner';
|
||||
import Modal from '@app/components/Common/Modal';
|
||||
import PageTitle from '@app/components/Common/PageTitle';
|
||||
import Table from '@app/components/Common/Table';
|
||||
import Tooltip from '@app/components/Common/Tooltip';
|
||||
import Transition from '@app/components/Transition';
|
||||
import { useUpdateQueryParams } from '@app/hooks/useUpdateQueryParams';
|
||||
import globalMessages from '@app/i18n/globalMessages';
|
||||
@@ -47,6 +48,7 @@ const messages = defineMessages({
|
||||
logDetails: 'Log Details',
|
||||
extraData: 'Additional Data',
|
||||
copiedLogMessage: 'Copied log message to clipboard.',
|
||||
viewdetails: 'View Details',
|
||||
});
|
||||
|
||||
type Filter = 'debug' | 'info' | 'warn' | 'error';
|
||||
@@ -327,23 +329,31 @@ const SettingsLogs = () => {
|
||||
<Table.TD className="text-gray-300">{row.message}</Table.TD>
|
||||
<Table.TD className="-m-1 flex flex-wrap items-center justify-end">
|
||||
{row.data && (
|
||||
<Tooltip
|
||||
content={intl.formatMessage(messages.viewdetails)}
|
||||
>
|
||||
<Button
|
||||
buttonType="primary"
|
||||
buttonSize="sm"
|
||||
onClick={() => setActiveLog(row)}
|
||||
className="m-1"
|
||||
>
|
||||
<DocumentSearchIcon className="icon-md" />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
<Tooltip
|
||||
content={intl.formatMessage(messages.copyToClipboard)}
|
||||
>
|
||||
<Button
|
||||
buttonType="primary"
|
||||
buttonSize="sm"
|
||||
onClick={() => setActiveLog(row)}
|
||||
onClick={() => copyLogString(row)}
|
||||
className="m-1"
|
||||
>
|
||||
<DocumentSearchIcon className="icon-md" />
|
||||
<ClipboardCopyIcon className="icon-md" />
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
buttonType="primary"
|
||||
buttonSize="sm"
|
||||
onClick={() => copyLogString(row)}
|
||||
className="m-1"
|
||||
>
|
||||
<ClipboardCopyIcon className="icon-md" />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</Table.TD>
|
||||
</tr>
|
||||
);
|
||||
|
@@ -1,11 +1,12 @@
|
||||
import Badge from '@app/components/Common/Badge';
|
||||
import Button from '@app/components/Common/Button';
|
||||
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
|
||||
import PageTitle from '@app/components/Common/PageTitle';
|
||||
import SensitiveInput from '@app/components/Common/SensitiveInput';
|
||||
import Tooltip from '@app/components/Common/Tooltip';
|
||||
import LanguageSelector from '@app/components/LanguageSelector';
|
||||
import RegionSelector from '@app/components/RegionSelector';
|
||||
import CopyButton from '@app/components/Settings/CopyButton';
|
||||
import SettingsBadge from '@app/components/Settings/SettingsBadge';
|
||||
import type { AvailableLocale } from '@app/context/LanguageContext';
|
||||
import { availableLanguages } from '@app/context/LanguageContext';
|
||||
import useLocale from '@app/hooks/useLocale';
|
||||
@@ -258,9 +259,7 @@ const SettingsMain = () => {
|
||||
<span className="mr-2">
|
||||
{intl.formatMessage(messages.trustProxy)}
|
||||
</span>
|
||||
<Badge badgeType="primary">
|
||||
{intl.formatMessage(globalMessages.restartRequired)}
|
||||
</Badge>
|
||||
<SettingsBadge badgeType="restartRequired" />
|
||||
<span className="label-tip">
|
||||
{intl.formatMessage(messages.trustProxyTip)}
|
||||
</span>
|
||||
@@ -281,28 +280,30 @@ const SettingsMain = () => {
|
||||
<span className="mr-2">
|
||||
{intl.formatMessage(messages.csrfProtection)}
|
||||
</span>
|
||||
<Badge badgeType="danger" className="mr-2">
|
||||
{intl.formatMessage(globalMessages.advanced)}
|
||||
</Badge>
|
||||
<Badge badgeType="primary">
|
||||
{intl.formatMessage(globalMessages.restartRequired)}
|
||||
</Badge>
|
||||
<SettingsBadge badgeType="advanced" className="mr-2" />
|
||||
<SettingsBadge badgeType="restartRequired" />
|
||||
<span className="label-tip">
|
||||
{intl.formatMessage(messages.csrfProtectionTip)}
|
||||
</span>
|
||||
</label>
|
||||
<div className="form-input-area">
|
||||
<Field
|
||||
type="checkbox"
|
||||
id="csrfProtection"
|
||||
name="csrfProtection"
|
||||
title={intl.formatMessage(
|
||||
<Tooltip
|
||||
content={intl.formatMessage(
|
||||
messages.csrfProtectionHoverTip
|
||||
)}
|
||||
onChange={() => {
|
||||
setFieldValue('csrfProtection', !values.csrfProtection);
|
||||
}}
|
||||
/>
|
||||
>
|
||||
<Field
|
||||
type="checkbox"
|
||||
id="csrfProtection"
|
||||
name="csrfProtection"
|
||||
onChange={() => {
|
||||
setFieldValue(
|
||||
'csrfProtection',
|
||||
!values.csrfProtection
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
@@ -367,9 +368,7 @@ const SettingsMain = () => {
|
||||
<span className="mr-2">
|
||||
{intl.formatMessage(messages.hideAvailable)}
|
||||
</span>
|
||||
<Badge badgeType="warning">
|
||||
{intl.formatMessage(globalMessages.experimental)}
|
||||
</Badge>
|
||||
<SettingsBadge badgeType="experimental" />
|
||||
</label>
|
||||
<div className="form-input-area">
|
||||
<Field
|
||||
|
@@ -5,6 +5,7 @@ import LoadingSpinner from '@app/components/Common/LoadingSpinner';
|
||||
import PageTitle from '@app/components/Common/PageTitle';
|
||||
import SensitiveInput from '@app/components/Common/SensitiveInput';
|
||||
import LibraryItem from '@app/components/Settings/LibraryItem';
|
||||
import SettingsBadge from '@app/components/Settings/SettingsBadge';
|
||||
import globalMessages from '@app/i18n/globalMessages';
|
||||
import { SaveIcon } from '@heroicons/react/outline';
|
||||
import { RefreshIcon, SearchIcon, XIcon } from '@heroicons/react/solid';
|
||||
@@ -567,9 +568,7 @@ const SettingsPlex = ({ onComplete }: SettingsPlexProps) => {
|
||||
</a>
|
||||
),
|
||||
})}
|
||||
<Badge badgeType="danger" className="ml-2">
|
||||
{intl.formatMessage(globalMessages.advanced)}
|
||||
</Badge>
|
||||
<SettingsBadge badgeType="advanced" className="ml-2" />
|
||||
<span className="label-tip">
|
||||
{intl.formatMessage(messages.webAppUrlTip)}
|
||||
</span>
|
||||
|
@@ -9,6 +9,7 @@ import LoadingSpinner from '@app/components/Common/LoadingSpinner';
|
||||
import PageTitle from '@app/components/Common/PageTitle';
|
||||
import type { PlayButtonLink } from '@app/components/Common/PlayButton';
|
||||
import PlayButton from '@app/components/Common/PlayButton';
|
||||
import Tooltip from '@app/components/Common/Tooltip';
|
||||
import ExternalLinkBlock from '@app/components/ExternalLinkBlock';
|
||||
import IssueModal from '@app/components/IssueModal';
|
||||
import ManageSlideOver from '@app/components/ManageSlideOver';
|
||||
@@ -68,6 +69,8 @@ const messages = defineMessages({
|
||||
streamingproviders: 'Currently Streaming On',
|
||||
productioncountries:
|
||||
'Production {countryCount, plural, one {Country} other {Countries}}',
|
||||
reportissue: 'Report an Issue',
|
||||
managemovie: 'Manage Movie',
|
||||
});
|
||||
|
||||
interface TvDetailsProps {
|
||||
@@ -389,38 +392,42 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
|
||||
type: 'or',
|
||||
}
|
||||
) && (
|
||||
<Button
|
||||
buttonType="warning"
|
||||
className="ml-2 first:ml-0"
|
||||
onClick={() => setShowIssueModal(true)}
|
||||
>
|
||||
<ExclamationIcon className="w-5" />
|
||||
</Button>
|
||||
<Tooltip content={intl.formatMessage(messages.reportissue)}>
|
||||
<Button
|
||||
buttonType="warning"
|
||||
onClick={() => setShowIssueModal(true)}
|
||||
className="ml-2 first:ml-0"
|
||||
>
|
||||
<ExclamationIcon />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
{hasPermission(Permission.MANAGE_REQUESTS) && data.mediaInfo && (
|
||||
<Button
|
||||
buttonType="default"
|
||||
className="relative ml-2 first:ml-0"
|
||||
onClick={() => setShowManager(true)}
|
||||
>
|
||||
<CogIcon className="!mr-0" />
|
||||
{hasPermission(
|
||||
[Permission.MANAGE_ISSUES, Permission.VIEW_ISSUES],
|
||||
{
|
||||
type: 'or',
|
||||
}
|
||||
) &&
|
||||
(
|
||||
data.mediaInfo?.issues.filter(
|
||||
(issue) => issue.status === IssueStatus.OPEN
|
||||
) ?? []
|
||||
).length > 0 && (
|
||||
<>
|
||||
<div className="absolute -right-1 -top-1 h-3 w-3 rounded-full bg-red-600" />
|
||||
<div className="absolute -right-1 -top-1 h-3 w-3 animate-ping rounded-full bg-red-600" />
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
<Tooltip content={intl.formatMessage(messages.managemovie)}>
|
||||
<Button
|
||||
buttonType="default"
|
||||
onClick={() => setShowManager(true)}
|
||||
className="relative ml-2 first:ml-0"
|
||||
>
|
||||
<CogIcon className="!mr-0" />
|
||||
{hasPermission(
|
||||
[Permission.MANAGE_ISSUES, Permission.VIEW_ISSUES],
|
||||
{
|
||||
type: 'or',
|
||||
}
|
||||
) &&
|
||||
(
|
||||
data.mediaInfo?.issues.filter(
|
||||
(issue) => issue.status === IssueStatus.OPEN
|
||||
) ?? []
|
||||
).length > 0 && (
|
||||
<>
|
||||
<div className="absolute -right-1 -top-1 h-3 w-3 rounded-full bg-red-600" />
|
||||
<div className="absolute -right-1 -top-1 h-3 w-3 animate-ping rounded-full bg-red-600" />
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import Badge from '@app/components/Common/Badge';
|
||||
import Button from '@app/components/Common/Button';
|
||||
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
|
||||
import SensitiveInput from '@app/components/Common/SensitiveInput';
|
||||
@@ -6,6 +5,7 @@ import NotificationTypeSelector, {
|
||||
ALL_NOTIFICATIONS,
|
||||
} from '@app/components/NotificationTypeSelector';
|
||||
import { OpenPgpLink } from '@app/components/Settings/Notifications/NotificationsEmail';
|
||||
import SettingsBadge from '@app/components/Settings/SettingsBadge';
|
||||
import { useUser } from '@app/hooks/useUser';
|
||||
import globalMessages from '@app/i18n/globalMessages';
|
||||
import { SaveIcon } from '@heroicons/react/outline';
|
||||
@@ -105,9 +105,7 @@ const UserEmailSettings = () => {
|
||||
<span className="mr-2">
|
||||
{intl.formatMessage(messages.pgpPublicKey)}
|
||||
</span>
|
||||
<Badge badgeType="danger">
|
||||
{intl.formatMessage(globalMessages.advanced)}
|
||||
</Badge>
|
||||
<SettingsBadge badgeType="advanced" />
|
||||
<span className="label-tip">
|
||||
{intl.formatMessage(messages.pgpPublicKeyTip, {
|
||||
OpenPgpLink: OpenPgpLink,
|
||||
|
Reference in New Issue
Block a user