-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - simplify confirm modal * - show TX instead of transaction on orders table on mobile * - rename StackInfo to StackDigest - Move StackDigest above orders * refactor StackModal - extract StackFrequencyAndDates - Rename StackOrdersProgress and move related orders componentd there * update github action node, bun versions
- Loading branch information
1 parent
e05298d
commit 7588fc2
Showing
7 changed files
with
148 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
packages/app/components/stack-modal/StackFrequencyAndDates.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { | ||
StackOrderProps, | ||
stackIsComplete, | ||
stackIsFinishedWithFunds, | ||
totalOrderSlotsDone, | ||
} from "@/models"; | ||
import { BodyText } from "@/ui"; | ||
import { formatFrequencyHours, formatTimestampToDateWithTime } from "@/utils"; | ||
import { ReactNode } from "react"; | ||
|
||
const StackDetail = ({ | ||
title, | ||
children, | ||
}: { | ||
title: string; | ||
children: ReactNode; | ||
}) => ( | ||
<div className="space-y-1"> | ||
<BodyText size={1} className="text-em-low"> | ||
{title} | ||
</BodyText> | ||
<BodyText size={1}>{children}</BodyText> | ||
</div> | ||
); | ||
|
||
export const StackFrequencyAndDates = ({ stackOrder }: StackOrderProps) => { | ||
const orderSlots = stackOrder.orderSlots; | ||
const firstSlot = orderSlots[0]; | ||
const lastSlot = orderSlots[orderSlots.length - 1]; | ||
const nextSlot = orderSlots[totalOrderSlotsDone(stackOrder)]; | ||
|
||
return ( | ||
<div className="grid grid-cols-2 gap-5 px-4 md:px-6 gap-x-8 md:grid-cols-4"> | ||
<StackDetail title="Starts on"> | ||
{formatTimestampToDateWithTime(firstSlot)} | ||
</StackDetail> | ||
<StackDetail title="Ends on"> | ||
{formatTimestampToDateWithTime(lastSlot)} | ||
</StackDetail> | ||
<StackDetail title="Frequency"> | ||
Every {formatFrequencyHours(Number(stackOrder.interval))} | ||
</StackDetail> | ||
<StackDetail title="Next order"> | ||
{stackIsComplete(stackOrder) | ||
? "Complete" | ||
: stackIsFinishedWithFunds(stackOrder) | ||
? "Finished with funds" | ||
: stackOrder.cancelledAt | ||
? "Cancelled" | ||
: formatTimestampToDateWithTime(nextSlot)} | ||
</StackDetail> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters