Skip to content

Commit

Permalink
fix(article-footer): link to translated-content for other locales (#1…
Browse files Browse the repository at this point in the history
…0743)

* 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]>
  • Loading branch information
hochan222 and caugner authored Mar 19, 2024
1 parent a2c331e commit fd3f69c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/src/document/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export function Document(props /* TODO: define a TS interface for this */) {
<DocumentSurvey doc={doc} />
<RenderDocumentBody doc={doc} />
</article>
<ArticleFooter doc={doc} locale={locale} />
<ArticleFooter doc={doc} />
</MainContentContainer>
{false && <PlayQueue standalone={true} />}
</div>
Expand Down
15 changes: 9 additions & 6 deletions client/src/document/organisms/article-footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ReactComponent as ArticleFooterSVG } from "../../../assets/article-foot
import "./index.scss";
import { useGleanClick } from "../../../telemetry/glean-context";
import { ARTICLE_FOOTER, THUMBS } from "../../../telemetry/constants";
import { DEFAULT_LOCALE } from "../../../../../libs/constants";

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

export function ArticleFooter({ doc, locale }) {
export function ArticleFooter({ doc }) {
const [view, setView] = useState<ArticleFooterView>(ArticleFooterView.Vote);
const [reason, setReason] = useState<FeedbackReason>();

Expand Down Expand Up @@ -127,9 +128,9 @@ export function ArticleFooter({ doc, locale }) {
)}
</fieldset>

<Contribute />
<Contribute locale={doc.locale} />
<p className="last-modified-date">
<LastModified value={doc.modified} locale={locale} /> by{" "}
<LastModified value={doc.modified} locale={doc.locale} /> by{" "}
<Authors url={doc.mdn_url} />.
</p>
{doc.isActive && <OnGitHubLink doc={doc} />}
Expand All @@ -138,13 +139,15 @@ export function ArticleFooter({ doc, locale }) {
);
}

function Contribute() {
function Contribute({ locale }) {
const repo = locale === DEFAULT_LOCALE ? "content" : "translated-content";

return (
<>
<a
className="contribute"
href="https://github.com/mdn/content/blob/main/CONTRIBUTING.md"
title={`This will take you to our contribution guidelines on GitHub.`}
href={`https://github.com/mdn/${repo}/blob/main/CONTRIBUTING.md`}
title="This will take you to our contribution guidelines on GitHub."
target="_blank"
rel="noopener noreferrer"
>
Expand Down

0 comments on commit fd3f69c

Please sign in to comment.