Add label to all action buttons

pull/1867/head
LASER-Yi 3 years ago
parent 059ab59fc7
commit 5a5df23b9c

@ -84,6 +84,8 @@ const AppHeader: FunctionComponent = () => {
<Menu <Menu
control={ control={
<Action <Action
label="System"
tooltip={{ position: "left" }}
loading={offline} loading={offline}
color={offline ? "yellow" : undefined} color={offline ? "yellow" : undefined}
icon={faGear} icon={faGear}

@ -136,6 +136,7 @@ const AppNavbar: FunctionComponent = () => {
<MantineNavbar.Section mt="xs"> <MantineNavbar.Section mt="xs">
<Group spacing="xs"> <Group spacing="xs">
<Action <Action
label="Change Theme"
color={dark ? "yellow" : "indigo"} color={dark ? "yellow" : "indigo"}
variant="hover" variant="hover"
onClick={() => toggleColorScheme()} onClick={() => toggleColorScheme()}
@ -145,7 +146,12 @@ const AppNavbar: FunctionComponent = () => {
href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XHHRWXT9YB7WE&source=url" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XHHRWXT9YB7WE&source=url"
target="_blank" target="_blank"
> >
<Action icon={faHeart} variant="hover" color="red"></Action> <Action
label="Donate"
icon={faHeart}
variant="hover"
color="red"
></Action>
</Anchor> </Anchor>
</Group> </Group>
</MantineNavbar.Section> </MantineNavbar.Section>

@ -222,6 +222,7 @@ const MovieUploadForm: FunctionComponent<Props> = ({
Cell: ({ row: { index } }) => { Cell: ({ row: { index } }) => {
return ( return (
<Action <Action
label="Remove"
icon={faTrash} icon={faTrash}
color="red" color="red"
onClick={() => action.remove(index)} onClick={() => action.remove(index)}

@ -207,6 +207,7 @@ const ProfileEditForm: FunctionComponent<Props> = ({
Cell: ({ row }) => { Cell: ({ row }) => {
return ( return (
<Action <Action
label="Remove"
icon={faTrash} icon={faTrash}
color="red" color="red"
onClick={() => action.remove(row.index)} onClick={() => action.remove(row.index)}

@ -285,6 +285,7 @@ const SeriesUploadForm: FunctionComponent<Props> = ({
Cell: ({ row: { index } }) => { Cell: ({ row: { index } }) => {
return ( return (
<Action <Action
label="Remove"
icon={faTrash} icon={faTrash}
color="red" color="red"
onClick={() => action.remove(index)} onClick={() => action.remove(index)}

@ -3,20 +3,29 @@ import {
FontAwesomeIcon, FontAwesomeIcon,
FontAwesomeIconProps, FontAwesomeIconProps,
} from "@fortawesome/react-fontawesome"; } from "@fortawesome/react-fontawesome";
import { ActionIcon, ActionIconProps } from "@mantine/core"; import {
ActionIcon,
ActionIconProps,
Tooltip,
TooltipProps,
} from "@mantine/core";
import { forwardRef } from "react"; import { forwardRef } from "react";
export type ActionProps = ActionIconProps<"button"> & { export type ActionProps = ActionIconProps<"button"> & {
icon: IconDefinition; icon: IconDefinition;
label: string;
tooltip?: Omit<TooltipProps, "label" | "openDelay" | "children">;
iconProps?: Omit<FontAwesomeIconProps, "icon">; iconProps?: Omit<FontAwesomeIconProps, "icon">;
}; };
const Action = forwardRef<HTMLButtonElement, ActionProps>( const Action = forwardRef<HTMLButtonElement, ActionProps>(
({ icon, iconProps, ...props }, ref) => { ({ icon, iconProps, label, tooltip, ...props }, ref) => {
return ( return (
<ActionIcon {...props} ref={ref}> <Tooltip {...tooltip} label={label} openDelay={500}>
<FontAwesomeIcon icon={icon} {...iconProps}></FontAwesomeIcon> <ActionIcon aria-label={label} {...props} ref={ref}>
</ActionIcon> <FontAwesomeIcon icon={icon} {...iconProps}></FontAwesomeIcon>
</ActionIcon>
</Tooltip>
); );
} }
); );

@ -82,6 +82,7 @@ const MovieHistoryView: FunctionComponent<MovieHistoryViewProps> = ({
if (subs_id && provider && language) { if (subs_id && provider && language) {
return ( return (
<MutateAction <MutateAction
label="Add to Blacklist"
disabled={value} disabled={value}
icon={faFileExcel} icon={faFileExcel}
mutation={add} mutation={add}
@ -193,6 +194,7 @@ const EpisodeHistoryView: FunctionComponent<EpisodeHistoryViewProps> = ({
if (subs_id && provider && language) { if (subs_id && provider && language) {
return ( return (
<MutateAction <MutateAction
label="Add to Blacklist"
disabled={value} disabled={value}
icon={faFileExcel} icon={faFileExcel}
mutation={add} mutation={add}

@ -162,6 +162,7 @@ function ManualSearchView<T extends SupportType>(props: Props<T>) {
const result = row.original; const result = row.original;
return ( return (
<Action <Action
label="Download"
icon={faDownload} icon={faDownload}
color="brand" color="brand"
variant="light" variant="light"

@ -67,6 +67,7 @@ const Table: FunctionComponent<Props> = ({ blacklist }) => {
return ( return (
<MutateAction <MutateAction
label="Remove from Blacklist"
noReset noReset
icon={faTrash} icon={faTrash}
mutation={remove} mutation={remove}

@ -74,6 +74,7 @@ const Table: FunctionComponent<Props> = ({ blacklist }) => {
return ( return (
<MutateAction <MutateAction
label="Remove from Blacklist"
noReset noReset
icon={faTrash} icon={faTrash}
mutation={remove} mutation={remove}

@ -161,6 +161,7 @@ const Table: FunctionComponent<Props> = ({ episodes, profile, disabled }) => {
return ( return (
<Group spacing="xs" noWrap> <Group spacing="xs" noWrap>
<Action <Action
label="Manual Search"
disabled={disabled} disabled={disabled}
onClick={() => { onClick={() => {
modals.openContextModal(EpisodeSearchModal, { modals.openContextModal(EpisodeSearchModal, {
@ -172,6 +173,7 @@ const Table: FunctionComponent<Props> = ({ episodes, profile, disabled }) => {
icon={faUser} icon={faUser}
></Action> ></Action>
<Action <Action
label="History"
disabled={disabled} disabled={disabled}
onClick={() => { onClick={() => {
modals.openContextModal( modals.openContextModal(

@ -104,6 +104,7 @@ const MoviesHistoryView: FunctionComponent = () => {
if (subs_id && provider && language) { if (subs_id && provider && language) {
return ( return (
<MutateAction <MutateAction
label="Add to Blacklist"
disabled={value} disabled={value}
icon={faFileExcel} icon={faFileExcel}
mutation={add} mutation={add}

@ -126,6 +126,7 @@ const SeriesHistoryView: FunctionComponent = () => {
if (subs_id && provider && language) { if (subs_id && provider && language) {
return ( return (
<MutateAction <MutateAction
label="Add to Blacklist"
disabled={value} disabled={value}
icon={faFileExcel} icon={faFileExcel}
mutation={add} mutation={add}

@ -192,7 +192,15 @@ const MovieDetailView: FunctionComponent = () => {
> >
Edit Movie Edit Movie
</Toolbox.Button> </Toolbox.Button>
<Menu control={<Action icon={faEllipsis} disabled={hasTask} />}> <Menu
control={
<Action
label="More Actions"
icon={faEllipsis}
disabled={hasTask}
/>
}
>
<Menu.Item <Menu.Item
icon={<FontAwesomeIcon icon={faToolbox} />} icon={<FontAwesomeIcon icon={faToolbox} />}
onClick={() => { onClick={() => {

@ -111,6 +111,7 @@ const Table: FunctionComponent<Props> = ({ movie, profile, disabled }) => {
if (isSubtitleMissing(path)) { if (isSubtitleMissing(path)) {
return ( return (
<Action <Action
label="Search Subtitle"
icon={faSearch} icon={faSearch}
disabled={disabled} disabled={disabled}
onClick={() => { onClick={() => {
@ -159,6 +160,7 @@ const Table: FunctionComponent<Props> = ({ movie, profile, disabled }) => {
}} }}
> >
<Action <Action
label="Subtitle Actions"
disabled={isSubtitleTrack(path)} disabled={isSubtitleTrack(path)}
icon={faEllipsis} icon={faEllipsis}
></Action> ></Action>

@ -83,6 +83,8 @@ const MovieView: FunctionComponent = () => {
const mutation = useMovieModification(); const mutation = useMovieModification();
return ( return (
<Action <Action
label="Edit Movie"
tooltip={{ position: "left" }}
variant="light" variant="light"
onClick={() => onClick={() =>
modals.openContextModal( modals.openContextModal(

@ -83,6 +83,8 @@ const SeriesView: FunctionComponent = () => {
const modals = useModals(); const modals = useModals();
return ( return (
<Action <Action
label="Edit Series"
tooltip={{ position: "left" }}
variant="light" variant="light"
onClick={() => onClick={() =>
modals.openContextModal( modals.openContextModal(

@ -88,6 +88,7 @@ const SettingsGeneralView: FunctionComponent = () => {
rightSection={ rightSection={
<MantineGroup spacing="xs" mx="xs" position="right"> <MantineGroup spacing="xs" mx="xs" position="right">
<Action <Action
label="Copy API Key"
variant="light" variant="light"
settingKey={settingApiKey} settingKey={settingApiKey}
color={copied ? "green" : undefined} color={copied ? "green" : undefined}
@ -100,6 +101,7 @@ const SettingsGeneralView: FunctionComponent = () => {
}} }}
></Action> ></Action>
<Action <Action
label="Regenerate"
variant="light" variant="light"
settingKey={settingApiKey} settingKey={settingApiKey}
color="red" color="red"

@ -122,6 +122,7 @@ const Table: FunctionComponent = () => {
return ( return (
<Group spacing="xs" noWrap> <Group spacing="xs" noWrap>
<Action <Action
label="Edit Profile"
icon={faWrench} icon={faWrench}
onClick={() => { onClick={() => {
modals.openContextModal(ProfileEditModal, { modals.openContextModal(ProfileEditModal, {
@ -132,6 +133,7 @@ const Table: FunctionComponent = () => {
}} }}
></Action> ></Action>
<Action <Action
label="Remove"
icon={faTrash} icon={faTrash}
color="red" color="red"
onClick={() => action.remove(row.index)} onClick={() => action.remove(row.index)}

@ -121,6 +121,7 @@ export const PathMappingTable: FunctionComponent<TableProps> = ({ type }) => {
Cell: ({ row: { index } }) => { Cell: ({ row: { index } }) => {
return ( return (
<Action <Action
label="Remove"
icon={faTrash} icon={faTrash}
onClick={() => action.remove(index)} onClick={() => action.remove(index)}
></Action> ></Action>

@ -53,6 +53,7 @@ const Table: FunctionComponent<Props> = ({ backups }) => {
return ( return (
<Group spacing="xs" noWrap> <Group spacing="xs" noWrap>
<Action <Action
label="Restore"
onClick={() => onClick={() =>
modals.openConfirmModal({ modals.openConfirmModal({
title: "Restore Backup", title: "Restore Backup",
@ -71,6 +72,7 @@ const Table: FunctionComponent<Props> = ({ backups }) => {
icon={faHistory} icon={faHistory}
></Action> ></Action>
<Action <Action
label="Delete"
onClick={() => onClick={() =>
modals.openConfirmModal({ modals.openConfirmModal({
title: "Delete Backup", title: "Delete Backup",

@ -58,6 +58,7 @@ const Table: FunctionComponent<Props> = ({ logs }) => {
if (!isUndefined(value)) { if (!isUndefined(value)) {
return ( return (
<Action <Action
label="Detail"
icon={faLayerGroup} icon={faLayerGroup}
onClick={() => onClick={() =>
modals.openContextModal(SystemLogModal, { stack: value }) modals.openContextModal(SystemLogModal, { stack: value })

@ -2,7 +2,7 @@ import { useRunTask } from "@/apis/hooks";
import { SimpleTable } from "@/components"; import { SimpleTable } from "@/components";
import MutateAction from "@/components/async/MutateAction"; import MutateAction from "@/components/async/MutateAction";
import { useTableStyles } from "@/styles"; import { useTableStyles } from "@/styles";
import { faSync } from "@fortawesome/free-solid-svg-icons"; import { faPlay } from "@fortawesome/free-solid-svg-icons";
import { Text } from "@mantine/core"; import { Text } from "@mantine/core";
import { FunctionComponent, useMemo } from "react"; import { FunctionComponent, useMemo } from "react";
import { Column, useSortBy } from "react-table"; import { Column, useSortBy } from "react-table";
@ -42,7 +42,8 @@ const Table: FunctionComponent<Props> = ({ tasks }) => {
return ( return (
<MutateAction <MutateAction
icon={faSync} label="Run"
icon={faPlay}
iconProps={{ spin: value }} iconProps={{ spin: value }}
mutation={runTask} mutation={runTask}
args={() => job_id} args={() => job_id}

Loading…
Cancel
Save