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 JobsDetailHeaderActionsToggleProduction from "./jobs-detail-header-actions.toggle-production";
|
||||
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({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -963,9 +963,7 @@ export function JobsDetailHeaderActions({
|
||||
}
|
||||
);
|
||||
|
||||
// TODO REMEMBER TO REVERT
|
||||
// if (Share_To_Teams?.treatment === "on") {
|
||||
if (true) {
|
||||
if (Share_To_Teams?.treatment === "on") {
|
||||
menuItems.push({
|
||||
key: "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 PrintWrapper from "../print-wrapper/print-wrapper.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({
|
||||
jobRO: selectJobReadOnly,
|
||||
|
||||
@@ -20,7 +20,7 @@ import dayjs from "../../utils/day";
|
||||
|
||||
import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.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";
|
||||
|
||||
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 ProductionListColumnStatus from "./production-list-columns.status.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 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 { Button } from "antd";
|
||||
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.
|
||||
* @returns {React.ReactElement} A button or text link for sharing to Microsoft Teams.
|
||||
*/
|
||||
const ShareToTeamsButton = ({
|
||||
const ShareToTeamsComponent = ({
|
||||
bodyshop,
|
||||
messageTextOverride,
|
||||
urlOverride,
|
||||
@@ -54,24 +54,13 @@ const ShareToTeamsButton = ({
|
||||
splitKey: bodyshop && bodyshop.imexshopid
|
||||
});
|
||||
|
||||
const currentUrl = useMemo(
|
||||
() =>
|
||||
urlOverride ||
|
||||
encodeURIComponent(`${window.location.origin}${location.pathname}${location.search}${location.hash}`),
|
||||
[urlOverride, location]
|
||||
);
|
||||
|
||||
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]
|
||||
);
|
||||
const currentUrl =
|
||||
urlOverride ||
|
||||
encodeURIComponent(`${window.location.origin}${location.pathname}${location.search}${location.hash}`);
|
||||
const pageTitle =
|
||||
pageTitleOverride ||
|
||||
encodeURIComponent(typeof document !== "undefined" ? document.title : t("general.actions.sharetoteams"));
|
||||
const messageText = messageTextOverride || encodeURIComponent(t("general.actions.sharetoteams"));
|
||||
|
||||
// Construct the Teams share URL with parameters
|
||||
const teamsShareUrl = `https://teams.microsoft.com/share?href=${currentUrl}&preText=${messageText}&title=${pageTitle}`;
|
||||
@@ -92,9 +81,9 @@ const ShareToTeamsButton = ({
|
||||
window.open(teamsShareUrl, "_blank", windowFeatures);
|
||||
};
|
||||
|
||||
// if (Share_To_Teams?.treatment !== "on") {
|
||||
// return null;
|
||||
// }
|
||||
if (Share_To_Teams?.treatment !== "on") {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (noIcon) {
|
||||
return (
|
||||
@@ -120,7 +109,7 @@ const ShareToTeamsButton = ({
|
||||
);
|
||||
};
|
||||
|
||||
ShareToTeamsButton.propTypes = {
|
||||
ShareToTeamsComponent.propTypes = {
|
||||
messageTextOverride: PropTypes.string,
|
||||
urlOverride: PropTypes.string,
|
||||
pageTitleOverride: PropTypes.string,
|
||||
@@ -129,7 +118,7 @@ ShareToTeamsButton.propTypes = {
|
||||
buttonStyle: PropTypes.object,
|
||||
buttonIconStyle: PropTypes.object,
|
||||
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 { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter.jsx";
|
||||
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
|
||||
|
||||
@@ -1193,7 +1193,9 @@
|
||||
"submit": "",
|
||||
"tryagain": "",
|
||||
"view": "",
|
||||
"viewreleasenotes": ""
|
||||
"viewreleasenotes": "",
|
||||
"sharetoteams": "",
|
||||
"ok": ""
|
||||
},
|
||||
"errors": {
|
||||
"fcm": "",
|
||||
@@ -3183,7 +3185,8 @@
|
||||
"tasks": {
|
||||
"actions": {
|
||||
"edit": "",
|
||||
"new": ""
|
||||
"new": "",
|
||||
"view": ""
|
||||
},
|
||||
"buttons": {
|
||||
"allTasks": "",
|
||||
|
||||
@@ -1193,7 +1193,8 @@
|
||||
"submit": "",
|
||||
"tryagain": "",
|
||||
"view": "",
|
||||
"viewreleasenotes": ""
|
||||
"viewreleasenotes": "",
|
||||
"ok": ""
|
||||
},
|
||||
"errors": {
|
||||
"fcm": "",
|
||||
@@ -3183,7 +3184,8 @@
|
||||
"tasks": {
|
||||
"actions": {
|
||||
"edit": "",
|
||||
"new": ""
|
||||
"new": "",
|
||||
"view": ""
|
||||
},
|
||||
"buttons": {
|
||||
"allTasks": "",
|
||||
|
||||
Reference in New Issue
Block a user