-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature-new-attachments'
Fixes #251
- Loading branch information
Showing
47 changed files
with
2,427 additions
and
805 deletions.
There are no files selected for viewing
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
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
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,45 @@ | ||
import * as React from 'react'; | ||
|
||
import { Box, Button, IconButton, Tooltip } from '@mui/joy'; | ||
import AddAPhotoIcon from '@mui/icons-material/AddAPhoto'; | ||
|
||
import { CameraCaptureModal } from './CameraCaptureModal'; | ||
|
||
|
||
const attachCameraLegend = (isMobile: boolean) => | ||
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}> | ||
<b>Attach photo</b><br /> | ||
{isMobile ? 'Auto-OCR to read text' : 'See the world, on the go'} | ||
</Box>; | ||
|
||
|
||
export function ButtonAttachCamera(props: { isMobile?: boolean, onAttachImage: (file: File) => void }) { | ||
// state | ||
const [open, setOpen] = React.useState(false); | ||
|
||
return <> | ||
|
||
{/* The Button */} | ||
{props.isMobile ? ( | ||
<IconButton variant='plain' color='neutral' onClick={() => setOpen(true)}> | ||
<AddAPhotoIcon /> | ||
</IconButton> | ||
) : ( | ||
<Tooltip variant='solid' placement='top-start' title={attachCameraLegend(!!props.isMobile)}> | ||
<Button fullWidth variant='plain' color='neutral' onClick={() => setOpen(true)} startDecorator={<AddAPhotoIcon />} | ||
sx={{ justifyContent: 'flex-start' }}> | ||
Camera | ||
</Button> | ||
</Tooltip> | ||
)} | ||
|
||
{/* The actual capture dialog, which will stream the video */} | ||
{open && ( | ||
<CameraCaptureModal | ||
onCloseModal={() => setOpen(false)} | ||
onAttachImage={props.onAttachImage} | ||
/> | ||
)} | ||
|
||
</>; | ||
} |
30 changes: 30 additions & 0 deletions
30
src/apps/chat/components/composer/ButtonAttachClipboard.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,30 @@ | ||
import * as React from 'react'; | ||
|
||
import { Box, Button, IconButton, Tooltip } from '@mui/joy'; | ||
import ContentPasteGoIcon from '@mui/icons-material/ContentPasteGo'; | ||
|
||
import { KeyStroke } from '~/common/components/KeyStroke'; | ||
|
||
|
||
const pasteClipboardLegend = | ||
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}> | ||
<b>Attach clipboard 📚</b><br /> | ||
Auto-converts to the best types<br /> | ||
<KeyStroke combo='Ctrl + Shift + V' sx={{ mt: 1, mb: 0.5 }} /> | ||
</Box>; | ||
|
||
|
||
export function ButtonAttachClipboard(props: { isMobile?: boolean, onClick: () => void }) { | ||
return props.isMobile ? ( | ||
<IconButton onClick={props.onClick}> | ||
<ContentPasteGoIcon /> | ||
</IconButton> | ||
) : ( | ||
<Tooltip variant='solid' placement='top-start' title={pasteClipboardLegend}> | ||
<Button fullWidth variant='plain' color='neutral' startDecorator={<ContentPasteGoIcon />} onClick={props.onClick} | ||
sx={{ justifyContent: 'flex-start' }}> | ||
Paste | ||
</Button> | ||
</Tooltip> | ||
); | ||
} |
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,27 @@ | ||
import * as React from 'react'; | ||
|
||
import { Box, Button, IconButton, Tooltip } from '@mui/joy'; | ||
import AttachFileOutlinedIcon from '@mui/icons-material/AttachFileOutlined'; | ||
|
||
|
||
const attachFileLegend = | ||
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}> | ||
<b>Attach files</b><br /> | ||
Drag & drop in chat for faster loads ⚡ | ||
</Box>; | ||
|
||
|
||
export function ButtonAttachFile(props: { isMobile?: boolean, onAttachFilePicker: () => void }) { | ||
return props.isMobile ? ( | ||
<IconButton onClick={props.onAttachFilePicker}> | ||
<AttachFileOutlinedIcon /> | ||
</IconButton> | ||
) : ( | ||
<Tooltip variant='solid' placement='top-start' title={attachFileLegend}> | ||
<Button fullWidth variant='plain' color='neutral' onClick={props.onAttachFilePicker} startDecorator={<AttachFileOutlinedIcon />} | ||
sx={{ justifyContent: 'flex-start' }}> | ||
File | ||
</Button> | ||
</Tooltip> | ||
); | ||
} |
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,25 @@ | ||
import * as React from 'react'; | ||
|
||
import { Box, Button, IconButton, Tooltip } from '@mui/joy'; | ||
import { SxProps } from '@mui/joy/styles/types'; | ||
import CallIcon from '@mui/icons-material/Call'; | ||
|
||
|
||
const callConversationLegend = | ||
<Box sx={{ px: 1, py: 0.75, lineHeight: '1.5rem' }}> | ||
Quick call regarding this chat | ||
</Box>; | ||
|
||
export function ButtonCall(props: { isMobile?: boolean, disabled?: boolean, onClick: () => void, sx?: SxProps }) { | ||
return props.isMobile ? ( | ||
<IconButton variant='soft' color='primary' disabled={props.disabled} onClick={props.onClick} sx={props.sx}> | ||
<CallIcon /> | ||
</IconButton> | ||
) : ( | ||
<Tooltip variant='solid' arrow placement='right' title={callConversationLegend}> | ||
<Button variant='soft' color='primary' disabled={props.disabled} onClick={props.onClick} endDecorator={<CallIcon />} sx={props.sx}> | ||
Call | ||
</Button> | ||
</Tooltip> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
src/apps/chat/components/composer/ButtonClipboardPaste.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.