mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-04-24 22:57:13 -04:00
Add tooltip to HistoryIcon
This commit is contained in:
parent
98937a0378
commit
23022f5282
1 changed files with 19 additions and 1 deletions
|
@ -9,6 +9,7 @@ import {
|
||||||
faUser,
|
faUser,
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
import { Tooltip } from "@mantine/core";
|
||||||
import { FunctionComponent } from "react";
|
import { FunctionComponent } from "react";
|
||||||
|
|
||||||
enum HistoryAction {
|
enum HistoryAction {
|
||||||
|
@ -26,35 +27,52 @@ const HistoryIcon: FunctionComponent<{
|
||||||
title?: string;
|
title?: string;
|
||||||
}> = ({ action, title }) => {
|
}> = ({ action, title }) => {
|
||||||
let icon = null;
|
let icon = null;
|
||||||
|
let label = "Unknown";
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case HistoryAction.Delete:
|
case HistoryAction.Delete:
|
||||||
icon = faTrash;
|
icon = faTrash;
|
||||||
|
label = "Delete";
|
||||||
break;
|
break;
|
||||||
case HistoryAction.Download:
|
case HistoryAction.Download:
|
||||||
icon = faDownload;
|
icon = faDownload;
|
||||||
|
label = "Download";
|
||||||
break;
|
break;
|
||||||
case HistoryAction.Manual:
|
case HistoryAction.Manual:
|
||||||
icon = faUser;
|
icon = faUser;
|
||||||
|
label = "Manual";
|
||||||
break;
|
break;
|
||||||
case HistoryAction.Sync:
|
case HistoryAction.Sync:
|
||||||
icon = faClock;
|
icon = faClock;
|
||||||
|
label = "Sync";
|
||||||
break;
|
break;
|
||||||
case HistoryAction.Upgrade:
|
case HistoryAction.Upgrade:
|
||||||
icon = faRecycle;
|
icon = faRecycle;
|
||||||
|
label = "Upgrade";
|
||||||
break;
|
break;
|
||||||
case HistoryAction.Upload:
|
case HistoryAction.Upload:
|
||||||
icon = faCloudUploadAlt;
|
icon = faCloudUploadAlt;
|
||||||
|
label = "Upload";
|
||||||
break;
|
break;
|
||||||
case HistoryAction.Translated:
|
case HistoryAction.Translated:
|
||||||
icon = faLanguage;
|
icon = faLanguage;
|
||||||
|
label = "Translated";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
icon = faClosedCaptioning;
|
icon = faClosedCaptioning;
|
||||||
|
label = "Unknown";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
return <FontAwesomeIcon title={title} icon={icon}></FontAwesomeIcon>;
|
return (
|
||||||
|
<Tooltip label={label} openDelay={500} position="right">
|
||||||
|
<FontAwesomeIcon
|
||||||
|
aria-label={label}
|
||||||
|
title={title}
|
||||||
|
icon={icon}
|
||||||
|
></FontAwesomeIcon>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue