Skip to content

Commit

Permalink
[field, desk-tool] hide revert all changes button when not showing cu…
Browse files Browse the repository at this point in the history
…rrent doc version
  • Loading branch information
vicmeow authored and rexxars committed Oct 6, 2020
1 parent 23139e3 commit d42fe24
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions packages/@sanity/field/src/diff/components/ChangeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface Props {
}

export function ChangeList({diff, fields, schemaType}: Props): React.ReactElement | null {
const {documentId} = React.useContext(DocumentChangeContext)
const {documentId, isComparingCurrent} = React.useContext(DocumentChangeContext)
const docOperations = useDocumentOperation(documentId, schemaType.name) as OperationsAPI
const {path} = React.useContext(DiffContext)
const isRoot = path.length === 0
Expand Down Expand Up @@ -88,19 +88,21 @@ export function ChangeList({diff, fields, schemaType}: Props): React.ReactElemen

{showFooter && (
<div className={styles.footer}>
<div className={styles.revertAllContainer} ref={setRevertAllContainerElement}>
<Button
color="danger"
icon={UndoIcon}
kind="secondary"
onClick={handleRevertAllChangesClick}
onMouseEnter={handleRevertAllChangesMouseEnter}
onMouseLeave={handleRevertAllChangesMouseLeave}
// selected={confirmRevertAllOpen}
>
Revert all changes
</Button>
</div>
{isComparingCurrent && (
<div className={styles.revertAllContainer} ref={setRevertAllContainerElement}>
<Button
color="danger"
icon={UndoIcon}
kind="secondary"
onClick={handleRevertAllChangesClick}
onMouseEnter={handleRevertAllChangesMouseEnter}
onMouseLeave={handleRevertAllChangesMouseLeave}
// selected={confirmRevertAllOpen}
>
Revert all changes
</Button>
</div>
)}

{confirmRevertAllOpen && (
<PopoverDialog
Expand Down

0 comments on commit d42fe24

Please sign in to comment.