-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(structure): History UI updates #7462
Changes from all commits
f24db84
67c3925
8e3b935
5f982a9
fbdbe12
d378006
be7191c
ffc494b
b68ae65
894c5b5
2805106
4642713
5618b2b
d97335f
89c8120
fa27a83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export {DateInput, type DateInputProps} from './DateInput' | ||
export {DateTimeInput, type DateTimeInputProps} from './DateTimeInput' | ||
export {getCalendarLabels} from './utils' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,7 +194,6 @@ export function useTimelineStore({ | |
findRangeForSince: (chunk: Chunk) => controller.findRangeForNewSince(chunk), | ||
loadMore: () => { | ||
controller.setLoadMore(true) | ||
timelineStateRef.current.isLoading = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed this in some cases was blocking the ui in a loading state, which never ended because the load more action was not actually fetching new data, so the controller was not triggering any update, so the |
||
}, | ||
getSnapshot: () => timelineStateRef.current, | ||
subscribe: (callback: () => void) => { | ||
|
@@ -217,7 +216,7 @@ export function useTimelineStore({ | |
return { | ||
chunks, | ||
diff: innerController.sinceTime ? innerController.currentObjectDiff() : null, | ||
isLoading: false, | ||
isLoading: innerController.isLoading, | ||
isPristine: timelineReady ? chunks.length === 0 && hasMoreChunks === false : null, | ||
hasMoreChunks: !innerController.timeline.reachedEarliestEntry, | ||
lastNonDeletedRevId: lastNonDeletedChunk?.[0]?.id, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,19 +111,14 @@ export const PublishAction: DocumentActionComponent = (props) => { | |
|
||
useEffect(() => { | ||
const didPublish = publishState === 'publishing' && !hasDraft | ||
if (didPublish) { | ||
if (changesOpen) { | ||
// Re-open the panel | ||
onHistoryOpen() | ||
} | ||
} | ||
Comment on lines
-114
to
-119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not necessary, the history panel won't close when a publish action happens. |
||
|
||
const nextState = didPublish ? 'published' : null | ||
const delay = didPublish ? 200 : 4000 | ||
const timer = setTimeout(() => { | ||
setPublishState(nextState) | ||
}, delay) | ||
return () => clearTimeout(timer) | ||
}, [changesOpen, publishState, hasDraft, onHistoryOpen]) | ||
}, [changesOpen, publishState, hasDraft]) | ||
|
||
const telemetry = useTelemetry() | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,7 @@ import { | |
useMemo, | ||
useState, | ||
} from 'react' | ||
import { | ||
type DocumentActionDescription, | ||
useFieldActions, | ||
useTimelineSelector, | ||
useTranslation, | ||
} from 'sanity' | ||
import {type DocumentActionDescription, useFieldActions, useTranslation} from 'sanity' | ||
|
||
import {Button, TooltipDelayGroupProvider} from '../../../../../ui-components' | ||
import { | ||
|
@@ -33,7 +28,6 @@ import {type PaneMenuItem} from '../../../../types' | |
import {useStructureTool} from '../../../../useStructureTool' | ||
import {ActionDialogWrapper, ActionMenuListItem} from '../../statusBar/ActionMenuButton' | ||
import {isRestoreAction} from '../../statusBar/DocumentStatusBarActions' | ||
import {TimelineMenu} from '../../timeline' | ||
import {useDocumentPane} from '../../useDocumentPane' | ||
import {DocumentHeaderTabs} from './DocumentHeaderTabs' | ||
import {DocumentHeaderTitle} from './DocumentHeaderTitle' | ||
|
@@ -57,7 +51,6 @@ export const DocumentPanelHeader = memo( | |
onPaneSplit, | ||
menuItemGroups, | ||
schemaType, | ||
timelineStore, | ||
connectionState, | ||
views, | ||
unstable_languageFilter, | ||
|
@@ -84,9 +77,6 @@ export const DocumentPanelHeader = memo( | |
const contextMenuNodes = useMemo(() => menuNodes.filter(isNotMenuNodeButton), [menuNodes]) | ||
const showTabs = views.length > 1 | ||
|
||
// Subscribe to external timeline state changes | ||
const rev = useTimelineSelector(timelineStore, (state) => state.revTime) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was removed from the Header and moved to |
||
|
||
const {collapsed, isLast} = usePane() | ||
// Prevent focus if this is the last (non-collapsed) pane. | ||
const tabIndex = isLast && !collapsed ? -1 : 0 | ||
|
@@ -152,7 +142,6 @@ export const DocumentPanelHeader = memo( | |
/> | ||
) | ||
} | ||
subActions={<TimelineMenu chunk={rev} mode="rev" placement="bottom-end" />} | ||
actions={ | ||
<Flex align="center" gap={1}> | ||
{unstable_languageFilter.length > 0 && ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Is there any need for this now? I don't imagine the formatting here will be localized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, actually I'm removing that in the changes I'm introducing for this in
corel
I think we can clear it there.