From 00f713b161ae9ad34225f37b7c6b0f9ff0f18f1b Mon Sep 17 00:00:00 2001 From: Drew Lyton <31733517+drewlyton@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:55:39 -0400 Subject: [PATCH] refactor(structure): cleanup RequestPermissionDialog (#7571) ### Description This PR cleans up some copy paste comment blocks in the RequestPermissionDialog component and telemetry files. ### What to review - Comment changes - Derive length from note value ### Testing No testing necessary. ### Notes for release No release notes --- .../RequestPermissionDialog.tsx | 10 ++++------ .../__telemetry__/RequestPermissionDialog.telemetry.ts | 5 +---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/sanity/src/structure/components/requestPermissionDialog/RequestPermissionDialog.tsx b/packages/sanity/src/structure/components/requestPermissionDialog/RequestPermissionDialog.tsx index 715e1fa30b2..54d2558ac38 100644 --- a/packages/sanity/src/structure/components/requestPermissionDialog/RequestPermissionDialog.tsx +++ b/packages/sanity/src/structure/components/requestPermissionDialog/RequestPermissionDialog.tsx @@ -34,9 +34,9 @@ export interface RequestPermissionDialogProps { } /** - * A confirmation dialog used to prevent unwanted document deletes. Loads all - * the referencing internal and cross-data references prior to showing the - * delete button. + * A dialog that enables the user to request permission to change their + * member role from "Viewer" to "Editor" or "Admin" depending on the + * project's available roles. * * @internal */ @@ -55,7 +55,6 @@ export function RequestPermissionDialog({ const [isSubmitting, setIsSubmitting] = useState(false) const [note, setNote] = useState('') - const [noteLength, setNoteLength] = useState(0) const [msgError, setMsgError] = useState() const [hasTooManyRequests, setHasTooManyRequests] = useState(false) @@ -169,11 +168,10 @@ export function RequestPermissionDialog({ value={note} onChange={(e) => { setNote(e.currentTarget.value) - setNoteLength(e.currentTarget.value.length) }} /> - {`${noteLength}/${MAX_NOTE_LENGTH}`} + {`${note.length}/${MAX_NOTE_LENGTH}`} )} diff --git a/packages/sanity/src/structure/components/requestPermissionDialog/__telemetry__/RequestPermissionDialog.telemetry.ts b/packages/sanity/src/structure/components/requestPermissionDialog/__telemetry__/RequestPermissionDialog.telemetry.ts index a3e03104bb6..0d211d98051 100644 --- a/packages/sanity/src/structure/components/requestPermissionDialog/__telemetry__/RequestPermissionDialog.telemetry.ts +++ b/packages/sanity/src/structure/components/requestPermissionDialog/__telemetry__/RequestPermissionDialog.telemetry.ts @@ -1,9 +1,6 @@ import {defineEvent} from '@sanity/telemetry' -/** - * When a draft in a live edit document is published - * @internal - */ +/** @internal */ export const AskToEditDialogOpened = defineEvent({ name: 'Ask To Edit Dialog Opened', version: 1,