on master help sign in
pages, lib, components: update grants to work with arrays
commit1a2a14ad85881d4fe89da19e862715359e75fefb authorMatilde Park <matilde.park@urbit.org> dateTue 16 Aug 2022, 18:30 (4 years ago) parent385512e
5 files changed+81−60
components/GrantPreview.js+1−1 lib/lib.js+1−1 pages/grants.js+1−1 pages/grants/[slug].js+17−8 pages/index.js+61−49
components/GrantPreview.js+1−1
@@ -3,7 +3,7 @@ import Link from "next/link";
33
44export default function GrantPreview({ grant }) {
55 const isCompleted = grant.extra.completed;
6− const isOpen = !isCompleted && grant.extra.assignee === "";
6+ const isOpen = !isCompleted && grant.extra.assignee?.[0] === "";
77 const type = grant.taxonomies.grant_type;
88
99 const className = classnames({
lib/lib.js+1−1
@@ -279,7 +279,7 @@ export function getOpenGrantsCount() {
279279 if (
280280 !metadata.data.extra.completed &&
281281 !metadata.data.extra.canceled &&
282− metadata.data.extra.assignee === ""
282+ metadata.data.extra.assignee?.[0] === ""
283283 ) {
284284 return acc + 1;
285285 }
pages/grants.js+1−1
@@ -69,7 +69,7 @@ export default function Grants({ posts, categories, types, search }) {
6969 return { ...post, status: "canceled" };
7070 } else if (post.extra.completed) {
7171 return { ...post, status: "completed" };
72− } else if (post.extra.assignee && post.extra.assignee.length > 0) {
72+ } else if (post.extra.assignee && post.extra.assignee?.[0].length > 0) {
7373 return { ...post, status: "wip" };
7474 } else {
7575 return { ...post, status: "open" };
pages/grants/[slug].js+17−8
@@ -27,13 +27,22 @@ export default function Grant({ post, markdown, search }) {
2727 const assignee = post?.extra?.assignee;
2828 const mentor = post.extra.mentor || post.extra.champion;
2929 const assigneeLink =
30− assignee && ob.isValidPatp(assignee) ? (
31− <Link href={`/ids/${assignee}`} passHref>
32− <a className="text-green-400">{assignee}</a>
33− </Link>
34− ) : (
35− assignee
36− );
30+ assignee &&
31+ assignee.map((each, index) => {
32+ return ob.isValidPatp(each) ? (
33+ <>
34+ {index ? ", " : ""}
35+ <Link href={`/ids/${each}`} passHref>
36+ <a className="text-green-400">{each}</a>
37+ </Link>
38+ </>
39+ ) : (
40+ <>
41+ {index ? ", " : ""}
42+ {each}
43+ </>
44+ );
45+ });
3746 const mentorLink =
3847 mentor && ob.isValidPatp(mentor) ? (
3948 <Link href={`/ids/${mentor}`} passHref>
@@ -56,7 +65,7 @@ export default function Grant({ post, markdown, search }) {
5665 <h1>{post.title}</h1>
5766 {post.extra.assignee ? (
5867 <div className="type-ui text-wall-500 mt-4">
59− Grantee: {assigneeLink}
68+ Grantee(s): {assigneeLink}
6069 </div>
6170 ) : null}
6271 {post.extra.mentor ? (
pages/index.js+61−49
@@ -47,7 +47,6 @@ export default function Home({
4747 // Hero
4848 }
4949 <Section>
50−
5150 <div className="bg-yellow-100 dark:bg-[#5C5037] w-full p-8 md:p-12 rounded-3xl flex flex-col md:flex-row">
5251 <div className="md:w-10/12 w-full md:mr-6">
5352 <h2 className="m-0 p-0 mr-4 pb-6">Assembly 2022</h2>
@@ -172,44 +171,44 @@ export default function Home({
172171 // Build on Urbit Developer CTA
173172 }
174173 <Section narrow>
175− <h2 className="pb-8">Build on Urbit</h2>
176− <h4 className="pb-6">
177− Urbit is a personal OS designed from scratch to run peer-to-peer
178− applications.
179− </h4>
180− <p className="pb-6">
181− It solves the hard problems of implementing a peer-to-peer network
182− (including identity, NAT traversal, and exactly-once delivery) in
183− the kernel so app developers can focus on business logic.
184− </p>
185− <p className="pb-6">
186− The entire OS is a{" "}
187− <Link href="https://urbit.org/docs/nock/definition/" passHref>
188− <a>single pure function</a>
189− </Link>{" "}
190− that provides application developers with strong guarantees:
191− automated persistence and memory management, repeatable builds,
192− and support for hot code reloading.
193− </p>
194− <p className="pb-10">
195− You can get started learning how to{" "}
196− <Link href="https://urbit.org/docs/development/develop/" passHref>
197− <a>contribute to the project</a>
198− </Link>
199− , or view a variety of{" "}
200− <Link
201− href="https://github.com/urbit/awesome-urbit#http-apis-airlock"
202− passHref
203− >
204− <a>libraries</a>
205− </Link>{" "}
206− for building on Urbit using the languages you already know.
207− </p>
208− <Link href="https://developers.urbit.org" passHref>
209− <a className="button-lg type-ui text-white bg-green-400 max-w-fit">
210− Visit Urbit Developers
211− </a>
174+ <h2 className="pb-8">Build on Urbit</h2>
175+ <h4 className="pb-6">
176+ Urbit is a personal OS designed from scratch to run peer-to-peer
177+ applications.
178+ </h4>
179+ <p className="pb-6">
180+ It solves the hard problems of implementing a peer-to-peer network
181+ (including identity, NAT traversal, and exactly-once delivery) in
182+ the kernel so app developers can focus on business logic.
183+ </p>
184+ <p className="pb-6">
185+ The entire OS is a{" "}
186+ <Link href="https://urbit.org/docs/nock/definition/" passHref>
187+ <a>single pure function</a>
188+ </Link>{" "}
189+ that provides application developers with strong guarantees:
190+ automated persistence and memory management, repeatable builds, and
191+ support for hot code reloading.
192+ </p>
193+ <p className="pb-10">
194+ You can get started learning how to{" "}
195+ <Link href="https://urbit.org/docs/development/develop/" passHref>
196+ <a>contribute to the project</a>
212197 </Link>
198+ , or view a variety of{" "}
199+ <Link
200+ href="https://github.com/urbit/awesome-urbit#http-apis-airlock"
201+ passHref
202+ >
203+ <a>libraries</a>
204+ </Link>{" "}
205+ for building on Urbit using the languages you already know.
206+ </p>
207+ <Link href="https://developers.urbit.org" passHref>
208+ <a className="button-lg type-ui text-white bg-green-400 max-w-fit">
209+ Visit Urbit Developers
210+ </a>
211+ </Link>
213212 </Section>
214213
215214 {
@@ -261,14 +260,29 @@ export default function Home({
261260
262261 <Section narrow>
263262 <h2 className="pb-8">Social Media</h2>
264− <p className="pb-2">Follow us on <Link href="http://twitter.com/urbit">Twitter</Link></p>
265− <p className="pb-2">Check out our posts on <Link href="http://instagram.com/urbit">Instagram</Link></p>
266− <p className="pb-2">Watch livestreams on <Link href="https://www.youtube.com/channel/UCNYIS9_SktINCC9yqO4CFZw">YouTube</Link></p>
267− <p className="pb-2">Dig into code on <Link href="http://github.com/urbit">Github</Link></p>
268− <p className="pb-2">Boot Urbit and join <Link href="https://urbit.org/groups/~bitbet-bolbel/urbit-community">Urbit Community</Link></p>
263+ <p className="pb-2">
264+ Follow us on <Link href="http://twitter.com/urbit">Twitter</Link>
265+ </p>
266+ <p className="pb-2">
267+ Check out our posts on{" "}
268+ <Link href="http://instagram.com/urbit">Instagram</Link>
269+ </p>
270+ <p className="pb-2">
271+ Watch livestreams on{" "}
272+ <Link href="https://www.youtube.com/channel/UCNYIS9_SktINCC9yqO4CFZw">
273+ YouTube
274+ </Link>
275+ </p>
276+ <p className="pb-2">
277+ Dig into code on <Link href="http://github.com/urbit">Github</Link>
278+ </p>
279+ <p className="pb-2">
280+ Boot Urbit and join{" "}
281+ <Link href="https://urbit.org/groups/~bitbet-bolbel/urbit-community">
282+ Urbit Community
283+ </Link>
284+ </p>
269285 </Section>
270−
271−
272286 </SingleColumn>
273287 <Footer />
274288 </Container>
@@ -346,15 +360,13 @@ export async function getStaticProps() {
346360 0
347361 )
348362 ),
349− contributors: [
350− ...new Set(...[grants.map((e) => e.extra.assignee.split(","))]),
351− ].length,
363+ contributors: [...new Set(...[grants.map((e) => e.extra.assignee)])].length,
352364 active: grants.filter(
353365 (e) =>
354366 !e.extra.canceled &&
355367 !e.extra.completed &&
356368 e.extra.assignee &&
357− e.extra.assignee.length > 0
369+ e.extra.assignee?.[0]?.length > 0
358370 ).length,
359371 };
360372