Skip to content

Commit

Permalink
Sync on ctrl+s (#1770)
Browse files Browse the repository at this point in the history
  • Loading branch information
Compositr authored Oct 10, 2023
1 parent 3dfe633 commit bdf5c45
Show file tree
Hide file tree
Showing 2 changed files with 41 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, cmd+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
6 changes: 6 additions & 0 deletions upcoming-release-notes/1770.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [Compositr, shaankhosla]
---

Sync on Ctrl+S

0 comments on commit bdf5c45

Please sign in to comment.