Skip to content

Commit

Permalink
Merge pull request #177 from kaleido-io/timeline-btn-bug
Browse files Browse the repository at this point in the history
Timeline btn bug
  • Loading branch information
dechdev authored Apr 27, 2022
2 parents eff6db9 + dcee41a commit fee2c55
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 26 deletions.
14 changes: 2 additions & 12 deletions src/components/Cards/EventCards/EventCardWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,14 @@ interface Props {
link?: string;
linkState?: any;
onHandleViewEvent?: any;
onHandleViewTx?: any;
}

export const EventCardWrapper = ({
event,
onHandleViewEvent,
onHandleViewTx,
link,
}: Props) => {
export const EventCardWrapper = ({ event, onHandleViewEvent, link }: Props) => {
const { t } = useTranslation();

return (
<BaseCard
onClick={
onHandleViewTx
? () => onHandleViewTx(event.transaction)
: () => onHandleViewEvent(event)
}
onClick={() => onHandleViewEvent(event)}
title={
event.transaction
? t(FF_TX_CATEGORY_MAP[event.transaction?.type]?.nicename)
Expand Down
3 changes: 2 additions & 1 deletion src/components/Cards/FireFlyCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Box, Grid, Typography } from '@mui/material';
import { IFireFlyCard } from '../../interfaces';
import { DEFAULT_BORDER_RADIUS } from '../../theme';
import { altScrollbarStyle, DEFAULT_BORDER_RADIUS } from '../../theme';
import { FFArrowButton } from '../Buttons/FFArrowButton';

type Props = {
Expand All @@ -19,6 +19,7 @@ export const FireFlyCard: React.FC<Props> = ({ cardData, size }) => {
item
md={12}
lg={size === 'medium' ? 4 : 6}
sx={altScrollbarStyle}
>
<Box
p={2}
Expand Down
29 changes: 19 additions & 10 deletions src/pages/Activity/views/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
IPagedEventResponse,
ITransaction,
} from '../../../interfaces';
import { DEFAULT_PADDING } from '../../../theme';
import { altScrollbarStyle, DEFAULT_PADDING } from '../../../theme';
import { fetchCatcher, fetchWithCredentials } from '../../../utils';
import { isOppositeTimelineEvent } from '../../../utils/timeline';
import { hasAnyEvent } from '../../../utils/wsEvents';
Expand Down Expand Up @@ -138,17 +138,25 @@ export const ActivityTimeline: () => JSX.Element = () => {
item: (
<EventCardWrapper
onHandleViewEvent={(event: IEvent) => {
setViewEvent(event);
setSlideSearchParam(event?.id);
}}
onHandleViewTx={(tx: ITransaction) => {
setViewTx(tx);
setSlideSearchParam(tx?.id);
if (event.transaction) {
setViewTx(event.transaction);
setSlideSearchParam(event?.tx ?? null);
} else {
setViewEvent(event);
setSlideSearchParam(event?.id);
}
}}
link={
event.tx
? FF_NAV_PATHS.activityTxDetailPath(selectedNamespace, event.tx)
: FF_NAV_PATHS.activityEventsPath(selectedNamespace, event.id)
event.transaction
? FF_NAV_PATHS.activityTxDetailPath(
selectedNamespace,
event.transaction.id
)
: FF_NAV_PATHS.activityTxDetailPathWithSlide(
selectedNamespace,
event.tx ?? '',
event.id
)
}
{...{ event }}
/>
Expand All @@ -175,6 +183,7 @@ export const ActivityTimeline: () => JSX.Element = () => {
direction="column"
item
pt={DEFAULT_PADDING}
sx={altScrollbarStyle}
>
<FFTimelineHeader
leftHeader={t('submittedByMe')}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Home/views/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ export const HomeDashboard: () => JSX.Element = () => {
recentEventTxs.map((event) => (
<React.Fragment key={event.id}>
<EventCardWrapper
onHandleViewTx={(tx: ITransaction) => {
setViewTx(tx);
setSlideSearchParam(tx.id);
onHandleViewEvent={(event: IEvent) => {
setViewTx(event.transaction);
setSlideSearchParam(event?.tx ?? null);
}}
link={
event.tx
Expand Down
14 changes: 14 additions & 0 deletions src/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,17 @@ export const themeOptions: ThemeOptions = {
},
},
};

export const altScrollbarStyle = {
overflow: 'overlay',
scrollbarColor: '#1e242a',
'&::-webkit-scrollbar, & *::-webkit-scrollbar': {
cursor: 'pointer',
backgroundColor: '#1e242a',
},
'&::-webkit-scrollbar-thumb, & *::-webkit-scrollbar-thumb': {
borderRadius: 8,
backgroundColor: '#12171d',
border: '3px solid #1e242a',
},
};

0 comments on commit fee2c55

Please sign in to comment.