Skip to content

Commit 74bedc0

Browse files
committed
Add dashboard
1 parent 9949d75 commit 74bedc0

File tree

7 files changed

+79
-54
lines changed

7 files changed

+79
-54
lines changed

app/css/pages/localization/dashboard.css

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,41 @@
11
#page-localization-dashboard {
22
.locales {
3+
@apply flex flex-col gap-12;
34
.locale {
5+
@apply flex items-center gap-20;
6+
@apply bg-white rounded-12 px-16 py-8;
7+
@apply shadow-sm;
8+
.flag {
9+
@apply text-[30px];
10+
}
11+
.code {
12+
@apply w-[50px];
13+
@apply font-mono text-16 font-semibold;
14+
@apply text-textColor6;
15+
}
16+
.name {
17+
@apply w-[150px];
18+
@apply text-18;
19+
}
20+
.total {
21+
@apply w-[50px];
22+
@apply text-16;
23+
@apply font-medium text-textColor2;
24+
}
425
.progress {
5-
width: 500px;
6-
height: 20px;
26+
height: 15px;
27+
@apply flex-grow;
28+
@apply bg-darkRed;
29+
@apply border-borderColor6;
730
@apply relative;
31+
@apply rounded-5 overflow-hidden;
32+
@apply flex;
833
& > div {
9-
@apply absolute inset-0;
10-
11-
&.generating {
12-
@apply bg-red;
13-
}
14-
&.unchecked {
15-
@apply bg-red;
16-
}
1734
&.proposed {
1835
@apply bg-orange;
1936
}
2037
&.checked {
21-
@apply bg-green-500;
38+
@apply bg-darkSuccessGreen;
2239
}
2340
}
2441
}

app/helpers/bootcamp_helper.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,4 @@ def flag_for_country_code(country_code)
44
map { |char| (127_397 + char.ord).chr("UTF-8") }.
55
join
66
end
7-
8-
def flag_for_locale(locale)
9-
country = locale.to_s.split("-").last
10-
case country
11-
when "en"
12-
country = "us"
13-
end
14-
flag_for_country_code(country)
15-
end
16-
17-
def name_for_locale(locale)
18-
case locale.to_s
19-
when "en"
20-
"English"
21-
when "hu"
22-
"Hungarian"
23-
else
24-
I18n.t("locales.#{locale}", default: locale.to_s.upcase)
25-
end
26-
end
277
end

app/helpers/localization_helper.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
module LocalizationHelper
2+
def flag_for_locale(locale)
3+
country = locale.to_s.split("-").last
4+
case country
5+
when "en"
6+
country = "us"
7+
end
8+
flag_for_country_code(country)
9+
end
10+
11+
def name_for_locale(locale)
12+
case locale.to_s
13+
when "en"
14+
"English"
15+
when "hu"
16+
"Hungarian"
17+
else
18+
I18n.t("locales.#{locale}", default: locale.to_s.upcase)
19+
end
20+
end
21+
222
def translate_exercise_introduction(exercise, markdown: false, solution: nil)
323
# We're not syncing old exercise versions, so if someone
424
# has an old version, encourage them to upgrade instead

app/helpers/view_components/localization/header.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ def tabs = [overview_tab, originals_tab]
3939

4040
def overview_tab
4141
selected = controller_name == "originals" ? "" : " selected"
42-
tag.div(class: "c-tab-2 #{selected}") do
42+
link_to(Exercism::Routes.localization_root_url, class: "c-tab-2 #{selected}") do
4343
graphical_icon(:overview) +
4444
tag.span("Overview")
4545
end
4646
end
4747

4848
def originals_tab
4949
selected = controller_name == "originals" ? "selected" : ""
50-
tag.div(class: "c-tab-2 #{selected}") do
50+
link_to(Exercism::Routes.localization_originals_url, class: "c-tab-2 #{selected}") do
5151
graphical_icon(:overview) +
5252
tag.span("Translations")
5353
end

app/javascript/components/localization/originals/list/OriginalsTableList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function OriginalsTableList() {
2626
) : (
2727
<FilterFallback
2828
icon="no-result-magnifier"
29-
title="No originals found."
29+
title="No translations found."
3030
description="Try changing your filters to find originals that need checking."
3131
/>
3232
)}

app/javascript/components/localization/originals/list/Tabs.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ import React from 'react'
33
import { OriginalsListContext } from '.'
44

55
const TABS = [
6-
{
7-
value: 'unchecked',
8-
label: 'Needs translating',
9-
},
6+
{ value: undefined, label: 'All' },
7+
{ value: 'unchecked', label: 'Needs translating' },
108
{ value: 'proposed', label: 'Needs reviewing' },
119
{ value: 'checked', label: 'Done' },
1210
]
Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,39 @@
1+
- require_stylesheet "mentoring"
12
- require_stylesheet "about"
23
- require_stylesheet "track"
34

45
#page-localization-dashboard
5-
%nav.c-header-with-bg.mb-32
6-
.lg-container.flex.mt-24.mb-24
7-
.content{ class: "max-w-[720px]" }
8-
= graphical_icon "world-colored", css_class: 'w-[32px] h-[32px] mb-12'
9-
%h1.text-h1.mb-12 Internationalization
10-
%p.text-p-large.mb-16
11-
We're making Exercism available in every language people want to learn in.
12-
%strong.font-semibold Help us on our mission to help people globally!
6+
-#
7+
%nav.c-header-with-bg.mb-32
8+
.lg-container.flex.mt-24.mb-24
9+
.content{ class: "max-w-[720px]" }
10+
= graphical_icon "world-colored", css_class: 'w-[32px] h-[32px] mb-12'
11+
%h1.text-h1.mb-12 Internationalization
12+
%p.text-p-large.mb-16
13+
We're making Exercism available in every language people want to learn in.
14+
%strong.font-semibold Help us on our mission to help people globally!
1315
14-
= graphical_icon "world", css_class: "w-[180px] h-[180px] ml-auto hidden md:block", category: :graphics
15-
.decorations
16+
= graphical_icon "world", css_class: "w-[180px] h-[180px] ml-auto hidden md:block", category: :graphics
17+
.decorations
1618
19+
= render ViewComponents::Localization::Header.new
1720
.lg-container
21+
%h2.text-h2.mb-2 All Locales
22+
%p.text-p-large.mb-20
23+
Track the progress of all locales.
24+
Are we missing your locale?
25+
= succeed('.') do
26+
= link_to "Open a forum issue", "https://forum.exercism.org/c/exercism/i18n/695", class: "text-primaryLinkColor font-semibold"
1827
.locales
1928
- @locale_counts.each do |locale, counts|
2029
- total = counts.values.sum
21-
30+
2231
.locale
2332
.flag= flag_for_locale(locale)
33+
.code= locale
34+
.name= name_for_locale(locale)
2435
.progress
25-
.generating{style: "width: #{counts[:generating].to_f / total * 100}%"}
26-
.unchecked{style: "width: #{counts[:unchecked].to_f / total * 100}%"}
27-
.proposed{style: "width: #{counts[:proposed].to_f / total * 100}%"}
28-
.checked{style: "width: #{counts[:checked].to_f / total * 100}%"}
29-
36+
.checked{ style: "width: #{counts[:checked].to_f / total * 100}%" }
37+
.proposed{ style: "width: #{counts[:proposed].to_f / total * 100}%" }
38+
39+
.total #{counts[:checked].to_f / total * 100}%

0 commit comments

Comments
 (0)