@@ -59,7 +59,9 @@ const PhotoCard = ({ img, day, tomorrowMilliseconds, hiddenOnDesktop }) => {
59
59
image = { img }
60
60
className = "w-full object-cover"
61
61
alt = "Cow"
62
- style = { tomorrowMilliseconds >= 0 ? { filter : 'blur(60px)' } : null }
62
+ style = {
63
+ tomorrowMilliseconds >= 0 ? { filter : 'blur(60px)' } : undefined
64
+ }
63
65
/>
64
66
</ div >
65
67
</ div >
@@ -68,27 +70,25 @@ const PhotoCard = ({ img, day, tomorrowMilliseconds, hiddenOnDesktop }) => {
68
70
} ;
69
71
70
72
export default function DailyStreak ( { streak } ) {
71
- const data = useStaticQuery ( graphql `
72
- {
73
+ const data : Queries . DailyStreakQuery = useStaticQuery ( graphql `
74
+ query DailyStreak {
73
75
allFile(
74
76
filter: { relativePath: { regex: "/^cows/.*/" } }
75
77
sort: { fields: name }
76
78
) {
77
- edges {
78
- node {
79
- childImageSharp {
80
- gatsbyImageData(quality: 100, layout: CONSTRAINED, width: 592)
81
- }
82
- name
79
+ nodes {
80
+ childImageSharp {
81
+ gatsbyImageData(quality: 100, layout: CONSTRAINED, width: 592)
83
82
}
83
+ name
84
84
}
85
85
}
86
86
}
87
87
` ) ;
88
88
// https://www.digitalocean.com/community/tutorials/react-usememo
89
89
const cows = React . useMemo ( ( ) => {
90
- return data . allFile . edges . map (
91
- ( { node } ) => node . childImageSharp . gatsbyImageData
90
+ return data . allFile . nodes . map (
91
+ node => node . childImageSharp ! . gatsbyImageData
92
92
) ;
93
93
} , [ ] ) ;
94
94
const { lastVisitDate } = useLastVisitInfo ( ) ;
@@ -168,15 +168,15 @@ export default function DailyStreak({ streak }) {
168
168
} ;
169
169
const leftCows = ( ) => {
170
170
// 2-column format for desktop, so hide every other cow
171
- const items = [ ] ;
171
+ const items : React . ReactElement [ ] = [ ] ;
172
172
for ( let i = maxInd ; i >= 0 ; -- i ) {
173
173
items . push ( getComponent ( i , ( maxInd - i ) % 2 == 1 ) ) ;
174
174
}
175
175
return items ;
176
176
} ;
177
177
const rightCows = ( ) => {
178
178
// desktop-only
179
- const items = [ ] ;
179
+ const items : React . ReactElement [ ] = [ ] ;
180
180
for ( let i = maxInd - 1 ; i >= 0 ; i -= 2 ) {
181
181
items . push ( getComponent ( i , false ) ) ;
182
182
}
0 commit comments