feat(tooltip): email tooltip now appears when hovered over info icon

This commit is contained in:
Fallenbagel
2023-06-11 06:36:51 +05:00
parent 9637c3f4ab
commit cd7930eef9

View File

@@ -1,5 +1,7 @@
import Button from '@app/components/Common/Button'; import Button from '@app/components/Common/Button';
import Tooltip from '@app/components/Common/Tooltip';
import useSettings from '@app/hooks/useSettings'; import useSettings from '@app/hooks/useSettings';
import { InformationCircleIcon } from '@heroicons/react/24/solid';
import axios from 'axios'; import axios from 'axios';
import { Field, Form, Formik } from 'formik'; import { Field, Form, Formik } from 'formik';
import getConfig from 'next/config'; import getConfig from 'next/config';
@@ -13,7 +15,7 @@ const messages = defineMessages({
password: 'Password', password: 'Password',
host: '{mediaServerName} URL', host: '{mediaServerName} URL',
email: 'Email', email: 'Email',
emailtooltip: 'This can be any valid email. It doesn\'t need to come from your {mediaServerName} instance.', emailtooltip: 'Any valid email. Unrelated to your {mediaServerName} instance',
validationhostrequired: '{mediaServerName} URL required', validationhostrequired: '{mediaServerName} URL required',
validationhostformat: 'Valid URL required', validationhostformat: 'Valid URL required',
validationemailrequired: 'Email required', validationemailrequired: 'Email required',
@@ -66,9 +68,7 @@ const JellyfinLogin: React.FC<JellyfinLoginProps> = ({
}); });
const mediaServerFormatValues = { const mediaServerFormatValues = {
mediaServerName: mediaServerName:
publicRuntimeConfig.JELLYFIN_TYPE == 'emby' publicRuntimeConfig.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin',
? 'Emby'
: 'Jellyfin',
}; };
return ( return (
<Formik <Formik
@@ -116,17 +116,33 @@ const JellyfinLogin: React.FC<JellyfinLoginProps> = ({
id="host" id="host"
name="host" name="host"
type="text" type="text"
placeholder={intl.formatMessage(messages.host, mediaServerFormatValues)} placeholder={intl.formatMessage(
messages.host,
mediaServerFormatValues
)}
/> />
</div> </div>
{errors.host && touched.host && ( {errors.host && touched.host && (
<div className="error">{errors.host}</div> <div className="error">{errors.host}</div>
)} )}
</div> </div>
<label htmlFor="email" className="text-label"> <label
htmlFor="email"
className="text-label"
style={{ display: 'inline-flex' }}
>
{intl.formatMessage(messages.email)} {intl.formatMessage(messages.email)}
<span className="label-tip"> <span className="label-tip">
{intl.formatMessage(messages.emailtooltip, mediaServerFormatValues)} <Tooltip
content={intl.formatMessage(
messages.emailtooltip,
mediaServerFormatValues
)}
>
<span className="tooltip-trigger">
<InformationCircleIcon className="h-5 w-5" />
</span>
</Tooltip>
</span> </span>
</label> </label>
<div className="mt-1 mb-2 sm:col-span-2 sm:mt-0"> <div className="mt-1 mb-2 sm:col-span-2 sm:mt-0">