Skip to content

Commit

Permalink
intiial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
leithonenglish committed Mar 10, 2022
1 parent 726b51f commit b6080d8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
Expand Up @@ -125,6 +125,20 @@ const InfoIndicatorButton = ({
}

useEffect(() => {
const displaySimpleMessage = message => {
setButtonProps({
...initialButtonProps,
tooltip: {
testId: initialButtonProps.testId,
content: message,
overrideShow: false,
show: false,
hoverable: true,
},
active: true,
hoverable: true,
})
}
const buildStatusActions = {
[BuildStatus.UPTODATE]: () => {
if (shouldShowFeedback) {
Expand All @@ -151,22 +165,12 @@ const InfoIndicatorButton = ({
hoverable: true,
})
} else {
setButtonProps({
...initialButtonProps,
tooltip: {
testId: initialButtonProps.testId,
content: `Preview updated ${formatDistance(
Date.now(),
new Date(createdAt),
{ includeSeconds: true }
)} ago`,
overrideShow: false,
show: false,
hoverable: true,
},
active: true,
hoverable: true,
})
const message = `Preview updated ${formatDistance(
Date.now(),
new Date(createdAt),
{ includeSeconds: true }
)} ago`
displaySimpleMessage(message)
}
},
[BuildStatus.SUCCESS]: () => {
Expand Down Expand Up @@ -215,6 +219,10 @@ const InfoIndicatorButton = ({
onClick: onTooltipToogle,
})
},
[BuildStatus.BUILDING]: displaySimpleMessage(`Building your preview...`),
[BuildStatus.QUEUED]: () =>
displaySimpleMessage(`Kicking off your build...`),
[BuildStatus.UPLOADING]: () => displaySimpleMessage(`Deploying...`),
}

// this is because the build status enum is used for ui state - so we can't have 1 ui state that covers multiple build statuses.
Expand Down
Expand Up @@ -3,4 +3,6 @@ export enum BuildStatus {
UPTODATE = `UPTODATE`,
ERROR = `ERROR`,
BUILDING = `BUILDING`,
QUEUED = `QUEUED`,
UPLOADING = `UPLOADING`,
}

0 comments on commit b6080d8

Please sign in to comment.