Skip to content

Commit c0a9ae1

Browse files
committed
a few changes first
1 parent 99d49dc commit c0a9ae1

File tree

7 files changed

+39
-41
lines changed

7 files changed

+39
-41
lines changed

content/1_General/Intro_CP.problems.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"source": "Kattis",
99
"difficulty": "Very Easy",
1010
"isStarred": false,
11-
"tags": null,
11+
"tags": [],
1212
"solutionMetadata": {
1313
"kind": "none"
1414
}

content/6_Advanced/Extend_Euclid.problems.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"source": "Kattis",
99
"difficulty": null,
1010
"isStarred": false,
11-
"tags": null,
11+
"tags": [],
1212
"solutionMetadata": {
1313
"kind": "none"
1414
}
@@ -22,7 +22,7 @@
2222
"source": "Kattis",
2323
"difficulty": null,
2424
"isStarred": false,
25-
"tags": null,
25+
"tags": [],
2626
"solutionMetadata": {
2727
"kind": "none"
2828
}
@@ -34,7 +34,7 @@
3434
"source": "Kattis",
3535
"difficulty": null,
3636
"isStarred": false,
37-
"tags": null,
37+
"tags": [],
3838
"solutionMetadata": {
3939
"kind": "none"
4040
}

content/6_Advanced/Persistent.problems.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"source": "Wesley's Anger Contest",
112112
"difficulty": "Very Hard",
113113
"isStarred": false,
114-
"tags": null,
114+
"tags": [],
115115
"solutionMetadata": {
116116
"kind": "autogen-label-from-site",
117117
"site": "DMOJ"
@@ -124,7 +124,7 @@
124124
"source": "YS",
125125
"difficulty": "Very Hard",
126126
"isStarred": false,
127-
"tags": null,
127+
"tags": [],
128128
"solutionMetadata": {
129129
"kind": "none"
130130
}

content/extraProblems.json

+1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@
207207
},
208208
{
209209
"uniqueId": "usaco-1083",
210+
"tags": [],
210211
"name": "Uddered but not Herd",
211212
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1083",
212213
"source": "Bronze",

gatsby-node.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,9 @@ exports.createSchemaCustomization = ({ actions }) => {
544544
source: String!
545545
sourceDescription: String
546546
isStarred: Boolean!
547-
difficulty: String
548-
tags: [String]
549-
solution: ProblemSolutionInfo
547+
difficulty: String!
548+
tags: [String!]!
549+
solution: ProblemSolutionInfo!
550550
inModule: Boolean!
551551
module: Xdm @link(by: "frontmatter.id")
552552
}
@@ -558,8 +558,8 @@ exports.createSchemaCustomization = ({ actions }) => {
558558
source: String!
559559
sourceDescription: String
560560
isStarred: Boolean!
561-
difficulty: String
562-
tags: [String]
561+
difficulty: String!
562+
tags: [String!]!
563563
solution: ProblemSolutionInfo
564564
}
565565

src/components/Dashboard/DailyStreak.tsx

+13-13
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ const PhotoCard = ({ img, day, tomorrowMilliseconds, hiddenOnDesktop }) => {
5959
image={img}
6060
className="w-full object-cover"
6161
alt="Cow"
62-
style={tomorrowMilliseconds >= 0 ? { filter: 'blur(60px)' } : null}
62+
style={
63+
tomorrowMilliseconds >= 0 ? { filter: 'blur(60px)' } : undefined
64+
}
6365
/>
6466
</div>
6567
</div>
@@ -68,27 +70,25 @@ const PhotoCard = ({ img, day, tomorrowMilliseconds, hiddenOnDesktop }) => {
6870
};
6971

7072
export default function DailyStreak({ streak }) {
71-
const data = useStaticQuery(graphql`
72-
{
73+
const data: Queries.DailyStreakQuery = useStaticQuery(graphql`
74+
query DailyStreak {
7375
allFile(
7476
filter: { relativePath: { regex: "/^cows/.*/" } }
7577
sort: { fields: name }
7678
) {
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)
8382
}
83+
name
8484
}
8585
}
8686
}
8787
`);
8888
// https://www.digitalocean.com/community/tutorials/react-usememo
8989
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
9292
);
9393
}, []);
9494
const { lastVisitDate } = useLastVisitInfo();
@@ -168,15 +168,15 @@ export default function DailyStreak({ streak }) {
168168
};
169169
const leftCows = () => {
170170
// 2-column format for desktop, so hide every other cow
171-
const items = [];
171+
const items: React.ReactElement[] = [];
172172
for (let i = maxInd; i >= 0; --i) {
173173
items.push(getComponent(i, (maxInd - i) % 2 == 1));
174174
}
175175
return items;
176176
};
177177
const rightCows = () => {
178178
// desktop-only
179-
const items = [];
179+
const items: React.ReactElement[] = [];
180180
for (let i = maxInd - 1; i >= 0; i -= 2) {
181181
items.push(getComponent(i, false));
182182
}

src/components/Index/ContributorsSection.tsx

+14-17
Original file line numberDiff line numberDiff line change
@@ -168,22 +168,20 @@ const MemberCard = ({
168168
};
169169

170170
export default function ContributorsSection(): JSX.Element {
171-
const data = useStaticQuery(graphql`
172-
{
171+
const data: Queries.ContributorsQuery = useStaticQuery(graphql`
172+
query Contributors {
173173
allFile(filter: { relativePath: { regex: "/^team/images/.*/" } }) {
174-
edges {
175-
node {
176-
childImageSharp {
177-
gatsbyImageData(
178-
width: 112
179-
height: 112
180-
quality: 100
181-
transformOptions: { cropFocus: CENTER }
182-
layout: FIXED
183-
)
184-
}
185-
name
174+
nodes {
175+
childImageSharp {
176+
gatsbyImageData(
177+
width: 112
178+
height: 112
179+
quality: 100
180+
transformOptions: { cropFocus: CENTER }
181+
layout: FIXED
182+
)
186183
}
184+
name
187185
}
188186
}
189187
}
@@ -213,9 +211,8 @@ export default function ContributorsSection(): JSX.Element {
213211
member={member}
214212
key={member.name}
215213
gatsbyImage={
216-
(data as any).allFile.edges.find(
217-
x => x.node.name === member.photo
218-
).node.childImageSharp
214+
data.allFile.nodes.find(x => x.name === member.photo)
215+
?.childImageSharp
219216
}
220217
/>
221218
))}

0 commit comments

Comments
 (0)