Skip to content

Commit 8bc15e0

Browse files
committed
WIP on dashboard
1 parent 8dca7c7 commit 8bc15e0

12 files changed

Lines changed: 171 additions & 19 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Localization::DashboardController < ApplicationController
2+
def show
3+
@locale_counts = Localization::Translation.group(:locale, :status).count.
4+
each_with_object({}) do |((locale, status), count), h|
5+
h[locale.to_sym] ||= {}
6+
h[locale.to_sym][status.to_sym] = count
7+
end
8+
end
9+
end

app/css/components/prominent-link.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
background: var(--c-prominent-link-bg);
2222
}
2323
&.--inline {
24-
@apply inline-flex;
24+
@apply inline;
25+
@apply leading-[inherit];
2526
}
2627
}

app/css/packs/signed-in.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
@import "../modals/crop-avatar";
6161

6262
/* Localization */
63+
@import "../pages/localization/dashboard";
6364
@import "../pages/localization/show";
6465
@import "../pages/localization/index";
6566

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#page-localization-dashboard {
2+
.locales {
3+
.locale {
4+
.progress {
5+
width: 500px;
6+
height: 20px;
7+
@apply relative;
8+
& > div {
9+
@apply absolute inset-0;
10+
11+
&.generating {
12+
@apply bg-red;
13+
}
14+
&.unchecked {
15+
@apply bg-red;
16+
}
17+
&.proposed {
18+
@apply bg-orange;
19+
}
20+
&.checked {
21+
@apply bg-green-500;
22+
}
23+
}
24+
}
25+
}
26+
}
27+
}

app/helpers/view_components/localization/header.rb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module ViewComponents
22
module Localization
33
class Header < ViewComponent
4+
delegate :controller_name, to: :view_context
5+
46
def to_s
57
tag.nav(class: 'c-mentor-header') do
68
tag.div(class: 'lg-container container') do
@@ -33,12 +35,21 @@ def stats
3335
end
3436
end
3537

36-
def tabs = [originals_tab]
38+
def tabs = [overview_tab, originals_tab]
39+
40+
def overview_tab
41+
selected = controller_name == "originals" ? "" : " selected"
42+
tag.div(class: "c-tab-2 #{selected}") do
43+
graphical_icon(:overview) +
44+
tag.span("Overview")
45+
end
46+
end
3747

3848
def originals_tab
39-
tag.div(class: "c-tab-2 selected") do
49+
selected = controller_name == "originals" ? "selected" : ""
50+
tag.div(class: "c-tab-2 #{selected}") do
4051
graphical_icon(:overview) +
41-
tag.span("Originals")
52+
tag.span("Translations")
4253
end
4354
end
4455
end

app/images/icons/world-colored.svg

Lines changed: 14 additions & 0 deletions
Loading

app/javascript/components/localization/originals/show/index.tsx

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ function Header() {
3030
</a>
3131
<div className="info">
3232
<div className="intro">You are editing translations for</div>
33-
<div className="key">{original.key}</div>
33+
<div className="key">
34+
{original.title} ({original.prettyType})
35+
</div>
3436
</div>
3537
</div>
3638
</header>
@@ -52,11 +54,10 @@ function LHS() {
5254
<div className="lhs">
5355
<div className="translations">
5456
<div className="text-h3 mb-6">Your Locales</div>
55-
<p className="text-16 mb-16">
56-
These are the locales you have opted into help translate. You can
57-
change your locales{' '}
57+
<p className="text-16 mb-16 leading-140">
58+
These are the locales you have opted into help translate. You can{' '}
5859
<a href="#" className="c-prominent-link --inline">
59-
here
60+
change your locales here
6061
</a>
6162
.
6263
</p>
@@ -90,17 +91,30 @@ function RHS() {
9091
return (
9192
<div className="rhs">
9293
<div className="original">
93-
<div className="text-h3 mb-6">Original English</div>
94-
<p className="text-16 mb-6">
95-
This is the original English value. Your job is to make the locales as
96-
close to this in
97-
<strong className="font-semibold">meaning and tone</strong>
98-
as possible. Please do not change the meaning away from the original
99-
English.
94+
<h2 className="text-h3 mb-6">The Original</h2>
95+
<p className="text-16 mb-4 leading-140">
96+
Your job is to make the locales as close to the original English in{' '}
97+
<strong className="font-semibold">meaning and tone</strong> as
98+
possible, considering how it is used in the site.{' '}
10099
</p>
100+
<p className="text-16 mb-8 leading-140">
101+
<strong className="font-semibold">
102+
Please be careful not change the meaning from the original English
103+
</strong>
104+
. If you feel the original English is wrong, please{' '}
105+
<a
106+
href="https://forum.exercism.org/c/exercism/i18n/695"
107+
className="c-prominent-link --inline"
108+
>
109+
start a discussion on the forum.
110+
</a>
111+
</p>
112+
113+
<h3 className="text-h4 mb-6">The English Version</h3>
101114
<div className="locale-value mb-20">{original.value}</div>
102-
<div className="text-h4 mb-6">Usage</div>
103-
<p className="text-16">Context</p>
115+
116+
<h3 className="text-h4 mb-6">How it's used</h3>
117+
<p className="text-16">{original.usageDetails}</p>
104118
</div>
105119
</div>
106120
)

app/javascript/components/localization/originals/types.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ type OriginalsListContextType = Pick<
1313
}
1414

1515
type Original = {
16+
prettyType: ReactI18NextChildren | Iterable<ReactI18NextChildren>
17+
title: ReactI18NextChildren | Iterable<ReactI18NextChildren>
18+
usageDetails: ReactI18NextChildren | Iterable<ReactI18NextChildren>
1619
uuid: string
1720
key: string
1821
value: string

app/models/localization/original.rb

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,45 @@ def title
4444
type.to_s.humanize
4545
end
4646
end
47+
48+
def usage_details
49+
return super if super.present?
50+
51+
case type
52+
when :exercise_introduction
53+
"This is the introduction text shown on the exercise page. It sets the context of the STORY of the exercise. The instructions are shown next and are translated seperately."
54+
when :exercise_instructions
55+
"These are the instructions shown on the exercise page. They tell the user what to do to complete the exercise. The introduction is shown before and is translated seperately."
56+
when :exercise_title
57+
"This is the title of the exercise shown around the site in various places."
58+
when :exercise_blurb
59+
"This is a short blurb about the exercise, shown as part of an exercise widget (e.g. on the page that lists the exercises for a track)."
60+
when :exercise_source
61+
"This appears at the bottom of an exercise to show where it originated, and is included in the README downloaded via the CLI."
62+
when :generic_exercise_introduction
63+
"This is the **programming-language-agnostic** introduction text. Some tracks override it, but it's generally used across most languages. The instructions and an optional append come seperately."
64+
when :generic_exercise_instructions
65+
"These are the **programming-language-agnostic** instructions. Some tracks override them, but they're generally used across most languages. The introduction and an optional append come seperately."
66+
when :generic_exercise_title
67+
"This is the **programming-language-agnostic** title of the exercise. It can be overriden by tracks but almost never is."
68+
when :generic_exercise_blurb
69+
"This is a **programming-language-agnostic** short blurb about the exercise, shown as part of an exercise widget (e.g. on the page that lists the exercises for a track). It can be overriden by tracks but almost never is."
70+
when :generic_exercise_source
71+
"This appears at the bottom of an exercise to show where it originated, and is included in the README downloaded via the CLI. This is the **programming-language-agnostic** version, which can be overriden by tracks but almost never is."
72+
when :concept_name
73+
"This is the name of a programming concept for a specific track. It appears throughout the track".
74+
when :concept_blurb
75+
"This is a short blurb about a programming concept for a specific track. It appears on the concept page and in various places around the site."
76+
when :concept_introduction
77+
"This is the version of the concept explanation that is shown to students BEFORE they complete the associated exercise."
78+
when :concept_about
79+
"This is the version of the concept explanation that is shown to students AFTER they complete the associated exercise."
80+
when :blog_post_content
81+
"This is the content of a blog post shown on the blog."
82+
when :docs_content
83+
"This is the content of a documentation page shown on the docs."
84+
else
85+
"No usage details available."
86+
end
87+
end
4788
end

app/serializers/serialize_localization_original.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def call
1111
title: original.title,
1212
type: original.type,
1313
pretty_type: original.type.to_s.titleize,
14+
usage_details: original.usage_details,
1415
translations: translations.filter_map do |translation|
1516
next if translation.locale == "en"
1617

0 commit comments

Comments
 (0)