IO-3020 IO-3036 Extend blur wrapper, add lock wrapper to components throughout the system. Many placeholders still left for upsell components.
This commit is contained in:
@@ -1,19 +1,31 @@
|
||||
import { useLazyQuery, useMutation } from "@apollo/client";
|
||||
import { CheckCircleOutlined } from "@ant-design/icons";
|
||||
import { useLazyQuery, useMutation } from "@apollo/client";
|
||||
import { Button, Card, Form, InputNumber, notification, Popover, Space } from "antd";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import {
|
||||
INSERT_SCOREBOARD_ENTRY,
|
||||
QUERY_SCOREBOARD_ENTRY,
|
||||
UPDATE_SCOREBOARD_ENTRY
|
||||
} from "../../graphql/scoreboard.queries";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors.js";
|
||||
import dayjs from "../../utils/day";
|
||||
import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component.jsx";
|
||||
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component.jsx";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import LockWrapperComponent from "../lock-wrapper/lock-wrapper.component.jsx";
|
||||
|
||||
export default function ScoreboardAddButton({ job, disabled, ...otherBtnProps }) {
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
|
||||
export function ScoreboardAddButton({ bodyshop, job, disabled, ...otherBtnProps }) {
|
||||
const { t } = useTranslation();
|
||||
const [insertScoreboardEntry] = useMutation(INSERT_SCOREBOARD_ENTRY);
|
||||
const [updateScoreboardEntry] = useMutation(UPDATE_SCOREBOARD_ENTRY);
|
||||
@@ -162,12 +174,14 @@ export default function ScoreboardAddButton({ job, disabled, ...otherBtnProps })
|
||||
setVisibility(true);
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const hasScoreboardAccess = HasFeatureAccess({ bodyshop, featureName: "scoreboard" });
|
||||
return (
|
||||
<Popover content={overlay} open={visibility} placement="bottom">
|
||||
<Button loading={loading} disabled={disabled} onClick={handleClick} {...otherBtnProps}>
|
||||
{t("jobs.actions.addtoscoreboard")}
|
||||
<Button loading={loading} disabled={disabled || !hasScoreboardAccess} onClick={handleClick} {...otherBtnProps}>
|
||||
<LockWrapperComponent featureName="scoreboard">{t("jobs.actions.addtoscoreboard")}</LockWrapperComponent>
|
||||
</Button>
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ScoreboardAddButton);
|
||||
|
||||
Reference in New Issue
Block a user