diff --git a/cypress/e2e/routing.cy.js b/cypress/e2e/routing.cy.js index 4dde687..7ed4351 100644 --- a/cypress/e2e/routing.cy.js +++ b/cypress/e2e/routing.cy.js @@ -51,4 +51,12 @@ describe("Routing-related navigation", () => { cy.get(".logoWrap").click(); cy.get('[data-cy="draft"]').should("have.class", "tabActive"); }); + + it("can set to default page number when go back on finalized", () => { + cy.get('[data-cy="draft"]').click(); + cy.get('[data-cy="next-page"]').click(); + cy.get('[data-cy="finalized"]').click(); + // cy.get("tbody>tr>td").not(".nonSelected"); + cy.get("table").find("tr").should("have.length.greaterThan", 1); + }); }); diff --git a/src/DataTable/TemplateTable.tsx b/src/DataTable/TemplateTable.tsx index b19316b..bfaed2b 100644 --- a/src/DataTable/TemplateTable.tsx +++ b/src/DataTable/TemplateTable.tsx @@ -59,7 +59,7 @@ const columns = [ }, ]; -export default function TemplateTable({ data }) { +export default function TemplateTable({ data, tabsMode }) { const [rowSelection, setRowSelection] = useState({}); const [pagination, setPagination] = useState({ pageIndex: 0, @@ -110,6 +110,10 @@ export default function TemplateTable({ data }) { setIdShosen(data && rowSelection ? data[rowSelection]?.uuid : null); }, [rowSelection, pagination]); + useEffect(() => { + table.setPageIndex(0); + }, [tabsMode]); + return (
diff --git a/src/DialogComp/CreateNewDialog.tsx b/src/DialogComp/CreateNewDialog.tsx index 1a2573e..6623d83 100644 --- a/src/DialogComp/CreateNewDialog.tsx +++ b/src/DialogComp/CreateNewDialog.tsx @@ -1,23 +1,22 @@ import * as Dialog from "@radix-ui/react-dialog"; -import React, { useEffect, useState } from "react"; -import config from "../utils/config"; +import React from "react"; import { Model } from "survey-core"; import { json } from "../SurveyComp/json"; -import Button from "@/ui/Button"; +import config from "../utils/config"; +import { Navigate } from "react-router-dom"; import { - useSetUuid, - useUuid, - useName, - useSetName, - useAuthor, - useSetAuthor, useAcknowledgment, + useAuthor, + useName, useSetAcknowledgment, + useSetAuthor, useSetIsShosen, + useSetName, + useSetUuid, + useUuid, } from "../store/store"; import "./styles.css"; -import { Navigate } from "react-router-dom"; const CreateNewDialog = () => { const setUUID = useSetUuid(); diff --git a/src/StartScreenComp/StartScreenComp.tsx b/src/StartScreenComp/StartScreenComp.tsx index ace189c..06d9a26 100644 --- a/src/StartScreenComp/StartScreenComp.tsx +++ b/src/StartScreenComp/StartScreenComp.tsx @@ -116,7 +116,10 @@ export default function StartScreenComp({}) {
- +
{tabsMode == "Draft" && (