Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbykumar706584 committed Nov 14, 2023
2 parents 620e6f6 + 604d41e commit 438a446
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion renderer/src/components/Sync/Gitea/GiteaFileBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ const GiteaFileBrowser = ({ changeRepo }) => {
title={`${repo?.name} (${repo.name.split('-').pop().replaceAll('_', ' ')})`}
lastSync={undefined}
selected
isUpload={selectedGiteaProject?.repo?.name === repo?.name && syncProgress.syncStarted}
isUpload={selectedGiteaProject?.repo?.name === repo?.name && syncProgress.syncStarted && syncProgress.syncType === 'syncFrom'}
uploadPercentage={(syncProgress.completedFiles * 100) / syncProgress.totalFiles}
/>
<div className="">
Expand Down
2 changes: 2 additions & 0 deletions renderer/src/components/Sync/Gitea/SyncFromGitea.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export async function downloadFromGitea(repo, auth, setSyncProgress, notifyStatu
setSyncProgress((prev) => ({
...prev,
syncStarted: true,
syncType: 'syncFrom',
totalFiles: 6,
completedFiles: 1,
}));
Expand Down Expand Up @@ -79,6 +80,7 @@ export async function downloadFromGitea(repo, auth, setSyncProgress, notifyStatu
} finally {
setSyncProgress({
syncStarted: false,
syncType: null,
totalFiles: 0,
completedFiles: 0,
});
Expand Down
2 changes: 1 addition & 1 deletion renderer/src/components/Sync/Scribe/ProjectFileBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function ProjectFileBrowser() {
lastSync={projectMeta?.lastSync}
// selected={selectedAgProject?.projectName === projectMeta?.identification?.name?.en}
selected={selectedAgProject?.projectId === Object.keys(projectMeta?.identification.primary.scribe)[0]}
isUpload={selectedAgProject?.projectName === projectMeta?.identification?.name?.en && syncProgress.syncStarted}
isUpload={selectedAgProject?.projectName === projectMeta?.identification?.name?.en && syncProgress.syncStarted && syncProgress.syncType === 'syncTo'}
uploadPercentage={(syncProgress.completedFiles * 100) / syncProgress.totalFiles}
/>
</div>
Expand Down
6 changes: 3 additions & 3 deletions renderer/src/components/Sync/Scribe/SyncToGitea.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function uploadToGitea(projectDataAg, auth, setSyncProgress, notify

if (!checkInit || !checkForRepo?.id) {
setSyncProgress((prev) => ({
...prev, syncStarted: true, completedFiles: 1, totalFiles: 6,
...prev, syncStarted: true, syncType: 'syncTo', completedFiles: 1, totalFiles: 6,
}));
let projectInitialized;
if (!checkInit) {
Expand All @@ -62,7 +62,7 @@ export async function uploadToGitea(projectDataAg, auth, setSyncProgress, notify
}
} else {
setSyncProgress((prev) => ({
...prev, syncStarted: true, completedFiles: 1, totalFiles: 3,
...prev, syncStarted: true, syncType: 'syncTo', completedFiles: 1, totalFiles: 3,
}));
// const repoOwner = await getRepoOwner(fs, projectsMetaPath);
const commitStatus = await commitChanges(fs, projectsMetaPath, { email: auth.user.email, username: auth.user.username }, 'Added from scribe');
Expand Down Expand Up @@ -121,7 +121,7 @@ export async function uploadToGitea(projectDataAg, auth, setSyncProgress, notify
throw new Error(err?.message || err);
} finally {
setSyncProgress((prev) => ({
...prev, syncStarted: false, completedFiles: 0, totalFiles: 0,
...prev, syncStarted: false, syncType: null, completedFiles: 0, totalFiles: 0,
}));
}
});
Expand Down
1 change: 1 addition & 0 deletions renderer/src/components/Sync/hooks/useSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function useSync() {
});
const [syncProgress, setSyncProgress] = useState({
syncStarted: false,
syncType: null,
totalFiles: 0,
completedFiles: 0,
});
Expand Down

0 comments on commit 438a446

Please sign in to comment.