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

@ -5,7 +5,7 @@ import * as React from "react";
import Button from "../button";
import Pencil from "../icons/pencil.svg";
import Trash from "../icons/trash.svg";
import { usePoll } from "../use-poll";
import { usePoll } from "../poll-context";
import { useUpdateParticipantMutation } from "./mutations";
import ParticipantRowForm from "./participant-row-form";
import { ControlledScrollDiv } from "./poll";
@ -42,10 +42,9 @@ const ParticipantRow: React.VoidFunctionComponent<ParticipantRowProps> = ({
const { mutate: updateParticipantMutation } =
useUpdateParticipantMutation(urlId);
const [deleteParticipantConfirModal, confirmDeleteParticipant] =
useDeleteParticipantModal(urlId, participant.id);
const confirmDeleteParticipant = useDeleteParticipantModal();
const poll = usePoll();
const { poll } = usePoll();
if (editMode) {
return (
<ParticipantRowForm
@ -83,7 +82,6 @@ const ParticipantRow: React.VoidFunctionComponent<ParticipantRowProps> = ({
key={participant.id}
className="group flex h-14 transition-colors hover:bg-slate-50"
>
{deleteParticipantConfirModal}
<div
className="flex shrink-0 items-center px-4"
style={{ width: sidebarWidth }}
@ -136,7 +134,9 @@ const ParticipantRow: React.VoidFunctionComponent<ParticipantRowProps> = ({
<Button
icon={<Trash />}
type="danger"
onClick={confirmDeleteParticipant}
onClick={() => {
confirmDeleteParticipant(participant.id);
}}
/>
) : null}
</div>