Skip to content

Commit

Permalink
Merge pull request #344 from mitaai/preview
Browse files Browse the repository at this point in the history
updates to filtering
  • Loading branch information
mbogo-mit authored Nov 17, 2023
2 parents 1d79820 + 0f415d7 commit f09ef86
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
25 changes: 23 additions & 2 deletions src/components/DashboardChannels/AnnotationsChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,29 @@ export default function AnnotationsChannel({
callback();
}).current;

const getDocumentFromDocuments = () => {
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
}
}
}

}
}

return undefined
}

const byWithGroupId = (anno) => (
getDocumentFromDocuments()?.version === 4 ? byGroupFilterMatch(anno?.creator?.withGroupId ? [anno?.creator?.withGroupId] : [], [selectedGroupId]) : true
);

const loadComponent = loadMore
? <ListLoadingSpinner />
: (
Expand Down Expand Up @@ -232,8 +255,6 @@ export default function AnnotationsChannel({
byDateCreated: <CalendarEventFill size={14} style={{ marginRight: 4 }} />,
};

const byWithGroupId = (anno) => byGroupFilterMatch(anno?.creator?.withGroupId ? [anno?.creator?.withGroupId] : [], [selectedGroupId]);

const buttons = [
{
text: 'Mine',
Expand Down
2 changes: 1 addition & 1 deletion src/components/DashboardChannels/GroupsChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default function GroupsChannel({
) || []).concat(seachQueryGroups.sort(sortGroups));

// Personal Psuedo group will only be apart of the active groups not archived
console.log(rawGroupTiles);
// console.log(rawGroupTiles);
groupTiles = rawGroupTiles.map(({
id, name, memberCount, role, isPrivateGroup,
}) => (
Expand Down
4 changes: 2 additions & 2 deletions src/components/FilterPopover/FilterPopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function FilterPopover({ session }) {
};

const GenerateFilterOptions = (userEmail, annotations, filters) => {
console.log('annotations: ', annotations)
// console.log('annotations: ', annotations)
// this function takes in a list of annotations and returns an object of all
// the filter options that are available for this list of annotations and how
// many matches each option has with the current filtres applied
Expand Down Expand Up @@ -222,7 +222,7 @@ function FilterPopover({ session }) {

const filterOptions = GenerateFilterOptions(session.user.email, channelAnnotations, f);

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

const numberOfMatchesForNoTag = GetNumberOfMatchesForNoTag(channelAnnotations, f);

Expand Down

0 comments on commit f09ef86

Please sign in to comment.