Skip to content

Commit 2a958d5

Browse files
authored
Merge pull request #201 from sillsdev/TT-7063
TT-7063 TT-7064 TT-7065
2 parents 083e06d + c9d713c commit 2a958d5

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

src/renderer/src/components/Team/ProjectCard.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import {
5555
} from '../../crud';
5656
import { localizeProjectTag } from '../../utils/localizeProjectTag';
5757
import OfflineIcon from '@mui/icons-material/OfflinePin';
58-
import { useHome, useJsonParams } from '../../utils';
58+
import { useDataChanges, useHome, useJsonParams } from '../../utils';
5959
import { copyComplete, CopyProjectProps } from '../../store';
6060
import { TokenContext } from '../../context/TokenProvider';
6161
import { useSnackBar } from '../../hoc/SnackBar';
@@ -139,6 +139,7 @@ export const ProjectCard = (props: IProps) => {
139139
doImport,
140140
} = ctx.state;
141141
const dispatch = useDispatch();
142+
const forceDataChanges = useDataChanges();
142143

143144
const copyProject = (props: CopyProjectProps) =>
144145
dispatch(actions.copyProject(props) as any);
@@ -211,8 +212,16 @@ export const ProjectCard = (props: IProps) => {
211212
if (copyStatus.errStatus || copyStatus.complete) {
212213
copyComplete();
213214
setCopying(false);
214-
setBusy(false);
215-
showMessage(copyStatus.errMsg ?? copyStatus.statusMsg);
215+
forceDataChanges()
216+
.then(() => {
217+
setBusy(false);
218+
showMessage(
219+
copyStatus.errMsg ?? copyStatus.statusMsg ?? 'COPY COMPLETE'
220+
);
221+
})
222+
.catch((err) => {
223+
showMessage(err.message);
224+
});
216225
} else showMessage(copyStatus.statusMsg);
217226
}
218227
/* eslint-disable-next-line react-hooks/exhaustive-deps */
@@ -593,7 +602,11 @@ export const ProjectCard = (props: IProps) => {
593602
</DialogContent>
594603
<DialogActions>
595604
<Button onClick={handleCopyCancel}>{t.cancel || 'Cancel'}</Button>
596-
<Button onClick={handleCopyConfirm} variant="contained">
605+
<Button
606+
onClick={handleCopyConfirm}
607+
variant="contained"
608+
disabled={copying || selectedTeamId === ''}
609+
>
597610
{t.copyProject || 'Copy'}
598611
</Button>
599612
</DialogActions>

src/renderer/src/components/Team/ProjectMenu.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ export function ProjectMenu(props: IProps) {
9494
}
9595
};
9696

97-
useEffect(() => { });
98-
9997
const offlineProject = offlineProjectRead(project);
10098

10199
return (
@@ -116,14 +114,17 @@ export function ProjectMenu(props: IProps) {
116114
open={Boolean(anchorEl)}
117115
onClose={handle('Close')}
118116
>
119-
{!isMobileWidth && !inProject && isAdmin && (!isOffline || offlineOnly) && (
120-
<StyledMenuItem id="projMenuSettings" onClick={handle('settings')}>
121-
<ListItemIcon>
122-
<SettingsIcon />
123-
</ListItemIcon>
124-
<ListItemText primary={t.settings} />
125-
</StyledMenuItem>
126-
)}
117+
{!isMobileWidth &&
118+
!inProject &&
119+
isAdmin &&
120+
(!isOffline || offlineOnly) && (
121+
<StyledMenuItem id="projMenuSettings" onClick={handle('settings')}>
122+
<ListItemIcon>
123+
<SettingsIcon />
124+
</ListItemIcon>
125+
<ListItemText primary={t.settings} />
126+
</StyledMenuItem>
127+
)}
127128
{!isMobileWidth && !inProject && isAdmin && !isOffline && (
128129
<StyledMenuItem id="projMenuCopy" onClick={handle('copyproject')}>
129130
<ListItemIcon>

0 commit comments

Comments
 (0)