//
// Copyright 2024 DXOS.org
//
import React, { useEffect, useState } from 'react';
import { Context } from '@dxos/context';
import { JsonView } from '../../../components';
export const SyncStateInfo = ({ space }) => {
    const [syncState, setSyncState] = useState({});
    useEffect(() => {
        if (space) {
            return space.internal.db.coreDatabase.subscribeToSyncState(Context.default(), (syncState) => {
                setSyncState(syncState);
            });
        }
    }, [space]);
    return (React.createElement("div", { className: 'p-2 text-sm' },
        React.createElement("p", { className: 'text-base' }, "Sync state"),
        React.createElement(JsonView, { data: syncState })));
};
//# sourceMappingURL=SyncStateInfo.js.map