forked from DeviceFarmer/stf
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from VKCOM/o.shcherbakov/clipboard-control/QA-…
…15743 feat(ui): clipboard control
- Loading branch information
Showing
4 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
ui/src/components/ui/device-control-panel/tabs/clipboard-control/clipboard-control.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { useState } from 'react' | ||
import { observer } from 'mobx-react-lite' | ||
import { useTranslation } from 'react-i18next' | ||
import { Icon20RefreshOutline } from '@vkontakte/icons' | ||
import { IconButton, Input, Tooltip } from '@vkontakte/vkui' | ||
|
||
import { DeviceControlStore } from '@/store/device-control-store' | ||
import { useServiceLocator } from '@/lib/hooks/use-service-locator.hook' | ||
|
||
export const ClipboardControl = observer(() => { | ||
const { t } = useTranslation() | ||
const [clipboardContent, setClipboardContent] = useState('') | ||
const deviceControlStore = useServiceLocator<DeviceControlStore>(DeviceControlStore.name) | ||
|
||
const onGetClipboardContent = async () => { | ||
const data = await deviceControlStore?.getClipboardContent() | ||
|
||
if (data) { | ||
setClipboardContent(data) | ||
} | ||
} | ||
|
||
return ( | ||
<Input | ||
placeholder={t('Get clipboard contents')} | ||
type='text' | ||
value={t(clipboardContent)} | ||
after={ | ||
<Tooltip appearance='accent' description={t('Get clipboard contents')}> | ||
<IconButton hoverMode='opacity' onClick={() => onGetClipboardContent()}> | ||
<Icon20RefreshOutline /> | ||
</IconButton> | ||
</Tooltip> | ||
} | ||
/> | ||
) | ||
}) |
1 change: 1 addition & 0 deletions
1
ui/src/components/ui/device-control-panel/tabs/clipboard-control/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { ClipboardControl } from './clipboard-control' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters