feat(gui): Clearly mark makers that have no available funds as having no available funds

This commit is contained in:
Binarybaron 2025-09-26 18:54:23 +02:00
parent 59f4f8e164
commit 3e86f40448
3 changed files with 34 additions and 2 deletions

View file

@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
- GUI: A warning will be display for makers running `<3.0.0`. Versions `2.*.*` are deprecated and do not support some essential protocols such as the new cooperative Monero redeem protocol. If you are a maker and are having issues with upgrading, please contact the developer on Matrix. - GUI: A warning will be display for makers running `<3.0.0`. Versions `2.*.*` are deprecated and do not support some essential protocols such as the new cooperative Monero redeem protocol. If you are a maker and are having issues with upgrading, please contact the developer on Matrix.
- GUI: Clearly mark makers that have no available funds as having no available funds.
## [3.0.3] - 2025-09-24 ## [3.0.3] - 2025-09-24

View file

@ -18,11 +18,13 @@ export default function MakerOfferItem({
quoteWithAddress: QuoteWithAddress; quoteWithAddress: QuoteWithAddress;
}) { }) {
const { multiaddr, peer_id, quote, version } = quoteWithAddress; const { multiaddr, peer_id, quote, version } = quoteWithAddress;
const isOutOfLiquidity = quote.max_quantity == 0;
return ( return (
<Paper <Paper
variant="outlined" variant="outlined"
sx={{ sx={{
position: "relative",
display: "flex", display: "flex",
flexDirection: { xs: "column", sm: "row" }, flexDirection: { xs: "column", sm: "row" },
gap: 2, gap: 2,
@ -121,6 +123,35 @@ export default function MakerOfferItem({
Select Select
</PromiseInvokeButton> </PromiseInvokeButton>
</Box> </Box>
{isOutOfLiquidity && (
<Box
sx={{
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
backdropFilter: "blur(1px)",
borderRadius: 2,
pointerEvents: "auto",
}}
>
<Typography
variant="h6"
sx={{
fontWeight: "bold",
color: "text.secondary",
textAlign: "center",
}}
>
Maker has no available funds
</Typography>
</Box>
)}
</Paper> </Paper>
); );
} }

View file

@ -39,10 +39,10 @@ export function sortMakerApprovals(list: SortableQuoteWithAddress[]) {
// Prefer makers that have a 'version' attribute // Prefer makers that have a 'version' attribute
// If we don't have a version, we cannot clarify if it's outdated or not // If we don't have a version, we cannot clarify if it's outdated or not
(m) => (m.version ? 0 : 1), (m) => (m.version ? 0 : 1),
// Prefer makers that are not outdated
(m) => (isMakerVersionOutdated(m.version) ? 1 : 0),
// Prefer makers with a minimum quantity > 0 // Prefer makers with a minimum quantity > 0
(m) => ((m.quote.min_quantity ?? 0) > 0 ? 0 : 1), (m) => ((m.quote.min_quantity ?? 0) > 0 ? 0 : 1),
// Prefer makers that are not outdated
(m) => (isMakerVersionOutdated(m.version) ? 1 : 0),
// Prefer approvals over actual quotes // Prefer approvals over actual quotes
(m) => (m.request_id ? 0 : 1), (m) => (m.request_id ? 0 : 1),
// Prefer makers with a lower price // Prefer makers with a lower price