Skip to content

Commit

Permalink
refactor(core): change revision history label from 'Version' to the m…
Browse files Browse the repository at this point in the history
…ore accurate 'Revision' (#6956)

* refactor(core): change revision history label from 'Version' to the more accurate 'Revision'

* fixup! refactor(core): change revision history label from 'Version' to the more accurate 'Revision'

* fixup! refactor(core): change revision history label from 'Version' to the more accurate 'Revision'
  • Loading branch information
bjoerge committed Jun 18, 2024
1 parent f662ae2 commit b90820c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
10 changes: 8 additions & 2 deletions packages/sanity/src/core/i18n/bundles/studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1585,8 +1585,14 @@ export const studioLocaleStrings = defineLocalesResources('studio', {
'timeline.error.unable-to-load-revision': 'Unable to load revision',
/** Label for when the timeline item is the latest in the history */
'timeline.latest': 'Latest',
/** Label for latest version for timeline menu dropdown */
'timeline.latest-version': 'Latest version',

/** Label for latest revision for timeline menu dropdown */
'timeline.latest-revision': 'Latest revision',
/**
* Label for latest revision for timeline menu dropdown
* @deprecated as of `v3.47.0` `timeline.latest-revision` should be used instead. Note: _usage_ of this key is deprecated, but Studios on `< v3.47.0` still require this key to be _defined_
* */
'timeline.latest-version': 'Latest revision',
/** The aria-label for the list of revisions in the timeline */
'timeline.list.aria-label': 'Document revisions',
/** Label for loading history */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function startFromSnapshot(state: VersionState, doc: SanityDocument) {
* - Internally this class will then try to align the history event to the received
* mutations and then dispatch to the timeline.
*
* - The aligner also maintains the latest version for both the draft and the published version.
* - The aligner also maintains the latest revision for both the draft and the published version.
*
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export const HistoryRestoreAction: DocumentActionComponent = ({id, type, revisio
return null
}, [handleConfirm, isConfirmDialogOpen, onComplete, t])

const isRevisionInitialVersion = revision === '@initial'
const isRevisionLatestVersion = revision === undefined // undefined means latest version
const isRevisionInitial = revision === '@initial'
const isRevisionLatest = revision === undefined // undefined means latest revision

if (isRevisionLatestVersion) {
if (isRevisionLatest) {
return null
}

Expand All @@ -68,13 +68,13 @@ export const HistoryRestoreAction: DocumentActionComponent = ({id, type, revisio
color: 'primary',
onHandle: handle,
title: t(
isRevisionInitialVersion
isRevisionInitial
? 'action.restore.disabled.cannot-restore-initial'
: 'action.restore.tooltip',
),
icon: RestoreIcon,
dialog,
disabled: isRevisionInitialVersion,
disabled: isRevisionInitial,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export function TimelineMenu({chunk, mode, placement}: TimelineMenuProps) {
timestamp: new Date(chunk?.endTimestamp),
formatParams,
})
: t('timeline.latest-version')
: t('timeline.latest-revision')

const sinceLabel = chunk
? t('timeline.since', {
Expand Down

0 comments on commit b90820c

Please sign in to comment.