Skip to content

Commit

Permalink
feat: edit page for the operator
Browse files Browse the repository at this point in the history
  • Loading branch information
pbastia committed Mar 4, 2022
1 parent cf08b65 commit 214cca6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/components/Operator/OperatorTableRow.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Button from "@button-inc/bcgov-theme/Button";
import { useRouter } from "next/router";
import { getOperatorViewPageRoute } from "pageRoutes";
import { getOperatorEditPageRoute, getOperatorViewPageRoute } from "pageRoutes";
import { useFragment, graphql } from "react-relay";
import { OperatorTableRow_operator$key } from "__generated__/OperatorTableRow_operator.graphql";

Expand All @@ -27,6 +27,9 @@ const OperatorTableRow: React.FC<Props> = ({ operator }) => {
const handleViewClick = () => {
router.push(getOperatorViewPageRoute(id));
};
const handleEditClick = () => {
router.push(getOperatorEditPageRoute(id));
};

return (
<tr>
Expand All @@ -39,6 +42,9 @@ const OperatorTableRow: React.FC<Props> = ({ operator }) => {
<Button size="small" onClick={handleViewClick}>
View
</Button>
<Button size="small" onClick={handleEditClick}>
Edit
</Button>
</div>
</td>
<style jsx>{`
Expand Down
7 changes: 7 additions & 0 deletions app/pageRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ export const getOperatorViewPageRoute = (operatorId: string) => ({
},
});

export const getOperatorEditPageRoute = (operatorId: string) => ({
pathname: `/cif/operator/[operator]/edit/`,
query: {
operator: operatorId,
},
});

export const getContactsPageRoute = () => ({
pathname: "/cif/contacts/",
});
Expand Down
3 changes: 3 additions & 0 deletions app/pages/cif/operator/[operator]/edit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const editPage = () => <div>EDIT</div>;

export default editPage;

0 comments on commit 214cca6

Please sign in to comment.