-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Safari happy #146
base: main
Are you sure you want to change the base?
Make Safari happy #146
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ import { Button } from '../../theme/button'; | |
import { ButtonText } from '../../theme/buttonText'; | ||
import { TextField } from '../../theme/textField'; | ||
import { ErpIcon } from './erpIcon'; | ||
import { copyToClipboard } from '../../utils/clipboard'; | ||
|
||
type Props = { | ||
onSave: (microservice: MicroservicePurchaseOrder) => any; | ||
|
@@ -99,18 +100,18 @@ export const Configuration: React.FunctionComponent<Props> = (props) => { | |
const webhookPoHead = 'm3/pohead'; | ||
const webhookPoLine = 'm3/poline'; | ||
|
||
const copyPOHeadUrl = async (event: React.MouseEvent<HTMLElement>) => { | ||
const copyPOHeadUrl = (event: React.MouseEvent<HTMLElement>) => { | ||
try { | ||
await navigator.clipboard.writeText(`${webhookPrefix}/${webhookPoHead}`); | ||
copyToClipboard(`${webhookPrefix}/${webhookPoHead}`); | ||
enqueueSnackbar('POHEAD URL copied to clipboard.'); | ||
} catch { | ||
enqueueSnackbar('Failed to copy POHEAD URL to clipboard.', { variant: 'error' }); | ||
} | ||
}; | ||
|
||
const copyPOLineUrl = async (event: React.MouseEvent<HTMLElement>) => { | ||
const copyPOLineUrl = (event: React.MouseEvent<HTMLElement>) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 4 locations. Consider refactoring. |
||
try { | ||
await navigator.clipboard.writeText(`${webhookPrefix}/${webhookPoLine}`); | ||
copyToClipboard(`${webhookPrefix}/${webhookPoLine}`); | ||
enqueueSnackbar('POLINE URL copied to clipboard.'); | ||
} catch { | ||
enqueueSnackbar('Failed to copy POLINE URL to clipboard.', { variant: 'error' }); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ import { EditWebhookCredentials } from './editWebhookCredentials'; | |
import { ButtonText } from '../../theme/buttonText'; | ||
import { RowWithLink } from './rowWithLink'; | ||
import { HeaderDataRow } from '../components/headDataRow'; | ||
import { copyToClipboard } from '../../utils/clipboard'; | ||
|
||
type Props = { | ||
onSave: (microservice: MicroservicePurchaseOrder) => any; | ||
|
@@ -33,18 +34,18 @@ export const ViewConfiguration: React.FunctionComponent<Props> = (props) => { | |
const webhookPoLine = 'm3/poline'; | ||
const msName = ms.name; | ||
|
||
const copyPOHeadUrl = async (event: React.MouseEvent<HTMLElement>) => { | ||
const copyPOHeadUrl = (event: React.MouseEvent<HTMLElement>) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 4 locations. Consider refactoring. |
||
try { | ||
await navigator.clipboard.writeText(`${webhookPrefix}/${webhookPoHead}`); | ||
copyToClipboard(`${webhookPrefix}/${webhookPoHead}`); | ||
enqueueSnackbar('POHEAD URL copied to clipboard.'); | ||
} catch { | ||
enqueueSnackbar('Failed to copy POHEAD URL to clipboard.', { variant: 'error' }); | ||
} | ||
}; | ||
|
||
const copyPOLineUrl = async (event: React.MouseEvent<HTMLElement>) => { | ||
const copyPOLineUrl = (event: React.MouseEvent<HTMLElement>) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 4 locations. Consider refactoring. |
||
try { | ||
await navigator.clipboard.writeText(`${webhookPrefix}/${webhookPoLine}`); | ||
copyToClipboard(`${webhookPrefix}/${webhookPoLine}`); | ||
enqueueSnackbar('POLINE URL copied to clipboard.'); | ||
} catch { | ||
enqueueSnackbar('Failed to copy POLINE URL to clipboard.', { variant: 'error' }); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) Dolittle. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
import copy from 'copy-to-clipboard'; | ||
|
||
|
||
|
||
export const copyToClipboard = (text: string) => { | ||
copy(text, { | ||
debug: false, | ||
}); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.