-
{title}
+
+ {title}
+
{labels.map(({ name }) =>
LABELS.includes(name) ? (
@@ -154,6 +156,8 @@ function Issues({ section }: { section: any }) {
"https://api.github.com/repos/",
"https://github.com/"
)}
+ target="_blank"
+ rel="noreferrer"
>
{repository_url.replace(
"https://api.github.com/repos/",
diff --git a/copy/community/index.json b/copy/community/index.json
index 30e5a858f899..4dcd59d3ce09 100644
--- a/copy/community/index.json
+++ b/copy/community/index.json
@@ -11,7 +11,7 @@
"id": null,
"title": null,
"isH3": false,
- "content": "Where web enthusiasts learn, collaborate, and create
\n\n\n 45K+ Total contributors \n 80M+ Monthly views \n 200+ Weekly commits \n 8 Language communities \n "
+ "content": "Where web enthusiasts learn, collaborate, and create
\n\n\n 45K+ Total contributors \n 80M+ Monthly views \n 200+ Weekly commits \n 8 Language communities \n "
}
},
{
@@ -20,7 +20,7 @@
"id": "mdns_community_powers_the_web",
"title": "MDN's community powers the web",
"isH3": false,
- "content": "MDN’s strength comes from the passion and dedication of our global community. Since our founding in 2005, we’ve grown into a thriving network. Together, we’ve created a comprehensive, open, and free resource that serves web developers across the globe. With volunteers leading translation efforts in 8 languages , we’re truly international.
"
+ "content": "\n MDN’s strength comes from the passion and dedication of our global community.\n Since our founding in 2005, we’ve grown into a thriving network. Together, we’ve\n created a comprehensive, open, and free resource that serves web developers\n across the globe. With volunteers leading translation efforts in\n 8 languages , we’re\n truly international.\n
"
}
},
{
@@ -29,7 +29,7 @@
"id": "meet_our_contributors",
"title": "Meet our contributors",
"isH3": false,
- "content": "We are an open-source community of developers dedicated to building resources for a better web. Our diverse contributors, including developers, technical writers, students, educators, designers, and more, come from various backgrounds and platforms. Anyone can contribute, and each contribution strengthens our community, driving innovation and improving this vital resource for developers worldwide.
\n\n"
+ "content": "\n We are an open-source community of developers dedicated to building resources\n for a better web. Our diverse contributors, including developers, technical\n writers, students, educators, designers, and more, come from various backgrounds\n and platforms. Anyone can contribute, and each contribution strengthens our\n community, driving innovation and improving this vital resource for developers\n worldwide.\n
\n\n"
}
},
{
@@ -38,7 +38,7 @@
"id": "contributor_spotlight",
"title": "Contributor spotlight",
"isH3": false,
- "content": "\n \n \n MDN Web Docs has the most up-to-date and accurate information and the content is presented in an easy-to-understand manner. I also like that it's available in many languages (very important!).
\n Yuji \n (MDN contributor)\n \n \n \n There are millions of web developers in China, and many of them begin their developer journey at MDN Web Docs. Contributing to MDN Web Docs is an excellent way to help people who are starting out.
\n YiTao Yin \n (MDN contributor)\n \n \n \n When I visited the forum some months ago and saw people helping each other, I thought, \"This seems like a great way to give something back for the countless hours I spent on MDN!\". Helping others gives me the chance to improve and deepen my own understanding.
\n Michael Koch \n (MDN contributor)\n \n \nIf you wish to be a part of the featured contributors here, let us know . If you’re featured here and would like to opt-out, please file an issue on GitHub .
"
+ "content": "\n \n \n \n There are many other things I like about MDN: the openness of its\n governance, the respect for contributors' work, the professional\n conversations, and the always timely reviews. MDN has consistently\n demonstrated the ideal form of an open-source project.\n
\n Joshua Chen (MDN contributor)\n \n \n \n \n MDN Web Docs has the most up-to-date and accurate information and the\n content is presented in an easy-to-understand manner. I also like that it's\n available in many languages (very important!).\n
\n Yuji (MDN contributor)\n \n \n \n \n There are millions of web developers in China, and many of them begin their\n developer journey at MDN Web Docs. Contributing to MDN Web Docs is an\n excellent way to help people who are starting out.\n
\n YiTao Yin (MDN contributor)\n \n \n\n If you wish to be a part of the featured contributors here,\n let us know . If you’re featured here and would like to opt-out,\n please file an issue on GitHub .\n
"
}
},
{
@@ -47,7 +47,7 @@
"id": "learn_how_to_get_started",
"title": "Learn how to get started",
"isH3": false,
- "content": "\n We collaborate on GitHub , our project's home, on various tasks such as writing and improving documentation, fixing bugs, and providing review feedback. It starts here, with you.\n Want to start right away, but not sure how? Follow our guide to make your first contribution.\n
\nWatch this video on how to get started with contributing to MDN Web Docs
\nVideo from the community team on contributing to MDN
"
+ "content": "\n We collaborate on GitHub , our project's home, on\n various tasks such as writing and improving documentation, fixing bugs, and\n providing review feedback. It starts here, with you. Want to start right away,\n but not sure how? Follow\n our guide \n to make your first contribution.\n
\n\n Watch this video on\n how to get started with contributing to MDN Web Docs \n
\nVideo from the community team on contributing to MDN
"
}
},
{
@@ -56,7 +56,7 @@
"id": "join_us_in_shaping_a_better_web",
"title": "Join us in shaping a better web",
"isH3": false,
- "content": "Become part of this globally cherished group that’s dedicated to documenting web technologies. Whether you’re an expert or a beginner, there’s a place for you in our inclusive community. Check out some of the ways you can contribute and engage.
\n\n \n Fix issues Submit pull requests to fix reported issues.\n Squash bugs \n \n \n Improve content Fix inaccuracies and fill in missing information.\n Start writing \n \n \n Localize content Participate in translating content into one of our supported languages.\n Find your locale \n \n \n Answer questions Share your knowledge and expertise and guide fellow learners.\n Help on Discord \n \n "
+ "content": "\n Become part of this globally cherished group that’s dedicated to documenting web\n technologies. Whether you’re an expert or a beginner, there’s a place for you in\n our inclusive community. Check out some of the ways you can contribute and\n engage.\n
\n\n \n Fix issues Submit pull requests to fix reported issues.\n Squash bugs \n \n \n Improve content Fix inaccuracies and fill in missing information.\n Start writing \n \n \n Localize content Participate in translating content into one of our supported languages.\n Find your locale \n \n \n Answer questions Share your knowledge and expertise and guide fellow learners.\n Help on Discord \n \n "
}
},
{
@@ -65,7 +65,7 @@
"id": "help_us_fix_open_issues",
"title": "Help us fix open issues",
"isH3": false,
- "content": "New to MDN or open-source projects? Tackle our beginner-friendly issues to help improve MDN.
"
+ "content": "\n New to MDN or open-source projects? Tackle our beginner-friendly issues to help\n improve MDN.\n
"
}
},
{
@@ -74,7 +74,7 @@
"id": "join_the_conversation",
"title": "Join the conversation",
"isH3": false,
- "content": "\n \n Chat with us on Discord Connect with the community. Engage with domain experts. Help others learn.\n Join MDN Discord \n \n \n Every month, get exclusive updates from the MDN team. Share your ideas and contributions.\n RSVP to the next community call \n \n \nWhile working in Mozilla spaces and communities, please adhere to the Mozilla Community Participation Guidelines , which promote respect, inclusion, and a harassment-free environment for all community members.
"
+ "content": "\n \n Chat with us on Discord Connect with the community. Engage with domain experts. Help others learn.\n Join MDN Discord \n \n \n Every month, get exclusive updates from the MDN team. Share your ideas and\n contributions.\n RSVP to the next community call \n \n \n\n While working in Mozilla spaces and communities, please adhere to the\n Mozilla Community Participation Guidelines ,\n which promote respect, inclusion, and a harassment-free environment for all\n community members.\n
"
}
},
{
@@ -83,7 +83,7 @@
"id": "licensing_and_reuse",
"title": "Licensing and reuse",
"isH3": false,
- "content": "MDN's resources are freely available under various open-source licenses. For detailed information on reusing MDN content, check out our Attribution and Copyright Licensing page.
"
+ "content": "\n MDN's resources are freely available under various open-source licenses. For\n detailed information on reusing MDN content, check out our\n Attribution and Copyright Licensing \n page.\n
"
}
}
],
diff --git a/copy/community/index.md b/copy/community/index.md
index 06e874cac5cb..57f5b3963bcc 100644
--- a/copy/community/index.md
+++ b/copy/community/index.md
@@ -1,13 +1,9 @@
----
-template: community
----
-
# MDN Community
Where web enthusiasts learn, collaborate, and create
-- [Start contributing](#join-us-in-shaping-a-better-web)
-- [Join MDN Discord](/discord)
+- [Start contributing](#join_us_in_shaping_a_better_web)
+- [Join MDN Discord](https://mdn.dev/discord)
@@ -58,6 +54,13 @@ worldwide.
## Contributor spotlight
+- > There are many other things I like about MDN: the openness of its
+ > governance, the respect for contributors' work, the professional
+ > conversations, and the always timely reviews. MDN has consistently
+ > demonstrated the ideal form of an open-source project.
+
+ [Joshua Chen](/en-US/community/spotlight/joshua-chen) (MDN contributor)
+
- > MDN Web Docs has the most up-to-date and accurate information and the
> content is presented in an easy-to-understand manner. I also like that it's
> available in many languages (very important!).
@@ -70,13 +73,6 @@ worldwide.
[YiTao Yin](/en-US/community/spotlight/yitao-yin) (MDN contributor)
-- > When I visited the forum some months ago and saw people helping each other,
- > I thought, "This seems like a great way to give something back for the
- > countless hours I spent on MDN!". Helping others gives me the chance to
- > improve and deepen my own understanding.
-
- [Michael Koch](/en-US/community/spotlight/michael-koch) (MDN contributor)
-
If you wish to be a part of the featured contributors here,
[let us know](https://docs.google.com/forms/d/171RuXZoNs1gQmlJtfTiiU-hFo_odvi6rkx5fH-nqXDY/prefill).
If you’re featured here and would like to opt-out,
@@ -121,7 +117,7 @@ engage.
- ### Answer questions
Share your knowledge and expertise and guide fellow learners.
- [Help on Discord](/discord)
+ [Help on Discord](https://mdn.dev/discord)
## Help us fix open issues
@@ -133,7 +129,7 @@ improve MDN.
- ### Chat with us on Discord
Connect with the community. Engage with domain experts. Help others learn.
- [Join MDN Discord](/discord)
+ [Join MDN Discord](https://mdn.dev/discord)
- ### Join our Community Call
From a065e13ea2fde90fa5302a97de31a7c0d83a5803 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Fri, 23 Aug 2024 16:36:08 +0000
Subject: [PATCH 14/44] fix(community): add gap between contributor sections on
mobile
https://mozilla-hub.atlassian.net/browse/MP-1449
---
client/src/community/index.scss | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/client/src/community/index.scss b/client/src/community/index.scss
index cc961a28d514..66ad6033805d 100644
--- a/client/src/community/index.scss
+++ b/client/src/community/index.scss
@@ -289,7 +289,8 @@ main.community-container {
grid-template-columns: 4fr 6fr;
@media (max-width: $screen-md) {
- --community-circle-height: 0;
+ /* stylelint-disable-next-line length-zero-no-unit */
+ --community-circle-height: 0rem;
display: block;
}
From c89164d60c70c327b4f253538a7d1619c9946836 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Fri, 6 Sep 2024 11:19:18 +0000
Subject: [PATCH 15/44] chore(community): revert webpack changes
---
client/config/webpack.config.js | 1 -
ssr/webpack.config.js | 1 -
2 files changed, 2 deletions(-)
diff --git a/client/config/webpack.config.js b/client/config/webpack.config.js
index f2bc9dba9103..db2139910913 100644
--- a/client/config/webpack.config.js
+++ b/client/config/webpack.config.js
@@ -245,7 +245,6 @@ function config(webpackEnv) {
plugins: [{ removeViewBox: false }],
},
titleProp: true,
- throwIfNamespace: false,
ref: true,
},
},
diff --git a/ssr/webpack.config.js b/ssr/webpack.config.js
index d0dd5de9c0ee..64a4195de08d 100644
--- a/ssr/webpack.config.js
+++ b/ssr/webpack.config.js
@@ -51,7 +51,6 @@ const config = {
plugins: [{ removeViewBox: false }],
},
titleProp: true,
- throwIfNamespace: false,
ref: true,
},
},
From 9e19c6f6974e8b877b4c3124099e09ed74f404fe Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Tue, 10 Sep 2024 15:56:23 +0000
Subject: [PATCH 16/44] fix(community): use avatars.githubusercontent.com
directly to avoid cookie warnings
also add readme for build hack
---
copy/community/README.md | 18 ++++++++++++++++++
copy/community/index.json | 2 +-
copy/community/index.md | 16 ++++++++--------
3 files changed, 27 insertions(+), 9 deletions(-)
create mode 100644 copy/community/README.md
diff --git a/copy/community/README.md b/copy/community/README.md
new file mode 100644
index 000000000000..f077d82a57c9
--- /dev/null
+++ b/copy/community/README.md
@@ -0,0 +1,18 @@
+Massive temporary hack:
+
+```bash
+cd yari
+cp copy/community/index.md ../curriculum/curriculum/
+yarn build:curriculum
+```
+
+This will build into `client/build/en-us/curriculum/index/index.json`, open that
+file:
+
+```bash
+code client/build/en-us/curriculum/index/index.json
+```
+
+Format the file, then manually update all the wrong references to curriculum:
+alternatively, if you've only changed the sections just copy the `body` key into
+`copy/community/index.json`.
diff --git a/copy/community/index.json b/copy/community/index.json
index 4dcd59d3ce09..58081a95fd5c 100644
--- a/copy/community/index.json
+++ b/copy/community/index.json
@@ -29,7 +29,7 @@
"id": "meet_our_contributors",
"title": "Meet our contributors",
"isH3": false,
- "content": "\n We are an open-source community of developers dedicated to building resources\n for a better web. Our diverse contributors, including developers, technical\n writers, students, educators, designers, and more, come from various backgrounds\n and platforms. Anyone can contribute, and each contribution strengthens our\n community, driving innovation and improving this vital resource for developers\n worldwide.\n
\n\n"
+ "content": "\n We are an open-source community of developers dedicated to building resources\n for a better web. Our diverse contributors, including developers, technical\n writers, students, educators, designers, and more, come from various backgrounds\n and platforms. Anyone can contribute, and each contribution strengthens our\n community, driving innovation and improving this vital resource for developers\n worldwide.\n
\n\n"
}
},
{
diff --git a/copy/community/index.md b/copy/community/index.md
index 57f5b3963bcc..fa551548ffc5 100644
--- a/copy/community/index.md
+++ b/copy/community/index.md
@@ -35,21 +35,21 @@ worldwide.
-- ![GitHub profile picture](https://github.com/JasonLamv-t.png?size=160)
+- ![GitHub profile picture](https://avatars.githubusercontent.com/JasonLamv-t?size=160)
[Jason Lam, 林家祥](https://github.com/JasonLamv-t) Grantit
-- ![GitHub profile picture](https://github.com/nicolo-ribaudo.png?size=160)
+- ![GitHub profile picture](https://avatars.githubusercontent.com/nicolo-ribaudo?size=160)
[Nicolò Ribaudo](https://github.com/nicolo-ribaudo) Igalia
-- ![GitHub profile picture](https://github.com/Josh-Cena.png?size=160)
+- ![GitHub profile picture](https://avatars.githubusercontent.com/Josh-Cena?size=160)
[Joshua Chen](https://github.com/Josh-Cena)
-- ![GitHub profile picture](https://github.com/c17an.png?size=160)
+- ![GitHub profile picture](https://avatars.githubusercontent.com/c17an?size=160)
[Kimchanmin](https://github.com/c17an) SK Planet
-- ![GitHub profile picture](https://github.com/givvemee.png?size=160)
+- ![GitHub profile picture](https://avatars.githubusercontent.com/givvemee?size=160)
[Gibbeum Yoon](https://github.com/givvemee)
-- ![GitHub profile picture](https://github.com/wisedog.png?size=160)
+- ![GitHub profile picture](https://avatars.githubusercontent.com/wisedog?size=160)
[Jongha Kim](https://github.com/wisedog)
-- ![GitHub profile picture](https://github.com/PassionPenguin.png?size=160)
+- ![GitHub profile picture](https://avatars.githubusercontent.com/PassionPenguin?size=160)
[Qizhe ZHANG](https://github.com/PassionPenguin)
-- ![GitHub profile picture](https://github.com/saionaro.png?size=160)
+- ![GitHub profile picture](https://avatars.githubusercontent.com/saionaro?size=160)
[Artem Shibakov](https://github.com/saionaro) Bright Data
## Contributor spotlight
From 8c2e6f64a2def1b142a39aa1fa7c80fb72d18e0f Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Tue, 10 Sep 2024 16:00:30 +0000
Subject: [PATCH 17/44] fix(community): react item key error
---
client/src/community/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/community/index.tsx b/client/src/community/index.tsx
index 437d828e3898..169ae01e1703 100644
--- a/client/src/community/index.tsx
+++ b/client/src/community/index.tsx
@@ -29,7 +29,7 @@ export function Community(appProps: HydrationData) {
/>
);
} else if (section.value.id === "help_us_fix_open_issues") {
- return ;
+ return ;
}
return null;
}}
From 235f40e7f8819b2ff7c25cf1218542ead065af95 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Tue, 10 Sep 2024 17:01:05 +0000
Subject: [PATCH 18/44] fix(community): match button padding to login button
https://mozilla-hub.atlassian.net/browse/MP-1457?focusedCommentId=932467
---
client/src/community/index.scss | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/client/src/community/index.scss b/client/src/community/index.scss
index 66ad6033805d..533b1bee81fb 100644
--- a/client/src/community/index.scss
+++ b/client/src/community/index.scss
@@ -85,7 +85,7 @@ main.community-container {
--button-border-color: var(--button-primary-default);
--button-color: var(--background-primary);
--button-font: var(--type-emphasis-m);
- --button-padding: 0.43em 0.6em;
+ --button-padding: 0.43rem 1rem;
--button-radius: 0.25rem;
background: var(--community-bg-secondary);
@@ -213,6 +213,7 @@ main.community-container {
color: var(--button-color);
display: inline-block;
font: var(--button-font);
+ letter-spacing: normal;
padding: var(--button-padding);
text-decoration: none;
}
@@ -330,6 +331,7 @@ main.community-container {
color: var(--button-color);
display: inline-block;
font: var(--button-font);
+ letter-spacing: normal;
padding: var(--button-padding);
text-decoration: none;
}
@@ -633,6 +635,7 @@ main.community-container {
color: var(--button-color);
display: inline-block;
font: var(--button-font);
+ letter-spacing: normal;
padding: var(--button-padding);
text-decoration: none;
}
@@ -780,6 +783,7 @@ main.community-container {
color: var(--button-color);
display: inline-block;
font: var(--button-font);
+ letter-spacing: normal;
padding: var(--button-padding);
text-decoration: none;
}
From 261f340c229ab62e62996fa4e1298c183f1daa96 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Tue, 10 Sep 2024 17:56:07 +0000
Subject: [PATCH 19/44] fix(community): cache github issues response in
localstorage to mitigate ratelimiting
https://mozilla-hub.atlassian.net/browse/MP-1452
---
client/src/community/index.tsx | 56 +++++++++++++++++++---------------
client/src/utils.ts | 40 ++++++++++++++++++++++++
2 files changed, 72 insertions(+), 24 deletions(-)
diff --git a/client/src/community/index.tsx b/client/src/community/index.tsx
index 169ae01e1703..e436c1b0bba7 100644
--- a/client/src/community/index.tsx
+++ b/client/src/community/index.tsx
@@ -1,12 +1,12 @@
import "./index.scss";
import { HydrationData } from "../../../libs/types/hydration";
import { useMemo } from "react";
-import useSWRImmutable from "swr/immutable";
import { Section } from "../../../libs/types/document";
-import useSWR from "swr";
+import useSWR, { SWRConfig } from "swr";
import { HTTPError } from "../document";
import { WRITER_MODE } from "../env";
import { Prose } from "../document/ingredients/prose";
+import { SWRLocalStorageCache } from "../utils";
interface CommunityDoc {
title: string;
@@ -16,25 +16,29 @@ interface CommunityDoc {
export function Community(appProps: HydrationData) {
const doc = useCommunityDoc(appProps);
return (
-
- {
- if (i === 0) {
- return (
-
- );
- } else if (section.value.id === "help_us_fix_open_issues") {
- return ;
- }
- return null;
- }}
- />
-
+ new SWRLocalStorageCache("community") }}
+ >
+
+ {
+ if (i === 0) {
+ return (
+
+ );
+ } else if (section.value.id === "help_us_fix_open_issues") {
+ return ;
+ }
+ return null;
+ }}
+ />
+
+
);
}
@@ -109,16 +113,20 @@ function Issues({ section }: { section: any }) {
[section.value?.content]
);
const LABELS = ["good first issue", "accepting PR"];
- const { data } = useSWRImmutable(
+ const { data } = useSWR(
`is:open is:issue repo:mdn/content repo:mdn/translated-content repo:mdn/yari label:"good first issue","accepting PR" sort:created-desc no:assignee is:public`,
async (query) => {
const url = new URL("https://api.github.com/search/issues");
url.searchParams.append("per_page", "5");
url.searchParams.append("q", query);
const res = await fetch(url);
- if (res.ok) {
- return await res.json();
+ if (!res.ok) {
+ throw new Error(res.status.toString());
}
+ return await res.json();
+ },
+ {
+ revalidateOnFocus: false,
}
);
return (
diff --git a/client/src/utils.ts b/client/src/utils.ts
index 1105e08da90f..357a6e3bf329 100644
--- a/client/src/utils.ts
+++ b/client/src/utils.ts
@@ -136,3 +136,43 @@ export function splitQuery(term: string): string[] {
return term.split(/[ ,.]+/);
}
}
+
+export class SWRLocalStorageCache {
+ #key: string;
+ #data: Map;
+
+ #writeToLocalStorage() {
+ const serialized = JSON.stringify([...this.#data]);
+ localStorage.setItem(this.#key, serialized);
+ }
+
+ constructor(key: string) {
+ this.#key = `cache.${key}`;
+ const serialized = localStorage.getItem(this.#key);
+ try {
+ this.#data = new Map(JSON.parse(serialized || "[]"));
+ } catch {
+ console.warn(`Can't read data from ${this.#key}, resetting the cache`);
+ this.#data = new Map();
+ this.#writeToLocalStorage();
+ }
+ }
+
+ get(key: string): Data | undefined {
+ return this.#data.get(key);
+ }
+
+ set(key: string, value: Data): void {
+ this.#data.set(key, value);
+ this.#writeToLocalStorage();
+ }
+
+ delete(key: string): void {
+ this.#data.delete(key);
+ this.#writeToLocalStorage();
+ }
+
+ keys(): IterableIterator {
+ return this.#data.keys();
+ }
+}
From ba1662ea0e15559e883d78bf99bc9145782f0b5e Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Wed, 11 Sep 2024 09:48:17 +0000
Subject: [PATCH 20/44] fix(community): don't try to access localstorage on the
server
---
client/src/utils.ts | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/client/src/utils.ts b/client/src/utils.ts
index 357a6e3bf329..74ea2070323a 100644
--- a/client/src/utils.ts
+++ b/client/src/utils.ts
@@ -148,12 +148,16 @@ export class SWRLocalStorageCache {
constructor(key: string) {
this.#key = `cache.${key}`;
- const serialized = localStorage.getItem(this.#key);
try {
+ const serialized = localStorage.getItem(this.#key);
this.#data = new Map(JSON.parse(serialized || "[]"));
} catch {
- console.warn(`Can't read data from ${this.#key}, resetting the cache`);
this.#data = new Map();
+ if (typeof localStorage === "undefined") {
+ // we're on the server
+ return;
+ }
+ console.warn(`Can't read data from ${this.#key}, resetting the cache`);
this.#writeToLocalStorage();
}
}
From a08dfa8ef0ded5fa8a3db19cc19ccf6ced3b1fe0 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Wed, 11 Sep 2024 16:35:34 +0000
Subject: [PATCH 21/44] fix(community): avoid hydration errors with
localstorage cache
tried fixing this within the cache itself, but couldn't manage it
---
client/src/community/index.tsx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/client/src/community/index.tsx b/client/src/community/index.tsx
index e436c1b0bba7..04c3acb2ca0a 100644
--- a/client/src/community/index.tsx
+++ b/client/src/community/index.tsx
@@ -7,6 +7,7 @@ import { HTTPError } from "../document";
import { WRITER_MODE } from "../env";
import { Prose } from "../document/ingredients/prose";
import { SWRLocalStorageCache } from "../utils";
+import { useIsServer } from "../hooks";
interface CommunityDoc {
title: string;
@@ -112,9 +113,11 @@ function Issues({ section }: { section: any }) {
() => ({ __html: section.value?.content }),
[section.value?.content]
);
+ const isServer = useIsServer();
const LABELS = ["good first issue", "accepting PR"];
const { data } = useSWR(
- `is:open is:issue repo:mdn/content repo:mdn/translated-content repo:mdn/yari label:"good first issue","accepting PR" sort:created-desc no:assignee is:public`,
+ !isServer &&
+ `is:open is:issue repo:mdn/content repo:mdn/translated-content repo:mdn/yari label:"good first issue","accepting PR" sort:created-desc no:assignee is:public`,
async (query) => {
const url = new URL("https://api.github.com/search/issues");
url.searchParams.append("per_page", "5");
From c75c9f4e1aaa88c8a5e0d94ed51e1b1f6e32248f Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Wed, 11 Sep 2024 17:51:35 +0000
Subject: [PATCH 22/44] fix(community): randomly select contributors to display
custom elements are lit!
also workaround issue in contributor circle with links not being clickable
https://mozilla-hub.atlassian.net/browse/MP-1480
---
client/src/community/contributor-list.ts | 77 +++++++++++
client/src/community/index.scss | 161 +++++++++++++----------
client/src/community/index.tsx | 7 +-
copy/community/index.json | 2 +-
copy/community/index.md | 37 +++---
package.json | 1 +
yarn.lock | 42 ++++++
7 files changed, 237 insertions(+), 90 deletions(-)
create mode 100644 client/src/community/contributor-list.ts
diff --git a/client/src/community/contributor-list.ts b/client/src/community/contributor-list.ts
new file mode 100644
index 000000000000..2a52a9d315d5
--- /dev/null
+++ b/client/src/community/contributor-list.ts
@@ -0,0 +1,77 @@
+import { LitElement, html } from "lit";
+import { customElement } from "lit/decorators.js";
+
+interface ContributorData {
+ name: string;
+ github?: string;
+ org?: string;
+}
+
+@customElement("contributor-list")
+export class ContributorList extends LitElement {
+ _contributors: ContributorData[] = [];
+
+ static properties = {
+ _contributors: { state: true },
+ };
+
+ createRenderRoot() {
+ // use light DOM
+ return this;
+ }
+
+ constructor() {
+ super();
+ const contributorList = this.querySelector("ul");
+ const randomContributors: ContributorData[] = [];
+ if (contributorList) {
+ const contributors = [...contributorList.querySelectorAll("li")];
+ for (let index = 0; index < 8; index++) {
+ const contributor = popRandom(contributors);
+ if (!contributor) {
+ break;
+ }
+ const [name, github, org] = [...contributor.childNodes].map(
+ (node) => node?.textContent?.trim() || undefined
+ );
+ if (!name) {
+ index--;
+ continue;
+ }
+ randomContributors.push({
+ name,
+ github,
+ org,
+ });
+ }
+ this._contributors = randomContributors;
+ contributorList.remove();
+ }
+ }
+
+ render() {
+ return html`
+ ${this._contributors.map(({ name, github, org }) => {
+ const imgSrc = `https://avatars.githubusercontent.com/${github
+ ?.split("/")
+ .slice(-1)}`;
+ return html`
+
+
+ ${name}
+
+ ${org}
+ `;
+ })}
+ `;
+ }
+}
+
+function popRandom(array: Array) {
+ const i = Math.floor(Math.random() * array.length);
+ return array.splice(i, 1)[0];
+}
diff --git a/client/src/community/index.scss b/client/src/community/index.scss
index 533b1bee81fb..18d5035fd0ae 100644
--- a/client/src/community/index.scss
+++ b/client/src/community/index.scss
@@ -303,87 +303,98 @@ main.community-container {
grid-template-rows: auto auto auto var(--community-circle-height);
margin-top: var(--community-section-gap);
- .section-content {
- display: contents;
- }
-
h2,
.section-content > * {
grid-column: 2;
}
- ul:first-of-type {
- // contributor buttons
+ .section-content {
+ display: contents;
- display: flex;
- flex-wrap: wrap;
- gap: 1rem;
- margin-top: 1.5rem;
+ > ul {
+ // contributor buttons
- @media (max-width: $screen-md) {
- justify-content: center;
- }
+ display: flex;
+ flex-wrap: wrap;
+ gap: 1rem;
+ margin-top: 1.5rem;
- a {
- background-color: var(--button-bg);
- border: 1px solid var(--button-border-color);
- border-radius: var(--button-radius);
- color: var(--button-color);
- display: inline-block;
- font: var(--button-font);
- letter-spacing: normal;
- padding: var(--button-padding);
- text-decoration: none;
- }
+ @media (max-width: $screen-md) {
+ justify-content: center;
+ }
- li:last-child a {
- --button-color: var(--button-bg);
- background: transparent;
+ a {
+ background-color: var(--button-bg);
+ border: 1px solid var(--button-border-color);
+ border-radius: var(--button-radius);
+ color: var(--button-color);
+ display: inline-block;
+ font: var(--button-font);
+ letter-spacing: normal;
+ padding: var(--button-padding);
+ text-decoration: none;
+ }
+
+ li:last-child a {
+ --button-color: var(--button-bg);
+ background: transparent;
+ }
}
- }
- ul:last-of-type {
- // contributor list
+ > contributor-list {
+ --community-list-img-size: 3.75rem;
+ --community-list-width: 10rem;
+ grid-column: 1;
+ grid-row: 1/5;
+ min-width: 0;
- --community-list-img-size: 3.75rem;
- --community-list-width: 10rem;
- align-content: start;
- display: grid;
- gap: 2rem 1rem;
- grid-column: 1;
- grid-row: 1/5;
- grid-template-columns: repeat(
- auto-fit,
- minmax(var(--community-list-width), 1fr)
- );
- justify-items: center;
- min-width: 0;
+ > * {
+ display: none;
+ }
- @media (max-width: $screen-md) {
- display: flex;
- margin-top: 2rem;
- overflow-x: auto;
- }
+ ul.rendered {
+ align-content: start;
+ display: grid;
+ gap: 2rem 1rem;
+ grid-template-columns: repeat(
+ auto-fit,
+ minmax(var(--community-list-width), 1fr)
+ );
+ justify-items: center;
+
+ @media (max-width: $screen-md) {
+ display: flex;
+ margin-top: 2rem;
+ overflow-x: auto;
+ }
- li {
- align-items: center;
- color: var(--community-text-primary);
- display: flex;
- flex-direction: column;
- flex-shrink: 0;
- text-align: center;
- width: var(--community-list-width);
- }
+ li,
+ a {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ text-align: center;
+ flex-shrink: 0;
+ }
- img {
- border: 6px var(--community-circle-img-border) solid;
- border-radius: 50%;
- height: var(--community-list-img-size);
- width: var(--community-list-img-size);
- }
+ li {
+ color: var(--community-text-primary);
+ width: var(--community-list-width);
+ }
- a {
- font-weight: 500;
+ img {
+ background: var(--community-circle-img-border);
+ border: 6px var(--community-circle-img-border) solid;
+ border-radius: 50%;
+ height: var(--community-list-img-size);
+ width: var(--community-list-img-size);
+ flex-shrink: 0;
+ }
+
+ a {
+ font-weight: 500;
+ }
+ }
}
}
}
@@ -391,9 +402,7 @@ main.community-container {
@supports (offset-path: ellipse(100% 50% at right center)) {
@media (min-width: $screen-xxl) {
&[aria-labelledby="meet_our_contributors"] {
- ul:last-of-type {
- // contributor semi-circle
-
+ contributor-list ul.rendered {
background-image: var(--community-circle-bg);
display: block;
height: var(--community-circle-height);
@@ -402,12 +411,24 @@ main.community-container {
position: relative;
li {
+ --offset-distance: calc(
+ var(--community-circle-angle) * 50% + 25%
+ );
height: var(--community-list-img-size);
- offset-distance: calc(var(--community-circle-angle) * 50% + 25%);
- // matches first svg defined in --community-circle-bg
+ offset-distance: calc(var(--offset-distance) - 1%);
+ // necessary because Firefox seems to have a bug where the links aren't
+ // clickable until we force some kind of re-render which an animation does:
+ animation: community-circle 1s forwards;
+ // matches first svg defined in --community-circle-bg:
offset-path: ellipse(100% 50% at right center);
offset-rotate: 0deg;
+ @keyframes community-circle {
+ to {
+ offset-distance: var(--offset-distance);
+ }
+ }
+
&:nth-child(n + 6) {
--community-list-img-size: 5rem;
// matches second svg defined in --community-circle-bg
diff --git a/client/src/community/index.tsx b/client/src/community/index.tsx
index 04c3acb2ca0a..8b6f4006d051 100644
--- a/client/src/community/index.tsx
+++ b/client/src/community/index.tsx
@@ -1,6 +1,6 @@
import "./index.scss";
import { HydrationData } from "../../../libs/types/hydration";
-import { useMemo } from "react";
+import { useEffect, useMemo } from "react";
import { Section } from "../../../libs/types/document";
import useSWR, { SWRConfig } from "swr";
import { HTTPError } from "../document";
@@ -16,6 +16,11 @@ interface CommunityDoc {
export function Community(appProps: HydrationData) {
const doc = useCommunityDoc(appProps);
+
+ useEffect(() => {
+ import("./contributor-list");
+ }, []);
+
return (
new SWRLocalStorageCache("community") }}
diff --git a/copy/community/index.json b/copy/community/index.json
index 58081a95fd5c..fefebc1a3f1c 100644
--- a/copy/community/index.json
+++ b/copy/community/index.json
@@ -29,7 +29,7 @@
"id": "meet_our_contributors",
"title": "Meet our contributors",
"isH3": false,
- "content": "\n We are an open-source community of developers dedicated to building resources\n for a better web. Our diverse contributors, including developers, technical\n writers, students, educators, designers, and more, come from various backgrounds\n and platforms. Anyone can contribute, and each contribution strengthens our\n community, driving innovation and improving this vital resource for developers\n worldwide.\n
\n\n"
+ "content": "\n We are an open-source community of developers dedicated to building resources\n for a better web. Our diverse contributors, including developers, technical\n writers, students, educators, designers, and more, come from various backgrounds\n and platforms. Anyone can contribute, and each contribution strengthens our\n community, driving innovation and improving this vital resource for developers\n worldwide.\n
\n\n\n \n "
}
},
{
diff --git a/copy/community/index.md b/copy/community/index.md
index fa551548ffc5..24733eaac35f 100644
--- a/copy/community/index.md
+++ b/copy/community/index.md
@@ -33,24 +33,25 @@ worldwide.
- [Join us](/en-US/docs/MDN/Community/Contributing/Getting_started)
- [View all contributors](https://github.com/mdn/content/graphs/contributors)
-
-
-- ![GitHub profile picture](https://avatars.githubusercontent.com/JasonLamv-t?size=160)
- [Jason Lam, 林家祥](https://github.com/JasonLamv-t) Grantit
-- ![GitHub profile picture](https://avatars.githubusercontent.com/nicolo-ribaudo?size=160)
- [Nicolò Ribaudo](https://github.com/nicolo-ribaudo) Igalia
-- ![GitHub profile picture](https://avatars.githubusercontent.com/Josh-Cena?size=160)
- [Joshua Chen](https://github.com/Josh-Cena)
-- ![GitHub profile picture](https://avatars.githubusercontent.com/c17an?size=160)
- [Kimchanmin](https://github.com/c17an) SK Planet
-- ![GitHub profile picture](https://avatars.githubusercontent.com/givvemee?size=160)
- [Gibbeum Yoon](https://github.com/givvemee)
-- ![GitHub profile picture](https://avatars.githubusercontent.com/wisedog?size=160)
- [Jongha Kim](https://github.com/wisedog)
-- ![GitHub profile picture](https://avatars.githubusercontent.com/PassionPenguin?size=160)
- [Qizhe ZHANG](https://github.com/PassionPenguin)
-- ![GitHub profile picture](https://avatars.githubusercontent.com/saionaro?size=160)
- [Artem Shibakov](https://github.com/saionaro) Bright Data
+
+
+- Jason Lam, 林家祥 https://github.com/JasonLamv-t Grantit
+- Nicolò Ribaudo https://github.com/nicolo-ribaudo Igalia
+- Joshua Chen https://github.com/Josh-Cena
+- Kimchanmin https://github.com/c17an SK Planet
+- Gibbeum Yoon https://github.com/givvemee
+- Jongha Kim https://github.com/wisedog
+- Qizhe ZHANG https://github.com/PassionPenguin
+- Artem Shibakov https://github.com/saionaro Bright Data
+- HoChan Lee https://github.com/hochan222 11STREET
+- Sangchul Lee https://github.com/1ilsang WoowaBros
+- Park Sunhee https://github.com/sunhpark42 WoowaBros
+- FU CHUNHUI https://github.com/fuchunhui Baidu
+- Estelle Weyl https://github.com/estelle Open Web Docs
+- Yitao Yin https://github.com/yin1999 Northwestern Polytechnical University
+- Florian Scholz https://github.com/Elchi3 Open Web Docs
+
+
## Contributor spotlight
diff --git a/package.json b/package.json
index a47c148e456b..e4c5f920908a 100644
--- a/package.json
+++ b/package.json
@@ -112,6 +112,7 @@
"inquirer": "^10.0.1",
"is-svg": "^5.1.0",
"js-yaml": "^4.1.0",
+ "lit": "^3.2.0",
"loglevel": "^1.9.2",
"lru-cache": "^10.4.3",
"md5-file": "^5.0.0",
diff --git a/yarn.lock b/yarn.lock
index 9eb7e05d1e74..8c8cc21bf10a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2185,6 +2185,18 @@
dependencies:
"@lezer/common" "^1.0.0"
+"@lit-labs/ssr-dom-shim@^1.2.0":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.2.1.tgz#2f3a8f1d688935c704dbc89132394a41029acbb8"
+ integrity sha512-wx4aBmgeGvFmOKucFKY+8VFJSYZxs9poN3SDNQFF6lT6NrQUnHiPB2PWz2sc4ieEcAaYYzN+1uWahEeTq2aRIQ==
+
+"@lit/reactive-element@^2.0.4":
+ version "2.0.4"
+ resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-2.0.4.tgz#8f2ed950a848016383894a26180ff06c56ae001b"
+ integrity sha512-GFn91inaUa2oHLak8awSIigYz0cU0Payr1rcFsrkf5OJ5eSPxElyZfKh0f2p9FsTiZWXQdWGJeXZICEfXXYSXQ==
+ dependencies:
+ "@lit-labs/ssr-dom-shim" "^1.2.0"
+
"@mdn/bcd-utils-api@^0.0.7":
version "0.0.7"
resolved "https://registry.yarnpkg.com/@mdn/bcd-utils-api/-/bcd-utils-api-0.0.7.tgz#555e80c33df520df068943e6b18ebc07f0e24d19"
@@ -3420,6 +3432,11 @@
resolved "https://registry.yarnpkg.com/@types/triple-beam/-/triple-beam-1.3.5.tgz#74fef9ffbaa198eb8b588be029f38b00299caa2c"
integrity sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==
+"@types/trusted-types@^2.0.2":
+ version "2.0.7"
+ resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.7.tgz#baccb07a970b91707df3a3e8ba6896c57ead2d11"
+ integrity sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==
+
"@types/unist@*", "@types/unist@^3.0.0":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-3.0.3.tgz#acaab0f919ce69cce629c2d4ed2eb4adc1b6c20c"
@@ -9715,6 +9732,31 @@ listr2@6.6.1:
rfdc "^1.3.0"
wrap-ansi "^8.1.0"
+lit-element@^4.1.0:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-4.1.0.tgz#cea3eb25f15091e3fade07c4d917fa6aaf56ba7d"
+ integrity sha512-gSejRUQJuMQjV2Z59KAS/D4iElUhwKpIyJvZ9w+DIagIQjfJnhR20h2Q5ddpzXGS+fF0tMZ/xEYGMnKmaI/iww==
+ dependencies:
+ "@lit-labs/ssr-dom-shim" "^1.2.0"
+ "@lit/reactive-element" "^2.0.4"
+ lit-html "^3.2.0"
+
+lit-html@^3.2.0:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-3.2.0.tgz#cb09071a8a1f5f0850873f9143f18f0260be1fda"
+ integrity sha512-pwT/HwoxqI9FggTrYVarkBKFN9MlTUpLrDHubTmW4SrkL3kkqW5gxwbxMMUnbbRHBC0WTZnYHcjDSCM559VyfA==
+ dependencies:
+ "@types/trusted-types" "^2.0.2"
+
+lit@^3.2.0:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/lit/-/lit-3.2.0.tgz#2189d72bccbc335f733a67bfbbd295f015e68e05"
+ integrity sha512-s6tI33Lf6VpDu7u4YqsSX78D28bYQulM+VAzsGch4fx2H0eLZnJsUBsPWmGYSGoKDNbjtRv02rio1o+UdPVwvw==
+ dependencies:
+ "@lit/reactive-element" "^2.0.4"
+ lit-element "^4.1.0"
+ lit-html "^3.2.0"
+
loader-runner@^4.2.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1"
From cfecfdc967a7c5961f2c3d97421b13d7f01241a7 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Wed, 11 Sep 2024 18:03:29 +0000
Subject: [PATCH 23/44] fix(community): stylelint
---
client/src/community/index.scss | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/client/src/community/index.scss b/client/src/community/index.scss
index 18d5035fd0ae..d89b1d7e3c1a 100644
--- a/client/src/community/index.scss
+++ b/client/src/community/index.scss
@@ -370,11 +370,11 @@ main.community-container {
li,
a {
+ align-items: center;
display: flex;
flex-direction: column;
- align-items: center;
- text-align: center;
flex-shrink: 0;
+ text-align: center;
}
li {
@@ -386,9 +386,9 @@ main.community-container {
background: var(--community-circle-img-border);
border: 6px var(--community-circle-img-border) solid;
border-radius: 50%;
+ flex-shrink: 0;
height: var(--community-list-img-size);
width: var(--community-list-img-size);
- flex-shrink: 0;
}
a {
@@ -414,11 +414,11 @@ main.community-container {
--offset-distance: calc(
var(--community-circle-angle) * 50% + 25%
);
- height: var(--community-list-img-size);
- offset-distance: calc(var(--offset-distance) - 1%);
// necessary because Firefox seems to have a bug where the links aren't
// clickable until we force some kind of re-render which an animation does:
animation: community-circle 1s forwards;
+ height: var(--community-list-img-size);
+ offset-distance: calc(var(--offset-distance) - 1%);
// matches first svg defined in --community-circle-bg:
offset-path: ellipse(100% 50% at right center);
offset-rotate: 0deg;
From 8fae5dc7cfc27a4106b2aa939a2ee0f5d0b76c5e Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Fri, 20 Sep 2024 12:49:07 +0000
Subject: [PATCH 24/44] fix(community): reduce width
---
client/src/community/index.scss | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/client/src/community/index.scss b/client/src/community/index.scss
index d89b1d7e3c1a..f3eb73a0c4e1 100644
--- a/client/src/community/index.scss
+++ b/client/src/community/index.scss
@@ -78,6 +78,10 @@
main.community-container {
--community-stats-height: 5.75rem;
--community-section-gap: 10rem;
+ --max-width: 74rem;
+ --negative-space: calc(
+ max(0px, 100vw - var(--max-width)) * -0.5 - var(--gutter)
+ );
--button-bg: var(--button-primary-default);
--button-bg-hover: var(--button-primary-hover);
@@ -493,6 +497,7 @@ main.community-container {
margin-left: -1rem;
overflow-x: auto;
padding: 2.41rem 1rem;
+ margin-right: var(--negative-space);
@media (max-width: $screen-md) {
margin-left: calc(var(--gutter) * -1);
From 36bbb682b17e298825ef5a89f8c66a8f42673432 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Mon, 23 Sep 2024 20:23:39 +0000
Subject: [PATCH 25/44] wip(community): various fixes
---
client/config/webpack.config.js | 27 ++-
client/package.json | 3 +
client/src/community/contributor-list.scss | 158 +++++++++++++
client/src/community/contributor-list.ts | 57 +++--
client/src/community/index.scss | 262 ++++-----------------
client/src/react-app.d.ts | 8 +
client/src/ui/atoms/button/_mixins.scss | 49 ++++
client/tsconfig.json | 2 +-
8 files changed, 316 insertions(+), 250 deletions(-)
create mode 100644 client/src/community/contributor-list.scss
create mode 100644 client/src/ui/atoms/button/_mixins.scss
diff --git a/client/config/webpack.config.js b/client/config/webpack.config.js
index 0c6e8a9460a4..3bb6b7916b0d 100644
--- a/client/config/webpack.config.js
+++ b/client/config/webpack.config.js
@@ -40,12 +40,13 @@ function config(webpackEnv) {
const env = getClientEnvironment();
// common function to get style loaders
- const getStyleLoaders = (cssOptions, preProcessor) => {
+ const getStyleLoaders = (cssOptions, preProcessor, extract = true) => {
const loaders = [
- isEnvDevelopment && resolve.sync("style-loader"),
- isEnvProduction && {
- loader: MiniCssExtractPlugin.loader,
- },
+ extract && isEnvDevelopment && resolve.sync("style-loader"),
+ extract &&
+ isEnvProduction && {
+ loader: MiniCssExtractPlugin.loader,
+ },
{
loader: resolve.sync("css-loader"),
options: cssOptions,
@@ -354,6 +355,22 @@ function config(webpackEnv) {
sideEffects: true,
},
// Opt-in support for SASS (using .scss or .sass extensions).
+ {
+ test: /\.(scss|sass)$/,
+ with: { type: "css" },
+ use: getStyleLoaders(
+ {
+ importLoaders: 3,
+ sourceMap: isEnvProduction
+ ? shouldUseSourceMap
+ : isEnvDevelopment,
+ exportType: "css-style-sheet",
+ },
+ "sass-loader",
+ false
+ ),
+ sideEffects: true,
+ },
{
test: /\.(scss|sass)$/,
use: getStyleLoaders(
diff --git a/client/package.json b/client/package.json
index f1ad9b7ab58a..58acd2b44593 100644
--- a/client/package.json
+++ b/client/package.json
@@ -4,6 +4,9 @@
"license": "MPL-2.0",
"type": "module",
"babel": {
+ "generatorOpts": {
+ "importAttributesKeyword": "with"
+ },
"presets": [
"react-app"
]
diff --git a/client/src/community/contributor-list.scss b/client/src/community/contributor-list.scss
new file mode 100644
index 000000000000..cd1d5a616f26
--- /dev/null
+++ b/client/src/community/contributor-list.scss
@@ -0,0 +1,158 @@
+@use "../ui/vars" as *;
+
+* {
+ box-sizing: border-box;
+}
+
+.wrap {
+ --img-size: 3.75em;
+ --li-size: calc(var(--img-size) * 2.5);
+}
+
+ul {
+ --circle-border-size: 0.375em;
+ align-content: start;
+ display: grid;
+ gap: 2rem 1rem;
+ grid-template-columns: repeat(auto-fit, minmax(var(--li-size), 1fr));
+ justify-items: center;
+ margin: 0;
+ padding: 0;
+
+ @media (max-width: $screen-md) {
+ display: flex;
+ margin-top: 2rem;
+ overflow-x: auto;
+ }
+}
+
+li,
+a {
+ align-items: center;
+ display: flex;
+ flex-direction: column;
+ flex-shrink: 0;
+ text-align: center;
+}
+
+li {
+ color: var(--community-text-primary);
+ width: var(--li-size);
+}
+
+img {
+ background: var(--community-circle-img-border);
+ border: var(--circle-border-size) var(--community-circle-img-border) solid;
+ border-radius: 50%;
+ flex-shrink: 0;
+ height: var(--img-size);
+ width: var(--img-size);
+}
+
+a {
+ color: unset;
+ font-weight: 500;
+}
+
+svg {
+ display: none;
+}
+
+@supports (offset-path: url("#outer-circle")) {
+ @media (min-width: $screen-md) {
+ .wrap {
+ container-type: size;
+ height: 100%;
+ width: 100%;
+ }
+
+ .inner {
+ font-size: min(1rem, 3.5cqmin);
+ padding: calc(var(--img-size) / 2) calc(var(--li-size) / 2);
+ }
+
+ ul {
+ aspect-ratio: 1 / 2;
+ display: block;
+ margin-left: auto;
+ max-height: var(--community-circle-height);
+ min-height: 0;
+ min-width: 0;
+ position: relative;
+ }
+
+ svg {
+ clip-path: inset(calc(-1 * var(--circle-border-size)));
+ display: block;
+ fill: none;
+ height: 100%;
+ overflow: visible;
+ position: absolute;
+ stroke: var(--community-circle-img-border);
+ stroke-width: var(--circle-border-size);
+ width: 100%;
+ }
+
+ li {
+ --offset-distance: calc(var(--community-circle-angle) * 50% + 25%);
+ // necessary because Firefox seems to have a bug where the links aren't
+ // clickable until we force some kind of re-render which an animation does:
+ animation: community-circle 0.1ms forwards;
+ offset-anchor: center calc(0.5 * var(--img-size));
+ offset-distance: var(--offset-distance);
+ offset-path: url("#outer-circle");
+ offset-rotate: 0deg;
+
+ @keyframes community-circle {
+ from {
+ offset-distance: calc(var(--offset-distance) - 0.1%);
+ }
+ }
+
+ &:nth-of-type(n + 6) {
+ --img-size: 5em;
+ offset-path: url("#inner-circle");
+ }
+
+ &:nth-of-type(1) {
+ --community-circle-angle: 0;
+ }
+
+ &:nth-of-type(2) {
+ --community-circle-angle: 1/4;
+ }
+
+ &:nth-of-type(3) {
+ --community-circle-angle: 2/4;
+ }
+
+ &:nth-of-type(4) {
+ --community-circle-angle: 3/4;
+ }
+
+ &:nth-of-type(5) {
+ --community-circle-angle: 1;
+ }
+
+ &:nth-of-type(6) {
+ --community-circle-angle: 0;
+ }
+
+ &:nth-of-type(7) {
+ --community-circle-angle: 1/2;
+ }
+
+ &:nth-of-type(8) {
+ --community-circle-angle: 1;
+ }
+ }
+
+ .org {
+ -webkit-box-orient: vertical;
+ display: box;
+ -webkit-line-clamp: 2;
+ line-clamp: 2;
+ overflow: hidden;
+ }
+ }
+}
diff --git a/client/src/community/contributor-list.ts b/client/src/community/contributor-list.ts
index 2a52a9d315d5..e8a659cc7e62 100644
--- a/client/src/community/contributor-list.ts
+++ b/client/src/community/contributor-list.ts
@@ -1,9 +1,11 @@
import { LitElement, html } from "lit";
import { customElement } from "lit/decorators.js";
+import styles from "./contributor-list.scss?css" with { type: "css" };
+
interface ContributorData {
name: string;
- github?: string;
+ github: string;
org?: string;
}
@@ -15,10 +17,7 @@ export class ContributorList extends LitElement {
_contributors: { state: true },
};
- createRenderRoot() {
- // use light DOM
- return this;
- }
+ static styles = styles;
constructor() {
super();
@@ -34,7 +33,7 @@ export class ContributorList extends LitElement {
const [name, github, org] = [...contributor.childNodes].map(
(node) => node?.textContent?.trim() || undefined
);
- if (!name) {
+ if (!name || !github) {
index--;
continue;
}
@@ -45,29 +44,37 @@ export class ContributorList extends LitElement {
});
}
this._contributors = randomContributors;
- contributorList.remove();
}
}
render() {
- return html`
- ${this._contributors.map(({ name, github, org }) => {
- const imgSrc = `https://avatars.githubusercontent.com/${github
- ?.split("/")
- .slice(-1)}`;
- return html`
-
-
- ${name}
-
- ${org}
- `;
- })}
- `;
+ return html`
+
+
+
+
+
+
+ ${this._contributors.map(({ name, github, org }) => {
+ const imgSrc = `https://avatars.githubusercontent.com/${github
+ ?.split("/")
+ .slice(-1)}`;
+ return html`
+
+
+ ${name}
+
+ ${org}
+ `;
+ })}
+
+
+
`;
}
}
diff --git a/client/src/community/index.scss b/client/src/community/index.scss
index f3eb73a0c4e1..bd70f1dea147 100644
--- a/client/src/community/index.scss
+++ b/client/src/community/index.scss
@@ -1,4 +1,5 @@
@use "../ui/vars" as *;
+@use "../ui/atoms/button/mixins" as button;
@mixin light-theme {
--community-bg-primary: #fcfcfc;
@@ -13,8 +14,6 @@
--community-box-shadow: 4px -2px 1rem 0 rgba(179, 179, 179, 0.2),
4px -4px 1rem 0 rgba(179, 179, 179, 0.15);
--community-circle-img-border: #fff;
- --community-circle-bg: url('data:image/svg+xml;utf8, '),
- url('data:image/svg+xml;utf8, ');
--community-quote-start: url("../assets/community/quote-start.svg");
--community-quote-end: url("../assets/community/quote-end.svg");
--community-video-bg: url("../assets/community/video-bg.svg");
@@ -41,8 +40,6 @@
--community-box-shadow: 4px -2px 15px 0 rgba(38, 38, 38, 0.2),
4px -4px 15px 0 rgba(38, 38, 38, 0.15);
--community-circle-img-border: #4e4e4e;
- --community-circle-bg: url('data:image/svg+xml;utf8, '),
- url('data:image/svg+xml;utf8, ');
--community-quote-start: url("../assets/community/quote-start-dark.svg");
--community-quote-end: url("../assets/community/quote-end-dark.svg");
--community-video-bg: url("../assets/community/video-bg-dark.svg");
@@ -77,28 +74,14 @@
main.community-container {
--community-stats-height: 5.75rem;
- --community-section-gap: 10rem;
+ --community-section-gap: 5rem;
--max-width: 74rem;
--negative-space: calc(
max(0px, 100vw - var(--max-width)) * -0.5 - var(--gutter)
);
- --button-bg: var(--button-primary-default);
- --button-bg-hover: var(--button-primary-hover);
- --button-bg-active: var(--button-primary-active);
- --button-border-color: var(--button-primary-default);
- --button-color: var(--background-primary);
- --button-font: var(--type-emphasis-m);
- --button-padding: 0.43rem 1rem;
- --button-radius: 0.25rem;
-
background: var(--community-bg-secondary);
color: var(--community-text-secondary);
- letter-spacing: var(--heading-letter-spacing);
-
- @media (max-width: $screen-md) {
- --community-section-gap: 5rem;
- }
h2,
h3,
@@ -106,30 +89,20 @@ main.community-container {
margin: 0;
}
- a {
- color: unset;
- text-decoration: underline;
-
- &.external:after {
- display: none;
- }
+ h2,
+ h3 {
+ color: var(--community-text-primary);
- &:hover {
- --button-border-color: var(--button-bg-hover);
- --button-bg: var(--button-bg-hover);
+ a {
+ color: unset;
text-decoration: none;
}
-
- &:active {
- --button-bg: var(--button-bg-active);
- }
}
- h2,
- h3 {
- color: var(--community-text-primary);
+ a {
+ text-decoration: underline;
- a {
+ &:hover {
text-decoration: none;
}
}
@@ -165,7 +138,6 @@ main.community-container {
var(--community-bg-primary) calc(var(--community-stats-height) / 2),
var(--community-bg-primary) 100%
);
- padding-top: 7rem;
@media (max-width: $screen-md) {
padding-top: 1rem;
@@ -177,6 +149,8 @@ main.community-container {
background-position: bottom calc(var(--community-stats-height) - 1rem)
right;
background-repeat: no-repeat;
+ background-size: 50%;
+ padding-top: var(--community-section-gap);
@media (max-width: $screen-md) {
background-position: top center;
@@ -187,8 +161,7 @@ main.community-container {
h1 {
color: var(--community-text-primary);
- font-size: 3rem;
- font-weight: 700;
+ font-size: 2.5rem;
margin-bottom: 1rem;
@media (max-width: $screen-md) {
@@ -211,15 +184,7 @@ main.community-container {
}
a {
- background-color: var(--button-bg);
- border: 1px solid var(--button-border-color);
- border-radius: var(--button-radius);
- color: var(--button-color);
- display: inline-block;
- font: var(--button-font);
- letter-spacing: normal;
- padding: var(--button-padding);
- text-decoration: none;
+ @include button.primary;
}
li:last-child a {
@@ -234,15 +199,11 @@ main.community-container {
box-shadow: var(--community-box-shadow);
color: var(--community-text-primary);
display: flex;
- gap: 1.38rem;
+ gap: 1rem;
justify-content: space-around;
margin-top: var(--community-section-gap);
padding: 1rem;
- @media (max-width: $screen-xl) {
- margin-top: 20rem;
- }
-
@media (max-width: $screen-md) {
flex-wrap: wrap;
margin-top: 2rem;
@@ -272,7 +233,6 @@ main.community-container {
display: inline-flex;
height: 3.75rem;
justify-content: center;
- letter-spacing: -0.03125rem;
width: 3.75rem;
}
}
@@ -288,8 +248,8 @@ main.community-container {
}
> section {
- --community-circle-height: 50rem;
- column-gap: 5rem;
+ --community-circle-height: 57rem;
+ column-gap: min(5rem, 5vw);
display: grid;
grid-template-columns: 4fr 6fr;
@@ -328,15 +288,7 @@ main.community-container {
}
a {
- background-color: var(--button-bg);
- border: 1px solid var(--button-border-color);
- border-radius: var(--button-radius);
- color: var(--button-color);
- display: inline-block;
- font: var(--button-font);
- letter-spacing: normal;
- padding: var(--button-padding);
- text-decoration: none;
+ @include button.primary;
}
li:last-child a {
@@ -345,133 +297,15 @@ main.community-container {
}
}
- > contributor-list {
- --community-list-img-size: 3.75rem;
- --community-list-width: 10rem;
+ contributor-list {
grid-column: 1;
grid-row: 1/5;
+ margin-left: calc(var(--negative-space) + var(--gutter));
min-width: 0;
- > * {
+ > ul {
display: none;
}
-
- ul.rendered {
- align-content: start;
- display: grid;
- gap: 2rem 1rem;
- grid-template-columns: repeat(
- auto-fit,
- minmax(var(--community-list-width), 1fr)
- );
- justify-items: center;
-
- @media (max-width: $screen-md) {
- display: flex;
- margin-top: 2rem;
- overflow-x: auto;
- }
-
- li,
- a {
- align-items: center;
- display: flex;
- flex-direction: column;
- flex-shrink: 0;
- text-align: center;
- }
-
- li {
- color: var(--community-text-primary);
- width: var(--community-list-width);
- }
-
- img {
- background: var(--community-circle-img-border);
- border: 6px var(--community-circle-img-border) solid;
- border-radius: 50%;
- flex-shrink: 0;
- height: var(--community-list-img-size);
- width: var(--community-list-img-size);
- }
-
- a {
- font-weight: 500;
- }
- }
- }
- }
- }
-
- @supports (offset-path: ellipse(100% 50% at right center)) {
- @media (min-width: $screen-xxl) {
- &[aria-labelledby="meet_our_contributors"] {
- contributor-list ul.rendered {
- background-image: var(--community-circle-bg);
- display: block;
- height: var(--community-circle-height);
- margin: calc(var(--community-list-img-size) / 2)
- calc(var(--community-list-width) / 2);
- position: relative;
-
- li {
- --offset-distance: calc(
- var(--community-circle-angle) * 50% + 25%
- );
- // necessary because Firefox seems to have a bug where the links aren't
- // clickable until we force some kind of re-render which an animation does:
- animation: community-circle 1s forwards;
- height: var(--community-list-img-size);
- offset-distance: calc(var(--offset-distance) - 1%);
- // matches first svg defined in --community-circle-bg:
- offset-path: ellipse(100% 50% at right center);
- offset-rotate: 0deg;
-
- @keyframes community-circle {
- to {
- offset-distance: var(--offset-distance);
- }
- }
-
- &:nth-child(n + 6) {
- --community-list-img-size: 5rem;
- // matches second svg defined in --community-circle-bg
- offset-path: ellipse(50% 25% at right center);
- }
-
- &:nth-child(1) {
- --community-circle-angle: 0;
- }
-
- &:nth-child(2) {
- --community-circle-angle: 1/4;
- }
-
- &:nth-child(3) {
- --community-circle-angle: 2/4;
- }
-
- &:nth-child(4) {
- --community-circle-angle: 3/4;
- }
-
- &:nth-child(5) {
- --community-circle-angle: 1;
- }
-
- &:nth-child(6) {
- --community-circle-angle: 0;
- }
-
- &:nth-child(7) {
- --community-circle-angle: 1/2;
- }
-
- &:nth-child(8) {
- --community-circle-angle: 1;
- }
- }
- }
}
}
}
@@ -495,9 +329,9 @@ main.community-container {
gap: 2rem;
margin-bottom: 1.5rem;
margin-left: -1rem;
+ margin-right: var(--negative-space);
overflow-x: auto;
padding: 2.41rem 1rem;
- margin-right: var(--negative-space);
@media (max-width: $screen-md) {
margin-left: calc(var(--gutter) * -1);
@@ -579,31 +413,35 @@ main.community-container {
}
p:last-child {
+ background-image: var(--community-video-bg);
+ background-position: center;
+ background-repeat: no-repeat;
+ background-size: contain;
// video link
- display: contents;
+ grid-column: 1;
+ grid-row: 1/6;
+ margin: 0;
@media (max-width: $screen-md) {
display: flex;
justify-content: center;
+ margin: 0 auto;
+ max-width: 25rem;
}
a {
+ aspect-ratio: 1;
background-image: url("../assets/community/youtube-play.svg"),
- url("../assets/community/video-thumbnail.png"),
- var(--community-video-bg);
+ url("../assets/community/video-thumbnail.png");
background-position:
43% 50%,
- 36% 50%,
- center;
+ 36% 50%;
background-repeat: no-repeat;
- background-size: 13%, 60%, contain;
+ background-size: 13%, 60%;
+ clip-path: circle(35%);
color: transparent;
display: block;
- grid-column: 1;
- grid-row: 1/6;
- height: min(25rem, 100vw);
- max-width: 28rem;
overflow: hidden;
text-indent: -100rem;
@@ -624,9 +462,9 @@ main.community-container {
ul {
display: grid;
- gap: 4.88rem;
+ gap: 2rem;
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
- margin-bottom: 5.13rem;
+ margin-bottom: var(--community-section-gap);
}
li {
@@ -655,15 +493,7 @@ main.community-container {
}
a {
- background-color: var(--button-bg);
- border: 1px solid var(--button-border-color);
- border-radius: var(--button-radius);
- color: var(--button-color);
- display: inline-block;
- font: var(--button-font);
- letter-spacing: normal;
- padding: var(--button-padding);
- text-decoration: none;
+ @include button.primary;
}
}
}
@@ -676,7 +506,7 @@ main.community-container {
color: var(--community-text-primary-alt);
display: block;
max-width: 100%;
- padding: calc(var(--community-section-gap) / 2) 0;
+ padding-bottom: var(--community-section-gap);
h2,
.section-content,
@@ -691,6 +521,8 @@ main.community-container {
}
&[aria-labelledby="help_us_fix_open_issues"] {
+ padding-top: var(--community-section-gap);
+
.issues-table {
margin-top: 1rem;
}
@@ -803,15 +635,7 @@ main.community-container {
}
a {
- background-color: var(--button-bg);
- border: 1px solid var(--button-border-color);
- border-radius: var(--button-radius);
- color: var(--button-color);
- display: inline-block;
- font: var(--button-font);
- letter-spacing: normal;
- padding: var(--button-padding);
- text-decoration: none;
+ @include button.primary;
}
}
}
diff --git a/client/src/react-app.d.ts b/client/src/react-app.d.ts
index 09f456fa1906..f48033dc209a 100644
--- a/client/src/react-app.d.ts
+++ b/client/src/react-app.d.ts
@@ -79,6 +79,14 @@ declare module "*.svg" {
export default src;
}
+// once https://github.com/microsoft/TypeScript/issues/46135 is fixed
+// we'll be able to do something like:
+// declare module '*' with {type: 'css'} {
+declare module "*?css" {
+ const sheet: CSSStyleSheet;
+ export default sheet;
+}
+
declare module "*.module.css" {
const classes: { readonly [key: string]: string };
export default classes;
diff --git a/client/src/ui/atoms/button/_mixins.scss b/client/src/ui/atoms/button/_mixins.scss
new file mode 100644
index 000000000000..d6c6d84c448f
--- /dev/null
+++ b/client/src/ui/atoms/button/_mixins.scss
@@ -0,0 +1,49 @@
+@mixin _button {
+ --button-font: var(--type-emphasis-m);
+ --button-padding: 0.43rem 1rem;
+ --button-radius: var(--elem-radius, 0.25rem);
+
+ background-color: var(--button-bg);
+ border: 1px solid var(--button-border-color);
+ border-radius: var(--button-radius);
+ color: var(--button-color);
+ display: inline-block;
+ font: var(--button-font);
+ letter-spacing: normal;
+ padding: var(--button-padding);
+ text-align: center;
+ text-decoration: none;
+
+ &.external:after {
+ display: none;
+ }
+
+ &:hover {
+ --button-border-color: var(--button-bg-hover);
+ --button-bg: var(--button-bg-hover);
+ }
+
+ &:active {
+ --button-bg: var(--button-bg-active);
+ }
+}
+
+@mixin primary {
+ --button-bg: var(--button-primary-default);
+ --button-bg-hover: var(--button-primary-hover);
+ --button-bg-active: var(--button-primary-active);
+ --button-border-color: var(--button-primary-default);
+ --button-color: var(--background-primary);
+
+ @include _button;
+}
+
+@mixin secondary {
+ --button-bg: var(--button-secondary-default);
+ --button-bg-hover: var(--button-secondary-hover);
+ --button-bg-active: var(--button-secondary-active);
+ --button-border-color: var(--border-primary);
+ --button-color: var(--text-secondary);
+
+ @include _button;
+}
diff --git a/client/tsconfig.json b/client/tsconfig.json
index 3785472bddfd..9d382647f7ae 100644
--- a/client/tsconfig.json
+++ b/client/tsconfig.json
@@ -7,7 +7,7 @@
"isolatedModules": true,
"jsx": "react-jsx",
"lib": ["dom", "dom.iterable", "es2021"],
- "module": "ES2020",
+ "module": "ESNext",
"moduleResolution": "Node",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
From d8e590afa541502c7cdeda289c7b282f6a853bbb Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Mon, 23 Sep 2024 20:30:10 +0000
Subject: [PATCH 26/44] wip(community): fix tsc
---
ssr/react-app.d.ts | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/ssr/react-app.d.ts b/ssr/react-app.d.ts
index 8930f7c00dc1..c1e7ada77a12 100644
--- a/ssr/react-app.d.ts
+++ b/ssr/react-app.d.ts
@@ -75,6 +75,14 @@ declare module "*.svg" {
export default src;
}
+// once https://github.com/microsoft/TypeScript/issues/46135 is fixed
+// we'll be able to do something like:
+// declare module '*' with {type: 'css'} {
+declare module "*?css" {
+ const sheet: CSSStyleSheet;
+ export default sheet;
+}
+
declare module "*.module.css" {
const classes: { readonly [key: string]: string };
export default classes;
From 5023a336a226fc175a510328281db241d2e0db16 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Mon, 23 Sep 2024 20:42:11 +0000
Subject: [PATCH 27/44] wip(community): fix line clamp
---
client/src/community/contributor-list.scss | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/client/src/community/contributor-list.scss b/client/src/community/contributor-list.scss
index cd1d5a616f26..94077037cf5b 100644
--- a/client/src/community/contributor-list.scss
+++ b/client/src/community/contributor-list.scss
@@ -149,7 +149,8 @@ svg {
.org {
-webkit-box-orient: vertical;
- display: box;
+ /* stylelint-disable-next-line value-no-vendor-prefix */
+ display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
overflow: hidden;
From 2f3e816e9144998e688a5b98dd3d497460d0103a Mon Sep 17 00:00:00 2001
From: Florian Dieminger
Date: Wed, 25 Sep 2024 13:26:03 +0200
Subject: [PATCH 28/44] fix(community): use md to build
---
build/spas.ts | 31 ++---------
copy/community/README.md | 18 ------
copy/community/index.json | 112 --------------------------------------
3 files changed, 6 insertions(+), 155 deletions(-)
delete mode 100644 copy/community/README.md
delete mode 100644 copy/community/index.json
diff --git a/build/spas.ts b/build/spas.ts
index b5771318e281..bab1950f696d 100644
--- a/build/spas.ts
+++ b/build/spas.ts
@@ -245,10 +245,9 @@ export async function buildSPAs(options: {
pageDescription,
noIndexing,
onlyFollow,
- json,
} of SPAs) {
const url = `/${locale}/${prefix}`;
- let context: HydrationData = {
+ const context: HydrationData = {
pageTitle,
pageDescription,
locale,
@@ -257,29 +256,6 @@ export async function buildSPAs(options: {
url,
};
- if (json) {
- context = JSON.parse(await fs.promises.readFile(json, "utf-8"));
- const localeReplace = function (obj: any) {
- try {
- Object.keys(obj);
- } catch {
- return;
- }
- for (const key of Object.keys(obj)) {
- if (typeof obj[key] === "object") {
- localeReplace(obj[key]);
- }
- if (typeof obj[key] === "string") {
- obj[key] = obj[key]
- .replace(/^en-US$/, locale)
- .replace(/^\/en-US\//, `/${locale}/`)
- .replace(/ href="\/en-US\//g, ` href="/${locale}/`);
- }
- }
- };
- localeReplace(context);
- }
-
const outPath = path.join(BUILD_OUT_ROOT, pathLocale, prefix);
fs.mkdirSync(outPath, { recursive: true });
const jsonFilePath = path.join(outPath, "index.json");
@@ -393,6 +369,11 @@ export async function buildSPAs(options: {
"observatory/docs",
OBSERVATORY_TITLE
);
+ await buildStaticPages(
+ fileURLToPath(new URL("../copy/community/", import.meta.url)),
+ "community",
+ "Contribute to MDN"
+ );
// Build all the home pages in all locales.
// Fetch merged content PRs for the latest contribution section.
diff --git a/copy/community/README.md b/copy/community/README.md
deleted file mode 100644
index f077d82a57c9..000000000000
--- a/copy/community/README.md
+++ /dev/null
@@ -1,18 +0,0 @@
-Massive temporary hack:
-
-```bash
-cd yari
-cp copy/community/index.md ../curriculum/curriculum/
-yarn build:curriculum
-```
-
-This will build into `client/build/en-us/curriculum/index/index.json`, open that
-file:
-
-```bash
-code client/build/en-us/curriculum/index/index.json
-```
-
-Format the file, then manually update all the wrong references to curriculum:
-alternatively, if you've only changed the sections just copy the `body` key into
-`copy/community/index.json`.
diff --git a/copy/community/index.json b/copy/community/index.json
deleted file mode 100644
index fefebc1a3f1c..000000000000
--- a/copy/community/index.json
+++ /dev/null
@@ -1,112 +0,0 @@
-{
- "doc": {
- "locale": "en-US",
- "title": "MDN Community",
- "mdn_url": "/en-US/community/",
- "native": "English (US)",
- "body": [
- {
- "type": "prose",
- "value": {
- "id": null,
- "title": null,
- "isH3": false,
- "content": "Where web enthusiasts learn, collaborate, and create
\n\n\n 45K+ Total contributors \n 80M+ Monthly views \n 200+ Weekly commits \n 8 Language communities \n "
- }
- },
- {
- "type": "prose",
- "value": {
- "id": "mdns_community_powers_the_web",
- "title": "MDN's community powers the web",
- "isH3": false,
- "content": "\n MDN’s strength comes from the passion and dedication of our global community.\n Since our founding in 2005, we’ve grown into a thriving network. Together, we’ve\n created a comprehensive, open, and free resource that serves web developers\n across the globe. With volunteers leading translation efforts in\n 8 languages , we’re\n truly international.\n
"
- }
- },
- {
- "type": "prose",
- "value": {
- "id": "meet_our_contributors",
- "title": "Meet our contributors",
- "isH3": false,
- "content": "\n We are an open-source community of developers dedicated to building resources\n for a better web. Our diverse contributors, including developers, technical\n writers, students, educators, designers, and more, come from various backgrounds\n and platforms. Anyone can contribute, and each contribution strengthens our\n community, driving innovation and improving this vital resource for developers\n worldwide.\n
\n\n\n \n "
- }
- },
- {
- "type": "prose",
- "value": {
- "id": "contributor_spotlight",
- "title": "Contributor spotlight",
- "isH3": false,
- "content": "\n \n \n \n There are many other things I like about MDN: the openness of its\n governance, the respect for contributors' work, the professional\n conversations, and the always timely reviews. MDN has consistently\n demonstrated the ideal form of an open-source project.\n
\n Joshua Chen (MDN contributor)\n \n \n \n \n MDN Web Docs has the most up-to-date and accurate information and the\n content is presented in an easy-to-understand manner. I also like that it's\n available in many languages (very important!).\n
\n Yuji (MDN contributor)\n \n \n \n \n There are millions of web developers in China, and many of them begin their\n developer journey at MDN Web Docs. Contributing to MDN Web Docs is an\n excellent way to help people who are starting out.\n
\n YiTao Yin (MDN contributor)\n \n \n\n If you wish to be a part of the featured contributors here,\n let us know . If you’re featured here and would like to opt-out,\n please file an issue on GitHub .\n
"
- }
- },
- {
- "type": "prose",
- "value": {
- "id": "learn_how_to_get_started",
- "title": "Learn how to get started",
- "isH3": false,
- "content": "\n We collaborate on GitHub , our project's home, on\n various tasks such as writing and improving documentation, fixing bugs, and\n providing review feedback. It starts here, with you. Want to start right away,\n but not sure how? Follow\n our guide \n to make your first contribution.\n
\n\n Watch this video on\n how to get started with contributing to MDN Web Docs \n
\nVideo from the community team on contributing to MDN
"
- }
- },
- {
- "type": "prose",
- "value": {
- "id": "join_us_in_shaping_a_better_web",
- "title": "Join us in shaping a better web",
- "isH3": false,
- "content": "\n Become part of this globally cherished group that’s dedicated to documenting web\n technologies. Whether you’re an expert or a beginner, there’s a place for you in\n our inclusive community. Check out some of the ways you can contribute and\n engage.\n
\n\n \n Fix issues Submit pull requests to fix reported issues.\n Squash bugs \n \n \n Improve content Fix inaccuracies and fill in missing information.\n Start writing \n \n \n Localize content Participate in translating content into one of our supported languages.\n Find your locale \n \n \n Answer questions Share your knowledge and expertise and guide fellow learners.\n Help on Discord \n \n "
- }
- },
- {
- "type": "prose",
- "value": {
- "id": "help_us_fix_open_issues",
- "title": "Help us fix open issues",
- "isH3": false,
- "content": "\n New to MDN or open-source projects? Tackle our beginner-friendly issues to help\n improve MDN.\n
"
- }
- },
- {
- "type": "prose",
- "value": {
- "id": "join_the_conversation",
- "title": "Join the conversation",
- "isH3": false,
- "content": "\n \n Chat with us on Discord Connect with the community. Engage with domain experts. Help others learn.\n Join MDN Discord \n \n \n Every month, get exclusive updates from the MDN team. Share your ideas and\n contributions.\n RSVP to the next community call \n \n \n\n While working in Mozilla spaces and communities, please adhere to the\n Mozilla Community Participation Guidelines ,\n which promote respect, inclusion, and a harassment-free environment for all\n community members.\n
"
- }
- },
- {
- "type": "prose",
- "value": {
- "id": "licensing_and_reuse",
- "title": "Licensing and reuse",
- "isH3": false,
- "content": "\n MDN's resources are freely available under various open-source licenses. For\n detailed information on reusing MDN content, check out our\n Attribution and Copyright Licensing \n page.\n
"
- }
- }
- ],
- "pageTitle": "MDN Community",
- "noIndexing": false,
- "toc": [
- {
- "text": "MDN's community powers the web",
- "id": "mdns_community_powers_the_web"
- },
- { "text": "Meet our contributors", "id": "meet_our_contributors" },
- { "text": "Contributor spotlight", "id": "contributor_spotlight" },
- { "text": "Learn how to get started", "id": "learn_how_to_get_started" },
- {
- "text": "Join us in shaping a better web",
- "id": "join_us_in_shaping_a_better_web"
- },
- { "text": "Help us fix open issues", "id": "help_us_fix_open_issues" },
- { "text": "Join the conversation", "id": "join_the_conversation" },
- { "text": "Licensing and reuse", "id": "licensing_and_reuse" }
- ]
- },
- "pageTitle": "MDN Community",
- "locale": "en-US",
- "url": "/en-US/community/"
-}
From d3742d2ac5bcba7d2dc44e0cdebde21ef0f0601c Mon Sep 17 00:00:00 2001
From: Florian Dieminger
Date: Wed, 25 Sep 2024 13:27:56 +0200
Subject: [PATCH 29/44] fix(community): remove hack
---
build/spas.ts | 7 -------
1 file changed, 7 deletions(-)
diff --git a/build/spas.ts b/build/spas.ts
index bab1950f696d..3225d8a44274 100644
--- a/build/spas.ts
+++ b/build/spas.ts
@@ -222,13 +222,6 @@ export async function buildSPAs(options: {
noIndexing: true,
},
{ prefix: "about", pageTitle: "About MDN" },
- {
- prefix: "community",
- pageTitle: "Contribute to MDN",
- json: fileURLToPath(
- new URL("../copy/community/index.json", import.meta.url)
- ),
- },
{
prefix: "advertising",
pageTitle: "Advertise with us",
From cade810ae09acea5a8e54922fb31f868ab174da4 Mon Sep 17 00:00:00 2001
From: Florian Dieminger
Date: Wed, 25 Sep 2024 13:56:56 +0200
Subject: [PATCH 30/44] fix(community): use hyData format
---
build/spas.ts | 23 ++++++-----------------
client/src/community/index.tsx | 15 ++++++---------
copy/community/{index.md => community.md} | 0
3 files changed, 12 insertions(+), 26 deletions(-)
rename copy/community/{index.md => community.md} (100%)
diff --git a/build/spas.ts b/build/spas.ts
index 3225d8a44274..c8e2c8f62b12 100644
--- a/build/spas.ts
+++ b/build/spas.ts
@@ -268,16 +268,9 @@ export async function buildSPAs(options: {
}
// Building the MDN Plus pages.
-
- /**
- *
- * @param {string} dirpath
- * @param {string} slug
- * @param {string} title
- */
async function buildStaticPages(
dirpath: string,
- slug: string,
+ slugPrefix?: string,
title = "MDN"
) {
const crawler = new fdir()
@@ -298,13 +291,14 @@ export async function buildSPAs(options: {
const frontMatter = frontmatter(markdown);
const rawHTML = await m2h(frontMatter.body, { locale });
- const url = `/${locale}/${slug}/${page}`;
+ const slug = slugPrefix ? `${slugPrefix}/${page}` : `${page}`;
+ const url = `/${locale}/${slug}`;
const d = {
url,
rawBody: rawHTML,
metadata: {
locale: DEFAULT_LOCALE,
- slug: `${slug}/${page}`,
+ slug,
url,
},
@@ -330,12 +324,7 @@ export async function buildSPAs(options: {
url,
};
- const outPath = path.join(
- BUILD_OUT_ROOT,
- pathLocale,
- ...slug.split("/"),
- page
- );
+ const outPath = path.join(BUILD_OUT_ROOT, pathLocale, ...slug.split("/"));
fs.mkdirSync(outPath, { recursive: true });
const jsonFilePath = path.join(outPath, "index.json");
fs.writeFileSync(jsonFilePath, JSON.stringify(context));
@@ -364,7 +353,7 @@ export async function buildSPAs(options: {
);
await buildStaticPages(
fileURLToPath(new URL("../copy/community/", import.meta.url)),
- "community",
+ "",
"Contribute to MDN"
);
diff --git a/client/src/community/index.tsx b/client/src/community/index.tsx
index 8b6f4006d051..26b9e6526f81 100644
--- a/client/src/community/index.tsx
+++ b/client/src/community/index.tsx
@@ -11,7 +11,7 @@ import { useIsServer } from "../hooks";
interface CommunityDoc {
title: string;
- body: Section[];
+ sections: Section[];
}
export function Community(appProps: HydrationData) {
@@ -70,15 +70,15 @@ function useCommunityDoc(
throw new HTTPError(response.status, url, text);
}
- return (await response.json())?.doc;
+ return (await response.json())?.hyData;
},
{
- fallbackData: appProps?.doc,
+ fallbackData: appProps?.hyData,
revalidateOnFocus: WRITER_MODE,
revalidateOnMount: true,
}
);
- const doc: CommunityDoc | undefined = data || appProps?.doc || undefined;
+ const doc: CommunityDoc | undefined = data || appProps?.hyData || undefined;
return doc;
}
@@ -89,7 +89,7 @@ function RenderCommunityBody({
doc?: CommunityDoc;
renderer?: (section: Section, i: number) => null | JSX.Element;
}) {
- return doc?.body.map((section, i) => {
+ return doc?.sections.map((section, i) => {
return (
renderer(section, i) || (
@@ -105,10 +105,7 @@ function Header({ section, h1 }: { section: any; h1?: string }) {
);
return (
);
}
diff --git a/copy/community/index.md b/copy/community/community.md
similarity index 100%
rename from copy/community/index.md
rename to copy/community/community.md
From 8bf0bf2421cf63898b928d3a3321226035415822 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Fri, 27 Sep 2024 10:54:01 +0000
Subject: [PATCH 31/44] fix(community): offset-path url not working in chrome
---
client/src/community/contributor-list.scss | 6 +++---
client/src/community/contributor-list.ts | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/client/src/community/contributor-list.scss b/client/src/community/contributor-list.scss
index 94077037cf5b..a1c5cefcde64 100644
--- a/client/src/community/contributor-list.scss
+++ b/client/src/community/contributor-list.scss
@@ -58,7 +58,7 @@ svg {
display: none;
}
-@supports (offset-path: url("#outer-circle")) {
+@supports (offset-path: ellipse(100% 50% at 100% 50%)) {
@media (min-width: $screen-md) {
.wrap {
container-type: size;
@@ -100,7 +100,7 @@ svg {
animation: community-circle 0.1ms forwards;
offset-anchor: center calc(0.5 * var(--img-size));
offset-distance: var(--offset-distance);
- offset-path: url("#outer-circle");
+ offset-path: ellipse(100% 50% at 100% 50%);
offset-rotate: 0deg;
@keyframes community-circle {
@@ -111,7 +111,7 @@ svg {
&:nth-of-type(n + 6) {
--img-size: 5em;
- offset-path: url("#inner-circle");
+ offset-path: ellipse(50% 25% at 100% 50%);
}
&:nth-of-type(1) {
diff --git a/client/src/community/contributor-list.ts b/client/src/community/contributor-list.ts
index e8a659cc7e62..e01d4f3e9c53 100644
--- a/client/src/community/contributor-list.ts
+++ b/client/src/community/contributor-list.ts
@@ -52,8 +52,8 @@ export class ContributorList extends LitElement {
-
-
+
+
${this._contributors.map(({ name, github, org }) => {
const imgSrc = `https://avatars.githubusercontent.com/${github
From 88fb28e1c253fa64bbe2d4f671c11012b89695a8 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Fri, 27 Sep 2024 10:59:13 +0000
Subject: [PATCH 32/44] fix(community): update copy
---
copy/community/community.md | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/copy/community/community.md b/copy/community/community.md
index 24733eaac35f..7e5e9d92dd53 100644
--- a/copy/community/community.md
+++ b/copy/community/community.md
@@ -8,9 +8,8 @@ Where web enthusiasts learn, collaborate, and create
- **45K+** Total contributors
-- **80M+** Monthly views
- **200+** Weekly commits
-- **8** Language communities
+- **7** Language communities
## MDN's community powers the web
@@ -18,15 +17,15 @@ MDN’s strength comes from the passion and dedication of our global community.
Since our founding in 2005, we’ve grown into a thriving network. Together, we’ve
created a comprehensive, open, and free resource that serves web developers
across the globe. With volunteers leading translation efforts in
-[8 languages](/en-US/docs/MDN/Community/Contributing/Translated_content), we’re
+[7 languages](/en-US/docs/MDN/Community/Contributing/Translated_content), we’re
truly international.
## Meet our contributors
-We are an open-source community of developers dedicated to building resources
-for a better web. Our diverse contributors, including developers, technical
-writers, students, educators, designers, and more, come from various backgrounds
-and platforms. Anyone can contribute, and each contribution strengthens our
+We are an open-source community dedicated to building resources for a better
+web. Our diverse contributors, including developers, technical writers,
+students, educators, designers, and more, come from various backgrounds and
+platforms. Anyone can contribute, and each contribution strengthens our
community, driving innovation and improving this vital resource for developers
worldwide.
@@ -75,8 +74,8 @@ worldwide.
[YiTao Yin](/en-US/community/spotlight/yitao-yin) (MDN contributor)
If you wish to be a part of the featured contributors here,
-[let us know](https://docs.google.com/forms/d/171RuXZoNs1gQmlJtfTiiU-hFo_odvi6rkx5fH-nqXDY/prefill).
-If you’re featured here and would like to opt-out,
+[let us know](https://forms.gle/7yk13Nn1WRLnuLvy5). If you’re featured here
+and would like to opt-out,
[please file an issue on GitHub](https://github.com/mdn/content/issues/new?assignees=&labels=needs+triage&projects=&template=content-bug.yml).
## Learn how to get started
@@ -89,7 +88,7 @@ but not sure how? Follow
to make your first contribution.
Watch this video on
-[how to get started with contributing to MDN Web Docs](https://www.youtube.com/watch?v=Xnhnu7PViQE)
+[how to get started with contributing to MDN](https://www.youtube.com/watch?v=Xnhnu7PViQE).
[Video from the community team on contributing to MDN](https://www.youtube.com/watch?v=Xnhnu7PViQE)
From a9d4513ce3d3e0be4738a14a9050fbeaa388c423 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Fri, 27 Sep 2024 11:26:06 +0000
Subject: [PATCH 33/44] fix(community): keep things within main box
---
client/src/community/index.scss | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/client/src/community/index.scss b/client/src/community/index.scss
index bd70f1dea147..e15bbaf8948d 100644
--- a/client/src/community/index.scss
+++ b/client/src/community/index.scss
@@ -300,7 +300,6 @@ main.community-container {
contributor-list {
grid-column: 1;
grid-row: 1/5;
- margin-left: calc(var(--negative-space) + var(--gutter));
min-width: 0;
> ul {
@@ -324,18 +323,43 @@ main.community-container {
margin-bottom: 0;
}
+ .section-content {
+ position: relative;
+
+ &::after {
+ content: "";
+ display: block;
+ position: absolute;
+ background: linear-gradient(
+ to right,
+ transparent,
+ var(--community-bg-secondary)
+ );
+ right: 0;
+ top: 0;
+ bottom: 0;
+ width: 3rem;
+ pointer-events: none;
+
+ @media (max-width: $screen-md) {
+ display: none;
+ }
+ }
+ }
+
ul {
display: flex;
gap: 2rem;
margin-bottom: 1.5rem;
margin-left: -1rem;
- margin-right: var(--negative-space);
overflow-x: auto;
padding: 2.41rem 1rem;
+ padding-right: 3rem;
@media (max-width: $screen-md) {
margin-left: calc(var(--gutter) * -1);
margin-right: calc(var(--gutter) * -1);
+ padding-right: 1rem;
}
}
From 5bfa3bb7aaa5c19389e436c0a57facea686df0ad Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Fri, 27 Sep 2024 11:35:52 +0000
Subject: [PATCH 34/44] fix(community): run svgs through svgo
---
.../assets/community/community-calls-dark.svg | 5 +-
.../src/assets/community/community-calls.svg | 9 +--
client/src/assets/community/discord-dark.svg | 6 +-
client/src/assets/community/discord.svg | 10 +--
client/src/assets/community/people-dark.svg | 70 +-----------------
client/src/assets/community/people.svg | 71 +------------------
.../src/assets/community/quote-end-dark.svg | 5 +-
client/src/assets/community/quote-end.svg | 5 +-
.../src/assets/community/quote-start-dark.svg | 5 +-
client/src/assets/community/quote-start.svg | 5 +-
client/src/assets/community/video-bg-dark.svg | 11 +--
client/src/assets/community/video-bg.svg | 11 +--
client/src/assets/community/youtube-play.svg | 9 +--
13 files changed, 13 insertions(+), 209 deletions(-)
diff --git a/client/src/assets/community/community-calls-dark.svg b/client/src/assets/community/community-calls-dark.svg
index 7856e5e846f6..2240154f1349 100644
--- a/client/src/assets/community/community-calls-dark.svg
+++ b/client/src/assets/community/community-calls-dark.svg
@@ -1,4 +1 @@
-
-
-
-
+
\ No newline at end of file
diff --git a/client/src/assets/community/community-calls.svg b/client/src/assets/community/community-calls.svg
index 962ac8364ae8..27cfe9867dd8 100644
--- a/client/src/assets/community/community-calls.svg
+++ b/client/src/assets/community/community-calls.svg
@@ -1,8 +1 @@
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/client/src/assets/community/discord-dark.svg b/client/src/assets/community/discord-dark.svg
index d5bfd2e0fa31..f836421aa365 100644
--- a/client/src/assets/community/discord-dark.svg
+++ b/client/src/assets/community/discord-dark.svg
@@ -1,5 +1 @@
-
-
-
-
-
+
\ No newline at end of file
diff --git a/client/src/assets/community/discord.svg b/client/src/assets/community/discord.svg
index 45d63e96a463..7a2f39028ace 100644
--- a/client/src/assets/community/discord.svg
+++ b/client/src/assets/community/discord.svg
@@ -1,9 +1 @@
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/client/src/assets/community/people-dark.svg b/client/src/assets/community/people-dark.svg
index 71db99b7f6b0..e8e6d6291378 100644
--- a/client/src/assets/community/people-dark.svg
+++ b/client/src/assets/community/people-dark.svg
@@ -1,69 +1 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/client/src/assets/community/people.svg b/client/src/assets/community/people.svg
index d8a6d8d20846..ed01e9f1ac51 100644
--- a/client/src/assets/community/people.svg
+++ b/client/src/assets/community/people.svg
@@ -1,70 +1 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/client/src/assets/community/quote-end-dark.svg b/client/src/assets/community/quote-end-dark.svg
index 169e0f190da4..17111d53c590 100644
--- a/client/src/assets/community/quote-end-dark.svg
+++ b/client/src/assets/community/quote-end-dark.svg
@@ -1,4 +1 @@
-
-
-
-
+
\ No newline at end of file
diff --git a/client/src/assets/community/quote-end.svg b/client/src/assets/community/quote-end.svg
index 4fc721e4dbd8..7157f39d7558 100644
--- a/client/src/assets/community/quote-end.svg
+++ b/client/src/assets/community/quote-end.svg
@@ -1,4 +1 @@
-
-
-
-
+
\ No newline at end of file
diff --git a/client/src/assets/community/quote-start-dark.svg b/client/src/assets/community/quote-start-dark.svg
index 16e4603b4c56..3a4f97aae0f5 100644
--- a/client/src/assets/community/quote-start-dark.svg
+++ b/client/src/assets/community/quote-start-dark.svg
@@ -1,4 +1 @@
-
-
-
-
+
\ No newline at end of file
diff --git a/client/src/assets/community/quote-start.svg b/client/src/assets/community/quote-start.svg
index a179e3ed2896..d668df1113f5 100644
--- a/client/src/assets/community/quote-start.svg
+++ b/client/src/assets/community/quote-start.svg
@@ -1,4 +1 @@
-
-
-
-
+
\ No newline at end of file
diff --git a/client/src/assets/community/video-bg-dark.svg b/client/src/assets/community/video-bg-dark.svg
index 3cbd3d0c845f..5e44ae3bfd1b 100644
--- a/client/src/assets/community/video-bg-dark.svg
+++ b/client/src/assets/community/video-bg-dark.svg
@@ -1,10 +1 @@
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/client/src/assets/community/video-bg.svg b/client/src/assets/community/video-bg.svg
index 4e57ae8435c2..28ed1f005ca3 100644
--- a/client/src/assets/community/video-bg.svg
+++ b/client/src/assets/community/video-bg.svg
@@ -1,10 +1 @@
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/client/src/assets/community/youtube-play.svg b/client/src/assets/community/youtube-play.svg
index 2cbdb4edb31c..f6d7dc4ca7b4 100644
--- a/client/src/assets/community/youtube-play.svg
+++ b/client/src/assets/community/youtube-play.svg
@@ -1,8 +1 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
From 9af3518cb72f03838fa6ebe60fb8ba8570af0d93 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Fri, 27 Sep 2024 11:46:33 +0000
Subject: [PATCH 35/44] fix(community): stylelint
---
client/src/community/index.scss | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/client/src/community/index.scss b/client/src/community/index.scss
index e15bbaf8948d..c20be86ef2d0 100644
--- a/client/src/community/index.scss
+++ b/client/src/community/index.scss
@@ -327,19 +327,19 @@ main.community-container {
position: relative;
&::after {
- content: "";
- display: block;
- position: absolute;
background: linear-gradient(
to right,
transparent,
var(--community-bg-secondary)
);
+ bottom: 0;
+ content: "";
+ display: block;
+ pointer-events: none;
+ position: absolute;
right: 0;
top: 0;
- bottom: 0;
width: 3rem;
- pointer-events: none;
@media (max-width: $screen-md) {
display: none;
From dcb19675e5f29064c033adc9fc39e53519dcca65 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Mon, 30 Sep 2024 11:09:05 +0000
Subject: [PATCH 36/44] fix(community): avoid '| Contribute to MDN' title
---
build/spas.ts | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/build/spas.ts b/build/spas.ts
index c8e2c8f62b12..7076f3f4c014 100644
--- a/build/spas.ts
+++ b/build/spas.ts
@@ -320,7 +320,9 @@ export async function buildSPAs(options: {
};
const context: HydrationData = {
hyData,
- pageTitle: `${frontMatter.attributes.title || ""} | ${title}`,
+ pageTitle: frontMatter.attributes.title
+ ? `${frontMatter.attributes.title} | ${title}`
+ : title,
url,
};
From 28aa732af42db98824b067857c4b332f157163a2 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Tue, 1 Oct 2024 11:01:04 +0000
Subject: [PATCH 37/44] fix(community): fix tabbing order in contributor circle
---
client/src/community/contributor-list.scss | 48 ++++++++--------------
1 file changed, 17 insertions(+), 31 deletions(-)
diff --git a/client/src/community/contributor-list.scss b/client/src/community/contributor-list.scss
index a1c5cefcde64..58cc783a0dd0 100644
--- a/client/src/community/contributor-list.scss
+++ b/client/src/community/contributor-list.scss
@@ -94,7 +94,6 @@ svg {
}
li {
- --offset-distance: calc(var(--community-circle-angle) * 50% + 25%);
// necessary because Firefox seems to have a bug where the links aren't
// clickable until we force some kind of re-render which an animation does:
animation: community-circle 0.1ms forwards;
@@ -109,41 +108,28 @@ svg {
}
}
- &:nth-of-type(n + 6) {
- --img-size: 5em;
- offset-path: ellipse(50% 25% at 100% 50%);
- }
-
- &:nth-of-type(1) {
- --community-circle-angle: 0;
- }
-
- &:nth-of-type(2) {
- --community-circle-angle: 1/4;
- }
-
- &:nth-of-type(3) {
- --community-circle-angle: 2/4;
- }
+ $outer-elements: 5;
+ $inner-elements: 3;
- &:nth-of-type(4) {
- --community-circle-angle: 3/4;
- }
-
- &:nth-of-type(5) {
- --community-circle-angle: 1;
- }
-
- &:nth-of-type(6) {
- --community-circle-angle: 0;
+ @for $i from 1 through $outer-elements {
+ &:nth-of-type(#{$i}) {
+ --offset-distance: #{calc(
+ 75% - (($i - 1) * 50% / ($outer-elements - 1))
+ )};
+ }
}
- &:nth-of-type(7) {
- --community-circle-angle: 1/2;
+ &:nth-of-type(n + #{$outer-elements + 1}) {
+ --img-size: 5em;
+ offset-path: ellipse(50% 25% at 100% 50%);
}
- &:nth-of-type(8) {
- --community-circle-angle: 1;
+ @for $i from 1 through $inner-elements {
+ &:nth-of-type(#{$outer-elements + $i}) {
+ --offset-distance: #{calc(
+ 75% - (($i - 1) * 50% / ($inner-elements - 1))
+ )};
+ }
}
}
From 608d563dc4e0956611d3d611ac84681d6f13eb0f Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Tue, 1 Oct 2024 11:10:02 +0000
Subject: [PATCH 38/44] wip(community): fix stylelint
---
client/src/community/contributor-list.scss | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/client/src/community/contributor-list.scss b/client/src/community/contributor-list.scss
index 58cc783a0dd0..7f3dab1f207f 100644
--- a/client/src/community/contributor-list.scss
+++ b/client/src/community/contributor-list.scss
@@ -94,6 +94,9 @@ svg {
}
li {
+ $outer-elements: 5;
+ $inner-elements: 3;
+
// necessary because Firefox seems to have a bug where the links aren't
// clickable until we force some kind of re-render which an animation does:
animation: community-circle 0.1ms forwards;
@@ -102,15 +105,17 @@ svg {
offset-path: ellipse(100% 50% at 100% 50%);
offset-rotate: 0deg;
+ &:nth-of-type(n + #{$outer-elements + 1}) {
+ --img-size: 5em;
+ offset-path: ellipse(50% 25% at 100% 50%);
+ }
+
@keyframes community-circle {
from {
offset-distance: calc(var(--offset-distance) - 0.1%);
}
}
- $outer-elements: 5;
- $inner-elements: 3;
-
@for $i from 1 through $outer-elements {
&:nth-of-type(#{$i}) {
--offset-distance: #{calc(
@@ -119,11 +124,6 @@ svg {
}
}
- &:nth-of-type(n + #{$outer-elements + 1}) {
- --img-size: 5em;
- offset-path: ellipse(50% 25% at 100% 50%);
- }
-
@for $i from 1 through $inner-elements {
&:nth-of-type(#{$outer-elements + $i}) {
--offset-distance: #{calc(
From 3e07e84902a6d69663d148758b736c19b0e484c0 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Tue, 1 Oct 2024 11:19:57 +0000
Subject: [PATCH 39/44] wip(community): clip-path: inset(); doesn't work
properly on webkit
---
client/src/community/contributor-list.scss | 1 -
client/src/community/contributor-list.ts | 28 ++++++++++++++++++++--
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/client/src/community/contributor-list.scss b/client/src/community/contributor-list.scss
index 7f3dab1f207f..232d5e7a6949 100644
--- a/client/src/community/contributor-list.scss
+++ b/client/src/community/contributor-list.scss
@@ -82,7 +82,6 @@ svg {
}
svg {
- clip-path: inset(calc(-1 * var(--circle-border-size)));
display: block;
fill: none;
height: 100%;
diff --git a/client/src/community/contributor-list.ts b/client/src/community/contributor-list.ts
index e01d4f3e9c53..c197cddbaa0d 100644
--- a/client/src/community/contributor-list.ts
+++ b/client/src/community/contributor-list.ts
@@ -52,8 +52,32 @@ export class ContributorList extends LitElement {
-
-
+
+
+
+
+
+
+
${this._contributors.map(({ name, github, org }) => {
const imgSrc = `https://avatars.githubusercontent.com/${github
From 285efc0e37c28f7d4c67f69053695e56da8e9888 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Tue, 1 Oct 2024 11:21:57 +0000
Subject: [PATCH 40/44] wip(community): review updates
---
client/src/community/contributor-list.ts | 1 +
libs/constants/index.js | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/community/contributor-list.ts b/client/src/community/contributor-list.ts
index c197cddbaa0d..79cc1d0143b4 100644
--- a/client/src/community/contributor-list.ts
+++ b/client/src/community/contributor-list.ts
@@ -104,5 +104,6 @@ export class ContributorList extends LitElement {
function popRandom(array: Array) {
const i = Math.floor(Math.random() * array.length);
+ // mutate the array:
return array.splice(i, 1)[0];
}
diff --git a/libs/constants/index.js b/libs/constants/index.js
index 2760c5f01fd1..a2ac0bbcb19b 100644
--- a/libs/constants/index.js
+++ b/libs/constants/index.js
@@ -153,7 +153,6 @@ export const CSP_DIRECTIVES = {
"firefoxusercontent.com",
"profile.stage.mozaws.net",
"profile.accounts.firefox.com",
- "https://github.com",
"mdn.dev",
"interactive-examples.mdn.mozilla.net",
From ffdce8007db071489e828e1fae5f9530380a501c Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Tue, 8 Oct 2024 10:16:56 +0000
Subject: [PATCH 41/44] fix(community): show focus ring on youtube link
---
client/src/community/index.scss | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/client/src/community/index.scss b/client/src/community/index.scss
index c20be86ef2d0..f58ef0ba3650 100644
--- a/client/src/community/index.scss
+++ b/client/src/community/index.scss
@@ -467,8 +467,22 @@ main.community-container {
color: transparent;
display: block;
overflow: hidden;
+ position: relative;
text-indent: -100rem;
+ &:focus-visible::after {
+ content: "";
+ display: block;
+ height: 30%;
+ left: 45% - 40% / 2;
+ outline-color: var(--accent-primary);
+ outline-offset: 1px;
+ outline-style: auto;
+ position: absolute;
+ top: 50% - 30% / 2;
+ width: 40%;
+ }
+
@media (max-width: $screen-md) {
width: 28rem;
}
From c4fc5d0c19bea9cd76b26b9ceb7be028ed574c1f Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Tue, 8 Oct 2024 13:27:22 +0000
Subject: [PATCH 42/44] fix(community): fix lint
---
client/src/community/index.scss | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/src/community/index.scss b/client/src/community/index.scss
index f58ef0ba3650..6ae44b260f8a 100644
--- a/client/src/community/index.scss
+++ b/client/src/community/index.scss
@@ -474,12 +474,12 @@ main.community-container {
content: "";
display: block;
height: 30%;
- left: 45% - 40% / 2;
+ left: calc(45% - 40% / 2);
outline-color: var(--accent-primary);
outline-offset: 1px;
outline-style: auto;
position: absolute;
- top: 50% - 30% / 2;
+ top: calc(50% - 30% / 2);
width: 40%;
}
From d97fc32637e5762fcac31105fc452c102f2f3cb6 Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Tue, 8 Oct 2024 13:59:32 +0000
Subject: [PATCH 43/44] fix(community): fix for
https://github.com/mdn/yari/pull/11930
---
client/src/community/index.scss | 11 +++++++----
copy/community/community.md | 4 ++++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/client/src/community/index.scss b/client/src/community/index.scss
index 6ae44b260f8a..e01daabd3062 100644
--- a/client/src/community/index.scss
+++ b/client/src/community/index.scss
@@ -512,11 +512,10 @@ main.community-container {
border-radius: 0.5rem;
box-shadow: var(--community-box-shadow);
display: flex;
- flex: 1;
flex-direction: column;
gap: 1.5rem;
justify-content: space-between;
- padding: 1.5rem 3rem;
+ padding: 1.5rem;
text-align: center;
h3 {
@@ -525,9 +524,13 @@ main.community-container {
border-radius: 0.5rem 0.5rem 0 0;
font-size: 1.25rem;
font-weight: 500;
- margin: -1.5rem -3rem;
+ margin: -1.5rem;
margin-bottom: 0;
- padding: 1.5rem 3rem;
+ padding: 1.5rem;
+ }
+
+ p {
+ margin: 0;
}
a {
diff --git a/copy/community/community.md b/copy/community/community.md
index 7e5e9d92dd53..f57c0a6bb5a9 100644
--- a/copy/community/community.md
+++ b/copy/community/community.md
@@ -102,21 +102,25 @@ engage.
- ### Fix issues
Submit pull requests to fix reported issues.
+
[Squash bugs](https://github.com/mdn/content/issues)
- ### Improve content
Fix inaccuracies and fill in missing information.
+
[Start writing](https://github.com/mdn/content/#readme)
- ### Localize content
Participate in translating content into one of our supported languages.
+
[Find your locale](/en-US/docs/MDN/Community/Contributing/Translated_content#active_locales)
- ### Answer questions
Share your knowledge and expertise and guide fellow learners.
+
[Help on Discord](https://mdn.dev/discord)
## Help us fix open issues
From af6fbc19a210f4967690ce21998932e25ba8a33c Mon Sep 17 00:00:00 2001
From: Leo McArdle
Date: Thu, 10 Oct 2024 16:07:57 +0000
Subject: [PATCH 44/44] fix(community): further fix for
https://github.com/mdn/yari/pull/11930
---
client/src/community/index.scss | 4 ++++
copy/community/community.md | 2 ++
2 files changed, 6 insertions(+)
diff --git a/client/src/community/index.scss b/client/src/community/index.scss
index e01daabd3062..e82e3e6b4645 100644
--- a/client/src/community/index.scss
+++ b/client/src/community/index.scss
@@ -678,6 +678,10 @@ main.community-container {
a {
@include button.primary;
}
+
+ p {
+ margin: 0;
+ }
}
}
}
diff --git a/copy/community/community.md b/copy/community/community.md
index f57c0a6bb5a9..1f851e99e660 100644
--- a/copy/community/community.md
+++ b/copy/community/community.md
@@ -133,12 +133,14 @@ improve MDN.
- ### Chat with us on Discord
Connect with the community. Engage with domain experts. Help others learn.
+
[Join MDN Discord](https://mdn.dev/discord)
- ### Join our Community Call
Every month, get exclusive updates from the MDN team. Share your ideas and
contributions.
+
[RSVP to the next community call](https://github.com/mdn/community-meetings?tab=readme-ov-file#mdn-community-meetings)
While working in Mozilla spaces and communities, please adhere to the