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

MessageTimeline stages link added #1

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
34 changes: 30 additions & 4 deletions src/messages/MessageTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface Props {
timings: StageTimings;
timestampSent?: number;
hideDescriptions?: boolean;
externalLink?: string;
}

export function MessageTimeline({
Expand All @@ -23,6 +24,7 @@ export function MessageTimeline({
timings,
timestampSent,
hideDescriptions,
externalLink,
}: Props) {
// Ignore stage value if status shows as delivered
const stage = status === MessageStatus.Delivered ? Stage.Relayed : _stage;
Expand All @@ -32,9 +34,18 @@ export function MessageTimeline({
? `${timeSent.toLocaleDateString()} ${timeSent.toLocaleTimeString()}`
: null;

const onStageClickHandler = () => {
if (externalLink) window.open(externalLink, '_blank', 'noreferrer');
};

return (
<div className="htw-pt-14 htw-pb-1 htw-flex htw-w-full">
<div className={styles.stageContainer}>
<div
onClick={onStageClickHandler}
className={`${styles.stageContainer} ${
externalLink ? 'htw-cursor-pointer' : 'htw-cursor-auto'
}`}
>
<div
className={`${styles.stageBar} htw-rounded-l ${getStageOpacityClass(
Stage.Sent,
Expand All @@ -59,7 +70,12 @@ export function MessageTimeline({
)}
</div>
<div className={styles.stageSpacer}></div>
<div className={styles.stageContainer}>
<div
onClick={onStageClickHandler}
className={`${styles.stageContainer} ${
externalLink ? 'htw-cursor-pointer' : 'htw-cursor-auto'
}`}
>
<div
className={`${styles.stageBar} ${getStageOpacityClass(Stage.Finalized, stage, status)}`}
>
Expand All @@ -79,7 +95,12 @@ export function MessageTimeline({
)}
</div>
<div className={styles.stageSpacer}></div>
<div className={styles.stageContainer}>
<div
onClick={onStageClickHandler}
className={`${styles.stageContainer} ${
externalLink ? 'htw-cursor-pointer' : 'htw-cursor-auto'
}`}
>
<div
className={`${styles.stageBar} ${getStageOpacityClass(Stage.Validated, stage, status)}`}
>
Expand All @@ -99,7 +120,12 @@ export function MessageTimeline({
)}
</div>
<div className={styles.stageSpacer}></div>
<div className={styles.stageContainer}>
<div
onClick={onStageClickHandler}
className={`${styles.stageContainer} ${
externalLink ? 'htw-cursor-pointer' : 'htw-cursor-auto'
}`}
>
<div
className={`${styles.stageBar} htw-rounded-r ${getStageOpacityClass(
Stage.Relayed,
Expand Down