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

Preview #345

Merged
merged 2 commits into from
Nov 22, 2023
Merged
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
1 change: 0 additions & 1 deletion src/components/AnnotationChannel/AnnotationChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const AnnotationChannelWithContext = ({
setLargeFontSize,
}) => {

console.log('membersIntersection: ', membersIntersection)
const [, documentZoom] = useContext(DocumentContext);
const [channelAnnotations, , expandedAnnotations] = useContext(DocumentAnnotationsContext);
const [documentFilters] = useContext(DocumentFiltersContext);
Expand Down
13 changes: 7 additions & 6 deletions src/components/DashboardChannels/AnnotationsChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,16 @@ export default function AnnotationsChannel({
if (selectedGroupId && selectedDocumentId) {
const obj = documents[selectedGroupId]

for (const [key, arr] of Object.entries(obj)) {
if (Array.isArray(arr)) {
for (let d of arr) {
if (d._id === selectedDocumentId) {
return d
if (obj) {
for (const [key, arr] of Object.entries(obj)) {
if (Array.isArray(arr)) {
for (let d of arr) {
if (d._id === selectedDocumentId) {
return d
}
}
}
}

}
}

Expand Down
15 changes: 6 additions & 9 deletions src/components/FilterPopover/FilterPopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function FilterPopover({ session }) {
documentGroupNameMapping,
defaultGroupFilteringId,
defaultGroupFilteringIdSelected,
documentVersion,
] = useContext(DocumentFiltersContext);

const [byTagsTypeheadMarginTop, setByTagsTypeheadMarginTop] = useState(0);
Expand Down Expand Up @@ -241,15 +242,12 @@ function FilterPopover({ session }) {
});

useEffect(() => {
console.log('defaultGroupFilteringIdSelected: ', defaultGroupFilteringIdSelected)
if (documentVersion < 4 || !documentVersion) return;
// console.log('defaultGroupFilteringIdSelected: ', defaultGroupFilteringIdSelected)
if (!defaultGroupFilteringIdSelected) return;

console.log('defaultGroupFilteringId: ', defaultGroupFilteringId)

console.log('filterOptions.byGroup: ', filterOptions.byGroup)

const selected = filterOptions.byGroup.find(({ id }) => id === defaultGroupFilteringId)
console.log('selected: ', selected)

if (selected) {
updateFilters('byGroup', [selected])
}
Expand Down Expand Up @@ -277,7 +275,6 @@ function FilterPopover({ session }) {
}, [documentFilters]);

const updateFilters = (type, selected) => {
console.log('selected: ', selected)
documentFilters.filters[type] = selected;

const annotationIds = FilterAnnotations(channelAnnotations, {
Expand Down Expand Up @@ -400,8 +397,8 @@ function FilterPopover({ session }) {
placeholder="Select one or more groups to filter by"
/>
<Form.Text className="text-muted">
{defaultGroupFilteringIdSelected
? '' : 'This option is only enabled for v4 and higher documnents (updated 10/06/2023)'
{documentVersion >= 4
? '' : 'Update! This filter option only works fully for documents made after October 6th, 2023'
}
</Form.Text>

Expand Down
4 changes: 1 addition & 3 deletions src/pages/documents/[slug]/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ const DocumentPage = ({
}
}

console.log('document: ', document)

const documentIsPDF = document && document.uploadContentType && document.uploadContentType.includes('pdf');

const focusedAnnotationsRef = useRef({ left: null, right: null }).current;
Expand Down Expand Up @@ -940,7 +938,7 @@ const DocumentPage = ({
]}
>
<DocumentFiltersContext.Provider
value={[documentFilters, setDocumentFilters, FilterAnnotations, groupNameMapping, defaultGroupFilteringId, defaultGroupFilteringIdSelected]}
value={[documentFilters, setDocumentFilters, FilterAnnotations, groupNameMapping, defaultGroupFilteringId, defaultGroupFilteringIdSelected, document?.version]}
>
<Layout
type="document"
Expand Down
Loading