-
-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): add more tooltips (#2961)
* feat(frontend): add more tooltips * fix: remove styling from Tooltip * refactor: tooltip expects a single child
- Loading branch information
1 parent
43a9067
commit 950b171
Showing
10 changed files
with
189 additions
and
110 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
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
Oops, something went wrong.