## Context There is no calendarChannel syncStatus column compared to the messageChannel table. In the meantime, we are trying to infer its status based on the fact that the connection hasn't failed and the sync is enabled
32 lines
906 B
TypeScript
32 lines
906 B
TypeScript
import { useGetSyncStatusOptions } from '@/settings/accounts/hooks//useGetSyncStatusOptions';
|
|
import { Status } from '@/ui/display/status/components/Status';
|
|
|
|
export type SettingsAccountsSynchronizationStatusProps = {
|
|
syncStatus: string;
|
|
isSyncEnabled?: boolean;
|
|
};
|
|
|
|
export const SettingsAccountsSynchronizationStatus = ({
|
|
syncStatus,
|
|
isSyncEnabled,
|
|
}: SettingsAccountsSynchronizationStatusProps) => {
|
|
const syncStatusOptions = useGetSyncStatusOptions();
|
|
|
|
const syncStatusOption = syncStatusOptions?.find(
|
|
(option) => option.value === syncStatus,
|
|
);
|
|
|
|
if (!isSyncEnabled) {
|
|
return <Status color="gray" text="Not synced" weight="medium" />;
|
|
}
|
|
|
|
return (
|
|
<Status
|
|
color={syncStatusOption?.color ?? 'gray'}
|
|
isLoaderVisible={syncStatus === 'ONGOING' || syncStatus === 'PENDING'}
|
|
text={syncStatusOption?.label ?? 'Not synced'}
|
|
weight="medium"
|
|
/>
|
|
);
|
|
};
|