-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Thomas Trompette
committed
Apr 9, 2024
1 parent
f9c319e
commit 7eaf811
Showing
6 changed files
with
127 additions
and
81 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
29 changes: 29 additions & 0 deletions
29
...ront/src/modules/settings/integrations/components/SettingsIntegrationSyncStatusToggle.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,29 @@ | ||
import { useState } from 'react'; | ||
|
||
import { Toggle } from '@/ui/input/components/Toggle'; | ||
import { RemoteTableStatus } from '~/generated-metadata/graphql'; | ||
|
||
export const SettingsIntegrationSyncStatusToggle = ({ | ||
item: table, | ||
onSyncUpdate, | ||
}: { | ||
item: { id: string; name: string; status: RemoteTableStatus }; | ||
onSyncUpdate: (value: boolean, tableName: string) => Promise<void>; | ||
}) => { | ||
const [isToggleLoading, setIsToggleLoading] = useState(false); | ||
|
||
const onChange = async (newValue: boolean) => { | ||
if (isToggleLoading) return; | ||
setIsToggleLoading(true); | ||
await onSyncUpdate(newValue, table.name); | ||
setIsToggleLoading(false); | ||
}; | ||
|
||
return ( | ||
<Toggle | ||
value={table.status === RemoteTableStatus.Synced} | ||
disabled={isToggleLoading} | ||
onChange={onChange} | ||
/> | ||
); | ||
}; |
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