Skip to content

Commit

Permalink
Merge branch 'develop' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ishvindersethi22 authored Jan 6, 2024
2 parents 4eebc43 + 3348898 commit b01f874
Show file tree
Hide file tree
Showing 10 changed files with 494 additions and 101 deletions.
15 changes: 15 additions & 0 deletions src/redux/reducers/Progress/MetaAnalytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ const diffAnnotationReview = (payload) => {
annotation_cumulative_word_count: (value?.ann_cumulative_word_count),
review_cumulative_word_count: (value?.rew_cumulative_word_count),
diff_annotation_review: (value?.ann_cumulative_word_count - value?.rew_cumulative_word_count),

annotation_cumulative_sentance_count: (value?.total_ann_sentance_count),
review_cumulative_sentance_count: (value?.total_rev_sentance_count),
diff_annotation_review_sentance_count: (value?.total_ann_sentance_count - value?.total_rev_sentance_count),

annotation_audio_word_count: (value?.ann_audio_word_count),
review_audio_word_count: (value?.rev_audio_word_count),
diff_annotation_review_audio_word: (value?.ann_audio_word_count - value?.rev_audio_word_count),

annotation_raw_aud_duration:(value?.ann_raw_aud_duration),
review_raw_aud_duration:(value?.rew_raw_aud_duration),
annotation_raw_aud_duration_tohour:(value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600),
review_raw_aud_duration_tohour:(value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600),
diff_annotation_review_raw_aud_duration_tohour:(value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600 - value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600),

annotation_aud_duration:(value?.ann_cumulative_aud_duration),
review_aud_duration:(value?.rew_cumulative_aud_duration),
annotation_aud_duration_tohour:(value?.ann_cumulative_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.ann_cumulative_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.ann_cumulative_aud_duration?.split(':')?.map(Number)?.[2]/3600),
Expand Down
15 changes: 15 additions & 0 deletions src/redux/reducers/WorkspaceDetails/GetMetaAnalytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ const diffAnnotationReview = (payload) => {
annotation_cumulative_word_count: (value?.ann_cumulative_word_count),
review_cumulative_word_count: (value?.rew_cumulative_word_count),
diff_annotation_review: (value?.ann_cumulative_word_count - value?.rew_cumulative_word_count),

annotation_cumulative_sentance_count: (value?.total_ann_sentance_count),
review_cumulative_sentance_count: (value?.total_rev_sentance_count),
diff_annotation_review_sentance_count: (value?.total_ann_sentance_count - value?.total_rev_sentance_count),

annotation_audio_word_count: (value?.ann_audio_word_count),
review_audio_word_count: (value?.rev_audio_word_count),
diff_annotation_review_audio_word: (value?.ann_audio_word_count - value?.rev_audio_word_count),

annotation_raw_aud_duration:(value?.ann_raw_aud_duration),
review_raw_aud_duration:(value?.rew_raw_aud_duration),
annotation_raw_aud_duration_tohour:(value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600),
review_raw_aud_duration_tohour:(value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600),
diff_annotation_review_raw_aud_duration_tohour:(value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600 - value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600),

annotation_aud_duration:(value?.ann_cumulative_aud_duration),
review_aud_duration:(value?.rew_cumulative_aud_duration),
annotation_aud_duration_tohour:(value?.ann_cumulative_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.ann_cumulative_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.ann_cumulative_aud_duration?.split(':')?.map(Number)?.[2]/3600),
Expand Down
4 changes: 2 additions & 2 deletions src/ui/pages/component/Project/FilterList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const FilterList = (props) => {
</FormControl> : null

}
{currentFilters?.annotation_status && selectedStatus == "labeled" ?
{currentFilters?.annotation_status && selectedStatus !== "unlabeled" ?
<FormControl sx={{ m: 1, minWidth: 125 }} size="small" >
<FormControlLabel
control={
Expand All @@ -186,7 +186,7 @@ const FilterList = (props) => {
}
label={currentFilters?.annotation_status ? "Rejected By reviewer" : currentFilters?.review_status ? "Rejected By SuperChecker" : null}
/>
</FormControl> : currentFilters?.review_status && selectedStatus == "accepted_with_major_changes" || selectedStatus == "accepted_with_minor_changes" || selectedStatus == "accepted" ? <FormControl sx={{ m: 1, minWidth: 125 }} size="small" >
</FormControl> : currentFilters?.review_status && selectedStatus !== "unreviewed" ? <FormControl sx={{ m: 1, minWidth: 125 }} size="small" >

<FormControlLabel
control={
Expand Down
87 changes: 47 additions & 40 deletions src/ui/pages/component/common/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { useEffect, useState } from "react";
import { formatDistanceToNow, format } from 'date-fns';
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
import AccessTimeFilledIcon from '@mui/icons-material/AccessTimeFilled';
import CheckCircleOutlineRoundedIcon from '@mui/icons-material/CheckCircleOutlineRounded';
import GradingSharpIcon from '@mui/icons-material/GradingSharp';
import NotificationsOffIcon from '@mui/icons-material/NotificationsOff';
import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord';
import { Link, NavLink } from "react-router-dom";
Expand Down Expand Up @@ -127,41 +129,37 @@ const Header = () => {
})
.catch((error) => {
console.error("Error fetching notifications:", error);
setnotification(error);
setSnackbarInfo({
open: true,
message: error,
variant: "Error",
});
});
};
const markAsRead = (notificationId) => {
const markAsRead = (notificationId) => {
const task = new NotificationPatchAPI(notificationId);
dispatch(APITransport(task));
fetchNotifications()
setSelectedNotificationId(notificationId);
dispatch(APITransport(task));
fetchNotifications()

};

const markAllAsRead = () => {
const markAllAsRead = () => {
const notificationIds = Notification.map((notification) => notification.id);
const tasks = new NotificationPatchAPI(notificationIds);
dispatch(APITransport(tasks));
fetchNotifications()
setSelectedNotificationId(notificationIds)
dispatch(APITransport(tasks));
fetchNotifications()

};

const handleMarkAllAsReadClick = () => {
const handleMarkAllAsReadClick = () => {
markAllAsRead();
handleMoreHorizonClose()
};

const handleMarkAsRead = () => {
markAsRead(selectedNotificationId);
handlePopoverClose();
const handleMarkAsRead = (notificationId) => {
markAsRead(notificationId);
};


useEffect(() => {
fetchNotifications();
}, [unread]);
}, [unread,selectedNotificationId]);

useEffect(() => {
getLoggedInUserData();
Expand Down Expand Up @@ -214,7 +212,11 @@ const Header = () => {
setSelectedNotificationId(null);
};


const handleopenproject=(id,type)=>{
if(type=="publish_project"){
navigate(`/projects/${id}`);
}
}

const handleOpenUserMenu = (event) => {
setAnchorElUser(event.currentTarget);
Expand Down Expand Up @@ -277,12 +279,12 @@ const Header = () => {
};
const handleTabChange = async (index) => {
if (index === 0) {
await setunread(null);
await setunread(null);
} else if (index === 1) {
await setunread("False");
await setunread("False");
}


};
const handleTagsChange = (event) => {
if (event.target.checked) {
Expand All @@ -309,8 +311,8 @@ const Header = () => {
/>
);
};
const unseenNotifications = Notification?.length>0 && Notification?.filter(notification =>notification?.seen_json && !notification.seen_json[loggedInUserData.id]);

const unseenNotifications = Notification?.length > 0 && Notification?.filter(notification => notification?.seen_json ==null || !notification?.seen_json[loggedInUserData.id]);
console.log(unseenNotifications,'uuu');

const renderTabs = () => {
if (
Expand Down Expand Up @@ -851,7 +853,7 @@ const Header = () => {
<Grid item xs={3} sm={3} md={2}>
<Tooltip title="Notifications">
<IconButton onClick={handleOpenNotification}>
<Badge badgeContent={Notification?.length} color="primary">
<Badge badgeContent={unseenNotifications?.length>0 ?unseenNotifications?.length: null} color="primary">
<NotificationsIcon color="primary.dark" fontSize="large" />
</Badge>

Expand Down Expand Up @@ -1018,9 +1020,9 @@ const Header = () => {
>
<Stack direction="row" style={{ justifyContent: "space-between", padding: "0 10px 0 10px" }} >
<Typography variant="h4">Notifications</Typography>
{Notification && Notification?.length > 0 ? <IconButton aria-label="More" onClick={handleMoreHorizonClick}>
<MoreHorizIcon />
</IconButton>:null}
{Notification && Notification?.length > 0 && unseenNotifications?.length > 0 ? <Tooltip title="Mark all as read"><IconButton aria-label="More" onClick={handleMarkAllAsReadClick}>
<GradingSharpIcon color="primary"/>
</IconButton> </Tooltip>: null}
</Stack>
<Stack direction="row" spacing={2} style={{ padding: "0 0 10px 10px" }}>
<Tabs value={value} onChange={handleChange} sx={{
Expand All @@ -1036,27 +1038,30 @@ const Header = () => {
<>
{Notification.map((notification, index) => (
<div key={index} style={{ display: 'flex', alignItems: 'center', padding: '10px' }}>
<div style={{ marginRight: '10px' }}>
<FiberManualRecordIcon color={ notification?.seen_json
? notification?.seen_json[loggedInUserData.id]
? 'action'
: 'primary'
: "primary"} />
<div style={{ marginRight: '10px' ,cursor:"pointer"}}>
<FiberManualRecordIcon color={notification?.seen_json
? notification?.seen_json[loggedInUserData.id]
? 'action'
: 'primary'
: "primary"} />
</div>
<div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>
<div style={{ display: 'flex', flexDirection: 'column', width: '100%' ,cursor:"pointer"}}>
<div style={{ display: 'flex', flexDirection: 'row', width: '100%' }}>
<Typography variant="subtitle2">{`ID: ${notification?.title?.split('-')[0]}`}</Typography>
<Typography style={{ paddingLeft: "10px" }} variant="subtitle2">{`TITLE: ${notification?.notification_type}`}</Typography>
<Typography style={{ padding: "5px 5px 0px 5px" }} variant="caption" color="action">{`${formatDistanceToNow(new Date(notification?.created_at), { addSuffix: true })}`}</Typography>
</div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: "space-between" }}>
<Typography style={{ justifyContent: "flex-start", width: '100%' }} variant="body2">{notification?.title?.split('-')[1]}</Typography>
<IconButton aria-label="More" onClick={(event) => handleTitleMouseEnter(event, notification?.id)}>
<MoreHorizIcon />
</IconButton>
{notification?.seen_json==null || !notification?.seen_json[loggedInUserData.id] ?
<Tooltip title="Mark as read"><IconButton aria-label="More" onClick={() => handleMarkAsRead(notification?.id)}>
<CheckCircleOutlineRoundedIcon color="primary"/>
</IconButton></Tooltip>:null}
</div>
<Typography variant="caption" color="action">{`Sent on: ${format(new Date(notification?.created_at), 'MMM d, yyyy')}`}</Typography>
{index !== Notification?.length - 1 && <Divider />}
</div>

</div>
))}
</>
Expand Down Expand Up @@ -1099,7 +1104,9 @@ const Header = () => {
horizontal: 'right',
}}
>
<MenuItem onClick={handleMarkAsRead}>Mark as Read</MenuItem>

<MenuItem onClick={handleMarkAsRead}>Mark as Read</MenuItem>

</Popover>

</Box>
Expand Down
Loading

0 comments on commit b01f874

Please sign in to comment.