Skip to content

Commit fd3f69c

Browse files
hochan222caugner
andauthored
fix(article-footer): link to translated-content for other locales (#10743)
* feat: improve learn how to contribute footer * refactor: contribute href url * refactor(article-footer): reuse locale from doc * refactor(article-footer): rename repo variable --------- Co-authored-by: Claas Augner <[email protected]>
1 parent a2c331e commit fd3f69c

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Diff for: client/src/document/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export function Document(props /* TODO: define a TS interface for this */) {
271271
<DocumentSurvey doc={doc} />
272272
<RenderDocumentBody doc={doc} />
273273
</article>
274-
<ArticleFooter doc={doc} locale={locale} />
274+
<ArticleFooter doc={doc} />
275275
</MainContentContainer>
276276
{false && <PlayQueue standalone={true} />}
277277
</div>

Diff for: client/src/document/organisms/article-footer/index.tsx

+9-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ReactComponent as ArticleFooterSVG } from "../../../assets/article-foot
55
import "./index.scss";
66
import { useGleanClick } from "../../../telemetry/glean-context";
77
import { ARTICLE_FOOTER, THUMBS } from "../../../telemetry/constants";
8+
import { DEFAULT_LOCALE } from "../../../../../libs/constants";
89

910
export function LastModified({ value, locale }) {
1011
if (!value) {
@@ -46,7 +47,7 @@ const FEEDBACK_REASONS: Required<Record<FeedbackReason, string>> = {
4647
other: "Other",
4748
};
4849

49-
export function ArticleFooter({ doc, locale }) {
50+
export function ArticleFooter({ doc }) {
5051
const [view, setView] = useState<ArticleFooterView>(ArticleFooterView.Vote);
5152
const [reason, setReason] = useState<FeedbackReason>();
5253

@@ -127,9 +128,9 @@ export function ArticleFooter({ doc, locale }) {
127128
)}
128129
</fieldset>
129130

130-
<Contribute />
131+
<Contribute locale={doc.locale} />
131132
<p className="last-modified-date">
132-
<LastModified value={doc.modified} locale={locale} /> by{" "}
133+
<LastModified value={doc.modified} locale={doc.locale} /> by{" "}
133134
<Authors url={doc.mdn_url} />.
134135
</p>
135136
{doc.isActive && <OnGitHubLink doc={doc} />}
@@ -138,13 +139,15 @@ export function ArticleFooter({ doc, locale }) {
138139
);
139140
}
140141

141-
function Contribute() {
142+
function Contribute({ locale }) {
143+
const repo = locale === DEFAULT_LOCALE ? "content" : "translated-content";
144+
142145
return (
143146
<>
144147
<a
145148
className="contribute"
146-
href="https://github.com/mdn/content/blob/main/CONTRIBUTING.md"
147-
title={`This will take you to our contribution guidelines on GitHub.`}
149+
href={`https://github.com/mdn/${repo}/blob/main/CONTRIBUTING.md`}
150+
title="This will take you to our contribution guidelines on GitHub."
148151
target="_blank"
149152
rel="noopener noreferrer"
150153
>

0 commit comments

Comments
 (0)