Skip to content

Commit

Permalink
feat: sync on ctrl+s
Browse files Browse the repository at this point in the history
* addresses [Bug]: ctrl+s should sync #1685
  • Loading branch information
Compositr committed Oct 8, 2023
1 parent 316da14 commit 8b591a2
Showing 1 changed file with 35 additions and 24 deletions.
59 changes: 35 additions & 24 deletions packages/desktop-client/src/components/Titlebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import Link from './common/Link';
import Paragraph from './common/Paragraph';
import Text from './common/Text';
import View from './common/View';
import { KeyHandlers } from './KeyHandlers';
import LoggedInUser from './LoggedInUser';
import { useServerURL } from './ServerContext';
import { useSidebar } from './sidebar';
Expand Down Expand Up @@ -173,30 +174,40 @@ export function SyncButton({ style, isMobile = false }: SyncButtonProps) {
: {};

return (
<Button
type="bare"
style={{
...style,
WebkitAppRegion: 'none',
color: isMobile ? mobileColor : desktopColor,
}}
hoveredStyle={activeStyle}
activeStyle={activeStyle}
onClick={sync}
>
{syncState === 'error' ? (
<AlertTriangle width={13} />
) : (
<AnimatedRefresh animating={syncing} />
)}
<Text style={{ marginLeft: 3 }}>
{syncState === 'disabled'
? 'Disabled'
: syncState === 'offline'
? 'Offline'
: 'Sync'}
</Text>
</Button>
<>
<KeyHandlers
keys={{
'ctrl+s': () => {
sync();
},
}}
/>

<Button
type="bare"
style={{
...style,
WebkitAppRegion: 'none',
color: isMobile ? mobileColor : desktopColor,
}}
hoveredStyle={activeStyle}
activeStyle={activeStyle}
onClick={sync}
>
{syncState === 'error' ? (
<AlertTriangle width={13} />
) : (
<AnimatedRefresh animating={syncing} />
)}
<Text style={{ marginLeft: 3 }}>
{syncState === 'disabled'
? 'Disabled'
: syncState === 'offline'
? 'Offline'
: 'Sync'}
</Text>
</Button>
</>
);
}

Expand Down

0 comments on commit 8b591a2

Please sign in to comment.