feature/IO-2681-Share-To-Teams-Button - Final revisions.
This commit is contained in:
@@ -31,7 +31,7 @@ import AddToProduction from "./jobs-detail-header-actions.addtoproduction.util";
|
|||||||
import DuplicateJob from "./jobs-detail-header-actions.duplicate.util";
|
import DuplicateJob from "./jobs-detail-header-actions.duplicate.util";
|
||||||
import JobsDetailHeaderActionsToggleProduction from "./jobs-detail-header-actions.toggle-production";
|
import JobsDetailHeaderActionsToggleProduction from "./jobs-detail-header-actions.toggle-production";
|
||||||
import SocketContext from "../../contexts/SocketIO/socketContext.jsx";
|
import SocketContext from "../../contexts/SocketIO/socketContext.jsx";
|
||||||
import ShareToTeamsButton from "../share-to-teams/share-to-teams-button.jsx";
|
import ShareToTeamsButton from "../share-to-teams/share-to-teams.component.jsx";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -963,9 +963,7 @@ export function JobsDetailHeaderActions({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO REMEMBER TO REVERT
|
if (Share_To_Teams?.treatment === "on") {
|
||||||
// if (Share_To_Teams?.treatment === "on") {
|
|
||||||
if (true) {
|
|
||||||
menuItems.push({
|
menuItems.push({
|
||||||
key: "sharetoteams",
|
key: "sharetoteams",
|
||||||
id: "job-actions-sharetoteams",
|
id: "job-actions-sharetoteams",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import LockWrapperComponent from "../lock-wrapper/lock-wrapper.component";
|
|||||||
import PartsReceiveModalContainer from "../parts-receive-modal/parts-receive-modal.container";
|
import PartsReceiveModalContainer from "../parts-receive-modal/parts-receive-modal.container";
|
||||||
import PrintWrapper from "../print-wrapper/print-wrapper.component";
|
import PrintWrapper from "../print-wrapper/print-wrapper.component";
|
||||||
import PartsOrderDrawer from "./parts-order-list-table-drawer.component";
|
import PartsOrderDrawer from "./parts-order-list-table-drawer.component";
|
||||||
import ShareToTeamsButton from "../share-to-teams/share-to-teams-button.jsx";
|
import ShareToTeamsButton from "../share-to-teams/share-to-teams.component.jsx";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import dayjs from "../../utils/day";
|
|||||||
|
|
||||||
import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component";
|
import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
import ShareToTeamsButton from "../share-to-teams/share-to-teams-button.jsx";
|
import ShareToTeamsButton from "../share-to-teams/share-to-teams.component.jsx";
|
||||||
import { SiMicrosoftteams } from "react-icons/si";
|
import { SiMicrosoftteams } from "react-icons/si";
|
||||||
|
|
||||||
const cardColor = (ssbuckets, totalHrs) => {
|
const cardColor = (ssbuckets, totalHrs) => {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import ProductionListColumnNote from "./production-list-columns.productionnote.c
|
|||||||
import ProductionListColumnCategory from "./production-list-columns.status.category";
|
import ProductionListColumnCategory from "./production-list-columns.status.category";
|
||||||
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
||||||
import ProductionListColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
import ProductionListColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
||||||
import ShareToTeamsButton from "../share-to-teams/share-to-teams-button.jsx";
|
import ShareToTeamsButton from "../share-to-teams/share-to-teams.component.jsx";
|
||||||
|
|
||||||
const getEmployeeName = (employeeId, employees) => {
|
const getEmployeeName = (employeeId, employees) => {
|
||||||
const employee = employees.find((e) => e.id === employeeId);
|
const employee = employees.find((e) => e.id === employeeId);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useMemo } from "react";
|
import React from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { Button } from "antd";
|
import { Button } from "antd";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
@@ -31,7 +31,7 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
* @param {Object} [props.additionalProps] - Additional props to pass to the rendered component.
|
* @param {Object} [props.additionalProps] - Additional props to pass to the rendered component.
|
||||||
* @returns {React.ReactElement} A button or text link for sharing to Microsoft Teams.
|
* @returns {React.ReactElement} A button or text link for sharing to Microsoft Teams.
|
||||||
*/
|
*/
|
||||||
const ShareToTeamsButton = ({
|
const ShareToTeamsComponent = ({
|
||||||
bodyshop,
|
bodyshop,
|
||||||
messageTextOverride,
|
messageTextOverride,
|
||||||
urlOverride,
|
urlOverride,
|
||||||
@@ -54,24 +54,13 @@ const ShareToTeamsButton = ({
|
|||||||
splitKey: bodyshop && bodyshop.imexshopid
|
splitKey: bodyshop && bodyshop.imexshopid
|
||||||
});
|
});
|
||||||
|
|
||||||
const currentUrl = useMemo(
|
const currentUrl =
|
||||||
() =>
|
urlOverride ||
|
||||||
urlOverride ||
|
encodeURIComponent(`${window.location.origin}${location.pathname}${location.search}${location.hash}`);
|
||||||
encodeURIComponent(`${window.location.origin}${location.pathname}${location.search}${location.hash}`),
|
const pageTitle =
|
||||||
[urlOverride, location]
|
pageTitleOverride ||
|
||||||
);
|
encodeURIComponent(typeof document !== "undefined" ? document.title : t("general.actions.sharetoteams"));
|
||||||
|
const messageText = messageTextOverride || encodeURIComponent(t("general.actions.sharetoteams"));
|
||||||
const pageTitle = useMemo(
|
|
||||||
() =>
|
|
||||||
pageTitleOverride ||
|
|
||||||
encodeURIComponent(typeof document !== "undefined" ? document.title : t("general.actions.sharetoteams")),
|
|
||||||
[pageTitleOverride, t]
|
|
||||||
);
|
|
||||||
|
|
||||||
const messageText = useMemo(
|
|
||||||
() => messageTextOverride || encodeURIComponent(t("general.actions.sharetoteams")),
|
|
||||||
[messageTextOverride, t]
|
|
||||||
);
|
|
||||||
|
|
||||||
// Construct the Teams share URL with parameters
|
// Construct the Teams share URL with parameters
|
||||||
const teamsShareUrl = `https://teams.microsoft.com/share?href=${currentUrl}&preText=${messageText}&title=${pageTitle}`;
|
const teamsShareUrl = `https://teams.microsoft.com/share?href=${currentUrl}&preText=${messageText}&title=${pageTitle}`;
|
||||||
@@ -92,9 +81,9 @@ const ShareToTeamsButton = ({
|
|||||||
window.open(teamsShareUrl, "_blank", windowFeatures);
|
window.open(teamsShareUrl, "_blank", windowFeatures);
|
||||||
};
|
};
|
||||||
|
|
||||||
// if (Share_To_Teams?.treatment !== "on") {
|
if (Share_To_Teams?.treatment !== "on") {
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (noIcon) {
|
if (noIcon) {
|
||||||
return (
|
return (
|
||||||
@@ -120,7 +109,7 @@ const ShareToTeamsButton = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
ShareToTeamsButton.propTypes = {
|
ShareToTeamsComponent.propTypes = {
|
||||||
messageTextOverride: PropTypes.string,
|
messageTextOverride: PropTypes.string,
|
||||||
urlOverride: PropTypes.string,
|
urlOverride: PropTypes.string,
|
||||||
pageTitleOverride: PropTypes.string,
|
pageTitleOverride: PropTypes.string,
|
||||||
@@ -129,7 +118,7 @@ ShareToTeamsButton.propTypes = {
|
|||||||
buttonStyle: PropTypes.object,
|
buttonStyle: PropTypes.object,
|
||||||
buttonIconStyle: PropTypes.object,
|
buttonIconStyle: PropTypes.object,
|
||||||
linkText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
linkText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
||||||
additionalProps: PropTypes.object
|
additionalProps: PropTypes.oneOfType([PropTypes.object, PropTypes.node])
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps)(ShareToTeamsButton);
|
export default connect(mapStateToProps)(ShareToTeamsComponent);
|
||||||
@@ -18,7 +18,7 @@ import { setModalContext } from "../../redux/modals/modals.actions";
|
|||||||
import { pageLimit } from "../../utils/config";
|
import { pageLimit } from "../../utils/config";
|
||||||
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter.jsx";
|
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter.jsx";
|
||||||
import dayjs from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
import ShareToTeamsButton from "../share-to-teams/share-to-teams-button.jsx";
|
import ShareToTeamsButton from "../share-to-teams/share-to-teams.component.jsx";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Task List Component
|
* Task List Component
|
||||||
|
|||||||
@@ -1193,7 +1193,9 @@
|
|||||||
"submit": "",
|
"submit": "",
|
||||||
"tryagain": "",
|
"tryagain": "",
|
||||||
"view": "",
|
"view": "",
|
||||||
"viewreleasenotes": ""
|
"viewreleasenotes": "",
|
||||||
|
"sharetoteams": "",
|
||||||
|
"ok": ""
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
"fcm": "",
|
"fcm": "",
|
||||||
@@ -3183,7 +3185,8 @@
|
|||||||
"tasks": {
|
"tasks": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"edit": "",
|
"edit": "",
|
||||||
"new": ""
|
"new": "",
|
||||||
|
"view": ""
|
||||||
},
|
},
|
||||||
"buttons": {
|
"buttons": {
|
||||||
"allTasks": "",
|
"allTasks": "",
|
||||||
|
|||||||
@@ -1193,7 +1193,8 @@
|
|||||||
"submit": "",
|
"submit": "",
|
||||||
"tryagain": "",
|
"tryagain": "",
|
||||||
"view": "",
|
"view": "",
|
||||||
"viewreleasenotes": ""
|
"viewreleasenotes": "",
|
||||||
|
"ok": ""
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
"fcm": "",
|
"fcm": "",
|
||||||
@@ -3183,7 +3184,8 @@
|
|||||||
"tasks": {
|
"tasks": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"edit": "",
|
"edit": "",
|
||||||
"new": ""
|
"new": "",
|
||||||
|
"view": ""
|
||||||
},
|
},
|
||||||
"buttons": {
|
"buttons": {
|
||||||
"allTasks": "",
|
"allTasks": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user