Skip to content

Commit

Permalink
Relocating the Sync related files to components
Browse files Browse the repository at this point in the history
  • Loading branch information
vipinpaul committed Oct 9, 2023
1 parent ddd1daa commit cbc0650
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 128 deletions.
2 changes: 1 addition & 1 deletion renderer/pages/sync.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Sync from '@/modules/projects/Sync';
import Sync from '@/components/Sync/Sync';
import AuthenticationContextProvider from '@/components/Login/AuthenticationContextProvider';
import AutographaContextProvider from '@/components/context/AutographaContext';
import SyncContextProvider from '@/components/Sync/SyncContextProvider';
Expand Down
107 changes: 0 additions & 107 deletions renderer/src/components/Sync/Ag/SyncToGitea-backup.js

This file was deleted.

4 changes: 2 additions & 2 deletions renderer/src/components/Sync/Gitea/EditorSync/EditorSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import Link from 'next/link';
import { SnackBar } from '@/components/SnackBar';
import menuStyles from '@/layouts/editor/MenuBar.module.css';
import useAddNotification from '@/components/hooks/useAddNotification';
import PopUpModal from '@/layouts/Sync/PopUpModal';
import ConfirmationModal from '@/layouts/editor/ConfirmationModal';
import { ReferenceContext } from '@/components/context/ReferenceContext';
import PopUpModal from '../../PopUpModal';
import * as logger from '../../../../logger';
import CloudUploadIcon from '@/icons/basil/Outline/Files/Cloud-upload.svg';
import CloudCheckIcon from '@/icons/basil/Solid/Files/Cloud-check.svg';
import ProgressCircle from '../../ProgressCircle';
import Door43Logo from '@/icons/door43.svg';
import { getGiteaUsersList, handleEditorSync } from './EditorSyncUtils';
import useGetCurrentProjectMeta from '../../hooks/useGetCurrentProjectMeta';
import { getOrPutLastSyncInAgSettings } from '../../Ag/SyncToGiteaUtils';
import { getOrPutLastSyncInAgSettings } from '../../Scribe/SyncToGiteaUtils';

function EditorSync({ selectedProject }) {
const [usersList, setUsersList] = useState([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as localForage from 'localforage';
import { environment } from '../../../../../environment';
import * as logger from '../../../../logger';
import packageInfo from '../../../../../../package.json';
import { uploadToGitea } from '../../Ag/SyncToGitea';
import { uploadToGitea } from '../../Scribe/SyncToGitea';

export async function getGiteaUsersList() {
let usersList = [];
Expand Down
2 changes: 1 addition & 1 deletion renderer/src/components/Sync/Gitea/Gitea.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from 'gitea-react-toolkit';
import GiteaFileBrowser from './GiteaFileBrowser';
import { environment } from '../../../../environment';
import { createSyncProfile } from '../Ag/SyncToGiteaUtils';
import { createSyncProfile } from '../Scribe/SyncToGiteaUtils';

const Gitea = ({ setAuth, setRepo }) => {
const [authentication, setAuthentication] = useState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import React, { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import ConfirmationModal from '@/layouts/editor/ConfirmationModal';
import PropTypes from 'prop-types';
import PopUpModal from '@/layouts/Sync/PopUpModal';
import { SnackBar } from '@/components/SnackBar';
import useAddNotification from '@/components/hooks/useAddNotification';
import PopUpModal from '../../PopUpModal';
import { VerticalLinearStepper } from '../../VerticalStepperProgress';
import { mergeProgressSteps } from './ProjectMergeConst';
import LoadingSpinner from '../../LoadingSpinner';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createFiletoServer } from '../../Ag/SyncToGiteaUtils';
import { createFiletoServer } from '../../Scribe/SyncToGiteaUtils';
import * as logger from '../../../../logger';
import packageInfo from '../../../../../../package.json';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
import { useState, useContext } from 'react';
import { useTranslation } from 'react-i18next';

import ProjectsLayout from '@/layouts/projects/Layout';
// import Gitea from '@/components/Sync/Gitea/Gitea';
import AuthenticationContextProvider from '@/components/Login/AuthenticationContextProvider';
import ProjectContextProvider from '@/components/context/ProjectContext';
import ReferenceContextProvider from '@/components/context/ReferenceContext';
import {
CloudArrowDownIcon,
CloudArrowUpIcon,
} from '@heroicons/react/24/outline';
import ProjectFileBrowser from '@/components/Sync/Ag/ProjectFileBrowser';
import Gitea from '@/components/Sync/Gitea/Gitea';
import { SyncContext } from '@/components/Sync/SyncContextProvider';
import { SnackBar } from '@/components/SnackBar';
import { uploadToGitea } from '@/components/Sync/Ag/SyncToGitea';
import { downloadFromGitea } from '@/components/Sync/Gitea/SyncFromGitea';
import useAddNotification from '@/components/hooks/useAddNotification';
import ConfirmationModal from '@/layouts/editor/ConfirmationModal';
import { cloneAndSetProject, updateSettingsFiles } from '@/components/Sync/Gitea/SyncFromGiteaUtils';
import { checkoutJsonFiles, pullProject } from '@/components/Sync/Isomorphic/utils';
import { SyncContext } from './SyncContextProvider';
import { uploadToGitea } from './Scribe/SyncToGitea';
import { downloadFromGitea } from './Gitea/SyncFromGitea';
import { cloneAndSetProject, updateSettingsFiles } from './Gitea/SyncFromGiteaUtils';
import { checkoutJsonFiles, pullProject } from './Isomorphic/utils';
import Gitea from './Gitea/Gitea';
import ProjectFileBrowser from './Scribe/ProjectFileBrowser';
import Door43Logo from '@/icons/door43.svg';
import * as logger from '../../logger';

Expand Down Expand Up @@ -81,7 +79,7 @@ export default function Sync() {
// for pull without conflict
const checkoutFIles = await checkoutJsonFiles(pullData.fs, pullData.gitprojectDir, pullData.checkoutBranch);
const pullStatus = checkoutFIles && await pullProject(pullData.fs, pullData.gitprojectDir, pullData.userBranch, auth.token.sha1, pullData.checkoutBranch);
pullStatus?.status && await updateSettingsFiles(
pullStatus?.status && await updateSettingsFiles(
pullData.fs,
pullData.sbDataObject,
pullData.projectDir,
Expand Down
2 changes: 1 addition & 1 deletion renderer/src/components/Sync/SyncContextProvider.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react/jsx-no-constructed-context-values */
import React, { createContext } from 'react';
import PropTypes from 'prop-types';
import useSync from './useSync';
import useSync from './hooks/useSync';

export const SyncContext = createContext();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState, useEffect } from 'react';
import * as localForage from 'localforage';
import * as logger from '../../logger';
import fetchProjectsMeta from '../../core/projects/fetchProjectsMeta';
import { getOrPutLastSyncInAgSettings } from './Ag/SyncToGiteaUtils';
import * as logger from '../../../logger';
import fetchProjectsMeta from '../../../core/projects/fetchProjectsMeta';
import { getOrPutLastSyncInAgSettings } from '../Scribe/SyncToGiteaUtils';

function useSync() {
const projectList = [];
Expand Down

0 comments on commit cbc0650

Please sign in to comment.