General improvements and bug fixes

This commit is contained in:
aet
2021-11-23 03:13:01 -05:00
parent bdd46a530c
commit 8f9ec73caf
26 changed files with 908 additions and 2122 deletions

View File

@ -1,6 +1,6 @@
import styled from "@emotion/styled"
import type { Item } from "opvault.js"
import { useMemo } from "react"
import { useMemo, memo } from "react"
import { parseMonthYear } from "../utils"
const Container = styled.div`
@ -12,7 +12,7 @@ const Container = styled.div`
}
`
export const ItemWarning: React.FC<{ item: Item }> = ({ item }) => {
export const ItemWarning = memo<{ item: Item }>(({ item }) => {
const isExpired = useMemo(() => {
const fields = item.details.sections?.flatMap(x => x.fields ?? [])
if (!fields?.length) return false
@ -38,4 +38,4 @@ export const ItemWarning: React.FC<{ item: Item }> = ({ item }) => {
}
return null
}
})