Improvements to mobile UI (#119)

This commit is contained in:
Luke Vella 2022-04-20 16:09:38 +01:00 committed by GitHub
parent f206d31083
commit dde0fe8ea1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 971 additions and 317 deletions

View file

@ -1,6 +1,6 @@
import { updatePoll, UpdatePollPayload } from "api-client/update-poll";
import { usePlausible } from "next-plausible";
import { useMutation, useQuery, useQueryClient } from "react-query";
import { useMutation, useQueryClient } from "react-query";
import { addParticipant } from "../../api-client/add-participant";
import {
@ -12,7 +12,7 @@ import {
updateParticipant,
UpdateParticipantPayload,
} from "../../api-client/update-participant";
import { usePoll } from "../use-poll";
import { usePoll } from "../poll-context";
import { useUserName } from "../user-name-context";
import { ParticipantForm } from "./types";
@ -83,7 +83,7 @@ export const useUpdateParticipantMutation = (pollId: string) => {
);
};
export const useDeleteParticipantMutation = (pollId: string) => {
export const useDeleteParticipantMutation = () => {
const queryClient = useQueryClient();
const plausible = usePlausible();
return useMutation(
@ -92,7 +92,7 @@ export const useDeleteParticipantMutation = (pollId: string) => {
onSuccess: () => {
plausible("Remove participant");
},
onSettled: () => {
onSettled: (_data, _error, { pollId }) => {
queryClient.invalidateQueries(["getPoll", pollId]);
},
},
@ -100,7 +100,7 @@ export const useDeleteParticipantMutation = (pollId: string) => {
};
export const useUpdatePollMutation = () => {
const poll = usePoll();
const { poll } = usePoll();
const plausible = usePlausible();
const queryClient = useQueryClient();