Skip to content

Commit

Permalink
timeline tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
phulin committed Nov 14, 2024
1 parent 2443de1 commit 44b5592
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/sections/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import { FC, forwardRef } from "react";

import { haveUnrestricted } from "../util/available";
import { inDevMode } from "../util/env";
import { plural } from "../util/text";

const Pill: FC<BadgeProps> = forwardRef(({ children, ...props }, ref) => (
Expand Down Expand Up @@ -64,6 +65,13 @@ const Timeline: FC<StackProps> = (props) => {
color: "yellow.600",
label: (turns) => `${plural(turns, "turn")} of Everything Looks Yellow.`,
},
{
name: "ELRWB",
turns: haveEffect($effect`Everything Looks Red, White and Blue`),
color: "purple.600",
label: (turns) =>
`${plural(turns, "turn")} of Everything Looks Red, White and Blue.`,
},
];

if (returnCombats > 0) {
Expand Down Expand Up @@ -100,15 +108,24 @@ const Timeline: FC<StackProps> = (props) => {
});
}

const elementsFiltered = elements; // .filter(([, turns]) => turns > 0);
const elementsFiltered = elements.filter(({ turns }) => turns > 0);
elementsFiltered.sort(
({ turns: turnsA }, { turns: turnsB }) => turnsA - turnsB,
);

if (elementsFiltered.length === 0) return null;

return (
<Stack flexFlow="row wrap" {...props}>
<Stack
flexFlow="row wrap"
// account for refresh button.
w={
inDevMode()
? "calc(100% - 30px - 3 * var(--chakra-space-1))"
: "calc(100% - 15px - 2 * var(--chakra-space-1))"
}
{...props}
>
{elementsFiltered.map(({ name, turns, color, label }) => (
<Tooltip hasArrow label={label(turns)}>
<Pill key={name} bgColor={color}>
Expand Down

0 comments on commit 44b5592

Please sign in to comment.