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

Activity bug fixes. #833

Merged
merged 1 commit into from
Jul 20, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ const ActivityItem: React.FC<ActivityItemProps> = ({
<Grid display="flex" flexWrap="nowrap" alignItems="center">
<UserIcon stroke="black" />
<Typography variant="body1" sx={{ ml: 0.5 }}>
{activity.createdBy?.identity.username ||
activity.createdBy?.owner?.name}
{activity.createdBy?.owner?.name ||
activity.createdBy?.identity.username}
</Typography>
</Grid>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ const ActivityItem: React.FC<ActivityItemProps> = ({
<Grid display="flex" flexWrap="nowrap" alignItems="center">
<UserIcon stroke="black" />
<Typography variant="body1" sx={{ ml: 0.5 }}>
{activity.createdBy?.identity.username ||
activity.createdBy?.owner?.name}
{activity.createdBy?.owner?.name ||
activity.createdBy?.identity.username}
</Typography>
</Grid>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const DatasetFieldInfoEditForm: React.FC<
datasetFieldId,
datasetFieldUpdateFormData: {
labelNames: data.labels.map(label => label.name),
description: data.internalDescription || undefined,
description: data.internalDescription.trim() || undefined,
},
}).then(
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ export const LabelItemsContainer = styled(Box)(({ theme }) => ({
paddingBottom: theme.spacing(1.5),
borderBottom: '1px solid',
borderBottomColor: theme.palette.backgrounds.primary,
display: 'flex',
alignItems: 'center',
flexWrap: 'wrap',
}));
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ const EnumsActivityField: React.FC<EnumsActivityFieldProps> = ({
<Grid container flexDirection="column">
<ActivityFieldHeader
startText=""
activityName="ENUM association"
activityName="Dataset field values"
eventType={activityEvent}
showDetailsBtn
detailsBtnOnClick={() => setIsDetailsOpen(!isDetailsOpen)}
isDetailsOpen={isDetailsOpen}
plural
/>
<ActivityFieldState
stateDirection="column"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const StringActivityField: React.FC<StringActivityFieldProps> = ({
});

React.useEffect(() => {
if (newState && oldState === undefined) {
if (newState && (oldState === undefined || oldState.length === 0)) {
setFieldData({
oldValue: '',
newValue: newState,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Box, PopoverProps, Theme } from '@mui/material';
import { PopoverProps, Theme } from '@mui/material';
import { SxProps } from '@mui/system';
import * as S from './AppPopoverStyles';

Expand Down Expand Up @@ -50,7 +50,7 @@ const AppPopover: React.FC<AppPopoverProps> = ({
anchorOrigin={anchorOrigin}
disableRestoreFocus
>
<Box sx={childrenSx}>{children}</Box>
<S.PopoverChildren sx={childrenSx}>{children}</S.PopoverChildren>
</S.AppPopover>
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from 'styled-components';
import { Popover, popoverClasses } from '@mui/material';
import { Box, Popover, popoverClasses } from '@mui/material';

export const AppPopover = styled(Popover)(({ theme }) => ({
[`&.${popoverClasses.root}`]: {
Expand All @@ -13,3 +13,9 @@ export const AppPopover = styled(Popover)(({ theme }) => ({
},
},
}));

export const PopoverChildren = styled(Box)(({ theme }) => ({
display: 'flex',
flexWrap: 'wrap',
alignItems: 'center',
}));
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import TruncateMarkup from 'react-truncate-markup';
import { Label } from 'generated-sources';
import LabelItem from 'components/shared/LabelItem/LabelItem';
import { Grid } from '@mui/material';
import TruncatedLabelMenu from './TruncatedLabelMenu/TruncatedLabelMenu';

interface TruncatedLabelProps {
Expand All @@ -19,7 +20,7 @@ const TruncatedLabel: React.FC<TruncatedLabelProps> = ({
onTruncate={() => onSizeChange()}
ellipsis={<TruncatedLabelMenu labelList={labelList} />}
>
<div>
<Grid container alignItems="center">
{labelList?.map(label => (
<TruncateMarkup.Atom key={label.id}>
<LabelItem
Expand All @@ -28,7 +29,7 @@ const TruncatedLabel: React.FC<TruncatedLabelProps> = ({
/>
</TruncateMarkup.Atom>
))}
</div>
</Grid>
</TruncateMarkup>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions odd-platform-ui/src/redux/reducers/activity.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ const updateActivitiesState = (
): ActivitiesState => {
const { activities, pageInfo } = payload;

return activities.reduce(
return activities.reduceRight(
(memo: ActivitiesState, activity: Activity) => ({
...memo,
activitiesByDate: {
...memo.activitiesByDate,
[formattedDate(activity.createdAt)]: uniqBy(
[
activity,
...(memo.activitiesByDate[formattedDate(activity.createdAt)] ||
[]),
activity,
],
'id'
),
Expand Down