Skip to content

Commit

Permalink
feature: Integrate the SurveyLink component to handle seeing complete…
Browse files Browse the repository at this point in the history
…d surveys

   1. Replace the survey link button with the SurveyLink component.
   2. Remove handleUserLink since the component now handles that.
  • Loading branch information
EfrainAD committed Oct 13, 2023
1 parent 7df9348 commit 05dba75
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions frontend/front/src/pages/Admin/home/HomeTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import Loader from "../../../components/Loader";
import React from "react";

import { useGetHomesQuery } from "../../../api/apiSlice";
import { useNavigate } from "react-router-dom";
import { ADMIN_HOME, withAdminPrefix } from "../../../routing/routes";
import SurveyLink from "../../../components/SurveyLink";

// Formats addresses
export const getAddress = (params) => {
Expand All @@ -27,7 +27,6 @@ export const getAddress = (params) => {

const HomeTable = () => {
const goToBreadcrumb = useGoToBreadcrumb();
const navigate = useNavigate();

useInitBreadcrumbs(
[{ url: withAdminPrefix(ADMIN_HOME), description: "homes" }],
Expand All @@ -36,10 +35,6 @@ const HomeTable = () => {

const handleHomeLink = (home) => goToBreadcrumb("home", home);

const handleUserLink = (home) => {
navigate(`/admin/survey/visit/${home.survey_visit_ids[0]}`);
};

const handleAssignmentLink = (assignment) =>
goToBreadcrumb("assignment", assignment);

Expand Down Expand Up @@ -90,15 +85,14 @@ const HomeTable = () => {
headerName: "Completed",
renderCell: (params) =>
params.row.completed ? (
<Button
<SurveyLink
label={"Yes ✅"}
links={params.row.survey_visit_ids}
variant="text"
sx={{ minWidth: "unset", padding: "0px" }}
color="primary"
size="small"
onClick={() => handleUserLink(params.row)}
>
Yes ✅
</Button>
/>
) : (
"No"
),
Expand Down

0 comments on commit 05dba75

Please sign in to comment.