Skip to content
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

Fix spatial demo #31

Draft
wants to merge 1 commit into
base: patchwork
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DocExplorer/components/DocExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const DocExplorer: React.FC = () => {
const [rootFolderDoc, changeRootFolderDoc] = useCurrentRootFolderDoc();

const [showSidebar, setShowSidebar] = useState(true);
const [showToolPicker, setShowToolPicker] = useState(false);
const [showToolPicker, setShowToolPicker] = useState(true);

const { selectedDoc, selectDoc, selectedDocUrl } = useSelectedDoc({
rootFolderDoc,
Expand Down
2 changes: 1 addition & 1 deletion src/patchwork/components/SideBySide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ function useHighlights(

return [
{
class: "text-[#D59C1E]",
class: "bg-yellow-50",
from,
to,
},
Expand Down
37 changes: 19 additions & 18 deletions src/tee/codemirrorPlugins/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,28 @@ export const annotationDecorations = EditorView.decorations.compute(
// TODO: for threads which represent edit groups and point to multiple ranges of text,
// we can highight all of those multiple ranges here.
const decorations =
sortBy(annotations ?? [], (annotation) => annotation.from)?.flatMap(
(annotation) => {
if (annotation.to === annotation.from) {
return [];
}
sortBy(
annotations.filter((anotation) => anotation) ?? [],
(annotation) => annotation.from
)?.flatMap((annotation) => {
if (annotation.to === annotation.from) {
return [];
}

if (
!("type" in annotation) ||
(annotation.type !== "thread" && annotation.type !== "discussion")
) {
return [];
}
if (
!("type" in annotation) ||
(annotation.type !== "thread" && annotation.type !== "discussion")
) {
return [];
}

const cmRange = amRangeToCMRange(annotation);
if (annotation.active) {
return activeThreadDecoration.range(cmRange.from, cmRange.to);
} else {
return commentThreadDecoration.range(cmRange.from, cmRange.to);
}
const cmRange = amRangeToCMRange(annotation);
if (annotation.active) {
return activeThreadDecoration.range(cmRange.from, cmRange.to);
} else {
return commentThreadDecoration.range(cmRange.from, cmRange.to);
}
) ?? [];
}) ?? [];

return Decoration.set(decorations);
}
Expand Down
2 changes: 1 addition & 1 deletion src/tee/codemirrorPlugins/patchDecorations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const patchDecorations = (diffStyle: DiffStyle) =>
EditorView.decorations.compute([patchesField, annotationsField], (state) => {
const activeAnnotations = state
.field(annotationsField)
.filter((annotationsField) => annotationsField.active);
.filter((annotationsField) => annotationsField?.active);

const patches = state
.field(patchesField)
Expand Down