Skip to content

Commit

Permalink
refactor(structure): cleanup RequestPermissionDialog (#7571)
Browse files Browse the repository at this point in the history
### 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
  • Loading branch information
drewlyton authored Oct 3, 2024
1 parent 80338c4 commit 00f713b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -55,7 +55,6 @@ export function RequestPermissionDialog({
const [isSubmitting, setIsSubmitting] = useState(false)

const [note, setNote] = useState('')
const [noteLength, setNoteLength] = useState<number>(0)

const [msgError, setMsgError] = useState<string | undefined>()
const [hasTooManyRequests, setHasTooManyRequests] = useState<boolean>(false)
Expand Down Expand Up @@ -169,11 +168,10 @@ export function RequestPermissionDialog({
value={note}
onChange={(e) => {
setNote(e.currentTarget.value)
setNoteLength(e.currentTarget.value.length)
}}
/>

<Text align="right" muted size={1}>{`${noteLength}/${MAX_NOTE_LENGTH}`}</Text>
<Text align="right" muted size={1}>{`${note.length}/${MAX_NOTE_LENGTH}`}</Text>
</Stack>
)}
</Stack>
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit 00f713b

Please sign in to comment.