Skip to content

Commit

Permalink
Merge branch 'main' into add-hyperlink
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafaroshdy1 authored Apr 19, 2024
2 parents bf0dd4d + 2b77133 commit b9b79ba
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 280 deletions.
5 changes: 0 additions & 5 deletions client/src/document/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,6 @@
.section-content {
p {
font: var(--type-article-p);

&:last-child {
margin-bottom: 2rem;
}
}

figure {
Expand Down Expand Up @@ -544,7 +540,6 @@ pre {

.callout {
background: var(--background-secondary);
border: 1px solid var(--border-primary);
border-radius: var(--elem-radius);
box-shadow: var(--shadow-01);
display: flex;
Expand Down
157 changes: 0 additions & 157 deletions client/src/document/molecules/_notecards.scss

This file was deleted.

5 changes: 0 additions & 5 deletions client/src/flaws/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
background-color: var(--background-warning);
}

h3 {
margin-top: 0;
}

h3 span.page {
color: var(--text-inactive);
}
Expand Down Expand Up @@ -66,7 +62,6 @@
gap: 20px;
grid-template-columns: 300px 1fr;
margin: auto;
width: calc(100% - 40px);

.filters {
h4 {
Expand Down
83 changes: 56 additions & 27 deletions client/src/translations/dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import useSWR from "swr";

import { MainContentContainer } from "../../ui/atoms/page-content";
import { Icon } from "../../ui/atoms/icon";
import { useLocale } from "../../hooks";

interface Data {
Expand Down Expand Up @@ -193,7 +194,7 @@ export function TranslationDashboard() {
)}
{error && <ShowError error={error} />}
{lastData && (
<div className="filter-documents">
<div>
<SectionHeader
l10nKPIs={lastData.l10nKPIs}
section={currentSection}
Expand Down Expand Up @@ -399,40 +400,62 @@ function DocumentsTable({
return documentDetail;
});

function TableHead({ id, title }: { id: string; title: string }) {
return (
<th
onClick={() => {
if (sort === id) {
setSearchParams(
createSearchParams({
sort: id,
sortReverse: JSON.stringify(!sortReverse),
section: currentSection,
})
);
} else {
setSearchParams(
createSearchParams({ sort: id, section: currentSection })
);
}
}}
className={`sortable ${sort === id ? "active" : ""} ${
sort === id && sortReverse ? "reverse" : ""
}`}
>
{title}
function TableHead({
id,
title,
sortable,
}: {
id: string;
title: string;
sortable?: boolean;
}) {
function getClassName() {
const className = ["sortable"];

if (sort === id) {
className.push("active");
}

if (sortReverse) {
className.push("reverse");
}

return className.join(" ");
}

function onClick() {
if (sort === id) {
setSearchParams(
createSearchParams({
sort: id,
sortReverse: JSON.stringify(!sortReverse),
section: currentSection,
})
);
} else {
setSearchParams(
createSearchParams({ sort: id, section: currentSection })
);
}
}

return sortable ? (
<th className={getClassName()} onClick={onClick}>
{title} <Icon name="small-arrow" />
</th>
) : (
<th>{title}</th>
);
}

return (
<section id="documents-table">
<h3>List of direct subpages</h3>

<table>
<thead>
<tr>
<TableHead id="url" title="Slug" />
<TableHead id="url" title="Slug" sortable />
<TableHead id="enMDNURL" title="English doc on MDN" />
<TableHead
id="enCommitGHURL"
Expand All @@ -444,14 +467,20 @@ function DocumentsTable({
id="localCommitGHURL"
title="Localized doc commit on GitHub"
/>
<TableHead id="popularityEn" title="Popularity rank (en-US)" />
<TableHead
id="popularityEn"
title="Popularity rank (en-US)"
sortable
/>
<TableHead
id="popularityLocale"
title={`Popularity rank (${locale})`}
sortable
/>
<TableHead id="dateDiff" title="Date delta" />
<TableHead id="dateDiff" title="Date delta" sortable />
</tr>
</thead>

<tbody>
{documents
.sort((A, B) => {
Expand Down
30 changes: 15 additions & 15 deletions client/src/translations/differences/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
}
}

h3 {
margin-top: 0;
}

h3 span.page {
color: var(--text-inactive);
}
Expand All @@ -39,6 +35,21 @@
table {
width: 100%;

th.sortable {
cursor: pointer;
}

th.sortable.active {
background-color: var(--background-secondary);
color: var(--text-primary);
}

th.sortable.active.reverse {
.icon {
transform: rotate(-180deg);
}
}

td a .url-prefix {
color: rgb(159, 159, 159);
font-size: 80%;
Expand Down Expand Up @@ -89,7 +100,6 @@
gap: 20px;
grid-template-columns: 300px 1fr;
margin: auto;
width: calc(100% - 40px);

.filters {
h4 {
Expand All @@ -105,15 +115,5 @@
}
}
}

.documents {
h4.subheader {
margin-top: 2px;
}

th.sortable {
cursor: ns-resize;
}
}
}
}
5 changes: 2 additions & 3 deletions client/src/ui/molecules/notecards/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
--note-background: var(--background-information);
--note-theme: var(--icon-information);
background-color: var(--note-background);
border: 1px solid var(--border-secondary);
border-left: 4px solid var(--note-theme);
border-left: 2px solid var(--note-theme);
border-radius: var(--elem-radius);
box-shadow: var(--shadow-01);
margin: 1rem 0;
Expand All @@ -18,7 +17,7 @@

p {
line-height: 2;
margin: 0 !important;
margin: 0;
}

&:before {
Expand Down
Loading

0 comments on commit b9b79ba

Please sign in to comment.