fix: bug fixes & UI improvements (#2884)

* chore: access restriction for api tokens

* fix: on create module total issues undefined

* fix: cycle board card typo

* chore: fetch modules after creation

* fix: peek module on delete

* fix: peek cycle on delete

* fix: cycle detail sidebar copy link toast

* chore: router replace -> push
This commit is contained in:
Lakhan Baheti 2023-11-27 12:15:10 +05:30 committed by GitHub
parent b2ac7b9ac6
commit 202ecd21df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 7 deletions

View File

@ -30,7 +30,7 @@ export const CycleDeleteModal: React.FC<ICycleDelete> = observer((props) => {
// states // states
const [loader, setLoader] = useState(false); const [loader, setLoader] = useState(false);
const router = useRouter(); const router = useRouter();
const { cycleId } = router.query; const { cycleId, peekCycle } = router.query;
const formSubmit = async () => { const formSubmit = async () => {
setLoader(true); setLoader(true);
@ -57,7 +57,7 @@ export const CycleDeleteModal: React.FC<ICycleDelete> = observer((props) => {
); );
}); });
if (cycleId) router.replace(`/${workspaceSlug}/projects/${projectId}/cycles`); if (cycleId || peekCycle) router.push(`/${workspaceSlug}/projects/${projectId}/cycles`);
handleClose(); handleClose();
} catch (error) { } catch (error) {

View File

@ -102,7 +102,8 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
.then(() => { .then(() => {
setToastAlert({ setToastAlert({
type: "success", type: "success",
title: "Cycle link copied to clipboard", title: "Link Copied!",
message: "Cycle link copied to clipboard.",
}); });
}) })
.catch(() => { .catch(() => {

View File

@ -24,7 +24,7 @@ export const DeleteModuleModal: React.FC<Props> = observer((props) => {
const [isDeleteLoading, setIsDeleteLoading] = useState(false); const [isDeleteLoading, setIsDeleteLoading] = useState(false);
const router = useRouter(); const router = useRouter();
const { workspaceSlug, projectId, moduleId } = router.query; const { workspaceSlug, projectId, moduleId, peekModule } = router.query;
const { module: moduleStore } = useMobxStore(); const { module: moduleStore } = useMobxStore();
@ -43,7 +43,7 @@ export const DeleteModuleModal: React.FC<Props> = observer((props) => {
await moduleStore await moduleStore
.deleteModule(workspaceSlug.toString(), projectId.toString(), data.id) .deleteModule(workspaceSlug.toString(), projectId.toString(), data.id)
.then(() => { .then(() => {
if (moduleId) router.push(`/${workspaceSlug}/projects/${data.project}/modules`); if (moduleId || peekModule) router.push(`/${workspaceSlug}/projects/${data.project}/modules`);
handleClose(); handleClose();
setToastAlert({ setToastAlert({
type: "success", type: "success",

View File

@ -56,7 +56,7 @@ export const ModuleCardItem: React.FC<Props> = observer((props) => {
const moduleStatus = MODULE_STATUS.find((status) => status.value === module.status); const moduleStatus = MODULE_STATUS.find((status) => status.value === module.status);
const issueCount = module const issueCount = module
? moduleTotalIssues === 0 ? !moduleTotalIssues || moduleTotalIssues === 0
? "0 Issue" ? "0 Issue"
: moduleTotalIssues === module.completed_issues : moduleTotalIssues === module.completed_issues
? `${moduleTotalIssues} Issue${moduleTotalIssues > 1 ? "s" : ""}` ? `${moduleTotalIssues} Issue${moduleTotalIssues > 1 ? "s" : ""}`

View File

@ -218,7 +218,7 @@ export class ModuleStore implements IModuleStore {
this.loader = false; this.loader = false;
this.error = null; this.error = null;
}); });
this.fetchModules(workspaceSlug, projectId);
return response; return response;
} catch (error) { } catch (error) {
console.error("Failed to create module in module store", error); console.error("Failed to create module in module store", error);