Skip to content

Commit

Permalink
"Top Story" label doesn't appear on some days of the multi-day events (
Browse files Browse the repository at this point in the history
  • Loading branch information
dzonidoo authored and petrjasek committed Sep 3, 2024
1 parent 93ec2a8 commit 1a4d6d2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions assets/agenda/components/AgendaList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class AgendaList extends React.Component<IProps, IState> {
{plans.map((plan) => (
<AgendaListItem
key={`${itemId}--${plan._id}`}
group={group.date}
group={group}
item={cloneDeep(this.props.itemsById[itemId])}
isActive={this.isActiveItem(itemId, group.date, plan)}
isSelected={this.props.selectedItems.includes(itemId)}
Expand Down Expand Up @@ -390,7 +390,7 @@ class AgendaList extends React.Component<IProps, IState> {
) : (
<AgendaListItem
key={itemId}
group={group.date}
group={group}
item={this.props.itemsById[itemId]}
isActive={this.isActiveItem(itemId, group.date, undefined)}
isSelected={this.props.selectedItems.includes(itemId)}
Expand Down
30 changes: 19 additions & 11 deletions assets/agenda/components/AgendaListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import classNames from 'classnames';

import {IAgendaItem, IItemAction, IListConfig, IUser} from 'interfaces';
import {IAgendaItem, IAgendaListGroup, IItemAction, IListConfig, IUser} from 'interfaces';

import ActionButton from 'components/ActionButton';
import AgendaListItemIcons from './AgendaListItemIcons';
Expand All @@ -27,7 +27,7 @@ import {LabelGroup} from 'ui/components/LabelGroup';

interface IProps {
item: IAgendaItem;
group: string;
group: IAgendaListGroup;
isActive: boolean;
isSelected: boolean;
isRead: boolean;
Expand All @@ -40,9 +40,9 @@ interface IProps {
showShortcutActionIcons: boolean;
listConfig: IListConfig;

onClick(item: IAgendaItem, group: string, planningId?: IAgendaItem['_id']): void;
onDoubleClick(item: IAgendaItem, group: string, planningId?: IAgendaItem['_id']): void;
onActionList(event: React.MouseEvent, item: IAgendaItem, group: string, plan?: IAgendaItem): void;
onClick(item: IAgendaItem, date: string, planningId?: IAgendaItem['_id']): void;
onDoubleClick(item: IAgendaItem, date: string, planningId?: IAgendaItem['_id']): void;
onActionList(event: React.MouseEvent, item: IAgendaItem, date: string, plan?: IAgendaItem): void;
toggleSelected(): void;
resetActioningItem(): void;
}
Expand Down Expand Up @@ -83,11 +83,11 @@ class AgendaListItem extends React.Component<IProps> {
}

onArticleClick() {
this.props.onClick(this.props.item, this.props.group, this.props.planningId);
this.props.onClick(this.props.item, this.props.group.date, this.props.planningId);
}

onArticleDoubleClick() {
this.props.onDoubleClick(this.props.item, this.props.group, this.props.planningId);
this.props.onDoubleClick(this.props.item, this.props.group.date, this.props.planningId);
}

onMouseEnter() {
Expand Down Expand Up @@ -293,6 +293,14 @@ class AgendaListItem extends React.Component<IProps> {
}
})();

const renderTopStoryLabel = () => {
if (group.hiddenItems.includes(item._id) === false) {
return <TopStoryLabel item={item} config={listConfig} />;
} else {
return null;
}
};

return (
<article key={item._id}
className={classes.card}
Expand All @@ -305,7 +313,7 @@ class AgendaListItem extends React.Component<IProps> {
<div className={classes.wrap} tabIndex={0}>
<div className={classes.article} key="article">
<LabelGroup>
<TopStoryLabel item={item} config={listConfig} />
{renderTopStoryLabel()}
<ToBeConfirmedLabel item={item} />
</LabelGroup>

Expand Down Expand Up @@ -338,7 +346,7 @@ class AgendaListItem extends React.Component<IProps> {

<AgendaListItemIcons
item={item}
group={group}
group={group.date}
planningItem={planningItem}
isMobilePhone={isMobile}
user={this.props.user}
Expand Down Expand Up @@ -367,7 +375,7 @@ class AgendaListItem extends React.Component<IProps> {
item={this.props.item}
plan={planningItem}
user={this.props.user}
group={this.props.group}
group={this.props.group.date}
actions={this.props.actions}
onActionList={this.props.onActionList}
showActions={this.props.showActions}
Expand Down Expand Up @@ -418,7 +426,7 @@ class AgendaListItem extends React.Component<IProps> {
item={this.props.item}
plan={planningItem}
user={this.props.user}
group={this.props.group}
group={this.props.group.date}
actions={this.props.actions}
onActionList={this.props.onActionList}
showActions={this.props.showActions}
Expand Down

0 comments on commit 1a4d6d2

Please sign in to comment.